fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12512]


From: Nelson Guerra
Subject: [Fmsystem-commits] [12512]
Date: Mon, 29 Dec 2014 23:32:15 +0000

Revision: 12512
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12512
Author:   nelson224
Date:     2014-12-29 23:32:15 +0000 (Mon, 29 Dec 2014)
Log Message:
-----------


Added Paths:
-----------
    branches/dev-syncromind/property/js/portico/entity.edit_inventory.js

Added: branches/dev-syncromind/property/js/portico/entity.edit_inventory.js
===================================================================
--- branches/dev-syncromind/property/js/portico/entity.edit_inventory.js        
                        (rev 0)
+++ branches/dev-syncromind/property/js/portico/entity.edit_inventory.js        
2014-12-29 23:32:15 UTC (rev 12512)
@@ -0,0 +1,89 @@
+
+$(document).ready(function(){
+
+       $("#edit_inventory").on("submit", function(e){
+
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                       success: function(data) {
+                               if(data)
+                               {
+                                       if(data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                               var obj = data;
+                       
+                               var submitBnt = 
$(thisForm).find("input[type='submit']");
+                               if(obj.status == "updated")
+                               {
+                                       $(submitBnt).val("Lagret");
+                                       }
+                                       else
+                                       {
+                                       $(submitBnt).val("Feil ved lagring");   
                                
+                                       }
+                                                
+                               // Changes text on save button back to original
+                               window.setTimeout(function() {
+                                               $(submitBnt).val('Lagre');
+                                               
$(submitBnt).addClass("not_active");
+                               }, 1000);
+
+                                       var ok = true;
+                                       var htmlString = "";
+                                       if(data['receipt'] != null)
+                                       {
+                                               if(data['receipt']['error'] != 
null)
+                                               {
+                                                       ok = false;
+                                                       for ( var i = 0; i < 
data['receipt']['error'].length; ++i )
+                                                       {
+                                                               htmlString += 
"<div class=\"error\">";
+                                                               htmlString += 
data['receipt']['error'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+                                       
+                                               }
+                                               
if(typeof(data['receipt']['message']) != 'undefined')
+                                               {
+                                                       for ( var i = 0; i < 
data['receipt']['message'].length; ++i )
+                                                       {
+                                                               htmlString += 
"<div class=\"msg_good\">";
+                                                               htmlString += 
data['receipt']['message'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+                                       
+                                               }
+                                               $("#receipt").html(htmlString);
+                                       }
+                                       
+                                       if(ok)
+                                       {
+                                               parent.TINY.box.hide();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("#workorder_cancel").on("submit", function(e){
+               if($("#lean").val() == 0)
+               {
+                       return;
+               }
+               e.preventDefault();
+               parent.closeJS_remote();
+       });
+
+});
+
+




reply via email to

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