WIP work on the edit add page for notificationTypes
authorSteve Sutton <ssutton@gmail.com>
Mon, 4 Dec 2017 10:33:12 +0000 (05:33 -0500)
committerSteve Sutton <ssutton@gmail.com>
Mon, 4 Dec 2017 10:33:12 +0000 (05:33 -0500)
Further work on notificaton types for edit and add page.

models/admin/billing/invoices.php
models/admin/settings/notificationTypes.php
views/admin/settings/editNotificationType.html
views/admin/settings/notificationTypes.html

index 6a7a6d5..91d75c7 100644 (file)
@@ -97,7 +97,7 @@ class GlmMembersAdmin_billing_list // extends GlmDataTransactions
         $haveTransactions        = false;
         $transactions            = false;
         $haveTransactions        = false;
-        $this->transactionID    = false;
+        $this->transactionID     = false;
         $transactionsUpdated     = false;
         $transactionsUpdateError = false;
         $transactionsAdded       = false;
index 215d2d8..fa07c07 100644 (file)
@@ -99,6 +99,7 @@ class GlmMembersAdmin_settings_notificationTypes extends GlmDataNotificationType
     public function modelAction ($actionData = false)
     {
 
+        $id                    = 0;
         $option                = 'list';
         $view                  = 'notificationTypes';
         $success               = true;
@@ -138,18 +139,20 @@ class GlmMembersAdmin_settings_notificationTypes extends GlmDataNotificationType
 
         switch($_REQUEST['option']) {
         case 'add':
-            $this->newEntry();
+            $notificationTypes = $this->newEntry();
             $view = 'editNotificationType';
             break;
 
         case 'insert':
             $view = 'editNotificationType';
-            $this->insertEntry();
+            $test = $this->insertEntry();
+            echo '<pre>$test: ' . print_r($test, true) . '</pre>';
             $notificationTypes = $this->getList();
             break;
 
         case 'edit':
-            $notificationTypes = $this->editEntry( $this->notification_id );
+            $notificationTypes = $this->editEntry( $id );
+            $view = 'editNotificationType';
             break;
 
         case 'update':
@@ -172,7 +175,7 @@ class GlmMembersAdmin_settings_notificationTypes extends GlmDataNotificationType
         }
 
 
-        echo '<pre>$notificationTypes: ' . print_r( $notificationTypes, true ) . '</pre>';
+        // echo '<pre>$notificationTypes: ' . print_r( $notificationTypes, true ) . '</pre>';
 
         // If we have list entries - even if it's an empty list
         $success = true;
@@ -200,6 +203,7 @@ class GlmMembersAdmin_settings_notificationTypes extends GlmDataNotificationType
 
         // Compile template data
         $templateData = array(
+            'notification_id'       => $id,
             'action'                => $_REQUEST['glm_action'],
             'enable_members'        => $enable_members,
             'haveNotificationTypes' => $haveNotificationTypes,
index 722ac6a..77ee708 100644 (file)
@@ -4,9 +4,10 @@
 
 Show error header here
 
-<form action="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes">
-    {if $haveNotificationTypes}
+<form action="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes" method="post">
+    {if $notification_id}
         <input type="hidden" name="option" value="update">
+        <input type="hidden" name="id" value="{$notification_id}">
     {else}
         <input type="hidden" name="option" value="insert">
     {/if}
@@ -17,7 +18,7 @@ Show error header here
             <th {if $notificationTypes.fieldRequired.name} class="glm-required"}{/if}>Name</th>
             <td {if $notificationTypes.fieldFail.name}class="glm-form-bad-input" data-tabid="glm-name"{/if}>
                 <input type="text" name="name" value="{$notificationTypes.fieldData.name}" class="glm-form-text-input-medium">
-            {if $notificationTypes.fieldFail.name}<p>{$notificationTypes.fieldFail.name}</p>{/if}<br>
+                {if $notificationTypes.fieldFail.name}<p>{$notificationTypes.fieldFail.name}</p>{/if}<br>
             </td>
         </tr>
 
@@ -28,7 +29,7 @@ Show error header here
             <th colspan="2">Due Date</th>
         </tr>
         <tr>
-            <th class="glm-required"><input type="radio" name="send_by" value="date" required></th>
+            <th class="glm-required"><input type="radio" name="send_by" value="date" required{if $notificationTypes.fieldData.send_by_date.value} checked{/if}></th>
             <td>
                 <input
                     type="number"
@@ -53,7 +54,7 @@ Show error header here
             <th colspan="2">Immediate Action</th>
         </tr>
         <tr>
-            <th><input type="radio" name="send_by" value="action" required></th>
+            <th><input type="radio" name="send_by" value="action" required{if $notificationTypes.fieldData.send_by_action.value} checked{/if}></th>
             <td>
                 <select name="send_action">
                     {foreach $send_action as $id => $val}
@@ -103,7 +104,7 @@ Show error header here
 
         <tr>
             <td colspan="2">
-                <input class="button button-primary" type="submit" value="{if $haveNotificationTypes}Update{else}Add{/if} Notification Type">
+                <input class="button button-primary" type="submit" value="{if $notification_id}Update{else}Add{/if} Notification Type">
             </td>
         </tr>
 
index bf2d746..38140a6 100644 (file)
                     <td>{$t.id}</td>
                     <td>
                         <div>
-                            <a class="editNotificationType"
+                            <a
+                                href="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes&option=edit&id={$t.id}"
                                 data-notification-id="{$t.id}"
                                 data-notification-name="{$t.name}"
                                 data-notification-sendbydate="{$t.send_by_date.value}"