Create new view file for account Reveals
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 9 Jul 2019 14:20:09 +0000 (10:20 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 9 Jul 2019 14:20:09 +0000 (10:20 -0400)
Setup account reveal into it's own view file so code is not duplicated
for dashboard and account pages.

models/admin/billing/index.php
views/admin/billing/accountReveals.html [new file with mode: 0644]
views/admin/billing/accounts.html
views/admin/billing/index.html
views/admin/billing/payments.html

index 87ae51e..f5eef1a 100644 (file)
@@ -304,6 +304,7 @@ class GlmMembersAdmin_billing_index extends GlmDataAccounts
             'filterActive'       => $filterActive,
             'filterArchived'     => $filterArchived,
             'searchName'         => $searchName,
+            'pluginAssetsUrl'    => GLM_MEMBERS_BILLING_PLUGIN_BASE_URL . '/assets/'
         );
 
         // Return status, any suggested view, and any data to controller
diff --git a/views/admin/billing/accountReveals.html b/views/admin/billing/accountReveals.html
new file mode 100644 (file)
index 0000000..201531b
--- /dev/null
@@ -0,0 +1,126 @@
+{* Foundation 6 Reveal modals for Billing Account Tables *}
+
+{* Reveal for Billing Info *}
+<div id="glmBillingInfo" class="medium reveal" data-reveal data-close-on-click="false">
+</div>
+{* Reveal for Billing Info Success *}
+<div class="reveal" id="billingInfoSuccess" data-reveal>
+    <h2>Billing Info Updated!</h2>
+    <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">
+        <span aria-hidden="true">&times;</span>
+    </button>
+</div>
+{* Reveal for Billing Payments *}
+<div id="glmBillingPayment" class="medium reveal" data-reveal data-close-on-click="false">
+</div>
+{* Reveal for Billing View Invoice *}
+<div id="glmBillingView" class="large 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>
+
+<script>
+    jQuery(document).ready(function($){
+        $('.account-billing').on('click', function(e){
+            e.preventDefault();
+            var member = $(this).data('member');
+            var $modal = $('#glmBillingInfo');
+
+            $.ajax({
+                url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=account&member=' + member,
+                cache: false,
+                beforeSend: startAjax,
+                complete: completeAjax,
+            })
+            .done(function(resp){
+                $modal.html(resp).foundation('open').trigger('resizeme.zp.reveal');
+            });
+            return false;
+        });
+
+        $('.account-member-statements').on('click', function(e){
+            e.preventDefault();
+            var member    = $(this).data('member');
+            var $modalStm = $('#glmBillingStatements');
+
+            $.ajax({
+                url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=list&member=' + member,
+                cache: false,
+                beforeSend: startAjax,
+                complete: completeAjax,
+            })
+            .done(function(resp){
+                $modalStm.html(resp).foundation('open').trigger('resizeme.zp.reveal');
+
+                // Pay Invoice link
+                $('.payInvoice').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=makepayment&member=' + member,
+                        cache: false,
+                        beforeSend: startAjax,
+                        complete: completeAjax,
+                    }).done(function(resp){
+                        $modalPayment.html(resp).foundation('open').trigger('resizeme.zp.reveal');
+                    });
+                    return false;
+                });
+
+                // Make A Payment link
+                $('.makeAPayment').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;
+                });
+
+                // View Link
+                $('.view').on('click', function(e){
+                    e.preventDefault();
+                    var member      = $(this).data('member');
+                    var id          = $(this).data('id');
+                    var $modalVidew = $('#glmBillingView');
+                    $.ajax({
+                        url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=view&member=' + member + '&id=' + id,
+                        cache: false,
+                        beforeSend: startAjax,
+                        complete: completeAjax,
+                    }).done(function(resp){
+                        $modalVidew.html(resp).foundation('open').trigger('resizeme.zp.reveal');
+
+                    });
+
+                    return false;
+                });
+
+            });
+            return false;
+        });
+
+        function startAjax(){
+            $('#glmLoading').show();
+        }
+        function completeAjax(){
+            $('#glmLoading').hide();
+        };
+    });
+</script>
index bb14509..327d4a4 100644 (file)
@@ -2,10 +2,10 @@
 
 <div class="callout large">
 
-    <div id="exportAccountsButton" class="button secondary">Accounts Export</div>
-
     <h2 class="subheader">Accounts</h2>
 
