+ });
+ $('#part_selection').keydown(function(e){
+ if (e.which == KEY.ESCAPE) {
+ self.close_dialog();
+ self.pp.$dummy.focus();
+ }
+ });
+ },
+ result_timer: function(event) {
+ var self = this;
+ if (!$('no_paginate').prop('checked')) {
+ if (event.keyCode == KEY.PAGE_UP) {
+ $('#part_picker_result a.paginate-prev').click();
+ return;
+ }
+ if (event.keyCode == KEY.PAGE_DOWN) {
+ $('#part_picker_result a.paginate-next').click();
+ return;
+ }
+ }
+ window.clearTimeout(this.timer);
+ if (event.which == KEY.ENTER) {
+ self.update_results();
+ } else {
+ this.timer = window.setTimeout(function() { self.update_results() }, 100);
+ }
+ },
+ close_dialog: function() {
+ $('#part_selection').dialog('close');
+ }
+ };
+
+ ns.PickerMultiPopup = function(pp) {
+ this.pp = pp;
+ this.callback = 'Part/add_multi_' + this.pp.o.part_type + '_items';
+ this.open_dialog();
+ };
+
+ ns.PickerMultiPopup.prototype = {
+ open_dialog: function() {
+ var self = this;
+ $('#row_table_id thead a img').remove();
+
+ kivi.popup_dialog({
+ url: 'controller.pl?action=Part/show_multi_items_dialog',
+ data: $.extend({
+ real_id: self.pp.real_id,
+ }, self.pp.ajax_data(this.pp.$dummy.val())),
+ id: 'jq_multi_items_dialog',
+ dialog: {
+ title: kivi.t8('Add multiple items'),
+ width: 800,
+ height: 800
+ },
+ load: function() {
+ self.init_search();
+ }
+ });
+ return true;
+ },
+ init_search: function() {
+ var self = this;
+ $('#multi_items_filter_table input, #multi_items_filter_table select').keydown(function(event) {
+ if(event.which == KEY.ENTER) {
+ event.preventDefault();
+ self.update_results();
+ return false;
+ }
+ });
+
+ $('#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() });
+ },
+ update_results: function() {
+ var self = this;
+ var data = $('#multi_items_form').serializeArray();
+ data.push({ name: 'type', value: self.pp.type });
+ $.ajax({
+ url: 'controller.pl?action=Part/multi_items_update_result',
+ data: data,
+ method: 'post',
+ success: function(data){
+ $('#multi_items_result').html(data);
+ self.init_results();
+ self.enable_continue();
+ }
+ });
+ },
+ set_qty_to_one: function(clicked) {
+ if ($(clicked).val() === '') {
+ $(clicked).val(kivi.format_amount(1.00, -2));