url: 'controller.pl?action=Part/history&part.id=' + id,
dialog: { title: kivi.t8('History') },
});
- }
+ };
ns.save = function() {
var data = $('#ic').serializeArray();
};
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) {
$('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + 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);
};
$('#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);
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);
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;
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,
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();
},
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) {
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();
},
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();
});
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 = $('<span>').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);
},
},
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() {
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);
});
});
$('#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) {
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() {
});
$('#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;
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({
$('#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');
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);