Some cleanup after testing with new admin accounts features.
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 2 Oct 2018 18:23:02 +0000 (14:23 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 2 Oct 2018 18:23:02 +0000 (14:23 -0400)
Also used some updated code from this new feature to improve individual account dashboard

classes/data/dataAccount.php
models/admin/registrations/accounts.php
views/admin/registrations/accountDashboard.html [changed mode: 0644->0755]
views/admin/registrations/accountsDashboard.html
views/admin/registrations/eventsDashboard.html

index 112c53c..3c0e01f 100755 (executable)
@@ -660,7 +660,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract
         }
 
         // If doing a list operation
-        if (in_array($action, array('l'))) {
+        if (in_array($action, array('l', 'g'))) {
 
             // If getAccountActivity is set and this is a list request
             if ($this->getAccountActivity) {
index 9cc8029..591febd 100755 (executable)
@@ -113,10 +113,10 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
         $namesList          = false;
         $numbDisplayed      = false;
         $lastDisplayed      = false;
-        $requests           = false;
-        $haveRequests       = false;
-        $registered         = false;
-        $haveRegistered     = false;
+//        $requests           = false;
+//        $haveRequests       = false;
+//        $registered         = false;
+//        $haveRegistered     = false;
 
         // Get any provided option
         if (isset($_REQUEST['option'])) {
@@ -193,6 +193,7 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
 
         case 'accountDashboard':
 
+/*
             // Load registration request and registration registrant data classes
             require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
             $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
@@ -200,13 +201,18 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
             $RegRequestRegistrant = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config);
             require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH .  '/data/dataRegRequestEvent.php';
             $RegRequestEvent = new GlmDataRegistrationsRequestEvent( $this->wpdb, $this->config );
-
-            // Get account base data
+*/
+            // Get account base data along with associated requests and attendee data
+            $this->getAccountActivity = true;
             $account = $this->getEntry($accountID);
+//echo "<pre>".print_r($account,1)."</pre>";
+
+
             if ($account) {
 
                 $haveAccount = true;
 
+/*
                 // Get any registrations submitted
                 $requests = $RegRequest->getList("T.account = $accountID");
                 if (is_array($requests) && count($requests) > 0) {
@@ -223,7 +229,7 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
                         $registered[$key]['eventData'] = $RegRequestEvent->getEntry( $reg['reg_request_event'] );
                     }
                 }
-
+*/
             }
 
             $view = 'accountDashboard';
@@ -319,12 +325,9 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
                 $where .= " AND active";
             }
 
-            // Compile input values array
-
-
+            // Get accounts list with activity (requests and registrations) data
             $this->getAccountActivity = true;
             $accountsResult = $this->getList( $where, 'lname', true, 'id', $start, $limit  );
- //echo '<pre>$accountsResult: ' . print_r( $accountsResult, true ) . '</pre>';
 
             //$accounts    = $this->getList( $where );
             // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
@@ -393,10 +396,10 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
             'namesList'          => $namesList,
             'numbDisplayed'      => $numbDisplayed,
             'lastDisplayed'      => $lastDisplayed,
-            'requests'           => $requests,
-            'haveRequests'       => $haveRequests,
-            'registered'         => $registered,
-            'haveRegistered'     => $haveRegistered,
+//            'requests'           => $requests,
+//            'haveRequests'       => $haveRequests,
+//            'registered'         => $registered,
+//            'haveRegistered'     => $haveRegistered,
             'reason'             => $reason
         );
              // Return status, any suggested view, and any data to controller
old mode 100644 (file)
new mode 100755 (executable)
index 299570b..878a866
                         </div>
                     {/if}
                         <div class="glm-small-12 glm-column">
-                            {$account.city}, {$account.state} {$account.zip}
+                            {$account.city}, {$account.state.name} {$account.zip}
                         </div>
                         <div class="glm-small-12 glm-column">
-                            {$account.country}
+                            {$account.country.name}
                         </div>
                     </div>
                 </div>
     </div>
 </div>
 
-<div class="glm-admin-table-inner glm-admin-table">
+<div>
+{if $account.numb_requests}
+    <div class="glm-admin-table-inner glm-admin-table">
         <p><h3>{$terms.reg_term_registration_cap} Requests</h3></p>
-        {assign var="i" value="0"}
-        <table class="wp-list-table striped glm-admin-table">
-            <thead>
-                <tr>
-                    <th>ID</th>
-                    <th>Submitted</th>
-                    <th>Payment By</th>
-                    <th>Total Payment</th>
-                    <th>Status</th>
-                </tr>
-            </thead>
-            <tbody>
-        {foreach $requests as $req}
-            {if $i++ is odd by 1}
-                <tr>
-            {else}
-                <tr class="alternate">
-            {/if}
-                <td>
-                    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&glm_action=requests&option=requestDashboard&requestID={$req.id}">
-                    {$req.id}
-                    </a>
-                </td>
-                <td>{$req.date_submitted.datetime}</td>
-                <td>{$req.pay_method.name}</td>
-                <td>{$req.total}</td>
-                <td>{$req.status.name}</td>
+    {assign var="i" value="0"}
+        <table class="glm-admin-table wp-list-table striped glm-nowrap">
+            <tr>
+                <td style="padding-right: 1em;">ID</td>
+                <td style="padding-right: 1em;">Date Submitted</td>
+                <td style="padding-right: 1em;">Pay Method</td>
+                <td style="padding-right: 1em;">Status</td>
+                <td>{$terms.reg_term_attendee_plur_cap}</td>
             </tr>
-        {/foreach}
+      {foreach $account.requests as $request}                            
+            <tr>
+                <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$request.id}">{$request.id}</a></td>
+                <td>{$request.date_submitted.datetime}</td>
+                <td>{$request.pay_method.name}</td>
+                <td>{$request.status.name}</td>
+                <td>{$request.registrants}</td>
+            </tr>                                
+      {/foreach}
         </table>
 
-</div>
+    </div>
+{/if}
 
-<div class="glm-admin-table-inner glm-admin-table">
-    <p><h3>{$terms.reg_term_registered} for {$terms.reg_term_event_plur_cap}</h3></p>
+{if $account.numb_registrants}
+    <div class="glm-admin-table-inner glm-admin-table">
+        <p><h3>{$terms.reg_term_registered_cap} for {$terms.reg_term_event_plur_cap}</h3></p>
     {assign var="i" value="0"}
-    <table class="wp-list-table striped glm-admin-table">
-        <thead>
+        <table class="glm-admin-table wp-list-table striped glm-nowrap">
             <tr>
-                <th>{$terms.reg_term_event_cap} Name</th>
-                <th>Date/Time</th>
+                <td style="padding-right: 1em;">ID</td>
+                <td style="padding-right: 1em;">Name</td>
+                <td style="padding-right: 1em;">{$terms.reg_term_event_cap}</td>
+                <td style="padding-right: 1em;">Level</td>
+                <td style="padding-right: 1em;">Rate</td>
+                <td style="padding-right: 1em;">Requeest Status</td>
+                <td>Attending</td>
             </tr>
-        </thead>
-        <tbody>
-    {foreach $registered as $reg}
-        {if $i++ is odd by 1}
+      {foreach $account.registrants as $registrant}                            
             <tr>
-        {else}
-            <tr class="alternate">
-        {/if}
-            <td>
-                <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard&regEventID={$reg.reg_event}">
-                    {$reg.eventData.event_name}
-                </a>
-
-            </td>
-            <td>{$reg.event_datetime.datetime}</td>
-        </tr>
+                <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$request.id}">{$registrant.id}</a></td>
+                <td>{$registrant.fname} {$registrant.lname}</td>
+                <td>{$registrant.event_name}</td>
+                <td>{$registrant.class_name}</td>
+                <td>{$registrant.rate_name}</td>
+                <td>{$registrant.request_status_name}</td>
+                <td>{if $registrant.not_attending.value}No{else}Yes{/if}</td>
+            </tr>                                
     {/foreach}