+    <div id="exportAccountsButton" class="button secondary">Accounts Export</div>
+
     {include file='admin/billing/accountSearchForm.html'}
     <br clear="all">
 
                 accountEmployee = false;
             }
 
-            $('.account-billing').on('click', function(e){
-                e.preventDefault();
-                var member = $(this).data('member');
-                var $modal = $('#glmBillingInfo');
-
-                $.ajax({
-                    url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=account&member=' + member,
-                    cache: false,
-                    beforeSend: startAjax,
-                    complete: completeAjax,
-                })
-                .done(function(resp){
-                    $modal.html(resp).foundation('open').trigger('resizeme.zp.reveal');
-                });
-                return false;
-            });
-
-            $('.account-member-statements').on('click', function(e){
-                e.preventDefault();
-                var member    = $(this).data('member');
-                var $modalStm = $('#glmBillingStatements');
-
-                $.ajax({
-                    url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=list&member=' + member,
-                    cache: false,
-                    beforeSend: startAjax,
-                    complete: completeAjax,
-                })
-                .done(function(resp){
-                    $modalStm.html(resp).foundation('open').trigger('resizeme.zp.reveal');
-
-                    // Pay Invoice link
-                    $('.payInvoice').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=makepayment&member=' + member,
-                            cache: false,
-                            beforeSend: startAjax,
-                            complete: completeAjax,
-                        }).done(function(resp){
-                            $modalPayment.html(resp).foundation('open').trigger('resizeme.zp.reveal');
-                        });
-                        return false;
-                    });
-
-                    // Make A Payment link
-                    $('.makeAPayment').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;
-                    });
-
-                    // View Link
-                    $('.view').on('click', function(e){
-                        e.preventDefault();
-                        var member      = $(this).data('member');
-                        var id          = $(this).data('id');
-                        var $modalVidew = $('#glmBillingView');
-                        $.ajax({
-                            url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=view&member=' + member + '&id=' + id,
-                            cache: false,
-                            beforeSend: startAjax,
-                            complete: completeAjax,
-                        }).done(function(resp){
-                            $modalVidew.html(resp).foundation('open').trigger('resizeme.zp.reveal');
-
-                        });
-
-                        return false;
-                    });
-
-                });
-                return false;
-            });
-
-            function startAjax(){
-                $('#glmLoading').show();
-            }
-            function completeAjax(){
-                $('#glmLoading').hide();
-            };
         });
 
     </script>
 
-    {* Reveal for Billing Info *}
-    <div id="glmBillingInfo" class="medium reveal" data-reveal data-close-on-click="false">
-    </div>
-    {* Reveal for Billing Info Success *}
-    <div class="reveal" id="billingInfoSuccess" data-reveal>
-        <h2>Billing Info Updated!</h2>
-        <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">
-            <span aria-hidden="true">&times;</span>
-        </button>
-    </div>
-    {* Reveal for Billing Payments *}
-    <div id="glmBillingPayment" class="medium reveal" data-reveal data-close-on-click="false">
-    </div>
-    {* Reveal for Billing View Invoice *}
-    <div id="glmBillingView" class="large 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>
+    {include file='admin/billing/accountReveals.html'}
 
 </div>
 {include file='admin/footer.html'}
index ddd843d..b9609a8 100644 (file)
@@ -47,7 +47,7 @@
                                     <a class="account-member-statements" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$t.ref_dest}">View Statements</a> |
                                 </span>
                                 <span class="account-dashboard-link">
-                                    <a class="account-billing" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=account&member={$t.ref_dest}">Billing Info</a>
+                                    <a class="account-billing" data-member="{$t.ref_dest}" href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=billing&option=account&member={$t.ref_dest}">Billing Info</a>
                                 </span>
                                 {if $t.boss.value}
                                 <span class="account-dashboard-link">
         });
     </script>
 
+    {include file='admin/billing/accountReveals.html'}
 </div>
 
 {include file='admin/footer.html'}
index 78c976b..c7a8ee4 100644 (file)
@@ -2,13 +2,13 @@
 
 <div class="callout large">
 
+    <h2 class="subheader">Payments</h2>
+
     <div class="button-group">
         <div id="exportPaymentsButton" class="button secondary">Payments Export</div>
         <a class="button primary" href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=payments&option=add">Make Payment</a>
     </div>
 
-    <h2 class="subheader">Payments</h2>
-
     <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm">
         <input type="hidden" name="glm_action" value="payments">
         <input type="hidden" name="option" value="list">