Revision 9fff4a29
Von Bernd Bleßmann vor etwa 8 Jahren hinzugefügt
templates/webpages/order/tabs/_multi_items_dialog.html | ||
---|---|---|
18 | 18 |
<div id='multi_items_result'></div> |
19 | 19 |
<hr> |
20 | 20 |
|
21 |
[% L.button_tag('add_multi_items()', LxERP.t8('Continue')) %] |
|
21 |
[% L.button_tag('add_multi_items()', LxERP.t8('Continue'), id='continue_button') %]
|
|
22 | 22 |
<a href="#" onclick="close_multi_items_dialog();">[%- LxERP.t8("Cancel") %]</a> |
23 | 23 |
|
24 | 24 |
<script type='text/javascript'> |
... | ... | |
31 | 31 |
method: 'post', |
32 | 32 |
success: function(data){ |
33 | 33 |
$('#multi_items_result').html(data); |
34 |
$('#multi_items_result input').keydown(function(event) { |
|
35 |
if(event.keyCode == 13) { |
|
36 |
event.preventDefault(); |
|
37 |
add_multi_items(); |
|
38 |
return false; |
|
39 |
} |
|
40 |
}); |
|
34 |
enable_continue(); |
|
41 | 35 |
} |
42 | 36 |
}); |
43 | 37 |
} |
44 | 38 |
|
39 |
function disable_continue() { |
|
40 |
// disable keydown-event and continue button to prevent |
|
41 |
// impatient users to add parts multiple times |
|
42 |
$('#multi_items_result input').off("keydown"); |
|
43 |
$('#continue_button').prop('disabled', true); |
|
44 |
} |
|
45 |
|
|
46 |
function enable_continue() { |
|
47 |
$('#multi_items_result input').keydown(function(event) { |
|
48 |
if(event.keyCode == 13) { |
|
49 |
event.preventDefault(); |
|
50 |
add_multi_items(); |
|
51 |
return false; |
|
52 |
} |
|
53 |
}); |
|
54 |
$('#continue_button').prop('disabled', false); |
|
55 |
} |
|
56 |
|
|
45 | 57 |
function add_multi_items() { |
58 |
// rows at all |
|
59 |
var n_rows = $('.multi_items_qty').length; |
|
60 |
if ( n_rows == 0) { return; } |
|
61 |
|
|
62 |
// filled rows |
|
63 |
n_rows = $('.multi_items_qty').filter(function() { |
|
64 |
return $(this).val().length > 0; |
|
65 |
}).length; |
|
66 |
if ( n_rows == 0) { return; } |
|
67 |
|
|
68 |
disable_continue(); |
|
69 |
|
|
46 | 70 |
var data = $('#[%- FORM.callback_data_id %]').serializeArray(); |
47 | 71 |
data = data.concat($('#multi_items_form').serializeArray()); |
48 | 72 |
data.push({ name: 'action', value: '[%- FORM.callback %]' }); |
Auch abrufbar als: Unified diff
Auftrags-Controller: Mehrfach-Artikelauswahl: Verbesserungen
- ungültige Artikel nicht anzeigen.
- Artikel nicht mehrfach hinzufügen, wenn ausversehen mehrfach Enter gedrückt
oder der Weiter-Knopf mehrfach angeklickt wird.