Setting up county invoice type selects
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 16 Nov 2018 14:51:10 +0000 (09:51 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 16 Nov 2018 14:51:10 +0000 (09:51 -0500)
Setup for filters.

models/admin/billing/invoices.php
views/admin/billing/bulkAddInvoices.html
views/admin/billing/subHeader.html

index 3417e49..21da272 100644 (file)
@@ -129,6 +129,8 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
         $totalInvoices      = false;
         $filterPending      = false;
         $filterOverdue      = false;
+        $counties           = false;
+        $paymentTypes       = false;
 
         // Get any provided option
         if (isset($_REQUEST['option'])) {
@@ -139,6 +141,19 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
         switch ($option) {
         case 'bulkadd':
             $view = 'bulkAddInvoices';
+
+            // Check if Counties is enabled and fetch counties
+            if ( isset( $this->config['settings']['enable_counties'] ) && $this->config['settings']['enable_counties'] ) {
+                // Grab counties
+                $counties = $this->wpdb->get_results(
+                    "SELECT *
+                       FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "counties
+                    ORDER BY name",
+                    ARRAY_A
+                );
+            }
+            $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+            $paymentTypes = $BillingSupport->getAllPayableInvoiceTypes();
             break;
 
         case 'add':
@@ -529,6 +544,8 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             'totalInvoices'       => $totalInvoices,
             'filterPending'       => $filterPending,
             'filterOverdue'       => $filterOverdue,
+            'counties'            => $counties,
+            'paymentTypes'        => $paymentTypes,
         );
 
         // Return status, any suggested view, and any data to controller
index e1ffec7..1e87a59 100644 (file)
@@ -3,6 +3,29 @@
 {include file='admin/billing/subHeader.html'}
 
 <h2>Bulk Create Invoices</h2>
-Test
+
+{if $paymentTypes}
+<label>Payment Types:</label>
+
+<select multiple size="10">
+    {foreach $paymentTypes as $paymentType}
+    <option value="{$paymentType.id}">{$paymentType.name}</option>
+    {/foreach}
+</select>
+
+{/if}
+
+{if $counties}
+
+<label>Counties:</label>
+
+<select multiple size="10">
+    {foreach $counties as $county}
+    <option value="{$county.id}">{$county.name}</option>
+    {/foreach}
+</select>
+{/if}
+
+<button>Filter</button>
 
 {include file='admin/footer.html'}
index e8bcd0c..5f5266a 100644 (file)
@@ -3,8 +3,6 @@
         class="nav-tab{if $option == 'list'} nav-tab-active{/if}">Search Invoices</a>
     <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=add"
         class="nav-tab{if $option == 'add' || $option == 'edit'} nav-tab-active{/if}">Create Invoice</a>
-    {* Bulk Add not ready yet
     <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=bulkadd"
         class="nav-tab{if $option == 'bulkadd'} nav-tab-active{/if}">Create Bulk Invoices</a>
-    *}
 </h2>