<tr>
</table>
-[% L.button_tag('update_result()', LxERP.t8('Filter')) %]
-<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>
+[% L.button_tag('kivi.Order.multi_items_dialog_update_result()', LxERP.t8('Filter')) %]
+[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
<hr>
<div id='multi_items_result'></div>
<hr>
-[% L.button_tag('add_multi_items()', LxERP.t8('Continue'), id='continue_button') %]
+[% L.button_tag('kivi.Order.add_multi_items()', LxERP.t8('Continue'), id='multi_items_dialog_continue_button') %]
<a href="#" onclick="kivi.Order.close_multi_items_dialog();">[%- LxERP.t8("Cancel") %]</a>
-<script type='text/javascript'>
-function update_result() {
- var data = $('#multi_items_form').serializeArray();
- data.push({ name: 'type', value: '[%- FORM.type %]' });
- $.ajax({
- url: 'controller.pl?action=Order/multi_items_update_result',
- data: data,
- method: 'post',
- success: function(data){
- $('#multi_items_result').html(data);
- enable_continue();
- }
- });
-}
-
-function disable_continue() {
- // disable keydown-event and continue button to prevent
- // impatient users to add parts multiple times
- $('#multi_items_result input').off("keydown");
- $('#continue_button').prop('disabled', true);
-}
-
-function enable_continue() {
- $('#multi_items_result input').keydown(function(event) {
- if(event.keyCode == 13) {
- event.preventDefault();
- add_multi_items();
- return false;
- }
- });
- $('#continue_button').prop('disabled', false);
-}
-
-function add_multi_items() {
- // 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; }
-
- disable_continue();
-
- var data = $('#[%- FORM.callback_data_id %]').serializeArray();
- data = data.concat($('#multi_items_form').serializeArray());
- data.push({ name: 'action', value: '[%- FORM.callback %]' });
- $.post("controller.pl", data, kivi.eval_json_result);
-}
-
-$('#multi_items_filter_table input, #multi_items_filter_table select').keydown(function(event) {
- if(event.keyCode == 13) {
- event.preventDefault();
- update_result();
- return false;
- }
-});
-
-$('#multi_items_filter_all_substr_multi_ilike').focus();
-</script>
</form>