fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9227] property: invoice


From: Sigurd Nes
Subject: [Fmsystem-commits] [9227] property: invoice
Date: Wed, 25 Apr 2012 16:44:54 +0000

Revision: 9227
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9227
Author:   sigurdne
Date:     2012-04-25 16:44:54 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
property: invoice

Added Paths:
-----------
    trunk/property/js/portico/ajax_workorder_edit.js

Added: trunk/property/js/portico/ajax_workorder_edit.js
===================================================================
--- trunk/property/js/portico/ajax_workorder_edit.js                            
(rev 0)
+++ trunk/property/js/portico/ajax_workorder_edit.js    2012-04-25 16:44:54 UTC 
(rev 9227)
@@ -0,0 +1,81 @@
+$(document).ready(function(){
+
+       $("#workorder_edit").live("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.hide_popupBox();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("#workorder_cancel").live("submit", function(e){
+               e.preventDefault();
+               parent.hide_popupBox();
+       });
+
+});
+




reply via email to

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