Setting up type date for date searches.
$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
}
}
- // 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
// By implode with AND.
$where = implode( ' AND ', $where_params );
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
// echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
// Get the list of accounts and determine number of accounts in list
// 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'] )
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( {
]
// Setup autocomplete for both inputs
- $('#account_name').autocomplete({
+ $('#searchName').autocomplete({
source: availableAccounts,
select: function( event, ui ){
$('#member-account').val( ui.item.id );
{$selected = $m.ref_name|unescape:'html'|replace:'"':''}
{/if}
{/foreach}
- $('#account_name').autocomplete().val('{$selected}');
+ $('#searchName').autocomplete().val('{$selected}');
{/if}
});
<div class="grid-x grid-margin-x">
<div class="cell small-12 medium-3">
- <label>Member Account:</label>
- <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}" />
- <input id="account_name" type="text" name="searchName" value="{if $searchName}{$searchName}{/if}" />
+ <div class="grid-x grid-margin-x">
+
+ {* Used for autocomplete *}
+ <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts|default:''}" />
+
+ {* 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'}
+
+ </div>
</div>
<div class="cell small-12 medium-3">
- <label>From Date: </label>
- <input type="text" name="fromDate" value="{$fromDate}" class="glm-date-input" />
+ <div class="grid-x grid-margin-x">
+ {* 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'}
+ </div>
</div>
<div class="cell small-12 medium-3">
- <label>To Date: </label>
- <input type="text" name="toDate" value="{$toDate}" class="glm-date-input" />
+ <div class="grid-x grid-margin-x">
+ {* 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'}
+ </div>
</div>
<div class="cell small-12 medium-3">
- <label>
- <input id="filterActive" name="filterActive" value="1" {if $filterActive}checked{/if} type="checkbox" /> Show Active
- </label>
- <label>
- <input id="filterPending" name="filterPending" value="1" {if $filterPending}checked{/if} type="checkbox" /> Show Pending
- </label>
- <label>
- <input id="filterOverdue" name="filterOverdue" value="1" {if $filterOverdue}checked{/if} type="checkbox" /> Show Overdue
- </label>
- <label>
- <input id="filterExpired" name="filterExpired" value="1" {if $filterExpired}checked{/if} type="checkbox" /> Show Expired
- </label>
+ {* 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'}
+
</div>
</div>
<div class="billing-search-form-submit">
<div class="grid-container full">
<div class="grid-x grid-padding-x">
<div class="cell small-12 medium-4">
- <label>From Date: </label>
- <input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
- <label>To Date: </label>
- <input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
+ <div class="grid-x grid-padding-x">
+ {* 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'}
+ </div>
</div>
<div class="cell small-12 medium-4">
- <label>Member Account: </label>
- <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}">
- <input id="account_name" type="text" name="searchName" value="{if !empty($smarty.request.searchName)}{$smarty.request.searchName}{/if}" />
- <label>Invoice #: </label>
- <input id="member-invoice-id" type="hidden" name="filterInvoice" value="{$filterInvoices|default:''}">
- <input id="invoiceId" type="text" name="searchInvoice" value="" />
+ <div class="grid-x grid-margin-x">
+
+ {* Used for autocomplete *}
+ <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts|default:''}">
+
+ {* 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 *}
+ <input id="member-invoice-id" type="hidden" name="filterInvoice" value="{$filterInvoices|default:''}">
+
+ {* Invoice # *}
+ {$ui = [
+ 'value' => $smarty.request.searchInvoice|default:'',
+ 'field' => 'searchInvoice',
+ 'label' => 'Invoice #',
+ 'required' => false,
+ 'errorText' => 'Invoice # is Required',
+ 'dataError' => ''
+ ]}
+ {include file='ui/f6/text.html'}
+ </div>
</div>
<div class="cell small-12 medium-4">
- <label>
- <input type="checkbox" name="filterUnpaid"{if !empty($smarty.request.filterUnpaid) && $smarty.request.filterUnpaid} checked{/if}>
- Show only Unpaid Invoices
- </label>
+ <div class="grid-x grid-margin-x">
+ {* 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'}
+ </div>
</div>
<div class="billing-search-form-submit">
<input type="submit" class="button primary" value="Submit">
});
// Date Input
- $('.glm-date-input').datepicker({
- dateFormat: 'mm/dd/yy'
- });
+ //$('.glm-date-input').datepicker({
+ // dateFormat: 'mm/dd/yy'
+ //});
var availableAccounts = [
{foreach $accounts as $m}
]
{* accounts for the search *}
- $('#account_name').autocomplete({
+ $('#searchName').autocomplete({
source: availableAccounts,
select: function( event, ui ){
$('#member-account').val( ui.item.id );
{ 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) {
{$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