X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.Order.js;h=a96f49f7fae78fb289b003f7ed7b94ee8272575e;hb=4058a47f317770d5cc5f5aa6b9f965b793f263bd;hp=d74e3470d61a378857a2748ce1564b3d5c11678b;hpb=aa60c5493c365f32ebef636d43ca37ea1cfeefd4;p=kivitendo-erp.git diff --git a/js/kivi.Order.js b/js/kivi.Order.js index d74e3470d..a96f49f7f 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -63,9 +63,10 @@ namespace('kivi.Order', function(ns) { $.post("controller.pl", data, kivi.eval_json_result); }; - ns.show_print_options = function(warn_on_duplicates) { + ns.show_print_options = function(warn_on_duplicates, warn_on_reqdate) { if (!ns.check_cv()) return; if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to print?"))) return; + if (warn_on_reqdate && !ns.check_valid_reqdate()) return; kivi.popup_dialog({ id: 'print_options', @@ -134,6 +135,9 @@ namespace('kivi.Order', function(ns) { }; ns.send_email = function() { + // push button only once -> slow response from mail server + ns.email_dialog_disable_send(); + var data = $('#order_form').serializeArray(); data = data.concat($('[name^="email_form."]').serializeArray()); data = data.concat($('[name^="print_options."]').serializeArray()); @@ -141,6 +145,12 @@ namespace('kivi.Order', function(ns) { $.post("controller.pl", data, kivi.eval_json_result); }; + ns.email_dialog_disable_send = function() { + // disable mail send event to prevent + // impatient users to send multiple times + $('#send_email').prop('disabled', true); + }; + ns.close_email_dialog = function() { email_dialog.dialog("close"); }; @@ -458,111 +468,22 @@ namespace('kivi.Order', function(ns) { $.post("controller.pl", data, kivi.eval_json_result); }; - ns.setup_multi_items_dialog = function() { - $('#multi_items_filter_table input, #multi_items_filter_table select').keydown(function(event) { - if (event.keyCode == 13) { - event.preventDefault(); - ns.multi_items_dialog_update_result(); - return false; - } - }); - - $('#multi_items_filter_all_substr_multi_ilike').focus(); - }; - - ns.show_multi_items_dialog = function() { + ns.open_multi_items_dialog = function() { if (!ns.check_cv()) return; - $('#row_table_id thead a img').remove(); - - kivi.popup_dialog({ - url: 'controller.pl?action=Order/show_multi_items_dialog', - data: { type: $('#type').val() }, - id: 'jq_multi_items_dialog', - load: kivi.Order.setup_multi_items_dialog, - dialog: { - title: kivi.t8('Add multiple items'), - width: 800, - height: 500 - } - }); - return true; - }; - - ns.close_multi_items_dialog = function() { - $('#jq_multi_items_dialog').dialog('close'); - }; - - ns.multi_items_dialog_update_result = function() { - var data = $('#multi_items_form').serializeArray(); - data.push({ name: 'type', value: $('#type').val() }); - $.ajax({ - url: 'controller.pl?action=Order/multi_items_update_result', - data: data, - method: 'post', - success: function(data) { - $('#multi_items_result').html(data); - ns.multi_items_dialog_enable_continue(); - ns.multi_items_result_setup_events(); - } - }); + var pp = $("#add_item_parts_id").data("part_picker"); + pp.o.multiple=1; + pp.open_dialog(); }; - ns.multi_items_dialog_disable_continue = function() { - // disable keydown-event and continue button to prevent - // impatient users to add parts multiple times - $('#multi_items_result input, #multi_items_position').off("keydown"); - $('#multi_items_dialog_continue_button').prop('disabled', true); - }; - - ns.multi_items_dialog_enable_continue = function() { - $('#multi_items_result input, #multi_items_position').keydown(function(event) { - if(event.keyCode == 13) { - event.preventDefault(); - ns.add_multi_items(); - return false; - } - }); - $('#multi_items_dialog_continue_button').prop('disabled', false); - }; - - ns.multi_items_result_setup_events = function() { - $('#multi_items_all_qty').change(ns.reformat_number); - $('#multi_items_all_qty').change(function(event) { - $('.multi_items_qty').val($(event.target).val()); - }); - $('.multi_items_qty').change(ns.reformat_number); - } - - ns.add_multi_items = function() { - // rows at all - var n_rows = $('.multi_items_qty').length; - if (n_rows == 0) return; - - // filled rows - n_rows = $('.multi_items_qty').filter(function() { - return $(this).val().length > 0; - }).length; - if (n_rows == 0) return; - - ns.multi_items_dialog_disable_continue(); - + ns.add_multi_items = function(data) { var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val()); - - var data = $('#order_form').serializeArray(); - data = data.concat($('#multi_items_form').serializeArray()); + data = data.concat($('#order_form').serializeArray()); data.push({ name: 'action', value: 'Order/add_multi_items' }, { name: 'insert_before_item_id', value: insert_before_item_id }); $.post("controller.pl", data, kivi.eval_json_result); }; - ns.set_input_to_one = function(clicked) { - if ($(clicked).val() == '') { - $(clicked).val(kivi.format_amount(1.00, -2)); - } - $(clicked).select(); - }; - ns.delete_order_item_row = function(clicked) { var row = $(clicked).parents("tbody").first(); $(row).remove(); @@ -900,14 +821,29 @@ namespace('kivi.Order', function(ns) { if (number_info !== '') { info += ' (' + number_info + ')' } if (name_info !== '') { info += ' (' + name_info + ')' } - $('').appendTo('#order_form').val(1); - $('').appendTo('#order_form').val(id); - $('').appendTo('#order_form').val(type); - $('').appendTo('#order_form').val(info); + if (!$('#follow_up_rowcount').lenght) { + $('').appendTo('#order_form'); + $('').appendTo('#order_form'); + $('').appendTo('#order_form'); + $('').appendTo('#order_form'); + $('').appendTo('#order_form'); + } + $('#follow_up_rowcount').val(1); + $('#follow_up_trans_id_1').val(id); + $('#follow_up_trans_type_1').val(type); + $('#follow_up_trans_info_1').val(info); + $('#follow_up_trans_subject_1').val($('#order_transaction_description').val()); follow_up_window(); }; + ns.create_part = function() { + var data = $('#order_form').serializeArray(); + data.push({ name: 'action', value: 'Order/create_part' }); + + $.post("controller.pl", data, kivi.eval_json_result); + }; + }); $(function() {