X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/068063804d2061fe26e70f7bfdba2a99c18d935a..8fdb9983021ac73551052681d3a9d69514447a58:/js/kivi.Order.js diff --git a/js/kivi.Order.js b/js/kivi.Order.js index 1a5924c11..298a8b51b 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -35,9 +35,19 @@ namespace('kivi.Order', function(ns) { return true; }; - ns.save = function(action, warn_on_duplicates) { + ns.check_valid_reqdate = function() { + if ($('#order_reqdate').val() === '') { + alert(kivi.t8('Please select a delivery date.')); + return false; + } else { + return true; + } + }; + + ns.save = function(action, warn_on_duplicates, warn_on_reqdate) { if (!ns.check_cv()) return; if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return; + if (warn_on_reqdate && !ns.check_valid_reqdate()) return; var data = $('#order_form').serializeArray(); data.push({ name: 'action', value: 'Order/' + action }); @@ -150,6 +160,10 @@ namespace('kivi.Order', function(ns) { email_dialog.dialog("close"); }; + ns.set_number_in_title = function(elt) { + $('#nr_in_title').html($(elt).val()); + }; + ns.reload_cv_dependant_selections = function() { var data = $('#order_form').serializeArray(); data.push({ name: 'action', value: 'Order/customer_vendor_changed' }); @@ -446,6 +460,7 @@ namespace('kivi.Order', function(ns) { }; ns.price_chooser_item_row = function(clicked) { + if (!ns.check_cv()) return; var row = $(clicked).parents("tbody").first(); var item_id_dom = $(row).find('[name="orderitem_ids[+]"]'); @@ -587,6 +602,47 @@ namespace('kivi.Order', function(ns) { return true; }; + ns.show_vc_details_dialog = function() { + if (!ns.check_cv()) return; + var vc; + var vc_id; + var title; + if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) { + vc = 'customer'; + vc_id = $('#order_customer_id').val(); + title = kivi.t8('Customer details'); + } else { + vc = 'vendor'; + vc_id = $('#order_vendor_id').val(); + title = kivi.t8('Vendor details'); + } + + kivi.popup_dialog({ + url: 'controller.pl', + data: { action: 'Order/show_customer_vendor_details_dialog', + type : $('#type').val(), + vc : vc, + vc_id : vc_id + }, + id: 'jq_customer_vendor_details_dialog', + dialog: { + title: title, + width: 800, + height: 650 + } + }); + return true; + }; + + ns.show_calculate_qty_dialog = function(clicked) { + var row = $(clicked).parents("tbody").first(); + var input_id = $(row).find('[name="order.orderitems[].qty_as_number"]').attr('id'); + var formula_id = $(row).find('[name="formula[+]"]').attr('id'); + + calculate_qty_selection_dialog("", input_id, "", formula_id); + return true; + } + }); $(function(){