]> wagnertech.de Git - mfinanz.git/blobdiff - js/kivi.TimeRecording.js
Zeiterfassung: Auftrag auswählen können, Kunden und ggf. Projekt daraus setzen
[mfinanz.git] / js / kivi.TimeRecording.js
index cf501490575dba82c7ab4c7c4b4125dc4892d2b3..f5cf3c84159875b0bf88eacdb3f2d94a3d6e6b3a 100644 (file)
@@ -19,4 +19,22 @@ namespace('kivi.TimeRecording', function(ns) {
     $time.val(kivi.format_time(date));
   };
 
+  ns.order_changed = function(value) {
+    if (!value) {
+      $('#time_recording_customer_id').data('customer_vendor_picker').set_item({});
+      $('#time_recording_customer_id_name').prop('disabled', false);
+      $('#time_recording_project_id').data('project_picker').set_item({});
+      $('#time_recording_project_id_name').prop('disabled', false);
+        return;
+    }
+
+    var url = 'controller.pl?action=TimeRecording/ajaj_get_order_info&id='+ value;
+    $.getJSON(url, function(data) {
+      $('#time_recording_customer_id').data('customer_vendor_picker').set_item(data.customer);
+      $('#time_recording_customer_id_name').prop('disabled', true);
+      $('#time_recording_project_id').data('project_picker').set_item(data.project);
+      $('#time_recording_project_id_name').prop('disabled', true);
+    });
+  };
+
 });