Fixed problem with confusion between asset and facility edit forms. develop
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 21 Mar 2018 19:00:25 +0000 (15:00 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 21 Mar 2018 19:00:25 +0000 (15:00 -0400)
Added flash to Facility on update
Added click action for expansion of Facility lines to support mobile.

models/admin/ajax/assetManagement.php
models/admin/ajax/facilityManagement.php
views/admin/assets/facilityForm.html
views/admin/assets/index.html

index ec5253e..0c8bada 100644 (file)
@@ -181,7 +181,7 @@ trigger_error("Option = ".$_REQUEST['option'],E_USER_NOTICE);
                 break;
 
             default:
-                die('No valid option provided');
+                die('Invalid option provided');
                 break;
         }
 
index 1952573..22ea57e 100644 (file)
@@ -82,7 +82,7 @@ class GlmMembersAdmin_ajax_facilityManagement extends GlmAssetsSupport
             die('No option specified.');
         }
 
-trigger_error("Option = ".$_REQUEST['option'],E_USER_NOTICE);
+trigger_error("Option = ".$_REQUEST['option'], E_USER_NOTICE);
 
         switch($_REQUEST['option']) {
 
@@ -143,6 +143,7 @@ trigger_error("Option = ".$_REQUEST['option'],E_USER_NOTICE);
                     $facility = $Facilities->editEntry($facilityId);
                     //echo " <pre>".print_r($facility,1)."</pre>";
                     //die();
+
                     $view = 'facilityForm';
 
                     $templateData = array(
@@ -187,7 +188,7 @@ trigger_error("Option = ".$_REQUEST['option'],E_USER_NOTICE);
                 break;
 
             default:
-                die('No valid option provided');
+                die('Invalid option provided: '.$_REQUEST['option']);
                 break;
         }
 
index 2aebd0e..eb70e1e 100644 (file)
         
         <form id="facilityForm" method="post" enctype="multipart/form-data">
 
-            <input type="hidden" name="glm_action" value="assetManagement">
+            <input type="hidden" name="glm_action" value="facilityManagement">
     {if $use == 'add'}
             <input type="hidden" name="option" value="addNewFacility">
     {/if}
     {if $use == 'edit'}
-            <input type="hidden" name="option" value="updateFacility">    
+            <input type="hidden" name="option" value="updateFacility">
             <input type="hidden" name="id" value="{$facility.id}">    
     {/if}
             
index 54eab88..8bf4b80 100644 (file)
@@ -1,7 +1,4 @@
 
-<br>
-* Having problem with submit of edit on new faclilty<br>
-
 <div class="wrap glm-associate-admin-wrap">
 
 
@@ -15,6 +12,7 @@
             font-weight: bold;
             margin-top: 10px;
             font-size: 1.1em;
+            cursor: pointer;
         }
         .assets-column-title {
             font-weight: bold;
 <script>
 jQuery(document).ready(function($){
 
-
     var editFlag = false;
     var facilityHoverId = false;    
     var currentFormAction = false;
     
-    // File Line Hover Action
+    // Facility Line Hover Action
     $('.facility-name').live( 'mouseenter', function() {     
+        if (editFlag) {
+            return;
+        }
+        if (!facilityHoverId) {
+            facilityHoverId = $(this).attr('data-id');
+            $('.facility_' + facilityHoverId).removeClass('glm-hidden');
+        }
+    });
+
+    // Facility Line Click Action - For mobile browsers
+    $('.facility-name').live( 'click', function() {     
         if (editFlag) {
             return;
         }
         if (facilityHoverId) {
             $('.facility_' + facilityHoverId).addClass('glm-hidden');
+            facilityHoverId = false;
+        } else {
+            facilityHoverId = $(this).attr('data-id');
+            $('.facility_' + facilityHoverId).removeClass('glm-hidden');
         }
-        facilityHoverId = $(this).attr('data-id');
-        $('.facility_' + facilityHoverId).removeClass('glm-hidden');
     });
 
-
     function fileLinksEditSelected() {
         $('#facilityLinks_' + facilityHoverId).addClass('glm-hidden');
         fileEditFlag = true;
@@ -241,7 +250,7 @@ jQuery(document).ready(function($){
     
     // Submit Facility Form
     $('#facilityForm').live('submit', function(event) {
-        
+
         if (currentFormAction == 'add') {
             var thisOption = 'addNewFacility';
         }
@@ -251,7 +260,7 @@ jQuery(document).ready(function($){
 
         event.preventDefault();        
         $.ajax({
-            url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=facilityManagement&option=' + thisOption,
+            url: '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=facilityManagement',
             type: $(this).attr("method"),
             dataType: 'html',
             data: new FormData(this),
@@ -262,7 +271,7 @@ jQuery(document).ready(function($){
                 var status = data.charAt(0);
                 var html = data.substring(1);
 
-                // If all is good add this facility to the top of the list for now
+                // If all is good add this facility to the top of the list for now or update if updating
                 if (status == 0) {
 
                     editFlag = false;
@@ -276,6 +285,8 @@ jQuery(document).ready(function($){
                         $('#facility_' + facilityHoverId).html(html);
                         $('#assetsDialog').dialog('close');
                     }    
+
+                    assetsFlashNotice($('#facility_' + facilityHoverId));
                 }
 
                 // if status....
@@ -367,8 +378,8 @@ jQuery(document).ready(function($){
         });        
     });
     
-    function flashNotice(notice) {
-        notice.fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+    function assetsFlashNotice(notice) {
+        notice.fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
     }
 
 });