Move Management into billing
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 19 Jul 2019 20:14:54 +0000 (16:14 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 19 Jul 2019 20:14:54 +0000 (16:14 -0400)
Use responsive navigation. medium up is dropdown small is drilldown.

24 files changed:
classes/billingSupport.php
classes/data/dataAccounts.php
models/admin/ajax/ajaxNotificationPreview.php [new file with mode: 0644]
models/admin/billing/accounts.php
models/admin/billing/invoicing.php
models/admin/billing/notifications.php
setup/standardTemplateParams.php
setup/validActions.php
views/admin/billing/accountReveals.html
views/admin/billing/editAccount.html
views/admin/billing/editAccountAjax.html
views/admin/billing/editInvoiceType.html
views/admin/billing/editNotificationType.html
views/admin/billing/header.html
views/admin/billing/invoiceTypes.html
views/admin/billing/invoices.html
views/admin/billing/invoicing.html
views/admin/billing/invoicingSubHeader.html
views/admin/billing/makePaymentAdjustmentAjax.html
views/admin/billing/notifications.html
views/admin/billing/preview.html [new file with mode: 0644]
views/admin/billing/reports.html
views/admin/billing/reportsSubHeader.html
views/admin/billing/statements.html

index 071836c..c29168b 100644 (file)
@@ -1093,6 +1093,7 @@ class GlmBillingSupport
             || !isset( $invoice_data['member_invoice'] )
             || !isset( $invoice_data['employee_data'] )
         ) {
+            echo '<pre>$invoice_data: ' . print_r( $invoice_data, true ) . '</pre>';
             return false;
         }
         extract( $invoice_data );
@@ -1140,7 +1141,7 @@ class GlmBillingSupport
                 'recurrence'     => $new_member_invoice_type['recurrence'],
             )
         );
-        // echo '<pre>$invoice_id: ' . print_r( $invoice_id, true ) . '</pre>';
+        echo '<pre>$invoice_id: ' . print_r( $invoice_id, true ) . '</pre>';
         if ( $invoice_id ) {
             if ( isset( $employees ) && is_array( $employees ) ) {
                 // Add line items for each employee.
index 00e7292..9a254f8 100644 (file)
@@ -469,6 +469,7 @@ class GlmDataAccounts extends GlmDataAbstract
             'anniversary_date' => $fSave['anniversary_date'],
             'invoice_type'     => $fSave['invoice_type'],
         );
+        $this->fields['invoice_type']['type'] = 'integer';
 
         $accountList = $this->getList($where, $order, $fieldVals, $idField, $start, $limit);
 
diff --git a/models/admin/ajax/ajaxNotificationPreview.php b/models/admin/ajax/ajaxNotificationPreview.php
new file mode 100644 (file)
index 0000000..a524265
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * PDF Output by admin-ajax
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+require_once GLM_MEMBERS_BILLING_PLUGIN_PATH . '/models/admin/billing/notifications.php';
+
+/**
+ * Steve Note
+ *
+ * You can get to this using the following URL.
+ *
+ *
+ {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=runQueue
+ *
+ * You should be able to do this as POST or GET and should be able to add and read additional parameters.
+ * I added a "mystuff" parameter to the URL above and it does output from the code in the
+ * modelAction() function below.
+ *
+ * To add another model under models/admin/ajax all you need to do is create it and add it to the
+ * setup/validActions.php file.
+ *
+ */
+
+/**
+ * This class handles the work of creating new invoices based on.
+ * 1) Member Type of member matching a paid invoiceType
+ * 2) Member renewal date past
+ * 3) Member has Billing Account
+ * 4) Member has no active Invoice
+ * 5) Renewal date is within the next 30 Days
+ *
+ */
+class GlmMembersAdmin_ajax_ajaxNotificationPreview extends GlmMembersAdmin_billing_notifications
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    public $ajaxSide = true;
+
+    public function __construct ( $wpdb, $config )
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+    }
+
+
+}
index 9e39dfe..39c6e65 100644 (file)
@@ -501,7 +501,6 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts
             'filterExpired'       => $filterExpired,
             'filterActive'        => $filterActive,
             'filterArchived'      => $filterArchived,
-            'pluginAssetsUrl'     => GLM_MEMBERS_BILLING_PLUGIN_BASE_URL . '/assets/'
         );
 
         // Return status, any suggested view, and any data to controller