-    </table>
+        </table>
+    </div>
+{/if}
 </div>
 
-
 {include file='admin/footer.html'}
 
index 419c43d..5a92563 100755 (executable)
@@ -96,8 +96,8 @@
                                 {if $account.state.value != ''}{if $account.city != ''},ddd {/if}{$account.state.name}{/if}
                                 {if $account.country.value}{$account.country.name}{/if}
                                 {if $account.city || $account.state.value || $account.country.value}<br>{/if}
-                                {if $account.phone != ''}<b>Phone:</b> {$account.phone}<br>{/if}
-                                {if $account.email != ''}<b>Email Address:</b> {$account.email}<br>{/if}
+                                {if $account.phone != ''}{$account.phone}<br>{/if}
+                                {if $account.email != ''}{$account.email}<br>{/if}
                             </p>
                             
                         </div>
index 9771900..0bad13f 100755 (executable)
              $('#requestLinks_' + requestHoverId).removeClass('glm-hidden');
          });
 
-         // Request Edit Action
+         // Request Edit Action - Clicking with edit open will close it
          $('.glm-request-link').on('click', function() {
+             if (requestEditId) {
+                 $('.glm-request-detail').addClass('glm-hidden');
+                 requestEditId = false;
+                 return;
+             }
              requestEditId = $(this).attr('data-request');
              $('#requestEdit_' + requestEditId).removeClass('glm-hidden');
          });