X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/5f810b4b61f933cfe253bf6113283c4a264768b0..c381d6c41b2c6a0da6811525fb5a0fc5ea716975:/js/kivi.TimeRecording.js diff --git a/js/kivi.TimeRecording.js b/js/kivi.TimeRecording.js index f5cf3c841..47b0f16cc 100644 --- a/js/kivi.TimeRecording.js +++ b/js/kivi.TimeRecording.js @@ -25,7 +25,7 @@ namespace('kivi.TimeRecording', function(ns) { $('#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; + return; } var url = 'controller.pl?action=TimeRecording/ajaj_get_order_info&id='+ value; @@ -37,4 +37,23 @@ namespace('kivi.TimeRecording', function(ns) { }); }; + ns.project_changed = function() { + var project_id = $('#time_recording_project_id').val(); + + if (!project_id) { + $('#time_recording_customer_id_name').prop('disabled', false); + return; + } + + var url = 'controller.pl?action=TimeRecording/ajaj_get_project_info&id='+ project_id; + $.getJSON(url, function(data) { + if (data) { + $('#time_recording_customer_id').data('customer_vendor_picker').set_item(data.customer); + $('#time_recording_customer_id_name').prop('disabled', true); + } else { + $('#time_recording_customer_id_name').prop('disabled', false); + } + }); + }; + });