From 2cb323063b8be266470a85ee91d4e45cf1203167 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 1 Aug 2019 12:55:01 -0400 Subject: [PATCH] Updating search forms for billing Setting up type date for date searches. --- models/admin/billing/accounts.php | 33 +----- models/admin/billing/invoices.php | 2 +- views/admin/billing/accountSearchForm.html | 114 ++++++++++++++++----- views/admin/billing/invoices.html | 93 +++++++++++++---- 4 files changed, 165 insertions(+), 77 deletions(-) diff --git a/models/admin/billing/accounts.php b/models/admin/billing/accounts.php index 97d2808..935af71 100644 --- a/models/admin/billing/accounts.php +++ b/models/admin/billing/accounts.php @@ -302,23 +302,6 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts $where_params = array( 'true' ); $sub_where_parts = array(); - // Check for paging - // if ( isset( $_REQUEST['pageSelect'] ) ) { - // $_SESSION['search']['pageSelect'] = $_REQUEST['pageSelect']; - // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['pageSelect'] ) ) { - // unset( $_SESSION['search']['pageSelect'] ); - // } - // if ( isset( $_REQUEST['nextStart'] ) ) { - // $_SESSION['search']['nextStart'] = $_REQUEST['nextStart']; - // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['nextStart'] ) ) { - // unset( $_SESSION['search']['nextStart'] ); - // } - // if ( isset( $_REQUEST['prevStart'] ) ) { - // $_SESSION['search']['prevStart'] = $_REQUEST['prevStart']; - // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['prevStart'] ) ) { - // unset( $_SESSION['search']['prevStart'] ); - // } - // Check if we're doing paging if (isset($_REQUEST['pageSelect'])) { // If request is for Next @@ -335,23 +318,10 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts } } - // if( isset($_SESSION['search']['pageSelect']) ){ - // // If request is for Next - // if ($_SESSION['search']['pageSelect'][0] == 'N') { - // $newStart = $_SESSION['search']['nextStart'] - 0; - // - // // Otherwise it must be Previous - // } else { - // $newStart = $_SESSION['search']['prevStart'] - 0; - // } - // if ($newStart > 0) { - // $start = $newStart; - // } - // } // Get any search parameters. $reg_options = array( 'options' => array( - 'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%' + 'regexp' => '%[0-9]{4}-[0-9]{2}-[0-9]{2}%' ) ); // When searching @@ -425,6 +395,7 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts // By implode with AND. $where = implode( ' AND ', $where_params ); + // echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; // echo '
$where: ' . print_r( $where, true ) . '
'; // Get the list of accounts and determine number of accounts in list diff --git a/models/admin/billing/invoices.php b/models/admin/billing/invoices.php index 0b150ed..124d7e9 100644 --- a/models/admin/billing/invoices.php +++ b/models/admin/billing/invoices.php @@ -626,7 +626,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices // Get any search parameters. $reg_options = array( 'options' => array( - 'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%' + 'regexp' => '%[0-9]{4}-[0-9]{2}-[0-9]{2}%' ) ); if ( isset( $_REQUEST['fromDate'] ) diff --git a/views/admin/billing/accountSearchForm.html b/views/admin/billing/accountSearchForm.html index f86f894..16ce7e7 100644 --- a/views/admin/billing/accountSearchForm.html +++ b/views/admin/billing/accountSearchForm.html @@ -2,9 +2,9 @@ jQuery(document).ready(function($) { // Date Input - $('.glm-date-input').datepicker({ - dateFormat: 'mm/dd/yy' - }); + //$('.glm-date-input').datepicker({ + // dateFormat: 'mm/dd/yy' + //}); // Setup for the modal box $('#exportAccountDialog').dialog( { @@ -36,7 +36,7 @@ jQuery(document).ready(function($) { ] // Setup autocomplete for both inputs - $('#account_name').autocomplete({ + $('#searchName').autocomplete({ source: availableAccounts, select: function( event, ui ){ $('#member-account').val( ui.item.id ); @@ -68,7 +68,7 @@ jQuery(document).ready(function($) { {$selected = $m.ref_name|unescape:'html'|replace:'"':''} {/if} {/foreach} - $('#account_name').autocomplete().val('{$selected}'); + $('#searchName').autocomplete().val('{$selected}'); {/if} }); @@ -95,34 +95,100 @@ jQuery(document).ready(function($) {
- - - +
+ + {* Used for autocomplete *} + + + {* Member Account *} + {$ui = [ + 'value' => $searchName|default:'', + 'field' => 'searchName', + 'label' => 'Member Account', + 'required' => false, + 'errorText' => 'Member Account is Required', + 'dataError' => '' + ]} + {include file='ui/f6/text.html'} + +
- - +
+ {* From Date *} + {$ui = [ + 'value' => $fromDate|default:'', + 'field' => 'fromDate', + 'label' => 'From Date', + 'required' => false, + 'errorText' => 'From Date is Required', + 'dataError' => '' + ]} + {include file='ui/f6/date.html'} +
- - +
+ {* To Date *} + {$ui = [ + 'value' => $toDate|default:'', + 'field' => 'toDate', + 'label' => 'To Date', + 'required' => false, + 'errorText' => 'To Date is Required', + 'dataError' => '' + ]} + {include file='ui/f6/date.html'} +
- - - - + {* Show Active *} + {$ui = [ + 'value' => $filterActive|default:'', + 'field' => 'filterActive', + 'label' => 'Show Active', + 'required' => false, + 'errorText' => 'Show Active is Required', + 'dataError' => '' + ]} + {include file='ui/f6/checkbox.html'} + + {* Show Pending *} + {$ui = [ + 'value' => $filterPending|default:'', + 'field' => 'filterPending', + 'label' => 'Show Pending', + 'required' => false, + 'errorText' => 'Show Pending is Required', + 'dataError' => '' + ]} + {include file='ui/f6/checkbox.html'} + + {* Show Overdue *} + {$ui = [ + 'value' => $filterOverdue|default:'', + 'field' => 'filterOverdue', + 'label' => 'Show Overdue', + 'required' => false, + 'errorText' => 'Show Overdue is Required', + 'dataError' => '' + ]} + {include file='ui/f6/checkbox.html'} + + {* Show Expired *} + {$ui = [ + 'value' => $filterExpired|default:'', + 'field' => 'filterExpired', + 'label' => 'Show Expired', + 'required' => false, + 'errorText' => 'Show Expired is Required', + 'dataError' => '' + ]} + {include file='ui/f6/checkbox.html'} +
diff --git a/views/admin/billing/invoices.html b/views/admin/billing/invoices.html index 5a20fe5..1ee10ab 100644 --- a/views/admin/billing/invoices.html +++ b/views/admin/billing/invoices.html @@ -37,24 +37,75 @@
- - - - +
+ {* From Date *} + {$ui = [ + 'value' => $fromDate|default:'', + 'field' => 'fromDate', + 'label' => 'From Date', + 'required' => false, + 'errorText' => 'From Date is Required', + 'dataError' => '' + ]} + {include file='ui/f6/date.html'} + + {* To Date *} + {$ui = [ + 'value' => $toDate|default:'', + 'field' => 'toDate', + 'label' => 'To Date', + 'required' => false, + 'errorText' => 'To Date is Required', + 'dataError' => '' + ]} + {include file='ui/f6/date.html'} +
- - - - - - +
+ + {* Used for autocomplete *} + + + {* Member Account *} + {$ui = [ + 'value' => $smarty.request.searchName|default:'', + 'field' => 'searchName', + 'label' => 'Member Account', + 'required' => false, + 'errorText' => 'Member Account is Required', + 'dataError' => '' + ]} + {include file='ui/f6/text.html'} + + {* Used for autocomplete *} + + + {* Invoice # *} + {$ui = [ + 'value' => $smarty.request.searchInvoice|default:'', + 'field' => 'searchInvoice', + 'label' => 'Invoice #', + 'required' => false, + 'errorText' => 'Invoice # is Required', + 'dataError' => '' + ]} + {include file='ui/f6/text.html'} +
- +
+ {* Show only Unpaid Invoices *} + {$ui = [ + 'value' => $smarty.request.filterUnpaid|default:'', + 'field' => 'filterUnpaid', + 'label' => 'Show only Unpaid Invoices', + 'required' => false, + 'errorText' => 'Show only Unpaid Invoices is Required', + 'dataError' => '' + ]} + {include file='ui/f6/checkbox.html'} +
@@ -316,9 +367,9 @@ }); // Date Input - $('.glm-date-input').datepicker({ - dateFormat: 'mm/dd/yy' - }); + //$('.glm-date-input').datepicker({ + // dateFormat: 'mm/dd/yy' + //}); var availableAccounts = [ {foreach $accounts as $m} @@ -327,7 +378,7 @@ ] {* accounts for the search *} - $('#account_name').autocomplete({ + $('#searchName').autocomplete({ source: availableAccounts, select: function( event, ui ){ $('#member-account').val( ui.item.id ); @@ -347,11 +398,11 @@ { label: "{$m.id} ( {$m.member_name|unescape:'html'|replace:'"':''} )", value: "{$m.id|unescape:'html'|replace:'"':''}", id: '{$m.id}' }, {/foreach} ] - $('#invoiceId').autocomplete({ + $('#searchInvoice').autocomplete({ source: availableInvoices, select: function( event, ui ){ $('#member-invoice-id').val( ui.item.id ); - $('#invoiceId').val( ui.item.id ); + $('#searchInvoice').val( ui.item.id ); $('#searchForm').submit(); }, change: function( event, ui) { @@ -368,7 +419,7 @@ {$selected = $m.ref_name|unescape:'html'|replace:'"':''} {/if} {/foreach} - $('#account_name').autocomplete().val('{$selected}'); + $('#searchName').autocomplete().val('{$selected}'); {/if} // Flash certain elements for a short time after display -- 2.17.1