Remove the Anniversary date column.
wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/css/foundation-6.min.css' );
wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/js/foundation-6.min.js' );
- // Check for region id
+ // Check for id
$id = 0;
if ( isset( $_REQUEST['id'] ) ) {
$id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT );
// Get a current list of members
$invoiceTypes = $this->getList();
- // echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
-
// If we have list entries - even if it's an empty list
$success = true;
$haveInvoiceTypes = false;
// Sort results by higherarchy (Parent/Child and Alpha)
$invoiceTypes = $this->sortParentChild( $invoiceTypes );
+ $parents = array_filter( $invoiceTypes, function($iType){
+ if ( $iType['parent']['value'] === 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ } );
+ if ( !empty( $id ) ) {
+ $parents = array_filter( $parents, function($iType) use ($id) {
+ if ( $iType['id'] != $id ) {
+ return true;
+ } else {
+ return false;
+ }
+ } );
+ }
+
// Get list of Member Types
$MemberType = new GlmDataMemberTypes( $this->wpdb, $this->config );
$memberTypes = $MemberType->getList();
);
}
-
+ // echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
// Compile template data
$templateData = array(
'enable_members' => $enable_members,
'haveInvoiceTypes' => $haveInvoiceTypes,
'invoiceTypes' => $invoiceTypes,
+ 'parents' => $parents,
'recurrenceTypes' => $this->config['recurrence'],
'memberTypes' => $memberTypes,
'invoiceType' => $invoiceType,
} else {
$paymentSuccess = true;
}
- if ( $this->ajaxSide ) {
- header( 'Content-type:application/json;charset=utf-8', true );
- echo json_encode( $errors, true );
- exit;
- }
break;
case 'pay_by_check':
break;
}
+ if ( $this->ajaxSide && !$errors ) {
+ if ( !empty( $invoices ) ) {
+ $invoiceData = array_map( array( $BillingSupport, 'getInvoiceById' ), $invoices );
+ }
+ $return = array(
+ 'payment_id' => $payment_id,
+ 'invoices' => $invoiceData
+ );
+ header( 'Content-type:application/json;charset=utf-8', true );
+ echo json_encode( $return, true );
+ exit;
+ } elseif ( $this->ajaxSide && $errors ) {
+ $return = array(
+ 'status' => false,
+ );
+ header( 'Content-type:application/json;charset=utf-8', true );
+ echo json_encode( $return, true );
+ exit;
+ }
if ( !$errors ) {
$view = 'statements';
$payment_id = false;
}
if ( $this->ajaxSide ) {
- // TODO: get invoices (array) of data and send back
- // Need to know which invoices were effected with payment.
if ( !empty( $invoices ) ) {
$invoiceData = array_map( array( $BillingSupport, 'getInvoiceById' ), $invoices );
}
<th>Boss/Employees</th>
{/if}
<th>Billing Email</th>
- <th>Anniversary Date</th>
<th>Renewal Date</th>
</tr>
</thead>
<td> {if $t.boss.value}Yes{/if} </td>
{/if}
<td> {$t.email} </td>
- <td> {$t.anniversary_date.date} </td>
<td> {$t.renewal_date.date} </td>
</tr>
<tr id="account-container-{$t.id}" class="hide-for-large glm-account-links {if $t@iteration is div by 2} alternate{/if}">
- <td colspan="{if $settings.allow_employees}6{else}5{/if}">
+ <td colspan="{if $settings.allow_employees}5{else}4{/if}">
<span class="account-dashboard-link">
<a title="Opens in a new window" class="account-member-dashboard" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&member={$t.ref_dest}" target="_blank">
Member Dashboard
</tr>
{if $t.boss.value}
<tr id="account-employees-{$t.id}" class="hide-for-large {if $t@iteration is div by 2} alternate{/if}" style="background-color: #fff;">
- <td colspan="6">
+ <td colspan="5">
<div class="glm-row" style="margin-bottom: 0px !important; margin-top: .5rem;">
{foreach $t.employees as $emp}
<div class="glm-columns glm-medium-2">{$emp.ref_name}</div>
<p class="validateAccountTips" style="color:red">* required</p>
<form id="addAccountForm">
<input id="non-member-account" type="hidden" name="ref_dest" value="">
- <input id="non-member-account" type="hidden" name="invoice_type" value="0">
<div class="grid-container">
<div class="grid-x grid-padding-x">
<div class="cell small-12">
- <label class="glm-required">Member Name</label>
+ <span
+ class="has-tip"
+ style="float:right;"
+ data-tooltip aria-haspopup="true"
+ data-disable-hover="false"
+ data-position="bottom" data-alignment="right"
+ title="Member must already exist. Start typeing name for lookup.">?</span>
+ <label class="glm-required">Member Name (lookup)</label>
<input id="glm_member_name" type="text" name="ref_name" value="">
</div>
<div class="cell small-12">
<label class="glm-required">Account Number</label>
<input type="text" name="account_number" value="">
</div>
+ {if !$settings.member_types_enabled}
+ <div class="cell small-12">
+ <label class="glm-required">Payment Types</label>
+ <select name="invoice_type" required>
+ <option value="0"></option>
+ {foreach $invoiceTypes as $type}
+ <option value="{$type.id}">{$type.name} (${$type.amount})</option>
+ {/foreach}
+ </select>
+ </div>
+ {/if}
<div class="cell small-12">
<label class="glm-required">Anniversary Date</label>
<input class="datepicker" type="text" name="anniversary_date" value="">
line_items = [], // Array holding line_items json objects
allFields = $( [] ).add( line_item_type ), // Array holding the form fields - add line_item form
ref_name = $( 'input[name="ref_name"' ),
+ invoice_type = $( 'select[name="invoice_type"' ),
account_number = $( 'input[name="account_number"' ),
anniversary_date = $( 'input[name="anniversary_date"' ),
renewal_date = $( 'input[name="renewal_date"' ),
allAccountFields.removeClass( 'ui-state-error' );
valid = valid && checkRequired( ref_name, accountTips, 'Name is required!' );
+ valid = valid && checkRequired( invoice_type, accountTips, 'Payment Type is required!' );
valid = valid && checkRequired( account_number, accountTips, 'Account Number is required!' );
valid = valid && checkRequired( anniversary_date, accountTips, 'Anniversary Date is required!' );
valid = valid && checkRequired( email, accountTips, 'Email is required!' );
{* Form Start *}
{$ui = [
'id' => 'billing-invoice-type-form',
- 'action' => "{$thisUrl}?page={$thisPage}&glm_action==invoiceTypes",
+ 'action' => "{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes",
'method' => 'post',
'file' => false,
'validate' => true,
'value' => $data.fieldData.parent.value,
'field' => 'parent',
'label' => 'Parent',
- 'list' => $invoiceTypes,
+ 'list' => $parents,
'l_label' => 'name',
'l_value' => 'id',
'l_blank' => true,
]}
{include file='ui/f6/grid-start.html'}
-<h3 class="subheader">Accounts</h3>
+<h3 class="subheader">Dashboard</h3>
<div>
<a class="button secondary" href="#" id="exportAccountsButton">Accounts Export</a>
<tr>
<th>Member Name</th>
<th>Billing Email</th>
- <th>Anniversary Date</th>
<th>Renewal Date</th>
</tr>
</thead>
<tr class="glm-account-row{if $t@iteration is div by 2} alternate{/if}" data-id="{$t.id}">
<td> <b id="account-ref-dest-{$t.id}">{$t.ref_name}</b> </td>
<td> {$t.email} </td>
- <td> {$t.anniversary_date.date} </td>
<td> {$t.renewal_date.date} </td>
</tr>
<tr id="account-container-{$t.id}" class="glm-account-links hide-for-large{if $t@iteration is div by 2} alternate{/if}">
- <td colspan="4">
+ <td colspan="3">
<span class="account-dashboard-link">
<a title="Opens in a new window" class="account-member-dashboard" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&member={$t.ref_dest}" target="_blank">Member Dashboard</a> |
</span>
</tr>
{if $t.boss.value}
<tr id="account-employees-{$t.id}" class="{if $t@iteration is div by 2} alternate{/if}" style="display: none;background-color: #fff;">
- <td colspan="4">
+ <td colspan="3">
<div class="glm-row" style="margin-bottom: 0px !important; margin-top: .5rem;">
{foreach $t.employees as $emp}
<div class="glm-columns glm-medium-2">{$emp.ref_name}</div>
if ( rsp ) {
var $sucessModal = $('#billingSuccess');
$sucessModal.foundation('open').trigger('resizeme.zp.reveal');
- // TODO: Need to refresh the page or the section for this invoice.
if ( rsp.invoices.length > 0 ) {
// Loop over the invoices and update the ones if found on this page.
for ( var i in rsp.invoices ) {
<input type="hidden" name="amount" value="" id="total_amount" />
- {include file='ui/f6/errorCallout.html'}
<!-- Call for billing section -->
{if $invoices}
'value' => $smarty.request.cc_name|default:'',
'field' => 'cc_name',
'label' => 'Name on Card',
+ 'class' => 'glm-billing-card glm-billing-credit',
+ 'inputClass' => 'ccard',
'required' => true,
'errorText' => 'Name on Card is Required',
'dataError' => ''
{* Card Type *}
{$ui = [
- 'value' => $smarty.request.cc_type|default:'',
- 'field' => 'cc_type',
- 'label' => 'Card Type',
- 'list' => $management.cc_accepts.names,
- 'l_blank' => true,
- 'required' => true,
- 'errorText' => 'Card Type is Required',
- 'dataError' => ''
+ 'value' => $smarty.request.cc_type|default:'',
+ 'field' => 'cc_type',
+ 'label' => 'Card Type',
+ 'list' => $management.cc_accepts.names,
+ 'l_blank' => true,
+ 'class' => 'glm-billing-card glm-billing-credit',
+ 'inputClass' => 'ccard',
+ 'required' => true,
+ 'errorText' => 'Card Type is Required',
+ 'dataError' => ''
]}
{include file='ui/f6/select.html'}
+ {* Card Number *}
+ {$ui = [
+ 'value' => $smarty.request.cc_numb|default:'',
+ 'field' => 'cc_numb',
+ 'label' => 'Card Number',
+ 'pattern' => 'card',
+ 'class' => 'glm-billing-card glm-billing-credit',
+ 'inputClass' => 'ccard',
+ 'required' => true,
+ 'errorText' => 'Card Number is Required and must be valid number',
+ 'dataError' => ''
+ ]}
+ {include file='ui/f6/text.html'}
+
+ {* Card Expiration *}
+ {$ui = [
+ 'value' => $smarty.request.cc_exp|default:'',
+ 'field' => 'cc_exp',
+ 'label' => 'Card Expiration',
+ 'placeholder' => 'MM/YY',
+ 'pattern' => '^\d{2}/\d{2}$',
+ 'class' => 'glm-billing-card glm-billing-credit',
+ 'inputClass' => 'ccard',
+ 'required' => true,
+ 'errorText' => 'Card Expiration is Required',
+ 'dataError' => ''
+ ]}
+ {include file='ui/f6/text.html'}
+
+ {* C V V *}
+ {$ui = [
+ 'value' => $smarty.request.cc_cvv|default:'',
+ 'field' => 'cc_cvv',
+ 'label' => 'C V V',
+ 'pattern' => 'cvv',
+ 'class' => 'glm-billing-card glm-billing-credit',
+ 'inputClass' => 'ccard',
+ 'required' => true,
+ 'errorText' => 'C V V is Required',
+ 'dataError' => ''
+ ]}
+ {include file='ui/f6/text.html'}
+
+
+
</fieldset>
{* Include the Payment Form template *}
beforeSend: startAjax,
complete: completeAjax,
}).done(function(rsp){
- // if ( rsp.status == '1' ) {
- // var $sucessModal = $('#billingInfoSuccess');
- // $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
- // } else {
- // return false;
- //
+ console.log('rsp: ', rsp);
+ var $sucessModal = $('#billingSuccess');
+ $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
+ if ( rsp.status == false ) {
+ console.log( 'Error:' );
+ }
+ if ( rsp.invoices.length > 0 ) {
+ // Loop over the invoices and update the ones if found on this page.
+ for ( var i in rsp.invoices ) {
+ // Update the balance due
+ $('#balance-' + rsp.invoices[i].id ).html( rsp.invoices[i].balance );
+ // If the invoices is marked 'Paid' then remove the make payment
+ // or pay invoices links and the send invoices line
+ if ( rsp.invoices[i].paid ) {
+ $('#make-a-payment-' + rsp.invoices[i].id).remove();
+ $('#pay-invoice-' + rsp.invoices[i].id).remove();
+ $('#send-invoice-' + rsp.invoices[i].id).remove();
+ }
+ }
+ }
return false;
}).fail(function(){
});
getPageTotal();
});
+ $('.payment_option').change(function(){
+ var payment_option = $('.payment_option:checked').val();
+ if ( payment_option == 'pay_by_check' ) {
+ {if $billing_settings.proc_methods == 4}
+ $('.sq-payment-form').hide();
+ paymentForm.destroy();
+ {else}
+ $('.glm-billing-credit').hide();
+ $('.ccard').prop('disabled', true);
+ $('#billing-payment-button').prop( 'onclick', null );
+ {/if}
+ } else if ( payment_option == 'mark_paid' ) {
+ {if $billing_settings.proc_methods == 4}
+ $('.sq-payment-form').hide();
+ paymentForm.destroy();
+ $('#billing-payment-button').prop( 'onclick', null );
+ {else}
+ $('.glm-billing-credit').hide();
+ $('.ccard').prop('disabled', true);
+ {/if}
+ } else {
+ {if $billing_settings.proc_methods == 4}
+ if ( confirm( 'This will reload the page' ) ) {
+ $('.sq-payment-form').show();
+ window.location.reload();
+ } else {
+ $('.payment_option[value=mark_paid]').prop( 'checked', true );
+ }
+ {else}
+ $('.glm-billing-credit').show();
+ $('.ccard').prop('disabled', false);
+ {/if}
+ }
+ });
+
+ $('#glm-billing-use-saved-card').change(function(){
+ var isChecked = $(this).prop( 'checked' );
+ if ( isChecked ) {
+ $('.glm-billing-card').hide();
+ $('.ccard').prop('disabled', true);
+ } else {
+ $('.glm-billing-card').show();
+ $('.ccard').prop('disabled', false);
+ }
+ });
// 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);
'label' => 'All Members Renew same day each year',
'required' => $data.fieldRequired.renewal_day_static,
'errorText' => 'All Members Renew same day each year is Required',
- 'helpText' => 'All Member renewal on the same day each billing period (yearly)',
+ 'tip' => 'All Member renewal on the same day each billing period (yearly)',
'dataError' => $data.fieldFail.renewal_day_static
]}
{include file='ui/f6/checkbox.html'}
'pattern' => 'number',
'required' => $data.fieldRequired.days_before_renewal,
'errorText' => 'Days Before Renewal Date is Required to be a number',
- 'helpText' => 'Days before Renewal Date to Allow Membership Renewal. Based on 1 year after renewal date.',
+ 'tip' => 'Days before Renewal Date to Allow Membership Renewal. Based on 1 year after renewal date.',
'dataError' => $data.fieldFail.days_before_renewal
]}
{include file='ui/f6/text.html'}
'pattern' => 'number',
'required' => $data.fieldRequired.days_after_expired,
'errorText' => 'Days After Renewal Date is Required to be a number',
- 'helpText' => 'Days after Renewal Date to Expire Membership. Based on 1 year after renewal date.',
+ 'tip' => 'Days after Renewal Date to Expire Membership. Based on 1 year after renewal date.',
'dataError' => $data.fieldFail.days_after_expired
]}
{include file='ui/f6/text.html'}