Revision 8ad661b7
Von Bernd Bleßmann vor fast 4 Jahren hinzugefügt
js/kivi.Order.js | ||
---|---|---|
458 | 458 |
$.post("controller.pl", data, kivi.eval_json_result); |
459 | 459 |
}; |
460 | 460 |
|
461 |
ns.setup_multi_items_dialog = function() { |
|
462 |
$('#multi_items_filter_table input, #multi_items_filter_table select').keydown(function(event) { |
|
463 |
if (event.keyCode == 13) { |
|
464 |
event.preventDefault(); |
|
465 |
ns.multi_items_dialog_update_result(); |
|
466 |
return false; |
|
467 |
} |
|
468 |
}); |
|
469 |
|
|
470 |
$('#multi_items_filter_all_substr_multi_ilike').focus(); |
|
471 |
}; |
|
472 |
|
|
473 |
ns.show_multi_items_dialog = function() { |
|
474 |
if (!ns.check_cv()) return; |
|
475 |
|
|
476 |
$('#row_table_id thead a img').remove(); |
|
477 |
|
|
478 |
kivi.popup_dialog({ |
|
479 |
url: 'controller.pl?action=Order/show_multi_items_dialog', |
|
480 |
data: { type: $('#type').val() }, |
|
481 |
id: 'jq_multi_items_dialog', |
|
482 |
load: kivi.Order.setup_multi_items_dialog, |
|
483 |
dialog: { |
|
484 |
title: kivi.t8('Add multiple items'), |
|
485 |
width: 800, |
|
486 |
height: 500 |
|
487 |
} |
|
488 |
}); |
|
489 |
return true; |
|
490 |
}; |
|
491 |
|
|
492 |
ns.close_multi_items_dialog = function() { |
|
493 |
$('#jq_multi_items_dialog').dialog('close'); |
|
494 |
}; |
|
495 |
|
|
496 |
ns.multi_items_dialog_update_result = function() { |
|
497 |
var data = $('#multi_items_form').serializeArray(); |
|
498 |
data.push({ name: 'type', value: $('#type').val() }); |
|
499 |
$.ajax({ |
|
500 |
url: 'controller.pl?action=Order/multi_items_update_result', |
|
501 |
data: data, |
|
502 |
method: 'post', |
|
503 |
success: function(data) { |
|
504 |
$('#multi_items_result').html(data); |
|
505 |
ns.multi_items_dialog_enable_continue(); |
|
506 |
ns.multi_items_result_setup_events(); |
|
507 |
} |
|
508 |
}); |
|
509 |
}; |
|
510 |
|
|
511 |
ns.multi_items_dialog_disable_continue = function() { |
|
512 |
// disable keydown-event and continue button to prevent |
|
513 |
// impatient users to add parts multiple times |
|
514 |
$('#multi_items_result input, #multi_items_position').off("keydown"); |
|
515 |
$('#multi_items_dialog_continue_button').prop('disabled', true); |
|
516 |
}; |
|
517 |
|
|
518 |
ns.multi_items_dialog_enable_continue = function() { |
|
519 |
$('#multi_items_result input, #multi_items_position').keydown(function(event) { |
|
520 |
if(event.keyCode == 13) { |
|
521 |
event.preventDefault(); |
|
522 |
ns.add_multi_items(); |
|
523 |
return false; |
|
524 |
} |
|
525 |
}); |
|
526 |
$('#multi_items_dialog_continue_button').prop('disabled', false); |
|
527 |
}; |
|
528 |
|
|
529 |
ns.multi_items_result_setup_events = function() { |
|
530 |
$('#multi_items_all_qty').change(ns.reformat_number); |
|
531 |
$('#multi_items_all_qty').change(function(event) { |
|
532 |
$('.multi_items_qty').val($(event.target).val()); |
|
533 |
}); |
|
534 |
$('.multi_items_qty').change(ns.reformat_number); |
|
535 |
} |
|
536 |
|
|
537 |
ns.add_multi_items = function() { |
|
538 |
// rows at all |
|
539 |
var n_rows = $('.multi_items_qty').length; |
|
540 |
if (n_rows == 0) return; |
|
541 |
|
|
542 |
// filled rows |
|
543 |
n_rows = $('.multi_items_qty').filter(function() { |
|
544 |
return $(this).val().length > 0; |
|
545 |
}).length; |
|
546 |
if (n_rows == 0) return; |
|
547 |
|
|
548 |
ns.multi_items_dialog_disable_continue(); |
|
549 |
|
|
461 |
ns.add_multi_items = function(data) { |
|
550 | 462 |
var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val()); |
551 |
|
|
552 |
var data = $('#order_form').serializeArray(); |
|
553 |
data = data.concat($('#multi_items_form').serializeArray()); |
|
463 |
data = data.concat($('#order_form').serializeArray()); |
|
554 | 464 |
data.push({ name: 'action', value: 'Order/add_multi_items' }, |
555 | 465 |
{ name: 'insert_before_item_id', value: insert_before_item_id }); |
556 | 466 |
$.post("controller.pl", data, kivi.eval_json_result); |
557 | 467 |
}; |
558 | 468 |
|
559 |
ns.set_input_to_one = function(clicked) { |
|
560 |
if ($(clicked).val() == '') { |
|
561 |
$(clicked).val(kivi.format_amount(1.00, -2)); |
|
562 |
} |
|
563 |
$(clicked).select(); |
|
564 |
}; |
|
565 |
|
|
566 | 469 |
ns.delete_order_item_row = function(clicked) { |
567 | 470 |
var row = $(clicked).parents("tbody").first(); |
568 | 471 |
$(row).remove(); |
Auch abrufbar als: Unified diff
Auftrags-Controller: Artikel-Mehrfachauswahl auf die des PartPickers umgestellt