index d44c0be..65b54b0 100644 (file)
@@ -182,17 +182,22 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts
             // echo '<pre>$wParts: ' . print_r( $wParts, true ) . '</pre>';
 
             if ( $option2 ) {
+                $successCounter = 0;
                 // $where used in all places.
-                $where    = implode( ' AND ', $wParts );
-                // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
-                $accounts = $Accounts->getSimpleAccountList( $where );
+                $where      = implode( ' AND ', $wParts );
+                $accounts   = $Accounts->getSimpleAccountList( $where );
+                $successMsg = '';
 
                 foreach ( $accounts as $account ) {
+
+                    echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+
                     // Get the invoice type
                     $invoiceType = $BillingSupport->getInvoiceTypeById( $account['invoice_type'] );
+                    echo '<pre>$invoiceType: ' . print_r( $invoiceType, true ) . '</pre>';
 
                     // Create the invoice for this member account
-                    $BillingSupport->createMemberInvoiceWithEmployees(
+                    $newInvoiceId = $BillingSupport->createMemberInvoiceWithEmployees(
                         array(
                             'account_id'     => $account['id'],
                             'renew_type_id'  => $account['invoice_type'],
@@ -203,8 +208,11 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts
                             'employees'      => array(),
                         )
                     );
+                    if ( $newInvoiceId ) {
+                        $successCounter++;
+                    }
                 }
-                $successMsg = 'Invoices Created';
+                $successMsg .= "<span class='label success'>$successCounter Invoices Created</span>";
             }
 
             break;
index 394fbb4..aca1492 100644 (file)
@@ -148,6 +148,26 @@ class GlmMembersAdmin_billing_notifications extends GlmDataNotificationTypes
 
         switch( $option ) {
 
+        case 'preview':
+            $view = 'preview';
+            // Compile template data
+            $templateData = array(
+                'id'      => $id,
+                'contact' => array(
+                    'fname' => 'Test',
+                    'lname' => 'Person',
+                )
+            );
+            // Return status, suggested view, and data to controller
+            return array(
+                'status'           => $success,
+                'menuItemRedirect' => false,
+                'modelRedirect'    => false,
+                'view'             => 'admin/billing/' . $view . '.html',
+                'data'             => $templateData
+            );
+            break;
+
         case 'add':
             /**
              * add:
index d91438f..7f09750 100644 (file)
  */
 
 // Common to both admin and front-end
-$smarty->templateAssign('glmPluginName', GLM_MEMBERS_BILLING_PLUGIN_NAME );
+$smarty->templateAssign( 'glmPluginName', GLM_MEMBERS_BILLING_PLUGIN_NAME );
+$smarty->templateAssign( 'pluginAssetsUrl', GLM_MEMBERS_BILLING_PLUGIN_BASE_URL . '/assets/' );
 
 if ( current_user_can( 'glm_members_management' ) ) {
-    $smarty->templateAssign('glmMemberManager', true);
+    $smarty->templateAssign( 'glmMemberManager', true );
 } else {
-    $smarty->templateAssign('glmMemberManager', false);
+    $smarty->templateAssign( 'glmMemberManager', false );
 }
index f75376a..7d76bc2 100644 (file)
@@ -78,6 +78,7 @@ $glmMembersBillingAddOnValidActions = array(
             'billingFixActiveUsers'   => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
             'ajaxBillingInfo'         => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
             'ajaxBillingSettings'     => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
+            'ajaxNotificationPreview' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
         ),
         'management' => array(
             'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
index f01b7f6..7776791 100644 (file)
         <span aria-hidden="true">&times;</span>
     </button>
 </div>
+{* Reveal for Payment Success *}
+<div class="small reveal" id="billingSuccess" data-reveal>
+    <h2>Payment Complete!</h2>
+    <div class="callout success">
+        <p>Successfully saved your data!</p>
+        <button class="close-button show-for-small-only" data-close aria-label="Close" type="button">
+            <span aria-hidden="true">&times;</span>
+        </button>
+    </div>
+    <button class="close-button" data-close aria-label="Close" type="button">
+        <span aria-hidden="true">&times;</span>
+    </button>
+</div>
 {* Reveal for Billing Statements *}
 <div id="glmBillingStatements" class="large reveal" data-reveal data-close-on-click="false">
     <button class="close-button" data-close aria-label="Close" type="button">
index 00fedbd..88ceef3 100644 (file)
@@ -70,9 +70,8 @@
                 <div class="glm-billing-label{if $account.fieldRequired.invoice_type} glm-required{/if}">Payment Type</div>
                 <div class="glm-billing-input{if $account.fieldFail.invoice_type} glm-form-bad-input{/if}" data-tabid="glm-invoice-type">
                     <select name="invoice_type" required>
-                        <option value="0"></option>
-                        {foreach $invoiceTypes as $type}
-                            <option value="{$type.id}"{if $type.id == $account.fieldData.invoice_type} selected{/if}>{$type.name} (${$type.amount})</option>
+                        {foreach $account.fieldData.invoice_type.list as $type}
+                            <option value="{$type.value}"{if $type.value == $account.fieldData.invoice_type.value} selected{/if}>{$type.name}</option>
                         {/foreach}
                     </select>
                     {if $account.fieldFail.invoice_type}<p>{$account.fieldFail.invoice_type}</p>{/if}<br>
index 8dd2577..bd8fdde 100644 (file)
@@ -82,7 +82,7 @@
 
                 {if $settings.invoice_methods_enabled}
 
-                    {* Payment Type *}
+                    {* Payment Methods *}
                     {$ui = [
                         'value'     => [
                             'email_invoice' => $data.fieldData.invoice_type.value,
index b3ae16b..96ce7ae 100644 (file)
 
 <button class="button primary" type="submit">{if isset( $data.fieldData.id )}Update{else}Add{/if} Invoice Type</button>
 
+<a class="button secondary" href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoiceTypes">Cancel</a>
+
 {include file='ui/f6/errorCallout.html'}
 
 
index 4ecd3eb..ed5c2b1 100644 (file)
 
                     <button class="button primary" type="submit">{if $notification_id}Update{else}Add{/if} Notification Type</button>
 
+                    <a class="button secondary" href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=notifications">Cancel</a>
+
                 </fieldset>
 
 
index 234a966..4991737 100644 (file)
 
     <h2>Billing</h2>
 
-    {* <ul class="tabs" data-responsive-accordion-tabs="tabs" id="glm-main-tabs"> *}
-    <ul class="menu" id="glm-main-tabs">
-        <li class="tabs-title{if $thisAction==index} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing">Dashboard</a>
-        </li>
-        <li class="tabs-title{if $thisAction==accounts} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=accounts">Accounts</a>
-        </li>
-        <li class="tabs-title{if $thisAction==invoices} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices">Invoices</a>
-        </li>
-        <li class="tabs-title{if $thisAction==payments} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=payments">Payments</a>
-        </li>
-        {if isset( $settings.renewal_day_static ) && $settings.renewal_day_static}
-            <li class="tabs-title{if $thisAction==invoicing} is-active{/if}">
-                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing">Invoicing</a>
-            </li>
-            <li class="tabs-title{if $thisAction==reports} is-active{/if}">
-                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports">Reports</a>
-            </li>
-        {/if}
-        <li class="tabs-title{if $thisAction==settings} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=settings">Settings</a>
-        </li>
-        <li class="tabs-title{if $thisAction==invoiceTypes} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoiceTypes">Invoice Types</a>
-        </li>
-        <li class="tabs-title{if $thisAction==notifications} is-active{/if}">
-            <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=notifications">Notifications</a>
-        </li>
-        {if $glmMemberManager}
-            <li class="tabs-title{if $thisAction==management} is-active{/if}">
-                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=management">Management</a>
-            </li>
-        {/if}
-    </ul>
+    <div class="title-bar" data-responsive-toggle="responsive-menu" data-hide-for="medium">
+      <button class="menu-icon" type="button" data-toggle="responsive-menu"></button>
+      <div class="title-bar-title">Menu</div>
+    </div>
+
+    <div class="top-bar stacked-for-small" id="responsive-menu">
+        <div class="top-bar-left">
+            <ul class="vertical medium-horizontal menu" data-responsive-menu="accordion medium-dropdown">
+                <li class="menu-text">Billing</li>
+                <li class="{if $thisAction==index}is-active{/if}">
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-billing">Dashboard</a>
+                </li>
+                <li class="{if $thisAction==accounts}is-active{/if}">
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=accounts">Accounts</a>
+                </li>
+                <li class="{if $thisAction==invoices}is-active{/if}">
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices">Invoices</a>
+                </li>
+                <li class="{if $thisAction==payments}is-active{/if}">
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=payments">Payments</a>
+                </li>
+                {if isset( $settings.renewal_day_static ) && $settings.renewal_day_static}
+                    <li class="">
+                        <a href="#">Invoicing</a>
+                        <ul class="menu">
+                            {*
+                            <li>
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing">Invoicing</a>
+                            </li>
+                            *}
+                            <li class="{if $option==createInvoices}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=createInvoices">Create Invoices</a>
+                            </li>
+                            <li class="{if $option==printInvoices}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=printInvoices">Print Invoices</a>
+                            </li>
+                            <li class="{if $option==createLabels}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=createLabels">Create Labels</a>
+                            </li>
+                            <li class="{if $option==sendEmails}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=sendEmails">Send Emails</a>
+                            </li>
+                        </ul>
+                    </li>
+                    <li class="{if $thisAction==reports} is-active{/if}">
+                        <a href="#">Reports</a>
+                        <ul class="menu">
+                            <li class="{if $option==openAccounts}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=openAccounts">Open Accounts</a>
+                            </li>
+                            <li class="{if $option==closedAccounts}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=closedAccounts">Closed Accounts</a>
+                            </li>
+                            <li class="{if $option==accountsByAge}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=accountsByAge">Accounts By Age</a>
+                            </li>
+                            <li class="{if $option==reportGenerator}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=reportGenerator">Report Generator</a>
+                            </li>
+                            <li class="{if $option==noAccounts}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=noAccounts">No Accounts</a>
+                            </li>
+                            <li class="{if $option==allAccounts}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=allAccounts">All Accounts</a>
+                            </li>
+                        </ul>
+                    </li>
+                {/if}
+            </ul>
+        </div>
+        <div class="top-bar-right">
+            <ul class="vertical medium-horizontal menu" data-responsive-menu="accordion medium-dropdown">
+                <li class="menu-text">Settings</li>
+                <li class="{if $thisAction==invoiceTypes}is-active{/if}">
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoiceTypes">Invoice Types</a>
+                </li>
+                <li class="{if $thisAction==notifications}is-active{/if}">
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=notifications">Notifications</a>
+                </li>
+                {if $glmMemberManager}
+                    <li class="">
+                        <a href="#">Config</a>
+                        <ul class="menu">
+                            <li class="{if $thisAction==settings}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=settings">Settings</a>
+                            </li>
+                            <li class="{if $thisAction==management}is-active{/if}">
+                                <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=management">Management</a>
+                            </li>
+                        </ul>
+                    </li>
+                {else}
+                    <li class="{if $thisAction==settings}is-active{/if}">
+                        <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=settings">Settings</a>
+                    </li>
+                {/if}
+            </ul>
+        </div>
+    </div>
 
     <div class="">
index 6bddcac..b3a307b 100644 (file)
@@ -45,6 +45,7 @@
                     </tr>
                     <tr id="invoiceType-container-{$t.id}" class="glm-invoiceType-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
                         <td colspan="6">
+                            <a href="{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes&option=edit&id={$t.id}">Edit</a> |
                             <span class="account-dashboard-link">
                                 <a class="deleteInvoiceTypeButton" data-invoiceTypeID="{$t.id}">Delete</a>
                             </span>
index 240063a..81c61b6 100644 (file)
         {if $paging}
             <input type="Submit" name="pageSelect" value="Previous {$limit} Invoices" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
             <input type="Submit" name="pageSelect" value="Next {$limit} Invoices" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
-            {*
-            <nav aria-label="Pagination">
-                <ul class="pagination">
-                    <li class="pagination-previous{if !$prevStart} disabled{/if}">
-                        {if $prevStart}<a href="#">{/if}
-                            Previous {$limit} Invoices
-                        {if $prevStart}</a>{/if}
-                    </li>
-                    <li class="pagination-next{if !$nextStart} disabled{/if}">
-                        {if $nextStart}<a href="#">{/if}
-                            Next {$limit} Invoices
-                        {if $nextStart}</a>{/if}
-                    </li>
-                  </ul>
-            </nav>
-            *}
         {/if}
             <br clear="all">
 
                                             data-account="{$t.account.value}"
                                             data-member_name="{$t.member_name}"
                                             >Send Invoice</a> |
-                                        {if isset( $settings.uptravel_payment_form ) && $settings.uptravel_payment_form}
-                                            <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepaymentadjustment&member={$t.member_id}">Make A Payment</a> |
+                                        {if $billing_settings.uptravel_payment_form}
+                                            <a class="make-a-payment" data-member="{$t.member_id}" href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepaymentadjustment&member={$t.member_id}">Make A Payment</a> |
                                         {else}
-                                            <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepayment&member={$t.member_id}">Pay Invoice</a> |
+                                            <a class="pay-invoice" data-member="{$t.member_id}" href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=makepayment&member={$t.member_id}">Pay Invoice</a> |
                                         {/if}
                                     {/if}
                                 </span>
         </form>
     </div>
 
+    {* Reveal for Billing Payments *}
+    <div id="glmBillingPayment" class="medium reveal" data-reveal data-close-on-click="false">
+    </div>
+    {* Ajax Loading Graphic *}
+    <div id="glmLoading" class="" style="display:none; position: absolute; left: 50%; top: 50vh;width: 100%; height: 100%;z-index: 9999;">
+        <img src="{$pluginAssetsUrl}loading25.gif">
+    </div>
+    {* Reveal for Payment Success *}
+    <div class="small reveal" id="billingSuccess" data-reveal>
+        <h2>Payment Complete!</h2>
+        <div class="callout success">
+            <p>Successfully saved your data!</p>
+            <button class="close-button show-for-small-only" data-close aria-label="Close" type="button">
+                <span aria-hidden="true">&times;</span>
+            </button>
+        </div>
+        <button class="close-button" data-close aria-label="Close" type="button">
+            <span aria-hidden="true">&times;</span>
+        </button>
+    </div>
     <script>
         jQuery(document).ready(function($) {
 
+            function startAjax(){
+                $('#glmLoading').show();
+            }
+            function completeAjax(){
+                $('#glmLoading').hide();
+            };
+
+            $('.make-a-payment').on('click', function(e){
+                e.preventDefault();
+                var member = $(this).data('member');
+                var $modalPayment = $('#glmBillingPayment');
+                $.ajax({
+                    url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=makepaymentadjustment&member=' + member,
+                    cache: false,
+                    beforeSend: startAjax,
+                    complete: completeAjax,
+                }).done(function(resp){
+                    $modalPayment.html(resp).foundation('open').trigger('resizeme.zp.reveal');
+                });
+                return false;
+            });
+
             function sendInvoice() {
                 var valid = true;
 
index ce16153..7ca5339 100644 (file)
@@ -3,7 +3,21 @@
 <div class="callout grid-container">
 
     <h3 class="subheader">Invoicing</h3>
-    {include file='admin/billing/invoicingSubHeader.html'}
+    {* include file='admin/billing/invoicingSubHeader.html' *}
+
+    {if $option}
+        <h4 class="subheader">
+            {if $option == 'createInvoices'}
+                Create Invoices
+            {elseif $option == 'printInvoices'}
+                Print Invoices
+            {elseif $option == 'createLabels'}
+                Create Labes
+            {elseif $option == 'sendEmails'}
+                Send Emails
+            {/if}
+        </h4>
+    {/if}
 
     <form id="invoicing-form" action="{$thisUrl}?page={$thisPage}" method="get">
         <input type="hidden" name="page" value="{$thisPage}">
index 3d8123b..9f25309 100644 (file)
@@ -1,6 +1,7 @@
 <div class="top-bar">
     <div class="top-bar-left">
         <ul class="menu">
+            <li class="menu-text">Invoicing</li>
             <li class="{if $option==createInvoices} is-active{/if}">
                 <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoicing&option=createInvoices">Create Invoices</a>
             </li>
index b8e52cc..9ad38fd 100644 (file)
@@ -130,12 +130,12 @@ jQuery(document).ready(function($){
             complete: completeAjax,
         }).done(function(rsp){
             console.log( 'rsp:', rsp );
-            // if ( rsp.status == '1' ) {
-            //     var $sucessModal = $('#billingInfoSuccess');
-            //     $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
-            // } else {
-            //     return false;
-            // }
+            if ( rsp ) {
+                var $sucessModal = $('#billingSuccess');
+                $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
+            } else {
+                return false;
+            }
         }).fail(function(){
             console.log( 'error no submission' );
         });
index f555b6e..5ea33e6 100644 (file)
@@ -16,7 +16,7 @@
         </div>
     </div>
 
-    <table class="stack hover">
+    <table class="stack hover glm-admin-table-inner">
         <thead>
             <tr>
                 <th style="width:50px;">ID</th>
@@ -51,6 +51,8 @@
                     </tr>
                     <tr id="notification-container-{$t.id}" class="glm-notification-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
                         <td colspan="5">
+                            <a href="{$thisUrl}?page={$thisPage}&glm_action=notifications&option=edit&id={$t.id}" data-notification-id="{$t.id}">Edit</a> |
+                            <a href="#" class="notification-preview" data-id="{$t.id}">Preview</a> |
                             <span class="account-dashboard-link">
                                 <a class="deleteNotificationTypeButton" data-notificationTypeID="{$t.id}">Delete</a>
                             </span>
 
 </div>
 
-<script type="text/javascript">
+<div id="preview" class="medium reveal" data-reveal>
+    <button class="close-button" data-close aria-label="Close" type="button">
+        <span aria-hidden="true">&times;</span>
+    </button>
+</div>
+<div id="glmLoading" class="" style="display:none; position: absolute; left: 50%; top: 50vh;width: 100%; height: 100%;z-index: 9999;">
+    <img src="{$pluginAssetsUrl}loading25.gif">
+</div>
+
+<script>
     jQuery(document).ready(function($) {
 
+        // on click event for preview
+        $('.notification-preview').on('click', function(e){
+            e.preventDefault();
+            var id      = $(this).data('id');
+            var $modal  = $('#preview');
+
+            $.ajax({
+                url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxNotificationPreview&option=preview&id=' + id,
+                beforeSend: startAjax,
+                complete: completeAjax,
+            })
+            .done(function(resp){
+                $modal.html(resp).foundation('open').trigger('resizeme.zp.reveal');
+            });
+            return false;
+        });
+
+        function startAjax(){
+            $('#glmLoading').show();
+        }
+        function completeAjax(){
+            $('#glmLoading').hide();
+        };
+
         $("#deleteNotificationTypeDialog").dialog({
             autoOpen: false,
             minWidth: 400,
diff --git a/views/admin/billing/preview.html b/views/admin/billing/preview.html
new file mode 100644 (file)
index 0000000..80255ca
--- /dev/null
@@ -0,0 +1,3 @@
+<h1>Preview message</h1>
+<div class="callout success">
+</div>
index 81e8a9b..688e0b3 100644 (file)
@@ -2,7 +2,25 @@
 <div class="callout grid-container">
 
     <h3 class="subheader">Reports</h3>
-    {include file='admin/billing/reportsSubHeader.html'}
+    {* include file='admin/billing/reportsSubHeader.html' *}
+
+    {if $option}
+        <h4 class="subheader">
+            {if $option == 'openAccounts'}
+                Open Accounts
+            {elseif $option == 'closedAccounts'}
+                Closed Accounts
+            {elseif $option == 'accountsByAge'}
+                Accounts By Age
+            {elseif $option == 'reportGenerator'}
+                Report Generator
+            {elseif $option == 'noAccounts'}
+                No Accounts
+            {elseif $option == 'allAccounts'}
+                All Accounts
+            {/if}
+        </h4>
+    {/if}
 
     {if $option == 'reportGenerator'}
         <div id="exportReportsButton" class="button secondary">Report Export</div>
index a55d7eb..77ff718 100644 (file)
@@ -1,6 +1,7 @@
 <div class="top-bar">
     <div class="top-bar-left">
         <ul class="menu">
+            <li class="menu-text">Reports</li>
             <li class="{if $option==openAccounts} is-active{/if}">
                 <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=reports&option=openAccounts">Open Accounts</a>
             </li>
index 12e62cd..46e6111 100644 (file)
                         <td class="glm-shrink">${$transaction.transaction_data.amount_total}</td>
                         <td class="glm-shrink">${$transaction.transaction_data.balance}</td>
                         <td class="glm-shrink">
-                        {if isset( $billing_settings.uptravel_payment_form ) && $billing_settings.uptravel_payment_form}
+                        {if $billing_settings.uptravel_payment_form}
                             {if $transaction.transaction_data.paid}&nbsp;{else}<a class="makeAPayment" data-member="{$memberID}" href="{$thisUrl}?page={$thisPage}&glm_action=billing&option=makepaymentadjustment&member={$memberID}">Make A Payment</a>{/if}
                         {else}
                             {if $transaction.transaction_data.paid}&nbsp;{else}<a class="payInvoice" data-member="{$memberID}" href="{$thisUrl}?page={$thisPage}&glm_action=billing&option=makepayment&member={$memberID}">Pay Invoice</a>{/if}