* In the Post Processing get the next_anniversary_date.
*/
public $postNextAnniversaryDate = false;
+ /**
+ * In the Post Processing get the employees
+ */
+ public $postEmployees = false;
/**
* Constructor
}
}
}
+
+ if ( $this->postEmployees ) {
+ include_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/billingSupport.php';
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+ $employees = $BillingSupport->getListOfAccountEmployees( $r['ref_dest'] );
+ $r['employees'] = $employees;
+ }
+
return $r;
}
width: 100%;
}
}
+
+/* Account list */
+.glm-admin-table a.account-link {
+ text-decoration: underline;
+}
+.glm-admin-table span.account-dashboard-link a{
+ text-decoration: underline;
+ font-size: 12px;
+}
$where = implode( ' AND ', $where_params );
// Get the list of accounts and determine number of accounts in list
- $orderBy = 'renewal_date ASC';
- $accountsResult = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
- $totalAccounts = $this->getStats( $where );
+ $orderBy = 'renewal_date ASC';
+ $this->postEmployees = true;
+ $accountsResult = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
+ $this->postEmployees = false;
+ $totalAccounts = $this->getStats( $where );
// Get paging results
$numbDisplayed = $accountsResult['returned'];
'limit' => $limit,
'invoiceTypeJSON' => $invoiceTypeJSON,
'invoiceTypes' => $invoiceTypes,
- 'accounts' => $accounts,
'invoiceHtml' => $invoiceHtml,
'fromDate' => $fromDate,
'toDate' => $toDate,
// Get list of pending invoices ( not overdue )
$days_before_renewal = $this->config['settings']['days_before_renewal'];
$days_after_expired = $this->config['settings']['days_after_expired'];
- $orderBy = 'renewal_date ASC';
- $curDate = date( 'Y-m-d' );
- $pendingWhere = "T.archived <> true AND invoice_type != 0 ";
- $pendingWhere .= " AND T.renewal_date + INTERVAL 1 YEAR - INTERVAL $days_before_renewal DAY <= '$curDate'" ;
- $pendingWhere .= " AND T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY >= '$curDate'";
- $start = 1;
- $pending = $this->getList( $pendingWhere, $orderBy, true, 'id', $start, $limit );
+ $orderBy = 'renewal_date ASC';
+ $curDate = date( 'Y-m-d' );
+ $pendingWhere = "T.archived <> true AND invoice_type != 0 ";
+ $pendingWhere .= " AND T.renewal_date + INTERVAL 1 YEAR - INTERVAL $days_before_renewal DAY < = '$curDate'" ;
+ $pendingWhere .= " AND T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY > = '$curDate'";
+ $start = 1;
+ $this->postEmployees = true;
+ $pending = $this->getList( $pendingWhere, $orderBy, true, 'id', $start, $limit );
+ $this->postEmployees = false;
// echo '<pre>$pending: ' . print_r( $pending, true ) . '</pre>';
$numberPending = ( isset( $pending['returned'] ) ? $pending['returned'] : 0 );
// Get the number of over due invoices
- $overDueWhere = "T.archived <> true AND invoice_type != 0";
- $overDueWhere .= " AND T.renewal_date + INTERVAL 1 YEAR < '$curDate'";
- $start = 1;
- $overdue = $this->getList( $overDueWhere, $orderBy, true, 'id', $start, $limit );
+ $overDueWhere = "T.archived <> true AND invoice_type != 0";
+ $overDueWhere .= " AND T.renewal_date + INTERVAL 1 YEAR < '$curDate'";
+ $start = 1;
+ $this->postEmployees = true;
+ $overdue = $this->getList( $overDueWhere, $orderBy, true, 'id', $start, $limit );
+ $this->postEmployees = false;
if ( isset( $overdue['returned'] ) ) {
$numberOverdue = $overdue['returned'];
}
{/if}
<br clear="all">
-<table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th style="width:50px;">ID</th>
- <th>Member Name</th>
- <th>Billing Email</th>
- <th>Anniversary Date</th>
- <th>Renewal Date</th>
- </tr>
- </thead>
- <tbody>
- {if $haveAccounts}
- {assign var="i" value="0"}
- {foreach $accounts as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td> {$t.id} </td>
- <td> <a href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">{$t.ref_name}</a> </td>
- <td> {$t.email} </td>
- <td> {$t.anniversary_date.date} </td>
- <td> {$t.renewal_date.date} </td>
- </tr>
- {/foreach}
- {else}
- <tr class="alternate"><td colspan="2">(no Invoice Types listed)</td></tr>
- {/if}
- </tbody>
-</table>
+<div class="glm-admin-table-inner">
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th style="width:50px;">ID</th>
+ <th>Member Name</th>
+ <th>Billing Email</th>
+ <th>Anniversary Date</th>
+ <th>Renewal Date</th>
+ </tr>
+ </thead>
+ <tbody>
+ {if $haveAccounts}
+ {foreach $accounts as $t}
+ <tr class="glm-account-row{if $t@iteration is div by 2} alternate{/if}" data-id="{$t.id}">
+ <td> {$t.id} </td>
+ <td> <a class="account-link" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">{$t.ref_name}</a> </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 glm-hidden{if $t@iteration is div by 2} alternate{/if}">
+ <td colspan="5">
+ <span class="account-dashboard-link">
+ <a class="account-member-dashboard" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&member={$t.ref_dest}">Member Dashboard</a> |
+ </span>
+ <span class="account-dashboard-link">
+ <a class="account-member-statements" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">View Statements</a> |
+ </span>
+ <span class="account-dashboard-link">
+ <a class="account-billing" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=account&member={$t.ref_dest}">Billing Info</a>
+ </span>
+ {if $t.boss.value}
+ <span class="account-dashboard-link">
+ | <a class="account-employees" data-id="{$t.id}" href="#">View Employees</a>
+ </span>
+ {/if}
+ </td>
+ </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="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>
+ {/foreach}
+ </div>
+ <div class="glm-row">
+ <div class="glm-columns glm-small-7">
+ <button class="glm-employee-cancel button button-secondary" data-id="{$t.id}">Cancel</button>
+ </div>
+ </div>
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {else}
+ <tr class="alternate"><td colspan="2">(no Invoice Types listed)</td></tr>
+ {/if}
+ </tbody>
+ </table>
+</div>
{if $paging}
{include file='admin/billing/exportBillingModal.html'}
+<script>
+ jQuery(document).ready(function($){
+
+ var accountHoverId = false;
+ var accountEmployee = false;
+
+ $('.glm-account-row').mouseenter( function(){
+ if ( accountEmployee ) {
+ return;
+ }
+ // Hide all
+ $( '.glm-account-links' ).addClass( 'glm-hidden' );
+
+ accountHoverId = $(this).data('id');
+ $( '#account-container-' + accountHoverId ).removeClass( 'glm-hidden' );
+ });
+ $('.glm-admin-table-inner').mouseleave( function() {
+ $( '#account-container-' + accountHoverId ).addClass( 'glm-hidden' );
+ });
+
+ $('.account-employees').on( 'click', function(e){
+ e.preventDefault();
+ accountLinksEmployeesSelected();
+ var account_id = $(this).data('id');
+ console.log('account_id: ', account_id);
+ $('#account-employees-' + account_id).show();
+ } );
+
+ $('.glm-employee-cancel').on('click', function(e){
+ e.preventDefault();
+ clearAccountLinks();
+ var account_id = $(this).data('id');
+ $('#account-employees-' + account_id).hide();
+ });
+
+ function accountLinksEmployeesSelected() {
+ accountEmployee = true;
+ console.log( 'accountHoverId: ', accountHoverId );
+ $('#account-container-' + accountHoverId).addClass('glm-hidden');
+ }
+
+ function clearAccountLinks() {
+ accountLinksEmployeesSelected();
+ accountHoverId = false;
+ accountEmployee = false;
+ }
+ });
+</script>
{include file='admin/footer.html'}
<table class="glm-admin-table">
<tr><th colspan="2">{$dashboard_title}</th></tr>
</table>
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th style="width: 50px;">ID</th>
- <th>Member Name</th>
- <th>Billing Email</th>
- <th>Anniversary Date</th>
- <th>Renewal Date</th>
- </tr>
- </thead>
- <tbody>
- {if $list.number > 0}
- {assign var="i" value="0"}
- {foreach $list.data.list as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td> {$t.id} </td>
- <td> <a href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">{$t.ref_name}</a> </td>
- <td> {$t.email} </td>
- <td> {$t.anniversary_date.date} </td>
- <td> {$t.renewal_date.date} </td>
- </tr>
- {/foreach}
- {/if}
- </tbody>
- </table>
+ <div class="glm-admin-table-inner">
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th style="width: 50px;">ID</th>
+ <th>Member Name</th>
+ <th>Billing Email</th>
+ <th>Anniversary Date</th>
+ <th>Renewal Date</th>
+ </tr>
+ </thead>
+ <tbody>
+ {if $list.number > 0}
+ {foreach $list.data.list as $t}
+ <tr class="glm-account-row{if $t@iteration is div by 2} alternate{/if}" data-id="{$t.id}">
+ <td> {$t.id} </td>
+ <td> <a class="account-link" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">{$t.ref_name}</a> </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 glm-hidden{if $t@iteration is div by 2} alternate{/if}">
+ <td colspan="5">
+ <span class="account-dashboard-link">
+ <a class="account-member-dashboard" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&member={$t.ref_dest}">Member Dashboard</a> |
+ </span>
+ <span class="account-dashboard-link">
+ <a class="account-member-statements" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">View Statements</a> |
+ </span>
+ <span class="account-dashboard-link">
+ <a class="account-billing" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=account&member={$t.ref_dest}">Billing Info</a>
+ </span>
+ {if $t.boss.value}
+ <span class="account-dashboard-link">
+ | <a class="account-employees" data-id="{$t.id}" href="#">View Employees</a>
+ </span>
+ {/if}
+ </td>
+ </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="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>
+ {/foreach}
+ </div>
+ <div class="glm-row">
+ <div class="glm-columns glm-small-7">
+ <button class="glm-employee-cancel button button-secondary" data-id="{$t.id}">Cancel</button>
+ </div>
+ </div>
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {/if}
+ </tbody>
+ </table>
+ </div>
<br clear="all">
{/foreach}
{include file='admin/billing/exportBillingModal.html'}
+<script>
+ jQuery(document).ready(function($){
+
+ var accountHoverId = false;
+ var accountEmployee = false;
+
+ $('.glm-account-row').mouseenter( function(){
+ if ( accountEmployee ) {
+ return;
+ }
+ // Hide all
+ $( '.glm-account-links' ).addClass( 'glm-hidden' );
+
+ accountHoverId = $(this).data('id');
+ $( '#account-container-' + accountHoverId ).removeClass( 'glm-hidden' );
+ });
+ $('.glm-admin-table-inner').mouseleave( function() {
+ $( '#account-container-' + accountHoverId ).addClass( 'glm-hidden' );
+ });
+
+ $('.account-employees').on( 'click', function(e){
+ e.preventDefault();
+ accountLinksEmployeesSelected();
+ var account_id = $(this).data('id');
+ console.log('account_id: ', account_id);
+ $('#account-employees-' + account_id).show();
+ } );
+
+ $('.glm-employee-cancel').on('click', function(e){
+ e.preventDefault();
+ clearAccountLinks();
+ var account_id = $(this).data('id');
+ $('#account-employees-' + account_id).hide();
+ });
+
+ function accountLinksEmployeesSelected() {
+ accountEmployee = true;
+ console.log( 'accountHoverId: ', accountHoverId );
+ $('#account-container-' + accountHoverId).addClass('glm-hidden');
+ }
+
+ function clearAccountLinks() {
+ accountLinksEmployeesSelected();
+ accountHoverId = false;
+ accountEmployee = false;
+ }
+
+
+ });
+</script>
+
{include file='admin/footer.html'}