Setup notification preview
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 24 Jul 2019 15:15:40 +0000 (11:15 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 24 Jul 2019 15:15:40 +0000 (11:15 -0400)
test in mobile

classes/notifications.php
models/admin/billing/notifications.php
views/admin/billing/accounts.html
views/admin/billing/editInvoiceType.html
views/admin/billing/editNotificationType.html
views/admin/billing/index.html
views/admin/billing/invoiceTypes.html
views/admin/billing/notifications.html
views/admin/billing/preview.html

index 6c38217..d64f5f3 100644 (file)
@@ -86,6 +86,8 @@ class GlmNotifications
                 $invTypeData   = $BillingSupport->getInvoiceTypeById( $account['invoice_type'] );
                 $currentAmount = $invTypeData['amount'];
             }
+        } else {
+            $account = $test_data['account'];
         }
 
         // get the Notification type
@@ -190,6 +192,11 @@ class GlmNotifications
                 $account_data['account']['first_name'] = $account['billing_fname'];
                 $account_data['account']['last_name'] = $account['billing_lname'];
             }
+        } else {
+            $account_data = array(
+                'account' => $test_data['account'],
+                'contact' => $test_data['contact'],
+            );
         }
         // Merge any data passed into this method
         $account_data['data'] = $data;
index 1467feb..6d8a67a 100644 (file)
@@ -153,8 +153,39 @@ class GlmMembersAdmin_billing_notifications extends GlmDataNotificationTypes
             $view = 'preview';
 
             $testData = array(
-                'account' => array(),
+                'account' => array(
+                    'first_name'   => 'Test',
+                    'fname'        => 'Test',
+                    'last_name'    => 'Person',
+                    'lname'         => 'Person',
+                    'contact_name' => 'Test Person',
+                    'name'         => 'Test Member',
+                    'email'        => 'test@gaslightmedia.com',
+                    'addr1'        => '120 E Lake St.',
+                    'addr2'        => 'P.O. Box 209',
+                    'city'         => 'Petoskey',
+                    'state'        => 'MI',
+                    'zip'          => '49770',
+                    'phone'        => '(231) 555-1234',
+                    'company'      => 'Gaslight Media',
+                    'position'     => 'Tester',
+                    'renewal_date' => '01/01/2018',
+                    'current_due'  => '100.00',
+                ),
                 'contact' => array(
+                    'company'      => 'Gaslight Media',
+                    'fname'        => 'Test',
+                    'lname'        => 'Person',
+                    'title'        => 'Tester',
+                    'city'         => 'Petoskey',
+                    'state'        => array(
+                        'value' => 'MI'
+                    ),
+                    'zip'          => '49770',
+                    'email'        => 'test@gaslightmedia.com',
+                    'office_phone' => '(231) 555-1234',
+                    'mobile_phone' => '(231) 555-2345',
+                    'fax'          => '(231) 555-3456',
                 )
             );
             $Notifications = new GlmNotifications( $this->wpdb, $this->config );
index ba76e9e..06b76de 100644 (file)
@@ -26,8 +26,7 @@
 {/if}
 
 <br clear="all">
-
-<table class="stack glm-admin-table-inner">
+<table class="stack hover glm-admin-table-inner">
     <thead>
         <tr>
             <th style="width:50px;">ID</th>
index b970fc7..fe9a142 100644 (file)
                 'field'       => 'amount',
                 'label'       => 'Amount',
                 'pattern'     => 'number',
-                'required'    => $data.fieldRequired.amount,
+                'required'    => true,
                 'errorText'   => 'Amount is Required',
                 'dataError'   => $data.fieldFail.amount
             ]}
             }
         });
 
+        // Either the Dynamic Amount is checked or Amount is required
+        $('#dynamic_amount').on('change', function(){
+            var amount = $('#amount');
+            if ( $(this).is(':checked')) {
+                amount.prop( 'required', false );
+                amount.focus().blur();
+            } else {
+                amount.prop( 'required', true );
+                amount.focus().blur();
+            }
+        });
+
+
         /*
          * Check for input changes
          */
index 322ff32..5c4d04d 100644 (file)
@@ -45,9 +45,9 @@
 
 {* Notification Insert Error *}
 {$ui = [
-    'label'  => 'Notification Added',
-    'active' => $notificationAdded,
-    'type'   => 'success'
+    'label'  => 'Notification Insert Error',
+    'active' => $notificationInsertError,
+    'type'   => 'alert'
 ]}
 {include file="ui/f6/callout.html"}
 
 <script>
 jQuery(document).ready(function($){
 
-    // Flash certain elements for a short time after display
-    $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-
     /*
      * Check for input changes
      */
index 8dadff9..615d360 100644 (file)
@@ -31,7 +31,7 @@
 {foreach $dashboards as $dashboard_title => $list}
     <br clear="all">
     <span class="label warning">{$dashboard_title}</span>
-    <table class="stack glm-admin-table-inner">
+    <table class="stack hover glm-admin-table-inner">
         <thead>
             <tr>
                 <th>Member Name</th>
@@ -49,7 +49,7 @@
                         <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}">
+                    <tr id="account-container-{$t.id}" class="glm-account-links hide-for-large{if $t@iteration is div by 2} alternate{/if}">
                         <td colspan="4">
                             <span class="account-dashboard-link">
                                 <a title="Opens in a new window" class="account-member-dashboard" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&member={$t.ref_dest}" target="_blank">Member Dashboard</a> |
@@ -68,7 +68,7 @@
                         </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;">
+                        <tr id="account-employees-{$t.id}" class="{if $t@iteration is div by 2} alternate{/if}" style="display: none;background-color: #fff;">
                             <td colspan="4">
                                 <div class="glm-row" style="margin-bottom: 0px !important; margin-top: .5rem;">
                                     {foreach $t.employees as $emp}
                 return;
             }
             // Hide all
