Updating invoice id search on invoices page.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 22 Apr 2019 19:28:04 +0000 (15:28 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 22 Apr 2019 19:28:04 +0000 (15:28 -0400)
Correct how the autocomplete is working.

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

index 55fd69b..eee71a4 100644 (file)
@@ -586,7 +586,8 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
         case 'list':
         default:
 
-        // echo '<pre>'.print_r( $_REQUEST, true ).'</pre>';
+            // echo '<pre>'.print_r( $_REQUEST, true ).'</pre>';
+
             // Need to get the accounts
             $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
             $accounts = $Accounts->getSimpleAccountList();
index 3a84e78..72be142 100644 (file)
         {/foreach}
         ]
 
+        {* accounts for the search *}
         $('#account_name').autocomplete({
             source: availableAccounts,
             select: function( event, ui ){
             },
         });
 
+        {* Invoices for the search *}
         var availableInvoices = [
         {foreach $invoiceList as $m}
             { label: "{$m.id} ( {$m.member_name|unescape:'html'|replace:'"':''} )", value: "{$m.id|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
             source: availableInvoices,
             select: function( event, ui ){
                 $('#member-invoice-id').val( ui.item.id );
+                $('#invoice_id').val( ui.item.id );
+                // console.log( 'selected invoice id: ', ui.item.id );
                 $('#searchForm').submit();
             },
             change: function( event, ui) {
                 if( ui.item == null ) {
                     $('#member-invoice-id').val( '' );
+                    // console.log( 'selected invoice id: ', ui );
                     $('#searchForm').submit();
                 }
             },