fix issue with notes deletion
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 25 May 2018 19:58:02 +0000 (15:58 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 25 May 2018 19:58:02 +0000 (15:58 -0400)
note deletion need to get the lead id first then check for note entry

css/admin.css
models/admin/ajax/travelNotes.php
models/admin/travel/index.php
views/admin/ajax/notes/list.html
views/admin/travel/edit.html
views/admin/travel/header.html

index 28d27bc..5b4ab2b 100644 (file)
@@ -31,7 +31,7 @@
 }
 
 #addLog textarea {
-    width: 500px;
+    width: 100%;
 }
 .glmCheckBox {
     display: block;
index a31cf55..765dede 100644 (file)
@@ -110,9 +110,8 @@ class GlmMembersAdmin_ajax_travelNotes extends GlmDataTravelNotes
             exit;
             break;
         case 'delete':
-            if ( isset( $_REQUEST['id'] )
-                && isset( $_REQUEST['note_id'] )
-                && $lead_id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT )
+            $lead_id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT );
+            if ( isset( $_REQUEST['note_id'] ) && $lead_id
                 && $note_id = filter_var( $_REQUEST['note_id'], FILTER_VALIDATE_INT )
             ) {
                 $this->wpdb->delete(
index 2bb55e1..4a9daf3 100644 (file)
@@ -183,42 +183,6 @@ class GlmMembersAdmin_travel_index extends GlmDataTravelLeads
         $grouped_interests = array();
 
         switch ( $option ) {
-        case 'addLog':
-            $this->wpdb->insert(
-                GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'lead_notes',
-                array(
-                    'lead'    => $this->entryId,
-                    'created' => date( 'Y-m-d H:i:s' ),
-                    'updated' => date( 'Y-m-d H:i:s' ),
-                    'notes'   => filter_var( $_REQUEST['new_log'], FILTER_SANITIZE_STRING )
-                ),
-                array(
-                    '%d',
-                    '%s',
-                    '%s',
-                    '%s'
-                )
-            );
-
-            $entry = $this->editEntry( $this->entryId );
-            $view = 'edit.html';
-            break;
-        case 'deleteLog':
-            if ( isset( $_REQUEST['id'] )
-                && isset( $_REQUEST['note_id'] )
-                && $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT )
-                && $note_id = filter_var( $_REQUEST['note_id'], FILTER_VALIDATE_INT )
-            ) {
-                $this->wpdb->delete(
-                    GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'lead_notes',
-                    array( 'lead' => $id, 'id'   => $note_id ),
-                    array( '%d', '%d' )
-                );
-            }
-
-            $entry = $this->editEntry( $this->entryId );
-            $view = 'edit.html';
-            break;
         case 'delete':
             // echo '<pre>$this->entryId: ' . print_r( $this->entryId, true ) . '</pre>';
             if ( $this->entryId ) {
index d5b9bc8..f9c253e 100644 (file)
@@ -4,7 +4,7 @@
         <input type="hidden" name="glm_action" value="travelNotes" />
         <input type="hidden" name="id" value="{$lead_id}" />
         <input type="hidden" name="option" value="add" />
-        <textarea name="new_log" cols="30" rows="5"></textarea>
+        <textarea class="new-log" name="new_log" cols="30" rows="5"></textarea>
         <input type="submit" class="button" value="New Note Entry" />
     </form>
 
index fc30e8a..3e08302 100644 (file)
                 $('#change-1').show();
             });
         });
+        $('html, body').animate( { scrollTop:0 }, 'fast');
     });
 </script>
 
index 201b1e2..22c856e 100644 (file)
@@ -1,3 +1,3 @@
 <div id="wrap">
     <h1>Travel Leads</h1>
-    <div id="glm-admin-content-container" style="max-width: 1200px;">
+    <div id="glm-admin-content-container" style="max-width: 720px;">