From: Steve Sutton Date: Mon, 22 Jul 2019 19:33:13 +0000 (-0400) Subject: Setting up form start and end includes. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=153d168705fe30a75ee7cfa6fae2874060b357f2;p=WP-Plugins%2Fglm-member-db-billing.git Setting up form start and end includes. Also adding check for setting and management if user is navigating off the page with unsaved changes. --- diff --git a/classes/data/dataInvoices.php b/classes/data/dataInvoices.php index 0eeddca..9a5345e 100644 --- a/classes/data/dataInvoices.php +++ b/classes/data/dataInvoices.php @@ -291,7 +291,7 @@ class GlmDataInvoices extends GlmDataAbstract // Remove what we don't want from the copy and get the list $this->fields = array( 'id' => $fSave['id'], - 'name' => $fSave['ref_name'], + 'name' => $fSave['account'], ); $invoiceList = $this->getList($where, $order, $fieldVals, $idField, $start, $limit); diff --git a/models/admin/billing/invoices.php b/models/admin/billing/invoices.php index 7762b00..57ad5d3 100644 --- a/models/admin/billing/invoices.php +++ b/models/admin/billing/invoices.php @@ -135,6 +135,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices $counties = false; $paymentTypes = false; $invoiceSent = false; + $lineItemJSON = false; // Enqueue GLMA Foundation wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/css/foundation-6.min.css' ); diff --git a/views/admin/billing/accountSearchForm.html b/views/admin/billing/accountSearchForm.html index 121ace2..4096dc7 100644 --- a/views/admin/billing/accountSearchForm.html +++ b/views/admin/billing/accountSearchForm.html @@ -74,51 +74,62 @@ jQuery(document).ready(function($) { }); -
- - +{* Form Start *} +{$ui = [ + 'id' => 'searchForm', + 'action' => "{$thisUrl}?page={$thisPage}", + 'method' => 'post' +]} +{include file='ui/f6/form-start.html'} - - - - + + -
- Search Accounts -
+ + + + -
- - - -
+
+ Search Accounts +
-
- - -
+
+ + + +
-
- - -
+
+ + +
-
- - - - -
+
+ +
-
- + +
+ + + +
-
+
+
+ {$ui = [ + 'label' => 'Submit', + 'class' => 'primary' + ]} + {include file='ui/f6/submit.html'} +
+
diff --git a/views/admin/billing/accounts.html b/views/admin/billing/accounts.html index 3f987e8..8f62781 100644 --- a/views/admin/billing/accounts.html +++ b/views/admin/billing/accounts.html @@ -6,6 +6,7 @@
Accounts Export
+ {* Search Form *} {include file='admin/billing/accountSearchForm.html'}

Total found: {$totalAccounts}

