-<button class="close-button" data-close aria-label="Close" type="button">
- <span aria-hidden="true">×</span>
-</button>
+<div id="glmBillingInfoFormWrap">
+ <button class="close-button" data-close aria-label="Close" type="button">
+ <span aria-hidden="true">×</span>
+ </button>
-<h2>{$account.fieldData.ref_name}</h2>
+ <h2>{$account.fieldData.ref_name}</h2>
-{$data = $account}
+ {$data = $account}
-<div class="glm-billing-form">
- <form id="billingInfoForm" action="{$ajaxUrl}?action=glm_members_admin_ajax" method="post" data-abide novalidate>
+ <div class="glm-billing-form">
+ <form id="billingInfoForm" action="{$ajaxUrl}?action=glm_members_admin_ajax" method="post" data-abide novalidate>
- <input type="hidden" name="glm_action" value="ajaxBillingInfo" />
+ <input type="hidden" name="glm_action" value="ajaxBillingInfo" />
- <input type="hidden" name="member" value="{$memberID}" />
- <input type="hidden" name="ref_dest" value="{$memberID}" />
- <input type="hidden" name="option" value="account" />
+ <input type="hidden" name="member" value="{$memberID}" />
+ <input type="hidden" name="ref_dest" value="{$memberID}" />
+ <input type="hidden" name="option" value="account" />
- {if $settings.member_types_enabled}
- <input type="hidden" name="invoice_type" value="{$account.fieldData.invoice_type}" />
- {/if}
- {if $lockedToMember}
- <input type="hidden" name="anniversary_date" value="{$account.fieldData.anniversary_date.date}" />
- <input type="hidden" name="renewal_date" value="{$account.fieldData.renewal_date.date}" />
- <input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />
- {/if}
-
- {if $accountID}
- <input type="hidden" name="id" value="{$accountID}">
- {/if}
- {if !$settings.account_number_enabled}<input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />{/if}
+ {if $settings.member_types_enabled}
+ <input type="hidden" name="invoice_type" value="{$account.fieldData.invoice_type}" />
+ {/if}
+ {if $lockedToMember}
+ <input type="hidden" name="anniversary_date" value="{$account.fieldData.anniversary_date.date}" />
+ <input type="hidden" name="renewal_date" value="{$account.fieldData.renewal_date.date}" />
+ <input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />
+ {/if}
- {include file='ui/f6/errorCallout.html'}
+ {if $accountID}
+ <input type="hidden" name="id" value="{$accountID}">
+ {/if}
+ {if !$settings.account_number_enabled}<input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />{/if}
- <fieldset class="fieldset cell small-12">
- <legend>Account Information</legend>
+ {include file='ui/f6/errorCallout.html'}
- {* Name *}
- {$ui = [
- 'value' => $data.fieldData.ref_name,
- 'field' => 'ref_name',
- 'label' => 'Name',
- 'placeholder' => 'Name',
- 'required' => $data.fieldRequired.ref_name,
- 'errorText' => 'Name is Required'
- ]}
- {include file='ui/f6/text.html'}
+ <fieldset class="fieldset cell small-12">
+ <legend>Account Information</legend>
+ {* Name *}
+ {$ui = [
+ 'value' => $data.fieldData.ref_name,
+ 'field' => 'ref_name',
+ 'label' => 'Name',
+ 'placeholder' => 'Name',
+ 'required' => $data.fieldRequired.ref_name,
+ 'errorText' => 'Name is Required'
+ ]}
+ {include file='ui/f6/text.html'}
- {if !$lockedToMember}
- {if $settings.account_number_enabled}
- {* Account Number *}
+ {if !$lockedToMember}
+ {if $settings.account_number_enabled}
+
+ {* Account Number *}
+ {$ui = [
+ 'value' => $data.fieldData.account_number,
+ 'field' => 'account_number',
+ 'label' => 'Account Number',
+ 'placeholder' => 'Account Number',
+ 'required' => $data.fieldRequired.account_number,
+ 'errorText' => 'Account Number is Required'
+ ]}
+ {include file='ui/f6/text.html'}
+
+ {/if}
+
+ {if !$settings.member_types_enabled}
+
+ {* Payment Type *}
+ {$ui = [
+ 'value' => $data.fieldData.invoice_type.value,
+ 'field' => 'invoice_type',
+ 'label' => 'Payment Type',
+ 'list' => $data.fieldData.invoice_type.list,
+ 'l_label' => 'name',
+ 'l_value' => 'value',
+ 'l_blank' => false,
+ 'required' => $data.fieldRequired.invoice_type,
+ 'errorText' => 'Payment Type is Required'
+ ]}
+ {include file='ui/f6/select.html'}
+
+ {/if}
+
+ {if $settings.invoice_methods_enabled}
+
+ {* Payment Methods *}
+ {$ui = [
+ 'value' => [
+ 'email_invoice' => $data.fieldData.invoice_type.value,
+ 'usmail_invoice' => $data.fieldData.usmail_invoice.value,
+ 'fax_invoice' => $data.fieldData.fax_invoice.value
+ ],
+ 'field' => 'invoice_type',
+ 'list' => ['email_invoice' => 'By Email','usmail_invoice' => 'By US Email','fax_invoice' => 'By Fax'],
+ 'label' => 'Invoice Delivery Methods',
+ 'required' => false,
+ 'errorText' => 'At least one Invoice Delivery Method is Required'
+ ]}
+ {include file='ui/f6/multicheckboxes.html'}
+
+ {/if}
+
+ {* Anniversary Date *}
{$ui = [
- 'value' => $data.fieldData.account_number,
- 'field' => 'account_number',
- 'label' => 'Account Number',
- 'placeholder' => 'Account Number',
- 'required' => $data.fieldRequired.account_number,
- 'errorText' => 'Account Number is Required'
+ 'value' => $data.fieldData.anniversary_date.date,
+ 'field' => 'anniversary_date',
+ 'label' => 'Anniversary Date',
+ 'placeholder' => 'Anniversary Date',
+ 'required' => $data.fieldRequired.anniversary_date,
+ 'errorText' => 'Anniversary Date is Required'
]}
{include file='ui/f6/text.html'}
- {/if}
-
- {if !$settings.member_types_enabled}
-
- {* Payment Type *}
+ {* Renewal Date *}
{$ui = [
- 'value' => $data.fieldData.invoice_type.value,
- 'field' => 'invoice_type',
- 'label' => 'Payment Type',
- 'list' => $data.fieldData.invoice_type.list,
- 'l_label' => 'name',
- 'l_value' => 'value',
- 'l_blank' => false,
- 'required' => $data.fieldRequired.invoice_type,
- 'errorText' => 'Payment Type is Required'
+ 'value' => $data.fieldData.renewal_date.date,
+ 'field' => 'renewal_date',
+ 'label' => 'Renewal Date',
+ 'placeholder' => 'Renewal Date',
+ 'required' => $data.fieldRequired.renewal_date,
+ 'errorText' => 'Renewal Date is Required'
]}
- {include file='ui/f6/select.html'}
+ {include file='ui/f6/text.html'}
{/if}
- {if $settings.invoice_methods_enabled}
+ {if $settings.allow_employees}
- {* Payment Methods *}
- {$ui = [
- 'value' => [
- 'email_invoice' => $data.fieldData.invoice_type.value,
- 'usmail_invoice' => $data.fieldData.usmail_invoice.value,
- 'fax_invoice' => $data.fieldData.fax_invoice.value
- ],
- 'field' => 'invoice_type',
- 'list' => ['email_invoice' => 'By Email','usmail_invoice' => 'By US Email','fax_invoice' => 'By Fax'],
- 'label' => 'Invoice Delivery Methods',
- 'required' => false,
- 'errorText' => 'At least one Invoice Delivery Method is Required'
- ]}
- {include file='ui/f6/multicheckboxes.html'}
+ <div class="glm-billing-field">
+ <div class="glm-billing-label{if $account.fieldRequired.boss} glm-required{/if}">Boss</div>
+ <div class="glm-billing-input{if $account.fieldFail.boss} glm-form-bad-input{/if}" data-tabid="glm-name">
+ <input id="billing-boss" type="checkbox" name="boss"{if $account.fieldData.boss.value} checked{/if}>
+ {if $account.fieldFail.boss}<p>{$account.fieldFail.boss}</p>{/if}<br>
+ </div>
+ </div>
+
+ <div id="glm-emp-list" class="glm-billing-field">
+ <div class="glm-billing-label">
+ <strong>Associated Members/Employees</strong>
+ </div>
+ <div class="glm-billing-input">
+ <input id="glm-billing-member-list" placeholder="Lookup Member">
+ <div id="glm-billing-employees">
+ {if $employees}
+ {foreach $employees as $employee}
+ <div class="glm-billing-employee">
+ <input type="hidden" name="employees[{$employee.employee}]" value="1">
+ {$employee.employee_name}
+ <span class="glm-billing-employee-del dashicons dashicons-trash glm-right"></span>
+ </div>
+ {/foreach}
+ {/if}
+ </div>
+ </div>
+ </div>
{/if}
- {* Anniversary Date *}
+ </fieldset>
+
+ <fieldset class="fieldset cell small-12">
+ <legend>Billing Information</legend>
+
+ {* Billing Email *}
{$ui = [
- 'value' => $data.fieldData.anniversary_date.date,
- 'field' => 'anniversary_date',
- 'label' => 'Anniversary Date',
- 'placeholder' => 'Anniversary Date',
- 'required' => $data.fieldRequired.anniversary_date,
- 'errorText' => 'Anniversary Date is Required'
+ 'value' => $data.fieldData.email,
+ 'field' => 'email',
+ 'label' => 'Billing Email',
+ 'placeholder' => 'Billing Email',
+ 'required' => $data.fieldRequired.email,
+ 'errorText' => 'Billing Email is Required'
]}
{include file='ui/f6/text.html'}
- {* Renewal Date *}
+ {* Billing Company *}
{$ui = [
- 'value' => $data.fieldData.renewal_date.date,
- 'field' => 'renewal_date',
- 'label' => 'Renewal Date',
- 'placeholder' => 'Renewal Date',
- 'required' => $data.fieldRequired.renewal_date,
- 'errorText' => 'Renewal Date is Required'
+ 'value' => $data.fieldData.billing_company,
+ 'field' => 'billing_company',
+ 'label' => 'Billing Company',
+ 'placeholder' => 'Billing Company',
+ 'required' => $data.fieldRequired.billing_company,
+ 'errorText' => 'Billing Company is Required'
]}
{include file='ui/f6/text.html'}
- {/if}
-
- {if $settings.allow_employees}
+ {* Billing Position *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_position,
+ 'field' => 'billing_position',
+ 'label' => 'Billing Position',
+ 'placeholder' => 'Billing Position',
+ 'required' => $data.fieldRequired.billing_position,
+ 'errorText' => 'Billing Position is Required'
+ ]}
+ {include file='ui/f6/text.html'}
- <div class="glm-billing-field">
- <div class="glm-billing-label{if $account.fieldRequired.boss} glm-required{/if}">Boss</div>
- <div class="glm-billing-input{if $account.fieldFail.boss} glm-form-bad-input{/if}" data-tabid="glm-name">
- <input id="billing-boss" type="checkbox" name="boss"{if $account.fieldData.boss.value} checked{/if}>
- {if $account.fieldFail.boss}<p>{$account.fieldFail.boss}</p>{/if}<br>
- </div>
- </div>
+ {if $settings.billing_contact_name_enabled}
- <div id="glm-emp-list" class="glm-billing-field">
- <div class="glm-billing-label">
- <strong>Associated Members/Employees</strong>
- </div>
- <div class="glm-billing-input">
- <input id="glm-billing-member-list" placeholder="Lookup Member">
- <div id="glm-billing-employees">
- {if $employees}
- {foreach $employees as $employee}
- <div class="glm-billing-employee">
- <input type="hidden" name="employees[{$employee.employee}]" value="1">
- {$employee.employee_name}
- <span class="glm-billing-employee-del dashicons dashicons-trash glm-right"></span>
- </div>
- {/foreach}
- {/if}
- </div>
- </div>
- </div>
+ {* Billing Contact Name *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_contact_name,
+ 'field' => 'billing_contact_name',
+ 'label' => 'Billing Contact Name',
+ 'placeholder' => 'Billing Contact Name',
+ 'required' => $data.fieldRequired.billing_contact_name,
+ 'errorText' => 'Billing Contact Name is Required'
+ ]}
+ {include file='ui/f6/text.html'}
+ {else}
+ {* Billing First Name *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_fname,
+ 'field' => 'billing_fname',
+ 'label' => 'Billing First Name',
+ 'placeholder' => 'Billing First Name',
+ 'required' => $data.fieldRequired.billing_fname,
+ 'errorText' => 'Billing First Name is Required'
+ ]}
+ {include file='ui/f6/text.html'}
- {/if}
+ {* Billing Last Name *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_lname,
+ 'field' => 'billing_lname',
+ 'label' => 'Billing Last Name',
+ 'placeholder' => 'Billing Last Name',
+ 'required' => $data.fieldRequired.billing_lname,
+ 'errorText' => 'Billing Last Name is Required'
+ ]}
+ {include file='ui/f6/text.html'}
+ {/if}
- </fieldset>
-
- <fieldset class="fieldset cell small-12">
- <legend>Billing Information</legend>
-
- {* Billing Email *}
- {$ui = [
- 'value' => $data.fieldData.email,
- 'field' => 'email',
- 'label' => 'Billing Email',
- 'placeholder' => 'Billing Email',
- 'required' => $data.fieldRequired.email,
- 'errorText' => 'Billing Email is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing Company *}
- {$ui = [
- 'value' => $data.fieldData.billing_company,
- 'field' => 'billing_company',
- 'label' => 'Billing Company',
- 'placeholder' => 'Billing Company',
- 'required' => $data.fieldRequired.billing_company,
- 'errorText' => 'Billing Company is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing Position *}
- {$ui = [
- 'value' => $data.fieldData.billing_position,
- 'field' => 'billing_position',
- 'label' => 'Billing Position',
- 'placeholder' => 'Billing Position',
- 'required' => $data.fieldRequired.billing_position,
- 'errorText' => 'Billing Position is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {if $settings.billing_contact_name_enabled}
-
- {* Billing Contact Name *}
+ {* Billing Address 1 *}
{$ui = [
- 'value' => $data.fieldData.billing_contact_name,
- 'field' => 'billing_contact_name',
- 'label' => 'Billing Contact Name',
- 'placeholder' => 'Billing Contact Name',
- 'required' => $data.fieldRequired.billing_contact_name,
- 'errorText' => 'Billing Contact Name is Required'
+ 'value' => $data.fieldData.billing_addr1,
+ 'field' => 'billing_addr1',
+ 'label' => 'Billing Address 1',
+ 'placeholder' => 'Billing Address 1',
+ 'required' => $data.fieldRequired.billing_addr1,
+ 'errorText' => 'Billing Address 1 is Required'
]}
{include file='ui/f6/text.html'}
- {else}
- {* Billing First Name *}
+
+ {* Billing Address 2 *}
{$ui = [
- 'value' => $data.fieldData.billing_fname,
- 'field' => 'billing_fname',
- 'label' => 'Billing First Name',
- 'placeholder' => 'Billing First Name',
- 'required' => $data.fieldRequired.billing_fname,
- 'errorText' => 'Billing First Name is Required'
+ 'value' => $data.fieldData.billing_addr2,
+ 'field' => 'billing_addr2',
+ 'label' => 'Billing Address 2',
+ 'placeholder' => 'Billing Address 2',
+ 'required' => $data.fieldRequired.billing_addr2,
+ 'errorText' => 'Billing Address 2 is Required'
]}
{include file='ui/f6/text.html'}
- {* Billing Last Name *}
+ {* Billing City *}
{$ui = [
- 'value' => $data.fieldData.billing_lname,
- 'field' => 'billing_lname',
- 'label' => 'Billing Last Name',
- 'placeholder' => 'Billing Last Name',
- 'required' => $data.fieldRequired.billing_lname,
- 'errorText' => 'Billing Last Name is Required'
+ 'value' => $data.fieldData.billing_city,
+ 'field' => 'billing_city',
+ 'label' => 'Billing City',
+ 'placeholder' => 'Billing City',
+ 'required' => $data.fieldRequired.billing_city,
+ 'errorText' => 'Billing City is Required'
]}
{include file='ui/f6/text.html'}
- {/if}
- {* Billing Address 1 *}
- {$ui = [
- 'value' => $data.fieldData.billing_addr1,
- 'field' => 'billing_addr1',
- 'label' => 'Billing Address 1',
- 'placeholder' => 'Billing Address 1',
- 'required' => $data.fieldRequired.billing_addr1,
- 'errorText' => 'Billing Address 1 is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing Address 2 *}
- {$ui = [
- 'value' => $data.fieldData.billing_addr2,
- 'field' => 'billing_addr2',
- 'label' => 'Billing Address 2',
- 'placeholder' => 'Billing Address 2',
- 'required' => $data.fieldRequired.billing_addr2,
- 'errorText' => 'Billing Address 2 is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing City *}
- {$ui = [
- 'value' => $data.fieldData.billing_city,
- 'field' => 'billing_city',
- 'label' => 'Billing City',
- 'placeholder' => 'Billing City',
- 'required' => $data.fieldRequired.billing_city,
- 'errorText' => 'Billing City is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {if $settings.billing_county_enabled}
- {* Billing County *}
+ {if $settings.billing_county_enabled}
+ {* Billing County *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_county.value,
+ 'field' => 'billing_county',
+ 'label' => 'Billing County',
+ 'list' => $data.fieldData.billing_county.list,
+ 'l_label' => 'name',
+ 'l_value' => 'value',
+ 'l_blank' => false,
+ 'required' => $data.fieldRequired.billing_county,
+ 'errorText' => 'Billing County is Required'
+ ]}
+ {include file='ui/f6/select.html'}
+ {else}
+ <input type="hidden" name="billing_county" value="{$account.fieldData.billing_county.value}">
+ {/if}
+
+ {* Billing State *}
{$ui = [
- 'value' => $data.fieldData.billing_county.value,
- 'field' => 'billing_county',
- 'label' => 'Billing County',
- 'list' => $data.fieldData.billing_county.list,
+ 'value' => $data.fieldData.billing_state.value,
+ 'field' => 'billing_state',
+ 'label' => 'Billing State',
+ 'list' => $data.fieldData.billing_state.list,
'l_label' => 'name',
'l_value' => 'value',
'l_blank' => false,
- 'required' => $data.fieldRequired.billing_county,
- 'errorText' => 'Billing County is Required'
+ 'required' => $data.fieldRequired.billing_state,
+ 'errorText' => 'Billing State is Required'
]}
{include file='ui/f6/select.html'}
- {else}
- <input type="hidden" name="billing_county" value="{$account.fieldData.billing_county.value}">
- {/if}
- {* Billing State *}
- {$ui = [
- 'value' => $data.fieldData.billing_state.value,
- 'field' => 'billing_state',
- 'label' => 'Billing State',
- 'list' => $data.fieldData.billing_state.list,
- 'l_label' => 'name',
- 'l_value' => 'value',
- 'l_blank' => false,
- 'required' => $data.fieldRequired.billing_state,
- 'errorText' => 'Billing State is Required'
- ]}
- {include file='ui/f6/select.html'}
-
- {* Billing Zip *}
- {$ui = [
- 'value' => $data.fieldData.billing_zip,
- 'field' => 'billing_zip',
- 'label' => 'Billing Zip',
- 'placeholder' => 'Billing Zip',
- 'required' => $data.fieldRequired.billing_zip,
- 'errorText' => 'Billing Zip is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing Country *}
- {$ui = [
- 'value' => $data.fieldData.billing_country,
- 'field' => 'billing_country',
- 'label' => 'Billing Country',
- 'placeholder' => 'Billing Country',
- 'required' => $data.fieldRequired.billing_country,
- 'errorText' => 'Billing Country is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing Phone *}
- {$ui = [
- 'value' => $data.fieldData.billing_phone,
- 'field' => 'billing_phone',
- 'label' => 'Billing Phone',
- 'placeholder' => 'Billing Phone',
- 'required' => $data.fieldRequired.billing_phone,
- 'errorText' => 'Billing Phone is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- {* Billing Fax *}
- {$ui = [
- 'value' => $data.fieldData.billing_fax,
- 'field' => 'billing_fax',
- 'label' => 'Billing Fax',
- 'placeholder' => 'Billing Fax',
- 'required' => $data.fieldRequired.billing_fax,
- 'errorText' => 'Billing Fax is Required'
- ]}
- {include file='ui/f6/text.html'}
-
- </fieldset>
-
- {include file='ui/f6/errorCallout.html'}
-
- <button class="button button-primary" type="submit" style="margin-top: 0;">{if $haveAccount}Save{else}Create{/if} Account</button>
-
- <button class="button glm-right" data-close aria-label="Cancel" type="button">
- <span>Cancel</span>
- </button>
-
- </form>
-</div>
+ {* Billing Zip *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_zip,
+ 'field' => 'billing_zip',
+ 'label' => 'Billing Zip',
+ 'placeholder' => 'Billing Zip',
+ 'required' => $data.fieldRequired.billing_zip,
+ 'errorText' => 'Billing Zip is Required'
+ ]}
+ {include file='ui/f6/text.html'}
+
+ {* Billing Country *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_country,
+ 'field' => 'billing_country',
+ 'label' => 'Billing Country',
+ 'placeholder' => 'Billing Country',
+ 'required' => $data.fieldRequired.billing_country,
+ 'errorText' => 'Billing Country is Required'
+ ]}
+ {include file='ui/f6/text.html'}
+
+ {* Billing Phone *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_phone,
+ 'field' => 'billing_phone',
+ 'label' => 'Billing Phone',
+ 'placeholder' => 'Billing Phone',
+ 'required' => $data.fieldRequired.billing_phone,
+ 'errorText' => 'Billing Phone is Required'
+ ]}
+ {include file='ui/f6/text.html'}
-<script>
-jQuery(document).ready(function($){
+ {* Billing Fax *}
+ {$ui = [
+ 'value' => $data.fieldData.billing_fax,
+ 'field' => 'billing_fax',
+ 'label' => 'Billing Fax',
+ 'placeholder' => 'Billing Fax',
+ 'required' => $data.fieldRequired.billing_fax,
+ 'errorText' => 'Billing Fax is Required'
+ ]}
+ {include file='ui/f6/text.html'}
- var accounts = [ {foreach $accounts as $m} { label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' }, {/foreach} ];
- var isBoss = {if $account.fieldData.boss.value}true{else}false{/if};
+ </fieldset>
- // Setup autocomplete for both inputs
- $('#glm-billing-member-list').autocomplete({
- source: accounts,
- select: function( event, ui ){
- addEmployee( ui.item );
- $('#glm-billing-member-list').val( '' );
- return false;
- },
- change: function( event, ui) {
- if( ui.item == null ) {
+ {include file='ui/f6/errorCallout.html'}
+
+ <button class="button button-primary" type="submit" style="margin-top: 0;">{if $haveAccount}Save{else}Create{/if} Account</button>
+
+ <button class="button glm-right" data-close aria-label="Cancel" type="button">
+ <span>Cancel</span>
+ </button>
+
+ </form>
+ </div>
+
+ <script>
+ jQuery(document).ready(function($){
+
+ var accounts = [ {foreach $accounts as $m} { label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' }, {/foreach} ];
+ var isBoss = {if $account.fieldData.boss.value}true{else}false{/if};
+
+ // Setup autocomplete for both inputs
+ $('#glm-billing-member-list').autocomplete({
+ source: accounts,
+ select: function( event, ui ){
+ addEmployee( ui.item );
$('#glm-billing-member-list').val( '' );
return false;
- }
- },
- });
+ },
+ change: function( event, ui) {
+ if( ui.item == null ) {
+ $('#glm-billing-member-list').val( '' );
+ return false;
+ }
+ },
+ });
- function addEmployee( employee ) {
- var html = '<div class="glm-billing-employee">';
- html += '<input type="hidden" name="employees[' + employee.id + ']" value="1">';
- html += employee.label;
- html += '<span class="glm-billing-employee-del dashicons dashicons-trash glm-right"></span>';
- html += '</div>';
- $('#glm-billing-employees').append(html);
- }
-
- // If the boss flag in unchecked then hide the employees box and
- // disable the employees inputs.
- $('#billing-boss').change(function(){
- if ( $(this).is(':checked') ) {
- isBoss = true;
- } else {
- isBoss = false;
+ function addEmployee( employee ) {
+ var html = '<div class="glm-billing-employee">';
+ html += '<input type="hidden" name="employees[' + employee.id + ']" value="1">';
+ html += employee.label;
+ html += '<span class="glm-billing-employee-del dashicons dashicons-trash glm-right"></span>';
+ html += '</div>';
+ $('#glm-billing-employees').append(html);
}
- setupEmployeesPart();
- });
- function setupEmployeesPart() {
- if ( isBoss ) {
- $('#glm-emp-list').show();
- $('input[name^="employees"]').each(function(){
- $(this).removeAttr('disabled');
- });
- } else {
- $('#glm-emp-list').hide();
- $('input[name^="employees"]').each(function(){
- $(this).prop('disabled', true);
- });
+
+ // If the boss flag in unchecked then hide the employees box and
+ // disable the employees inputs.
+ $('#billing-boss').change(function(){
+ if ( $(this).is(':checked') ) {
+ isBoss = true;
+ } else {
+ isBoss = false;
+ }
+ setupEmployeesPart();
+ });
+ function setupEmployeesPart() {
+ if ( isBoss ) {
+ $('#glm-emp-list').show();
+ $('input[name^="employees"]').each(function(){
+ $(this).removeAttr('disabled');
+ });
+ } else {
+ $('#glm-emp-list').hide();
+ $('input[name^="employees"]').each(function(){
+ $(this).prop('disabled', true);
+ });
+ }
}
- }
- setupEmployeesPart();
+ setupEmployeesPart();
- $('#glm-billing-employees').on('click', '.glm-billing-employee-del', function(){
- $(this).parent('.glm-billing-employee').remove();
- });
+ $('#glm-billing-employees').on('click', '.glm-billing-employee-del', function(){
+ $(this).parent('.glm-billing-employee').remove();
+ });
- // Setup the date picker for the input field with the name anniversary_date
- $('input[name="anniversary_date"]').datepicker({
- dateFormat: 'mm/dd/yy'
- });
- // Setup the date picker for the input field with the name renewal_date
- $('input[name="renewal_date"]').datepicker({
- dateFormat: 'mm/dd/yy'
- });
+ // Setup the date picker for the input field with the name anniversary_date
+ $('input[name="anniversary_date"]').datepicker({
+ dateFormat: 'mm/dd/yy'
+ });
+ // Setup the date picker for the input field with the name renewal_date
+ $('input[name="renewal_date"]').datepicker({
+ dateFormat: 'mm/dd/yy'
+ });
- // Flash certain elements for a short time after display
- $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-
- //$('#billingInfoForm')
- var abide = new Foundation.Abide($('#billingInfoForm'));
- $(document)
- .on('invalid.zf.abide', function(ev,elem){
- elem.focus();
- return false;
- })
- // .on('forminvalid.zf.abide', function(ev,frm){
- // console.log( 'form id '+ev.target.id+' is invalid' );
- // })
- .on('submit', function(ev){
- ev.preventDefault();
- var validForm = $('#billingInfoForm').foundation('validateForm');
- console.log('ValidForm: ',validForm);
- var data = $('#billingInfoForm').serialize();
- console.log('data: ', data);
- console.log('Submit for form id '+ev.target.id+' intercepted');
- $.ajax({
- url: '{$ajaxUrl}?action=glm_members_admin_ajax&' + data,
- cache: false,
- beforeSend: startAjax,
- complete: completeAjax,
- }).done(function(rsp){
- console.log( 'rsp:', rsp );
- if ( rsp.status == '1' ) {
- var $sucessModal = $('#billingInfoSuccess');
- $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
-
- // Update the anchor label
- var id = rsp.fieldData.id;
- var ref_name = rsp.fieldData.ref_name;
- console.log('name: ', ref_name);
- $('#account-ref-dest-' + id).text( ref_name );
- } else {
- return false;
- }
- }).fail(function(){
- console.log( 'error' );
+ // Flash certain elements for a short time after display
+ $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+
+ //$('#billingInfoForm')
+ var abide = new Foundation.Abide($('#billingInfoForm'));
+ $('#billingInfoForm')
+ .on('submit', function(ev){
+ ev.preventDefault();
+ var validForm = $('#billingInfoForm').foundation('validateForm');
+ //console.log('ValidForm: ',validForm);
+ var data = $('#billingInfoForm').serialize();
+ //console.log('data: ', data);
+ //console.log('Submit for form id '+ev.target.id+' intercepted');
+ $.ajax({
+ url: '{$ajaxUrl}?action=glm_members_admin_ajax&' + data,
+ cache: false,
+ beforeSend: startAjax,
+ complete: completeAjax,
+ }).done(function(rsp){
+ //console.log( 'rsp:', rsp );
+ if ( rsp.status == '1' ) {
+ var $sucessModal = $('#billingInfoSuccess');
+ $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
+
+ // Update the anchor label
+ var id = rsp.fieldData.id;
+ var ref_name = rsp.fieldData.ref_name;
+ // kill this abide form
+ $('#billingInfoForm').foundation('_destroy');
+ //console.log('name: ', ref_name);
+ //$('#account-ref-dest-' + id).text( ref_name );
+ } else {
+ return false;
+ }
+ }).fail(function(){
+ //console.log( 'error' );
+ });
+ return false;
});
- return false;
+ function startAjax(){
+ $('#glmLoading').show();
+ }
+ function completeAjax(){
+ $('#glmLoading').hide();
+ };
});
- function startAjax(){
- $('#glmLoading').show();
- }
- function completeAjax(){
- $('#glmLoading').hide();
- };
-});
-</script>
+ </script>
+</div>