fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10892] Added functionality for changing status for a


From: Torstein
Subject: [Fmsystem-commits] [10892] Added functionality for changing status for a check list
Date: Sun, 17 Feb 2013 14:33:48 +0000

Revision: 10892
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10892
Author:   vator
Date:     2013-02-17 14:33:46 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
Added functionality for changing status for a check list

Modified Paths:
--------------
    
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
    trunk/controller/templates/mobilefrontend/css/base.css

Added Paths:
-----------
    trunk/controller/js/controller/check_list.js

Copied: trunk/controller/js/controller/check_list.js (from rev 10891, 
trunk/controller/js/controller/ajax.js)
===================================================================
--- trunk/controller/js/controller/check_list.js                                
(rev 0)
+++ trunk/controller/js/controller/check_list.js        2013-02-17 14:33:46 UTC 
(rev 10892)
@@ -0,0 +1,112 @@
+$(document).ready(function(){
+               
+       // ADD CHECKLIST
+       $("#frm_add_check_list").live("submit", function(e){
+               var thisForm = $(this);
+               var statusFieldVal = $("#status").val();
+               var statusRow = $("#status").closest(".row");
+               var plannedDateVal = $("#planned_date").val();
+               var plannedDateRow = $("#planned_date").closest(".row");
+               var completedDateVal = $("#completed_date").val();
+               var completedDateRow = $("#completed_date").closest(".row");
+               
+               $(thisForm).find(".input_error_msg").remove();
+               
+               // Is COMPLETED DATE assigned when STATUS is done 
+               if(statusFieldVal == 1 && completedDateVal == ''){
+                       e.preventDefault();
+                       // Displays error message above completed date
+                       $(completedDateRow).before("<div 
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
+               }
+    // Is COMPLETED DATE assigned when STATUS is not done
+               else if(statusFieldVal == 0 && completedDateVal != ''){
+                       e.preventDefault();
+                       // Displays error message above completed date
+                       $(statusRow).before("<div class='input_error_msg'>Du 
har angitt utførtdato, men status er Ikke utført. Vennligst endre status til 
utført</div>");
+               }
+       });     
+       
+       // Display submit button on click
+       $("#frm_add_check_list").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");       
        $(submitBnt).removeClass("not_active");
+       });
+
+       
+       
+       // UPDATE CHECKLIST DETAILS     
+       $("#frm_update_check_list").live("submit", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               
+               var check_list_id = $("#check_list_id").val();
+                       
+               var statusFieldVal = $("#status").val();
+               var statusRow = $("#status").closest(".row");
+               var plannedDateVal = $("#planned_date").val();
+               var plannedDateRow = $("#planned_date").closest(".row");
+               var completedDateVal = $("#completed_date").val();
+               var completedDateRow = $("#completed_date").closest(".row");
+               
+               $(thisForm).find('.input_error_msg').remove();
+               
+               // Checks that COMPLETE DATE is set if status is set to DONE 
+               if(statusFieldVal == 1 & completedDateVal == ''){
+                       e.preventDefault();
+                       // Displays error message above completed date
+                       $(completedDateRow).before("<div 
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
+       }
+               else if(statusFieldVal == 0 && completedDateVal != ''){
+                       e.preventDefault();
+                       // Displays error message above completed date
+                       $(statusRow).before("<div 
class='input_error_msg'>Vennligst endre status til utført eller slett 
utførtdato</div>");
+               }
+               else if(statusFieldVal == 0 & plannedDateVal == ''){
+                       e.preventDefault();
+                       // Displays error message above planned date
+                       if( 
!$(plannedDateRow).prev().hasClass("input_error_msg") )
+                       {
+                         $(plannedDateRow).before("<div 
class='input_error_msg'>Vennligst endre status for kontroll eller angi 
planlagtdato</div>");   
+                       }
+               }       
+       });
+  
+  // UPDATE CHECKLIST STATUS
+       $("#frm-update-check-list-status").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               
+               var check_list_id = $("#check_list_id").val();
+                       
+               var statusFieldVal = $("#status").val();
+               var statusRow = $("#status").closest(".row");
+               var plannedDateVal = $("#planned_date").val();
+               var plannedDateRow = $("#planned_date").closest(".row");
+               var completedDateVal = $("#completed_date").val();
+               var completedDateRow = $("#completed_date").closest(".row");
+               
+               $(thisForm).find('.input_error_msg').remove();
+               
+               // Checks that COMPLETE DATE is set if status is set to DONE 
+               if(statusFieldVal == 1 & completedDateVal == ''){
+                       e.preventDefault();
+                       // Displays error message above completed date
+                       $(completedDateRow).before("<div 
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
+       }
+               else if(statusFieldVal == 0 && completedDateVal != ''){
+                       e.preventDefault();
+                       // Displays error message above completed date
+                       $(statusRow).before("<div 
class='input_error_msg'>Vennligst endre status til utført eller slett 
utførtdato</div>");
+               }
+               else if(statusFieldVal == 0 & plannedDateVal == ''){
+                       e.preventDefault();
+                       // Displays error message above planned date
+                       if( 
!$(plannedDateRow).prev().hasClass("input_error_msg") )
+                       {
+                         $(plannedDateRow).before("<div 
class='input_error_msg'>Vennligst endre status for kontroll eller angi 
planlagtdato</div>");   
+                       }
+               }       
+       });
+});
\ No newline at end of file

Modified: 
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
===================================================================
--- 
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
   2013-02-17 13:41:16 UTC (rev 10891)
+++ 
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
   2013-02-17 14:33:46 UTC (rev 10892)
@@ -24,13 +24,24 @@
                </div>
                
     <!-- ==================  CHANGE STATUS FOR CHECKLIST  
===================== -->
-    <div id="change-check-list-status">
-      <span class="btn"><xsl:value-of select="php:function('lang', 'Status not 
done')" /></span>
+    
+      <form id="update-check-list-status" action="{$action_url}" method="post">
+        <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
+        <input type="hidden" name="control_item_id" value="{$control_item_id}" 
/> 
+        <input type="hidden" name="check_list_id"><xsl:attribute 
name="value"><xsl:value-of select="//check_list/id"/></xsl:attribute></input>
+        <input type="hidden" name="status" value="0" />
+        <input type="hidden" name="type" value="control_item_type_1" />
+        <input type="hidden" name="location_code"  value="" class="required" />
+
+         <span class="btn"><xsl:value-of select="php:function('lang', 'Status 
not done')" /></span>
       <div class="icon">
-        <img height="15" src="controller/images/red_ring.png" />
-      </div>      
-    </div>
-                       
+        <img src="/pe/controller/images/red_ring.png" />
+      </div>    
+        
+        <input type="submit" class="btn" name="save_control" value="Lagre sak" 
/>
+      </form>
+       
+
                <!-- ==================  CHECKLIST TAB MENU  
===================== -->
                <xsl:call-template name="check_list_menu" />
        </div>          

Modified: trunk/controller/templates/mobilefrontend/css/base.css
===================================================================
--- trunk/controller/templates/mobilefrontend/css/base.css      2013-02-17 
13:41:16 UTC (rev 10891)
+++ trunk/controller/templates/mobilefrontend/css/base.css      2013-02-17 
14:33:46 UTC (rev 10892)
@@ -31,17 +31,21 @@
   text-transform: capitalize;
 }
 
-#change-check-list-status {
+#update-check-list-status {
   float: right;
-  width: 12%;
+  width: 13%;
 }
 
-#change-check-list-status .btn {
+#update-check-list-status .btn {
   float:left;
 }
 
-#change-check-list-status .icon {
-    float: left;
-    margin-left: 10px;
-    vertical-align: middle;
+#update-check-list-status .icon {
+  float: left;
+  margin-left: 10px;
+  vertical-align: middle;
+}
+
+#update-check-list-status .icon img{
+  height: 28px;
 }
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]