WIP invoice Types
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 15 Jul 2019 20:50:22 +0000 (16:50 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 15 Jul 2019 20:50:22 +0000 (16:50 -0400)
Redo invoice types.
Instead of a jquery popup form to add edit them.
Using a new page to edit them using a foundation abide form.

classes/data/dataInvoiceTypes.php
models/admin/billing/invoiceTypes.php
models/admin/member/billing.php
views/admin/billing/editAccountAjax.html
views/admin/billing/editInvoiceType.html [new file with mode: 0644]
views/admin/billing/editNotificationType.html
views/admin/billing/invoiceTypes.html
views/admin/billing/notifications.html
views/admin/billing/settings.html
views/admin/billing/statements.html

index 07b6e49..738a5ef 100644 (file)
@@ -117,9 +117,10 @@ class GlmDataInvoiceTypes extends GlmDataAbstract
 
             // Invoice Type Name
             'name' => array(
-                'field' => 'name',
-                'type'  => 'text',
-                'use'   => 'a',
+                'field'    => 'name',
+                'type'     => 'text',
+                'required' => true,
+                'use'      => 'a',
             ),
 
             // Parent - for adding, deleting and editing, has selection tables
index b68c5d9..405ea4d 100644 (file)
@@ -49,7 +49,7 @@ class GlmMembersAdmin_billing_invoiceTypes extends GlmDataInvoiceTypes
      * @return object Class object
      *
      */
-    public function __construct ($wpdb, $config)
+    public function __construct ( $wpdb, $config )
     {
 
         // Save WordPress Database object
@@ -97,15 +97,21 @@ class GlmMembersAdmin_billing_invoiceTypes extends GlmDataInvoiceTypes
      * produce output.
      *
      */
-    public function modelAction ($actionData = false)
+    public function modelAction ( $actionData = false )
     {
 
-        $success          = true;
-        $haveInvoiceTypes = false;
-        $invoiceTypes     = false;
-        $error            = false;
-        $enable_members   = $this->config['settings']['enable_members'];
-        $memberTypes      = false;
+        $success                = true;
+        $haveInvoiceTypes       = false;
+        $invoiceTypes           = false;
+        $error                  = false;
+        $enable_members         = $this->config['settings']['enable_members'];
+        $memberTypes            = false;
+        $view                   = 'invoiceTypes';
+        $invoiceType            = false;
+        $invoiceTypeUpdated     = false;
+        $invoiceTypeUpdateError = false;
+        $invoiceTypeAdded       = false;
+        $invoiceTypeInsertError = false;
 
         // Enqueue GLMA Foundation
         wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/css/foundation-6.min.css' );
@@ -113,32 +119,56 @@ class GlmMembersAdmin_billing_invoiceTypes extends GlmDataInvoiceTypes
 
         // Check for region id
         $id = 0;
-        if (isset($_REQUEST['id'])) {
-            $id = $_REQUEST['id']-0;
+        if ( isset( $_REQUEST['id'] ) ) {
+            $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT );
         }
 
         // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
 
         // If there's an action option
-        if (isset($_REQUEST['option'])) {
-
-            switch($_REQUEST['option']) {
-
-                case 'addNew':
-                    $this->insertEntry();
-                    break;
-
-                case 'update':
-                    if ($id > 0) {
-                        $this->updateEntry($id);
+        if ( isset( $_REQUEST['option'] ) ) {
+
+            switch( $_REQUEST['option'] ) {
+
+            case 'add':
+                $invoiceType = $this->newEntry();
+                $view        = 'editInvoiceType';
+                break;
+
+            case 'addNew':
+                $invoiceType = $this->insertEntry();
+                if ( $invoiceType['status'] ) {
+                    $invoiceTypeUpdated = true;
+                    $invoiceType = $this->editEntry( $id );
+                } else {
+                    $invoiceTypeUpdateError = true;
+                }
+                $view = 'editInvoiceType';
+                break;
+
+            case 'edit':
+                $invoiceType = $this->editEntry( $id );
+                $view        = 'editInvoiceType';
+                break;
+
+            case 'update':
+                if ( $id > 0 ) {
+                    $invoiceType = $this->updateEntry( $id );
+                    if ( $invoiceType['status'] ) {
+                        $invoiceTypeUpdated = true;
+                        $invoiceType = $this->editEntry( $id );
+                    } else {
+                        $invoiceTypeUpdateError = true;
                     }
-                    break;
+                }
+                $view = 'editInvoiceType';
+                break;
 
-                case 'delete':
-                    if ($id > 0) {
-                        $this->deleteEntry($id, true);
-                    }
-                    break;
+            case 'delete':
+                if ( $id > 0 ) {
+                    $this->deleteEntry( $id, true );
+                }
+                break;
 
             }
 
@@ -152,28 +182,26 @@ class GlmMembersAdmin_billing_invoiceTypes extends GlmDataInvoiceTypes
         // If we have list entries - even if it's an empty list
         $success          = true;
         $haveInvoiceTypes = false;
-        if ($invoiceTypes !== false) {
+        if ( $invoiceTypes !== false ) {
 
             $success = true;
 
             // If we have any entries
-            if (count($invoiceTypes) > 0) {
+            if ( count( $invoiceTypes ) > 0 ) {
                 $haveInvoiceTypes = true;
             }
         }
 
         // Sort results by higherarchy (Parent/Child and Alpha)
-        $invoiceTypes = $this->sortParentChild($invoiceTypes);
-        // echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
+        $invoiceTypes = $this->sortParentChild( $invoiceTypes );
 
         // Get list of Member Types
         $MemberType = new GlmDataMemberTypes( $this->wpdb, $this->config );
         $memberTypes = $MemberType->getList();
-        // echo '<pre>$memberTypes: ' . print_r( $memberTypes, true ) . '</pre>';
 
 
         // If we had a fatal error, redirect to the error page
-        if ($error) {
+        if ( $error ) {
             return array(
                 'status'           => $success,
                 'menuItemRedirect' => 'error',
@@ -187,12 +215,17 @@ class GlmMembersAdmin_billing_invoiceTypes extends GlmDataInvoiceTypes
 
         // Compile template data
         $templateData = array(
-            'action'           => $_REQUEST['glm_action'],
-            'enable_members'   => $enable_members,
-            'haveInvoiceTypes' => $haveInvoiceTypes,
-            'invoiceTypes'     => $invoiceTypes,
-            'recurrenceTypes'  => $this->config['recurrence'],
-            'memberTypes'      => $memberTypes,
+            'action'                 => $_REQUEST['glm_action'],
+            'enable_members'         => $enable_members,
+            'haveInvoiceTypes'       => $haveInvoiceTypes,
+            'invoiceTypes'           => $invoiceTypes,
+            'recurrenceTypes'        => $this->config['recurrence'],
+            'memberTypes'            => $memberTypes,
+            'invoiceType'            => $invoiceType,
+            'invoiceTypeUpdated'     => $invoiceTypeUpdated,
+            'invoiceTypeUpdateError' => $invoiceTypeUpdateError,
+            'invoiceTypeAdded'       => $invoiceTypeAdded,
+            'invoiceTypeInsertError' => $invoiceTypeInsertError,
         );
 
         // Return status, suggested view, and data to controller
@@ -200,7 +233,7 @@ class GlmMembersAdmin_billing_invoiceTypes extends GlmDataInvoiceTypes
             'status'           => $success,
             'menuItemRedirect' => false,
             'modelRedirect'    => false,
-            'view'             => 'admin/billing/invoiceTypes.html',
+            'view'             => 'admin/billing/'.$view.'.html',
             'data'             => $templateData
         );
 
index c1ac133..4eebc46 100644 (file)
@@ -998,23 +998,22 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
 
         case 'list':
             $view = 'statements';
+            require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
+            $account = $Accounts->editEntry( $accountID );
             if ( isset( $_REQUEST['all'] ) && $all = filter_var( $_REQUEST['all'], FILTER_VALIDATE_BOOLEAN ) ) {
                 $allStatements = true;
             }
-            // echo '<pre>$test: ' . print_r( $test, true ) . '</pre>';
             break;
         }
 
         // Get the list of invoices for this member.
         $statements = $BillingSupport->getStatementsByRefDest( $this->memberID, $allStatements );
-        // echo '<pre>$statements: ' . print_r( $statements, true ) . '</pre>';
         if ( $statements ) {
             $transactions      = $statements['transactions'];
             $account_data      = $statements['account_data'];
             $balance_due       = $statements['balance_due'];
             $hasBillingAccount = true;
         }
-        // echo '<pre>$account_data: ' . print_r( $account_data, true ) . '</pre>';
 
         // Compile template data
         $templateData = array(
index 597ccb1..96d3cf7 100644 (file)
@@ -2,11 +2,7 @@
     <span aria-hidden="true">&times;</span>
 </button>
 
-{if $accountUpdated}<span class="glm-notice glm-flash-updated">Account Updated</span>{/if}
-{if $accountUpdateError}<span class="glm-notice glm-flash-updated">Account Update Error</span>{/if}
-{if $accountInsertError}<span class="glm-notice glm-flash-updated">Account Insert Error</span>{/if}
-{if $accountAdded}<span class="glm-notice glm-flash-updated">Account Added</span>{/if}
-
+<h2>{$account.fieldData.ref_name}</h2>
 
 {$data = $account}
 
diff --git a/views/admin/billing/editInvoiceType.html b/views/admin/billing/editInvoiceType.html
new file mode 100644 (file)
index 0000000..ba938d4
--- /dev/null
@@ -0,0 +1,182 @@
+{include file='admin/billing/header.html'}
+
+<div class="callout grid-container">
+
+    {* Set $data to $invoiceType *}
+    {* This is for using the UI elements *}
+    {$data = $invoiceType}
+
+    {* Invoice Type Updated *}
+    {$ui = [
+        'label'  => 'Invoice Type Updated',
+        'active' => $invoiceTypeUpdated,
+        'type'   => 'success'
+    ]}
+    {include file="ui/f6/callout.html"}
+
+    {* Invoice Type Added *}
+    {$ui = [
+        'label'  => 'Invoice Type Added',
+        'active' => $invoiceTypeAdded,
+        'type'   => 'success'
+    ]}
+    {include file="ui/f6/callout.html"}
+
+    {* Invoice Type Update Error *}
+    {$ui = [
+        'label'  => 'Invoice Type Update Error',
+        'active' => $invoiceTypeUpdateError,
+        'type'   => 'alert'
+    ]}
+    {include file="ui/f6/callout.html"}
+
+    {* Invoice Type Insert Error *}
+    {$ui = [
+        'label'  => 'Invoice Type Added',
+        'active' => $invoiceTypeAdded,
+        'type'   => 'success'
+    ]}
+    {include file="ui/f6/callout.html"}
+
+    <form action="{$thisUrl}?page={$thisPage}&glm_action==invoiceTypes" method="post" enctype="multipart/form-data" data-abide novalidate>
+        <input type="hidden" name="glm_action" value="invoiceTypes">
+        {if isset($data.fieldData.id)}
+            <input type="hidden" name="option" value="update">
+            <input id="edit-id" type="hidden" name="id" value="{$data.fieldData.id}">
+        {else}
+            <input type="hidden" name="option" value="addNew">
+        {/if}
+
+            <div class="grid-x grid-margin-x">
+
+                <fieldset class="fieldset cell small-12 medium-6">
+                    <legend>Invoice Type</legend>
+
+                    <div class="grid-x grid-margin-x">
+
+                        {* Invoice Type Name *}
+                        {$ui = [
+                            'value'       => $data.fieldData.name,
+                            'field'       => 'name',
+                            'label'       => 'Invoice Type Name',
+                            'required'    => $data.fieldRequired.name,
+                            'errorText'   => 'Invoice Type Name is Required',
+                            'dataError'   => $data.fieldFail.name
+                        ]}
+                        {include file='ui/f6/text.html'}
+
+                        {* Parent *}
+                        {$ui = [
+                            'value'     => $data.fieldData.parent.value,
+                            'field'     => 'parent',
+                            'label'     => 'Parent',
+                            'list'      => $invoiceTypes,
+                            'l_label'   => 'name',
+                            'l_value'   => 'id',
+                            'l_blank'   => true,
+                            'required'  => $data.fieldRequired.parent,
+                            'errorText' => 'Parent is Required',
+                            'dataError' => $data.fieldFail.parent
+                        ]}
+                        {include file='ui/f6/select.html'}
+
+                        {* Member Type *}
+                        {$ui = [
+                            'value'     => $data.fieldData.member_type.value,
+                            'field'     => 'member_type',
+                            'label'     => 'Member Type',
+                            'list'      => $memberTypes,
+                            'l_label'   => 'name',
+                            'l_value'   => 'id',
+                            'l_blank'   => true,
+                            'required'  => $data.fieldRequired.member_type,
+                            'errorText' => 'Member Type is Required',
+                            'dataError' => $data.fieldFail.member_type
+                        ]}
+                        {include file='ui/f6/select.html'}
+
+                        {* Amount *}
+                        {$ui = [
+                            'value'       => $data.fieldData.amount,
+                            'field'       => 'amount',
+                            'label'       => 'Amount',
+                            'pattern'     => 'number',
+                            'required'    => $data.fieldRequired.amount,
+                            'errorText'   => 'Amount is Required',
+                            'dataError'   => $data.fieldFail.amount
+                        ]}
+                        {include file='ui/f6/text.html'}
+
+                        {* Dynamic Amount *}
+                        {$ui = [
+                            'value'     => $data.fieldData.dynamic_amount.value,
+                            'field'     => 'dynamic_amount',
+                            'label'     => 'Dynamic Amount',
+                            'required'  => $data.fieldRequired.dynamic_amount,
+                            'errortext' => 'Dynamic Amount is Required',
+                            'helpText'  => 'Ask for the amount on Invoice Form',
+                            'dataError' => $data.fieldFail.dynamic_amount
+                        ]}
+                        {include file='ui/f6/checkbox.html'}
+
+                        {* Recurring *}
+                        {$ui = [
+                            'value'     => $data.fieldData.recurring.value,
+                            'field'     => 'recurring',
+                            'label'     => 'Recurring',
+                            'required'  => $data.fieldRequired.recurring,
+                            'errortext' => 'Recurring is Required',
+                            'dataError' => $data.fieldFail.recurring
+                        ]}
+                        {include file='ui/f6/checkbox.html'}
+
+                        {* Recurrence *}
+                        {$ui = [
+                            'value'     => $data.fieldData.recurrence,
+                            'field'     => 'recurrence',
+                            'label'     => 'Recurrence',
+                            'list'      => $recurrenceTypes,
+                            'l_blank'   => true,
+                            'required'  => $data.fieldRequired.recurrence,
+                            'errorText' => 'Recurrence is Required',
+                            'dataError' => $data.fieldFail.recurrence
+                        ]}
+                        {include file='ui/f6/select.html'}
+
+
+                        {* Code *}
+                        {$ui = [
+                            'value'       => $data.fieldData.qcode,
+                            'field'       => 'qcode',
+                            'label'       => 'Code',
+                            'required'    => $data.fieldRequired.qcode,
+                            'errorText'   => 'Code is Required',
+                            'dataError'   => $data.fieldFail.qcode
+                        ]}
+                        {include file='ui/f6/text.html'}
+
+                        {* Category *}
+                        {$ui = [
+                            'value'       => $data.fieldData.category,
+                            'field'       => 'category',
+                            'label'       => 'Category',
+                            'required'    => $data.fieldRequired.category,
+                            'errorText'   => 'Category is Required',
+                            'dataError'   => $data.fieldFail.category
+                        ]}
+                        {include file='ui/f6/text.html'}
+
+                    </div>
+
+
+            </div>
+
+        <input class="button primary" type="submit" value="{if isset( $data.fieldData.id )}Update{else}Add{/if} Invoice Type">
+
+    </form>
+</div>
+
+<script>
+</script>
+
+{include file='admin/footer.html'}
index 0801ae1..f9ca292 100644 (file)
     {$data = $notification}
 
     {* Notification Updated *}
-    {if $notificationUpdated}
-        <div class="success callout" data-closable>
-            <button class="close-button" aria-label="Close alert" type="button" data-close>
-                <span aria-hidden="true">&times;</span>
-            </button>
-            <p><i class="fi-alert"></i> Notification Updated</p>
-        </div>
-    {/if}
+    {$ui = [
+        'label'  => 'Notification Updated',
+        'active' => $notificationUpdated,
+        'type'   => 'success'
+    ]}
+    {include file="ui/f6/callout.html"}
+
     {* Notification Added *}
-    {if $notificationAdded}
-        <div class="success callout" data-closable>
-            <button class="close-button" aria-label="Close alert" type="button" data-close>
-                <span aria-hidden="true">&times;</span>
-            </button>
-            <p><i class="fi-alert"></i> Notification Added</p>
-        </div>
-    {/if}
+    {$ui = [
+        'label'  => 'Notification Added',
+        'active' => $notificationAdded,
+        'type'   => 'success'
+    ]}
+    {include file="ui/f6/callout.html"}
+
     {* Notification Update Error *}
-    {if $notificationUpdateError}
-        <div class="alert callout" data-closable>
-            <button class="close-button" aria-label="Close alert" type="button" data-close>
-                <span aria-hidden="true">&times;</span>
-            </button>
-            <p><i class="fi-alert"></i> Notification Update Error</p>
-        </div>
-    {/if}
+    {$ui = [
+        'label'  => 'Notification Update Error',
+        'active' => $notificationUpdateError,
+        'type'   => 'alert'
+    ]}
+    {include file="ui/f6/callout.html"}
+
     {* Notification Insert Error *}
-    {if $notificationInsertError}
-        <div class="alert callout" data-closable>
-            <button class="close-button" aria-label="Close alert" type="button" data-close>
-                <span aria-hidden="true">&times;</span>
-            </button>
-            <p><i class="fi-alert"></i> Notification Insert Error</p>
-        </div>
-    {/if}
+    {$ui = [
+        'label'  => 'Notification Added',
+        'active' => $notificationAdded,
+        'type'   => 'success'
+    ]}
+    {include file="ui/f6/callout.html"}
 
     <form action="{$thisUrl}?page={$thisPage}&glm_action=notifications" method="post" data-abide novalidate>
         {if $notification_id}
index 85f715d..8103f55 100644 (file)
@@ -5,96 +5,7 @@
     <h3 class="subheader">InvoiceTypes</h3>
 
     {* Add InvoiceTypes Button and Dialog Box *}
-    <div id="newInvoiceTypeButton" class="button primary">Add a Invoice Type</div>
-    <div id="newInvoiceTypeDialog" class="glm-dialog-box" title="Enter a New InvoiceType">
-        <form action="{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes" method="post" enctype="multipart/form-data">
-            <input type="hidden" name="glm_action" value="invoiceTypes">
-            <input type="hidden" name="option" value="addNew">
-            <table class="stack unstriped">
-                <tr>
-                    <th class="glm-required" style="text-align: right;">Invoice Type Name</th>
-                    <td>
-                        <input type="text" name="name" class="glm-form-text-input" required>
-                    </td>
-                </tr>
-                <tr>
-                    <th class="glm-required" style="text-align: right;">Parent</th>
-                    <td>
-                        <select name="parent">
-                            <option value="0">(none)</option>
-                            {if $haveInvoiceTypes}
-                                {foreach $invoiceTypes as $t}
-                                    {if !$t.parent.value} <!-- don't show child categories -->
-                                        <option value="{$t.id}">{$t.name}</option>
-                                    {/if}
-                                {/foreach}
-                            {/if}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Member Type</th>
-                    <td>
-                        <select name="member_type">
-                            <option value="0">(none)</option>
-                            {if $memberTypes}
-                                {foreach $memberTypes as $type}
-                                    <option value="{$type.id}">{$type.name}</option>
-                                {/foreach}
-                            {/if}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th class="glm-required" style="text-align: right;">Amount:Numbers only<br> (999.99)</th>
-                    <td>
-                        <input type="text" name="amount" class="glm-form-text-input" required>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Dynamic Amount:</th>
-                    <td>
-                        <input type="hidden" name="dynamic_amount" class="glm-form-text-input" value="0">
-                        <input type="checkbox" name="dynamic_amount" class="glm-form-text-input" value="1">
-                        Ask for the amount on Invoice Forms
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Recurring:</th>
-                    <td>
-                        <input type="hidden" name="recurring" class="glm-form-text-input" value="0">
-                        <input type="checkbox" name="recurring" class="glm-form-text-input" value="1">
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Recurrence:</th>
-                    <td>
-                        <select name="recurrence">
-                            <option value="">(none)</option>
-                                {foreach $recurrenceTypes as $typeId => $typeLabel}
-                                    <option value="{$typeId}">{$typeLabel}</option>
-                                {/foreach}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Code:</th>
-                    <td>
-                        <input type="text" name="qcode" class="glm-form-text-input">
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Category:</th>
-                    <td>
-                        <input type="text" name="category" class="glm-form-text-input">
-                    </td>
-                </tr>
-            </table>
-            <p><span class="glm-required">*</span> Required</p>
-            <a id="newInvoiceTypeCancel" class="button button-primary glm-right">Cancel</a>
-            <input type="submit" value="Add new Invoice Type" class="button button-primary">
-        </form>
-    </div>
+    <a id="newInvoiceTypeButton" class="button primary" href="{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes&option=add">Add a Invoice Type</a>
 
     {* Add InvoiceTypes Button *}
     <div id="deleteInvoiceTypeDialog" class="glm-dialog-box" title="Delete InvoiceType">
         </div>
     </div>
 
-    {* Edit InvoiceTypes Dialog Box *}
-    <div id="editInvoiceTypeDialog" class="glm-dialog-box" title="Edit this InvoiceType">
-        <form action="{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes" method="post" enctype="multipart/form-data">
-            <input type="hidden" name="glm_action" value="invoiceTypes">
-            <input type="hidden" name="option" value="update">
-            <input id="edit-id" type="hidden" name="id" value="">
-            <table class="stack unstriped">
-                <tr>
-                    <th style="text-align: right;" class="glm-required">Invoice Type Name:</th>
-                    <td>
-                        <input id="edit-name" type="text" name="name" class="glm-form-text-input" required>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;" class="glm-required">Parent:</th>
-                    <td>
-                        <select id="edit-parent" name="parent">
-                            <option value="0">(none)</option>
-                                {if $haveInvoiceTypes}
-                                    {foreach $invoiceTypes as $t}
-                                        {if !$t.parent.value} <!-- don't show child categories -->
-                                            <option value="{$t.id}">{$t.name}</option>
-                                        {/if}
-                                    {/foreach}
-                                {/if}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Member Type</th>
-                    <td>
-                        <select id="edit-member_type" name="member_type">
-                            <option value="0">(none)</option>
-                            {if $memberTypes}
-                                {foreach $memberTypes as $type}
-                                    <option value="{$type.id}">{$type.name}</option>
-                                {/foreach}
-                            {/if}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;" class="glm-required">Amount:Numbers only<br> (999.99)</th>
-                    <td>
-                        <input id="edit-amount" type="text" name="amount" class="glm-form-text-input" required>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Dynamic Amount:</th>
-                    <td>
-                        <input type="hidden" name="dynamic_amount" class="glm-form-text-input" value="0">
-                        <input id="edit-dynamic-amount" type="checkbox" name="dynamic_amount" class="glm-form-text-input" value="1">
-                        Ask for the amount on Invoice Forms
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Recurring:</th>
-                    <td>
-                        <input type="hidden" name="recurring" class="glm-form-text-input" value="0">
-                        <input id="edit-recurring" type="checkbox" name="recurring" class="glm-form-text-input" value="1">
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Recurrence:</th>
-                    <td>
-                        <select id="edit-recurrence" name="recurrence">
-                            <option value="">(none)</option>
-                                {foreach $recurrenceTypes as $typeId => $typeLabel}
-                                    <option value="{$typeId}">{$typeLabel}</option>
-                                {/foreach}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Code:</th>
-                    <td>
-                        <input id="edit-qcode" type="text" name="qcode" class="glm-form-text-input">
-                    </td>
-                </tr>
-                <tr>
-                    <th style="text-align: right;">Category:</th>
-                    <td>
-                        <input id="edit-category" type="text" name="category" class="glm-form-text-input">
-                    </td>
-                </tr>
-            </table>
-            <p><span class="glm-required">*</span> Required</p>
-            <a id="editInvoiceTypeCancel" class="button button-primary glm-right">Cancel</a>
-            <input type="submit" value="Update this Invoice Type" class="button button-primary">
-        </form>
-    </div>
-
-
     <table class="stack hover">
         <thead>
             <tr>
                         <td>{$t.id}</td>
                         <td>
                             <div{if $t.parent.value} class="glm-indent"{/if}>
-                                <a class="editInvoiceType"
-                                    data-invoice-id="{$t.id}"
-                                    data-invoice-name="{$t.name|escape}"
-                                    data-invoice-parent="{$t.parent.value}"
-                                    data-invoice-member_type="{$t.member_type.value}"
-                                    data-invoice-amount="{$t.amount}"
-                                    data-invoice-dynamic-amount="{$t.dynamic_amount.value}"
-                                    data-invoice-recurring="{$t.recurring.value}"
-                                    data-invoice-recurrence="{$t.recurrence}"
-                                    data-invoice-qcode="{$t.qcode}"
-                                    data-invoice-category="{$t.category|escape}">{$t.name}</a>
+                                <a href="{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes&option=edit&id={$t.id}">{$t.name}</a>
                             </div>
                         </td>
                         <td>{$t.amount}</td>
 
 </div>
 
-<script type="text/javascript">
+<script>
 jQuery(document).ready(function($) {
 
     $("#newInvoiceTypeDialog").dialog({
@@ -275,45 +83,6 @@ jQuery(document).ready(function($) {
     $('#newInvoiceTypeButton').click( function() {
         $("#newInvoiceTypeDialog").dialog("open");
     });
-    $('.editInvoiceType').click( function() {
-        $('#edit-recurring').prop( 'checked', false );
-        $('#edit-dynamic-amount').prop( 'checked', false );
-
-        var invoiceID            = $(this).data('invoice-id');
-        var invoiceName          = $(this).data('invoice-name');
-        var invoiceParent        = $(this).data('invoice-parent');
-        var invoiceType          = $(this).data('invoice-member_type');
-        var invoiceAmount        = $(this).data('invoice-amount');
-        var invoiceDynamicAmount = $(this).data('invoice-dynamic-amount');
-        var invoiceRecurring     = $(this).data('invoice-recurring');
-        var invoiceRecurrence    = $(this).data('invoice-recurrence');
-        var invoiceQcode         = $(this).data('invoice-qcode');
-        var invoiceCategory      = $(this).data('invoice-category');
-
-        // Set the values of the edit form for the selected invoiceType
-        $('#edit-id').val( invoiceID );
-        $('#edit-name').val( invoiceName );
-        $('#edit-parent').val( invoiceParent );
-        $('#edit-member_type').val( invoiceType );
-        $('#edit-amount').val( invoiceAmount );
-        $('#edit-qcode').val( invoiceQcode );
-        $('#edit-category').val( invoiceCategory );
-        if ( invoiceDynamicAmount === 1 ) {
-            $('#edit-dynamic-amount').prop( 'checked', true );
-        }
-        if ( invoiceRecurring === 1 ) {
-            $('#edit-recurring').prop( 'checked', true );
-        }
-        $('#edit-recurrence').val( invoiceRecurrence );
-
-        $("#editInvoiceTypeDialog").dialog("open");
-    });
-    $('#editInvoiceTypeCancel').click( function() {
-        $("#editInvoiceTypeDialog").dialog("close");
-    });
-    $('#newInvoiceTypeCancel').click( function() {
-        $("#newInvoiceTypeDialog").dialog("close");
-    });
 
     var id = false;
     $('.deleteInvoiceTypeButton').click( function() {
index 1de25e5..a4f9e44 100644 (file)
         </div>
     </div>
 
-    {* Edit NotificationTypes Dialog Box *}
-    <div id="editNotificationTypeDialog" class="glm-dialog-box" title="Edit this NotificationType">
-        <form action="{$thisUrl}?page={$thisPage}&glm_action=notifications" method="post" enctype="multipart/form-data" data-abide novalidate>
-            <input type="hidden" name="glm_action" value="notifications">
-            <input type="hidden" name="option" value="update">
-            <input id="edit-id" type="hidden" name="id" value="">
-            <table class="stack">
-                <tr>
-                    <th class="glm-required">Name:</th>
-                    <td>
-                        <input id="edit-name" type="text" name="name" required />
-                    </td>
-                </tr>
-                <tr>
-                    <th colspan="2" class="glm-required">Send Notification based on</th>
-                </tr>
-                <tr>
-                    <th colspan="2">Due Date</th>
-                </tr>
-                <tr>
-                    <th class="glm-required"><input type="radio" id="edit-sendbydate" name="send_by" value="date" required></th>
-                    <td>
-                        <input
-                            type="number"
-                            step="1"
-                            min="0"
-                            max="100"
-                            name="send_date_number"
-                            id="edit-senddatenumber"
-                            class="glm-form-text-input-veryshort">
-                        <select id="edit-senddateperiod" name="send_date_period">
-                            {foreach $send_date_period as $id => $val}
-                                <option value="{$id}">{$val}</option>
-                            {/foreach}
-                        </select>
-                        <select id="edit-senddatewhen" name="send_date_when">
-                            {foreach $send_date_when as $id => $val}
-                                <option value="{$id}">{$val}</option>
-                            {/foreach}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th colspan="2">Immediate Action</th>
-                </tr>
-                <tr>
-                    <th><input id="edit-sendbyaction" type="radio" name="send_by" value="action" required></th>
-                    <td>
-                        <select id="edit-sendaction" name="send_action">
-                            {foreach $send_action as $id => $val}
-                                <option value="{$id}">{$val}</option>
-                            {/foreach}
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <th class="glm-required">Subject</th>
-                    <td class="glm-required">
-                        <input type="text" id="edit-subject" name="subject" required />
-                    </td>
-                </tr>
-                <tr>
-                    <th class="glm-required">From</th>
-                    <td class="glm-required">
-                        <input type="text" id="edit-fromheader" name="from_header" required />
-                    </td>
-                </tr>
-                <tr>
-                    <th class="glm-required">Reply-To</th>
-                    <td class="glm-required">
-                        <input type="text" id="edit-replyto" name="replyto" required />
-                    </td>
-                </tr>
-                <tr>
-                    <td colspan="2">
-                        <textarea id="edit-message" name="message"></textarea>
-                    </td>
-                </tr>
-            </table>
-            <p><span class="glm-required">*</span> Required</p>
-            <a id="editNotificationTypeCancel" class="button button-primary glm-right">Cancel</a>
-            <input type="submit" value="Update this Notification Type" class="button button-primary">
-        </form>
-    </div>
-
     <table class="stack hover">
         <thead>
             <tr>
index caa0539..39b444a 100644 (file)
                                 ]}
                                 {include file='ui/f6/text.html'}
 
-                                {* Show Account # *}
-                                {$ui = [
-                                    'value'     => $data.fieldData.invoice_show_account_number.value,
-                                    'field'     => 'invoice_show_account_number',
-                                    'label'     => 'Show Account #',
-                                    'required'  => $data.fieldRequired.invoice_show_account_number,
-                                    'errortext' => 'Show Account # is Required',
-                                    'dataError' => $data.fieldFail.invoice_show_account_number
-                                ]}
-                                {include file='ui/f6/checkbox.html'}
-
-                                {* Show Invoice # *}
-                                {$ui = [
-                                    'value'     => $data.fieldData.invoice_show_invoice_number.value,
-                                    'field'     => 'invoice_show_invoice_number',
-                                    'label'     => 'Show Invoice #',
-                                    'required'  => $data.fieldRequired.invoice_show_invoice_number,
-                                    'errortext' => 'Show Invoice # is Required',
-                                    'dataError' => $data.fieldFail.invoice_show_invoice_number
-                                ]}
-                                {include file='ui/f6/checkbox.html'}
-
                                 {* Enable Account Number *}
                                 {$ui = [
                                     'value'     => $data.fieldData.account_number_enabled.value,
                                 ]}
                                 {include file='ui/f6/checkbox.html'}
 
+                                {* Show Account # *}
+                                {$ui = [
+                                    'value'     => $data.fieldData.invoice_show_account_number.value,
+                                    'field'     => 'invoice_show_account_number',
+                                    'label'     => 'Show Account # On Invoices',
+                                    'required'  => $data.fieldRequired.invoice_show_account_number,
+                                    'errortext' => 'Show Account # is Required',
+                                    'dataError' => $data.fieldFail.invoice_show_account_number
+                                ]}
+                                {include file='ui/f6/checkbox.html'}
+
+                                {* Show Invoice # *}
+                                {$ui = [
+                                    'value'     => $data.fieldData.invoice_show_invoice_number.value,
+                                    'field'     => 'invoice_show_invoice_number',
+                                    'label'     => 'Show Invoice # On Invoices',
+                                    'required'  => $data.fieldRequired.invoice_show_invoice_number,
+                                    'errortext' => 'Show Invoice # is Required',
+                                    'dataError' => $data.fieldFail.invoice_show_invoice_number
+                                ]}
+                                {include file='ui/f6/checkbox.html'}
+
                                 {* Allow Membership Choice When Renewing *}
                                 {$ui = [
                                     'value'     => $data.fieldData.allow_membership_choice.value,
index 22886a0..1d744f1 100644 (file)
@@ -1,86 +1,86 @@
 {if !$adminAjaxPassthru}
-<style>
+    <style>
 
-@media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px)  {
+    @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px)  {
 
-    #wpbody-content #glm-admin-billing-wrapper .wrap {
-        margin-right: 0;
-    }
+        #wpbody-content #glm-admin-billing-wrapper .wrap {
+            margin-right: 0;
+        }
 
-    /* Force table to not be like tables anymore */
-    #wpbody-content #glm-admin-billing-wrapper table,
-    #wpbody-content #glm-admin-billing-wrapper thead,
-    #wpbody-content #glm-admin-billing-wrapper tbody,
-    #wpbody-content #glm-admin-billing-wrapper th,
-    #wpbody-content #glm-admin-billing-wrapper td,
-    #wpbody-content #glm-admin-billing-wrapper tr {
-        display: block;
-    }
+        /* Force table to not be like tables anymore */
+        #wpbody-content #glm-admin-billing-wrapper table,
+        #wpbody-content #glm-admin-billing-wrapper thead,
+        #wpbody-content #glm-admin-billing-wrapper tbody,
+        #wpbody-content #glm-admin-billing-wrapper th,
+        #wpbody-content #glm-admin-billing-wrapper td,
+        #wpbody-content #glm-admin-billing-wrapper tr {
+            display: block;
+        }
 
-    /* Hide table headers (but not display: none;, for accessibility) */
-    #wpbody-content #glm-admin-billing-wrapper thead tr {
-        position: absolute;
-        top: -9999px;
-        left: -9999px;
-    }
+        /* Hide table headers (but not display: none;, for accessibility) */
+        #wpbody-content #glm-admin-billing-wrapper thead tr {
+            position: absolute;
+            top: -9999px;
+            left: -9999px;
+        }
 
-    #wpbody-content #glm-admin-billing-wrapper tr { border: 1px solid #ccc; }
+        #wpbody-content #glm-admin-billing-wrapper tr { border: 1px solid #ccc; }
 
-    #wpbody-content #glm-admin-billing-wrapper td {
-        /* Behave  like a "row" */
-        border: none;
-        border-bottom: 1px solid #eee;
-        position: relative;
-        padding-left: 25%;
-    }
+        #wpbody-content #glm-admin-billing-wrapper td {
+            /* Behave  like a "row" */
+            border: none;
+            border-bottom: 1px solid #eee;
+            position: relative;
+            padding-left: 25%;
+        }
 
-    #wpbody-content #glm-admin-billing-wrapper td:before {
-        /* Now like a table header */
-        position: absolute;
-        /* Top/left values mimic padding */
-        top: 6px;
-        left: 6px;
-        width: 25%;
-        padding-right: 10px;
-        white-space: nowrap;
-    }
-    /* Label the data */
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(1):before { content: "ID"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(2):before { content: "Date"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(3):before { content: "Due"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(4):before { content: "Type"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(5):before { content: "Items"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(6):before { content: "Amount"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(7):before { content: "Balance"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(8):before { content: "Pay"; }
-    #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(9):before { content: "View"; }
+        #wpbody-content #glm-admin-billing-wrapper td:before {
+            /* Now like a table header */
+            position: absolute;
+            /* Top/left values mimic padding */
+            top: 6px;
+            left: 6px;
+            width: 25%;
+            padding-right: 10px;
+            white-space: nowrap;
+        }
+        /* Label the data */
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(1):before { content: "ID"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(2):before { content: "Date"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(3):before { content: "Due"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(4):before { content: "Type"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(5):before { content: "Items"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(6):before { content: "Amount"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(7):before { content: "Balance"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(8):before { content: "Pay"; }
+        #wpbody-content #glm-admin-billing-wrapper td:nth-of-type(9):before { content: "View"; }
 
-    /* Table styles */
-    #wpbody-content #glm-admin-billing-wrapper .wp-list-table {
-        max-width: 100%;
-    }
-    #wpbody-content #glm-admin-billing-wrapper .wp-list-table tr {
-        padding: 10px 0;
-    }
-    #wpbody-content #glm-admin-billing-wrapper .wp-list-table td:before {
-        top: 1px;
-        font-weight: bold;
-    }
-    #wpbody-content #glm-admin-billing-wrapper .striped>tbody>:nth-child(even) {
-        background-color: #f2ffff;
-    }
+        /* Table styles */
+        #wpbody-content #glm-admin-billing-wrapper .wp-list-table {
+            max-width: 100%;
+        }
+        #wpbody-content #glm-admin-billing-wrapper .wp-list-table tr {
+            padding: 10px 0;
+        }
+        #wpbody-content #glm-admin-billing-wrapper .wp-list-table td:before {
+            top: 1px;
+            font-weight: bold;
+        }
+        #wpbody-content #glm-admin-billing-wrapper .striped>tbody>:nth-child(even) {
+            background-color: #f2ffff;
+        }
 
-    /* Misc */
-    #glm-admin-billing-wrapper .glm-contact-top-buttons {
-        text-align: center;
-    }
-    #glm-admin-billing-wrapper .glm-contact-top-buttons > * {
-        /* margin: 10px auto 10px; */
-        float: none;
-        clear: both;
+        /* Misc */
+        #glm-admin-billing-wrapper .glm-contact-top-buttons {
+            text-align: center;
+        }
+        #glm-admin-billing-wrapper .glm-contact-top-buttons > * {
+            /* margin: 10px auto 10px; */
+            float: none;
+            clear: both;
+        }
     }
-}
-</style>
+    </style>
 
     {if $fromMemberMenu}
         {include file='admin/member/header.html'}
@@ -89,7 +89,8 @@
         {include file='admin/billing/header.html'}
     {/if}
 {else}
-    <h3>Statements</h3>
+    <h2>{$account.fieldData.ref_name}</h2>
+    <h3 class="subheader">Statements</h3>
     <button class="close-button" data-close aria-label="Close" type="button">
         <span aria-hidden="true">&times;</span>
     </button>