1 namespace('kivi.TimeRecording', function(ns) {
4 ns.set_end_date = function() {
5 if ($('#start_date').val() !== '' && $('#end_date').val() === '') {
6 var kivi_start_date = kivi.format_date(kivi.parse_date($('#start_date').val()));
7 $('#end_date').val(kivi_start_date);
11 ns.set_current_date_time = function(what) {
12 if (what !== 'start' && what !== 'end') return;
14 var $date = $('#' + what + '_date');
15 var $time = $('#' + what + '_time');
16 var date = new Date();
18 $date.val(kivi.format_date(date));
19 $time.val(kivi.format_time(date));
22 ns.order_changed = function(value) {
24 $('#time_recording_customer_id').data('customer_vendor_picker').set_item({});
25 $('#time_recording_customer_id_name').prop('disabled', false);
26 $('#time_recording_project_id').data('project_picker').set_item({});
27 $('#time_recording_project_id_name').prop('disabled', false);
31 var url = 'controller.pl?action=TimeRecording/ajaj_get_order_info&id='+ value;
32 $.getJSON(url, function(data) {
33 $('#time_recording_customer_id').data('customer_vendor_picker').set_item(data.customer);
34 $('#time_recording_customer_id_name').prop('disabled', true);
35 $('#time_recording_project_id').data('project_picker').set_item(data.project);
36 $('#time_recording_project_id_name').prop('disabled', true);
40 ns.project_changed = function() {
41 var project_id = $('#time_recording_project_id').val();
44 $('#time_recording_customer_id_name').prop('disabled', false);
48 var url = 'controller.pl?action=TimeRecording/ajaj_get_project_info&id='+ project_id;
49 $.getJSON(url, function(data) {
51 $('#time_recording_customer_id').data('customer_vendor_picker').set_item(data.customer);
52 $('#time_recording_customer_id_name').prop('disabled', true);
54 $('#time_recording_customer_id_name').prop('disabled', false);