From: Sven Schöling Date: Fri, 21 May 2021 14:27:29 +0000 (+0200) Subject: Part: eslint fixes X-Git-Tag: kivitendo-mebil_0.1-0~9^2~120 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9e05d02964016b3b281aad130433bac08c09cb34;p=kivitendo-erp.git Part: eslint fixes --- diff --git a/js/kivi.Part.js b/js/kivi.Part.js index b83fb044d..6207569f6 100644 --- a/js/kivi.Part.js +++ b/js/kivi.Part.js @@ -7,7 +7,7 @@ namespace('kivi.Part', function(ns) { url: 'controller.pl?action=Part/history&part.id=' + id, dialog: { title: kivi.t8('History') }, }); - } + }; ns.save = function() { var data = $('#ic').serializeArray(); @@ -34,7 +34,7 @@ namespace('kivi.Part', function(ns) { }; ns.set_tab_active_by_index = function (index) { - $("#ic_tabs").tabs({active: index}) + $("#ic_tabs").tabs({active: index}); }; ns.set_tab_active_by_name= function (name) { @@ -66,26 +66,32 @@ namespace('kivi.Part', function(ns) { $('#' + order_by + '_header_id a').append('' + kivi.t8('sort items') + ''); - data.push({ name: 'action', value: 'Part/reorder_items' }, - { name: 'order_by', value: order_by }, - { name: 'part_type', value: part_type }, - { name: 'sort_dir', value: dir }); + data.push( + { name: 'action', value: 'Part/reorder_items' }, + { name: 'order_by', value: order_by }, + { name: 'part_type', value: part_type }, + { name: 'sort_dir', value: dir } + ); $.post("controller.pl", data, kivi.eval_json_result); }; ns.assortment_recalc = function() { var data = $('#assortment :input').serializeArray(); - data.push({ name: 'action', value: 'Part/update_item_totals' }, - { name: 'part_type', value: 'assortment' }); + data.push( + { name: 'action', value: 'Part/update_item_totals' }, + { name: 'part_type', value: 'assortment' } + ); $.post("controller.pl", data, kivi.eval_json_result); }; ns.assembly_recalc = function() { var data = $('#assembly :input').serializeArray(); - data.push( { name: 'action', value: 'Part/update_item_totals' }, - { name: 'part_type', value: 'assembly' }); + data.push( + { name: 'action', value: 'Part/update_item_totals' }, + { name: 'part_type', value: 'assembly' } + ); $.post("controller.pl", data, kivi.eval_json_result); }; @@ -159,9 +165,11 @@ namespace('kivi.Part', function(ns) { $('#row_table_id thead a img').remove(); var data = $('#assortment :input').serializeArray(); - data.push({ name: 'action', value: 'Part/add_assortment_item' }, - { name: 'part.id', value: $('#part_id').val() }, - { name: 'part.part_type', value: 'assortment' }); + data.push( + { name: 'action', value: 'Part/add_assortment_item' }, + { name: 'part.id', value: $('#part_id').val() }, + { name: 'part.part_type', value: 'assortment' } + ); $('#assortment_picker').data('part_picker').clear(); $.post("controller.pl", data, kivi.eval_json_result); @@ -171,9 +179,11 @@ namespace('kivi.Part', function(ns) { if ($('#assembly_picker').val() === '') return; var data = $('#assembly :input').serializeArray(); - data.push({ name: 'action', value: 'Part/add_assembly_item' }, - { name: 'part.id', value: $("#part_id").val() }, - { name: 'part.part_type', value: 'assembly' }); + data.push( + { name: 'action', value: 'Part/add_assembly_item' }, + { name: 'part.id', value: $("#part_id").val() }, + { name: 'part.part_type', value: 'assembly' } + ); $('#assembly_picker').data('part_picker').clear(); $.post("controller.pl", data, kivi.eval_json_result); @@ -183,20 +193,20 @@ namespace('kivi.Part', function(ns) { data.push({ name: 'part.id', value: $('#part_id').val() }); data.push({ name: 'part.part_type', value: $('#part_part_type').val() }); $.post("controller.pl?action=Part/add_multi_assembly_items", data, kivi.eval_json_result); - } + }; ns.set_multi_assortment_items = function(data) { data.push({ name: 'part.id', value: $('#part_id').val() }); data.push({ name: 'part.part_type', value: $('#part_part_type').val() }); $.post("controller.pl?action=Part/add_multi_assortment_items", data, kivi.eval_json_result); - } + }; ns.close_picker_dialogs = function() { $('.part_autocomplete').each(function(_, e) { var picker = $(e).data('part_picker'); if (picker && picker.dialog) picker.close_dialog(); }); - } + }; ns.redisplay_items = function(data) { var old_rows; @@ -285,8 +295,8 @@ namespace('kivi.Part', function(ns) { ns.reload_bin_selection = function() { - $.post("controller.pl", { action: 'Part/warehouse_changed', warehouse_id: function(){ return $('#part_warehouse_id').val() } }, kivi.eval_json_result); - } + $.post("controller.pl", { action: 'Part/warehouse_changed', warehouse_id: function(){ return $('#part_warehouse_id').val(); } }, kivi.eval_json_result); + }; var KEY = { TAB: 9, @@ -402,11 +412,11 @@ namespace('kivi.Part', function(ns) { make_defined_state: function() { if (this.state == this.STATES.PICKED) { this.annotate_state(); - return true - } else if (this.state == this.STATES.UNDEFINED && this.$dummy.val() === '') - this.set_item({}) - else { - this.set_item({ id: this.last_real, name: this.last_dummy }) + return true; + } else if (this.state == this.STATES.UNDEFINED && this.$dummy.val() === '') { + this.set_item({}); + } else { + this.set_item({ id: this.last_real, name: this.last_dummy }); } this.annotate_state(); }, @@ -507,7 +517,7 @@ namespace('kivi.Part', function(ns) { url: 'controller.pl?action=Part/ajax_autocomplete', dataType: "json", data: self.ajax_data(req.term), - success: function (data){ rsp(data) } + success: function (data){ rsp(data); } })); }, select: function(event, ui) { @@ -516,7 +526,7 @@ namespace('kivi.Part', function(ns) { self.run_action(self.o.action.commit_one); } }, - search: function(event, ui) { + search: function(event) { if ((event.which == KEY.SHIFT) || (event.which == KEY.CTRL) || (event.which == KEY.ALT)) event.preventDefault(); }, @@ -527,7 +537,7 @@ namespace('kivi.Part', function(ns) { self.autocomplete_open = false; } }); - this.$dummy.keydown(function(event){ self.handle_keydown(event) }); + this.$dummy.keydown(function(event){ self.handle_keydown(event); }); this.$dummy.on('paste', function(){ setTimeout(function() { self.handle_changed_text(); @@ -535,16 +545,16 @@ namespace('kivi.Part', function(ns) { }); this.$dummy.blur(function(){ window.clearTimeout(self.timer); - self.timer = window.setTimeout(function() { self.annotate_state() }, 100); + self.timer = window.setTimeout(function() { self.annotate_state(); }, 100); }); var popup_button = $('').addClass('ppp_popup_button'); this.$dummy.after(popup_button); - popup_button.click(function() { self.open_dialog() }); + popup_button.click(function() { self.open_dialog(); }); }, run_action: function(code, args) { if (typeof code === 'function') - code.apply(this, args) + code.apply(this, args); else kivi.run(code, args); }, @@ -584,8 +594,8 @@ namespace('kivi.Part', function(ns) { }, init_search: function() { var self = this; - $('#part_picker_filter').keypress(function(e) { self.result_timer(e) }).focus(); - $('#no_paginate').change(function() { self.update_results() }); + $('#part_picker_filter').keypress(function(e) { self.result_timer(e); }).focus(); + $('#no_paginate').change(function() { self.update_results(); }); this.update_results(); }, update_results: function() { @@ -596,7 +606,7 @@ namespace('kivi.Part', function(ns) { no_paginate: $('#no_paginate').prop('checked') ? 1 : 0, }, self.pp.ajax_data(function(){ var val = $('#part_picker_filter').val(); - return val === undefined ? '' : val + return val === undefined ? '' : val; })), success: function(data){ $('#part_picker_result').html(data); @@ -623,10 +633,10 @@ namespace('kivi.Part', function(ns) { }); }); $('#part_selection').keydown(function(e){ - if (e.which == KEY.ESCAPE) { - self.close_dialog(); - self.pp.$dummy.focus(); - } + if (e.which == KEY.ESCAPE) { + self.close_dialog(); + self.pp.$dummy.focus(); + } }); }, result_timer: function(event) { @@ -645,7 +655,7 @@ namespace('kivi.Part', function(ns) { if (event.which == KEY.ENTER) { self.update_results(); } else { - this.timer = window.setTimeout(function() { self.update_results() }, 100); + this.timer = window.setTimeout(function() { self.update_results(); }, 100); } }, close_dialog: function() { @@ -693,9 +703,9 @@ namespace('kivi.Part', function(ns) { }); $('#multi_items_filter_all_substr_multi_ilike').focus(); - $('#multi_items_filter_button').click(function(){ self.update_results() }); - $('#multi_items_filter_reset').click(function(){ $("#multi_items_form").resetForm() }); - $('#continue_button').click(function(){ self.add_multi_items() }); + $('#multi_items_filter_button').click(function(){ self.update_results(); }); + $('#multi_items_filter_reset').click(function(){ $("#multi_items_form").resetForm(); }); + $('#continue_button').click(function(){ self.add_multi_items(); }); }, update_results: function() { var self = this; @@ -704,7 +714,7 @@ namespace('kivi.Part', function(ns) { data.push({ name: 'limit', value: self.pp.o.multiple_limit }); var ppdata = self.pp.ajax_data(function(){ var val = $('#multi_items_filter').val(); - return val === undefined ? '' : val + return val === undefined ? '' : val; }); $.each(Object.keys(ppdata), function() {data.push({ name: 'multi_items.' + this, value: ppdata[this]});}); $.ajax({ @@ -729,9 +739,9 @@ namespace('kivi.Part', function(ns) { $('#multi_items_all_qty').change(function(event){ $('.multi_items_qty').val($(event.target).val()); }); - $('.multi_items_qty').click(function(){ self.set_qty_to_one(this) }); + $('.multi_items_qty').click(function(){ self.set_qty_to_one(this); }); }, - result_timer: function(event) { + result_timer: function() { }, close_dialog: function() { $('#jq_multi_items_dialog').dialog('close'); @@ -782,15 +792,15 @@ namespace('kivi.Part', function(ns) { kivi.run_once_for('#makemodel_rows', 'makemodel_row_sort_renumber', function(elt) { $(elt).on('sortstop', kivi.Part.makemodel_renumber_positions); }); - } + }; ns.init = function() { ns.reinit_widgets(); - } + }; $(function(){ $('#ic').on('focusout', '.reformat_number', function(event) { - ns.reformat_number(event); + ns.reformat_number(event); }); $('#part_warehouse_id').change(kivi.Part.reload_bin_selection);