@@ -92,63 +93,65 @@ {/if} -
+ {* Form End *} + {include file='ui/f6/form-end.html'} {include file='admin/billing/exportBillingModal.html'} + {include file='admin/billing/accountReveals.html'} - + function accountLinksEmployeesSelected() { + accountEmployee = true; + console.log( 'accountHoverId: ', accountHoverId ); + $('#account-container-' + accountHoverId).addClass('hide-for-large'); + } + + function clearAccountLinks() { + accountLinksEmployeesSelected(); + accountHoverId = false; + accountEmployee = false; + } + + }); + + - {include file='admin/billing/accountReveals.html'} - {include file='admin/billing/footer.html'} diff --git a/views/admin/billing/editAccountAjax.html b/views/admin/billing/editAccountAjax.html index bd8fdde..6f850e4 100644 --- a/views/admin/billing/editAccountAjax.html +++ b/views/admin/billing/editAccountAjax.html @@ -112,7 +112,7 @@ {* Renewal Date *} {$ui = [ - 'value' => $data.fieldData.renewal_date, + 'value' => $data.fieldData.renewal_date.date, 'field' => 'renewal_date', 'label' => 'Renewal Date', 'placeholder' => 'Renewal Date', diff --git a/views/admin/billing/editInvoiceType.html b/views/admin/billing/editInvoiceType.html index 96ce7ae..ae3bd21 100644 --- a/views/admin/billing/editInvoiceType.html +++ b/views/admin/billing/editInvoiceType.html @@ -189,8 +189,17 @@ - - +{if isset( $data.fieldData.id )} + {$label = 'Update Invoice Type'} +{else} + {$label = 'Add Invoice Type'} +{/if} +{$ui = [ + 'type' => 'submit', + 'label' => $label, + 'class' => 'primary' +]} +{include file='ui/f6/submit.html'} Cancel @@ -225,6 +234,33 @@ //ev.preventDefault(); //console.log( 'Submit for form intercepted' ); }); + + /* + * Check for input changes + */ + var glmSubmitRequired = false; + $('input, textarea, select').on( 'change', function() { + glmSubmitRequired = true; + console.log('locked', glmSubmitRequired); + }); + + /* + * Checks for leaving the page + */ + + // When submit button is clicked, disable the beforeunload message + $('#billing-invoice-type-form').on('click', function() { + glmSubmitRequired = false; + return true; + }); + + // If submit is required and we're laving the page, alert the user + $(window).bind('beforeunload', function() { + if (glmSubmitRequired) { + return true; + } + }); + }); diff --git a/views/admin/billing/editNotificationType.html b/views/admin/billing/editNotificationType.html index ed5c2b1..b4b5a06 100644 --- a/views/admin/billing/editNotificationType.html +++ b/views/admin/billing/editNotificationType.html @@ -51,7 +51,7 @@ ]} {include file="ui/f6/callout.html"} -
+ {if $notification_id} @@ -269,6 +269,32 @@ 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 + */ + var glmSubmitRequired = false; + $('input, textarea, select').on( 'change', function() { + glmSubmitRequired = true; + console.log('locked', glmSubmitRequired); + }); + + /* + * Checks for leaving the page + */ + + // When submit button is clicked, disable the beforeunload message + $('#billing-notification-form').on('click', function() { + glmSubmitRequired = false; + return true; + }); + + // If submit is required and we're laving the page, alert the user + $(window).bind('beforeunload', function() { + if (glmSubmitRequired) { + return true; + } + }); + }); diff --git a/views/admin/billing/header.html b/views/admin/billing/header.html index 4991737..c0c82d4 100644 --- a/views/admin/billing/header.html +++ b/views/admin/billing/header.html @@ -1,3 +1,9 @@ + +

Billing

@@ -7,98 +13,100 @@
Menu
-
-
- +
diff --git a/views/admin/billing/index.html b/views/admin/billing/index.html index c4f3ec7..a46793b 100644 --- a/views/admin/billing/index.html +++ b/views/admin/billing/index.html @@ -15,8 +15,9 @@ Make Payment + {* Search Form *} {include file='admin/billing/accountSearchForm.html'} -
+ {include file='ui/f6/form-end.html'} {foreach $dashboards as $dashboard_title => $list}
diff --git a/views/admin/billing/invoices.html b/views/admin/billing/invoices.html index 81c61b6..1468438 100644 --- a/views/admin/billing/invoices.html +++ b/views/admin/billing/invoices.html @@ -7,135 +7,141 @@ Create Invoice {if $invoiceSent}

Invoice Sent

{/if} -
- - - - - - - - -
- Search Invoices -
-
-
- - - - -
-
- - - -
-
- - - -
-
- -
-
- -
- + {* Form Start *} + {$ui = [ + 'id' => 'searchForm', + 'action' => "{$thisUrl}?page={$thisPage}", + 'method' => 'post' + ]} + {include file='ui/f6/form-start.html'} + + + + + + + + + +
+ Search Invoices +
+
+
+ + + + +
+
+ + + + + + +
+
+ +
+
+
-
-
- -
- -

Total found: {$totalInvoices}

- {if $paging} - - - {/if} -
- - - - - - - - - - - - - - - {if $haveInvoices} - {foreach $invoices as $t} - - - - - - - - - - - + + {/foreach} + {else} + + {/if} + +
Invoice #Member NameInvoice ForTimeDue DateAmount TotalBalance
{$t.id} {$t.member_name} - {foreach $t.line_items as $item} - {$item.name} {if $item.recurring && $item.recurrence_string}( {$item.recurrence_string} ){/if} - {/foreach} - {$t.transaction_time.datetime} {$t.due_date.date} {$t.amount_total} {$t.balance}
(no Invoices listed)
- {if $paging} - - - {/if} + {if $paging} + + + {/if} - + {* Form End *} + {include file='ui/f6/form-end.html'}
@@ -169,170 +175,171 @@
- + }); + -
{include file='admin/billing/footer.html'} diff --git a/views/admin/billing/management.html b/views/admin/billing/management.html index f993106..1d2af89 100644 --- a/views/admin/billing/management.html +++ b/views/admin/billing/management.html @@ -275,7 +275,7 @@
-
+
Square {* Use Production Mode *} @@ -405,6 +405,35 @@ jQuery(function($){ showSelectedCardProcessor(); }); + /* + * Check for input changes + */ + var glmSubmitRequired = false; + $('input, textarea, select').on( 'change', function() { + glmPageUpdateRequired(); + }); + + /* + * Checks for leaving the page + */ + + // Flag submit button when updates are required. + function glmPageUpdateRequired() { + glmSubmitRequired = true; + } + // When submit button is clicked, disable the beforeunload message + $('#glm-billing-management-form').on('click', function() { + glmSubmitRequired = false; + return true; + }); + + // If submit is required and we're laving the page, alert the user + $(window).bind('beforeunload', function() { + if (glmSubmitRequired) { + return true; + } + }); + }); diff --git a/views/admin/billing/payments.html b/views/admin/billing/payments.html index b08d529..148f698 100644 --- a/views/admin/billing/payments.html +++ b/views/admin/billing/payments.html @@ -9,87 +9,95 @@ Make Payment - - - - - - - - - -
- Search Payments -
-
-
- From Date: -
-
- To Date: -
-
- Member Account:  - - -
-
- -
+ {* Form Start *} + {$ui = [ + 'id' => 'searchForm', + 'action' => "{$thisUrl}?page={$thisPage}", + 'method' => 'post' + ]} + {include file='ui/f6/form-start.html'} + + + + + + + + + +
+ Search Payments +
+
+
+ From Date: +
+
+ To Date: +
+
+ Member Account:  + + +
+
+
-
+
+
+ +
+

Total found: {$numbDisplayed}

+ {if $paging} + + + {/if}
-

Total found: {$numbDisplayed}

- {if $paging} - - - {/if} -
- - - - - - - - - - - - {if $havePayments} - {assign var="i" value="0"} - {foreach $payments as $t} - - - - - - - - - - - {/foreach} - {else} - - {/if} - -
Member NameTimeAmountPayment Method - Payment Notes
{$t.member_name} {$t.transaction_time.datetime} {$t.amount|string_format:"%.2f"} {$t.payment_method} {$t.payment_data}
(no Payments listed)
+ + + + + + + + + + + {if $havePayments} + {assign var="i" value="0"} + {foreach $payments as $t} + + + + + + + + + + + {/foreach} + {else} + + {/if} + +
Member NameTimeAmountPayment Method + Payment Notes
{$t.member_name} {$t.transaction_time.datetime} {$t.amount|string_format:"%.2f"} {$t.payment_method} {$t.payment_data}
(no Payments listed)
{if $paging} {/if} - + {* Form End *} + {include file='ui/f6/form-end.html'} {include file='admin/billing/footer.html'}