-            $( '.glm-account-links' ).addClass( 'glm-hidden' );
+            $( '.glm-account-links' ).addClass( 'hide-for-large' );
 
             accountHoverId = $(this).data('id');
-            $( '#account-container-' + accountHoverId ).removeClass( 'glm-hidden' );
+            $( '#account-container-' + accountHoverId ).removeClass( 'hide-for-large' );
         });
         $('.glm-admin-table-inner').mouseleave( function() {
-            $( '#account-container-' + accountHoverId ).addClass( 'glm-hidden' );
+            $( '#account-container-' + accountHoverId ).addClass( 'hide-for-large' );
         });
 
         $('.account-employees').on( 'click', function(e){
 
         function accountLinksEmployeesSelected() {
             accountEmployee = true;
-            $('#account-container-' + accountHoverId).addClass('glm-hidden');
+            $('#account-container-' + accountHoverId).addClass('hide-for-large');
         }
 
         function clearAccountLinks() {
index b3a307b..c8c2b13 100644 (file)
@@ -15,7 +15,6 @@
             <p><div id="deleteInvoiceTypeCancel" class="button button-primary">Cancel</div></p>
         </div>
     </div>
-
     <table class="stack hover">
         <thead>
             <tr>
@@ -43,7 +42,7 @@
                         <td>{if $t.recurring.value}Yes{else}No{/if}</td>
                         <td>{if $t.recurrence}{$recurrenceTypes[$t.recurrence]}{/if}</td>
                     </tr>
-                    <tr id="invoiceType-container-{$t.id}" class="glm-invoiceType-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
+                    <tr id="invoiceType-container-{$t.id}" class="glm-invoiceType-links hide-for-large{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">
@@ -67,13 +66,13 @@ jQuery(document).ready(function($) {
 
     $('.glm-invoiceType-row').mouseenter( function(){
         // Hide all
-        $( '.glm-invoiceType-links' ).addClass( 'glm-hidden' );
+        $( '.glm-invoiceType-links' ).addClass( 'hide-for-large' );
 
         invoiceTypeHoverId = $(this).data('id');
-        $( '#invoiceType-container-' + invoiceTypeHoverId ).removeClass( 'glm-hidden' );
+        $( '#invoiceType-container-' + invoiceTypeHoverId ).removeClass( 'hide-for-large' );
     });
     $('.glm-admin-table-inner').mouseleave( function() {
-        $( '#invoiceType-container-' + invoiceTypeHoverId ).addClass( 'glm-hidden' );
+        $( '#invoiceType-container-' + invoiceTypeHoverId ).addClass( 'hide-for-large' );
     });
 
     $("#newInvoiceTypeDialog").dialog({
index 5ea33e6..48a49ec 100644 (file)
@@ -49,7 +49,7 @@
                             {/if}
                         </td>
                     </tr>
-                    <tr id="notification-container-{$t.id}" class="glm-notification-links glm-hidden{if $t@iteration is div by 2} alternate{/if}">
+                    <tr id="notification-container-{$t.id}" class="glm-notification-links hide-for-large{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> |
 
         $('.glm-notification-row').mouseenter( function(){
             // Hide all
-            $( '.glm-notification-links' ).addClass( 'glm-hidden' );
+            $( '.glm-notification-links' ).addClass( 'hide-for-large' );
 
             notificationHoverId = $(this).data('id');
-            $( '#notification-container-' + notificationHoverId ).removeClass( 'glm-hidden' );
+            $( '#notification-container-' + notificationHoverId ).removeClass( 'hide-for-large' );
         });
         $('.glm-admin-table-inner').mouseleave( function() {
-            $( '#notification-container-' + notificationHoverId ).addClass( 'glm-hidden' );
+            $( '#notification-container-' + notificationHoverId ).addClass( 'hide-for-large' );
         });
 
         var id = false;
index 3e98071..e5f2863 100644 (file)
@@ -1,5 +1,9 @@
 <h1>Preview message</h1>
-<div class="callout success">
+<div class="callout secondary">
+
+    <button class="close-button" data-close aria-label="Close" type="button">
+        <span aria-hidden="true">&times;</span>
+    </button>
 
     {$previewHtml}