Revision 58cdbaae
Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt
templates/webpages/part/_multi_assortments_dialog.html | ||
---|---|---|
1 |
[%- USE T8 %][%- USE HTML %][%- USE L %][%- USE LxERP %] |
|
2 |
|
|
3 |
<form method="post" id="multi_items_form" method="POST"> |
|
4 |
|
|
5 |
<table id='multi_items_filter_table'> |
|
6 |
<tr> |
|
7 |
<th>[%- LxERP.t8("Description") %]/[%- LxERP.t8("Partnumber") %]:</th> |
|
8 |
<td>[%- L.input_tag('multi_items.filter.all:substr:multi::ilike', '') %]</td> |
|
9 |
<th>[%- LxERP.t8("Partsgroup") %]</th> |
|
10 |
<td>[%- L.select_tag('multi_items.filter.partsgroup_id', all_partsgroups, title_key='displayable_name', value_key='id', with_empty=1) %]</td> |
|
11 |
<tr> |
|
12 |
</table> |
|
13 |
|
|
14 |
[% L.button_tag('update_result()', LxERP.t8('Filter')) %] |
|
15 |
<a href='#' onClick='javascript:$("#multi_items_filter_table input").val("");$("#multi_items_filter_table input[type=checkbox]").prop("checked", 0);$("#multi_items_filter_table select").prop("selectedIndex", 0);'>[% 'Reset' | $T8 %]</a> |
|
16 |
|
|
17 |
<hr> |
|
18 |
<div id='multi_items_result'></div> |
|
19 |
<hr> |
|
20 |
|
|
21 |
[% L.button_tag('add_multi_items()', LxERP.t8('Continue'), id='continue_button') %] |
|
22 |
<a href="#" onclick="kivi.Part.close_multi_items_dialog();">[%- LxERP.t8("Cancel") %]</a> |
|
23 |
|
|
24 |
<script type='text/javascript'> |
|
25 |
function update_result() { |
|
26 |
var data = $('#multi_items_form').serializeArray(); |
|
27 |
data.push({ name: 'type', value: '[%- FORM.type %]' }); |
|
28 |
$.ajax({ |
|
29 |
url: 'controller.pl?action=Part/multi_items_update_result', |
|
30 |
data: data, |
|
31 |
method: 'post', |
|
32 |
success: function(data){ |
|
33 |
$('#multi_items_result').html(data); |
|
34 |
enable_continue(); |
|
35 |
} |
|
36 |
}); |
|
37 |
} |
|
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 |
|
|
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 |
|
|
70 |
var data = $('#[%- FORM.callback_data_id %]').serializeArray(); |
|
71 |
data = data.concat($('#multi_items_form').serializeArray()); |
|
72 |
data.push({ name: 'action', value: '[%- FORM.callback %]' }); |
|
73 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
74 |
} |
|
75 |
|
|
76 |
$('#multi_items_filter_table input, #multi_items_filter_table select').keydown(function(event) { |
|
77 |
if(event.keyCode == 13) { |
|
78 |
event.preventDefault(); |
|
79 |
update_result(); |
|
80 |
return false; |
|
81 |
} |
|
82 |
}); |
|
83 |
|
|
84 |
$('#multi_items_filter_all_substr_multi_ilike').focus(); |
|
85 |
</script> |
|
86 |
|
|
87 |
</form> |
Auch abrufbar als: Unified diff
Part Controller - altes Template entfernt
wurde ersetzt durch templates/webpages/part/_multi_items_dialog.html