use Clone qw(clone);
use SL::DB::Part;
+use SL::DB::PartsGroup;
use SL::Controller::Helper::GetModels;
use SL::Locale::String qw(t8);
use SL::JSON;
my $item_objects = $self->parse_add_items_to_objects(part_type => 'assortment');
my $html = $self->render_assortment_items_to_html($item_objects);
- $self->js->run('kivi.Part.close_multi_items_dialog')
+ $self->js->run('kivi.Part.close_picker_dialogs')
->append('#assortment_rows', $html)
->run('kivi.Part.renumber_positions')
->run('kivi.Part.assortment_recalc')
my $html = $self->render_assembly_items_to_html(\@checked_objects);
- $self->js->run('kivi.Part.close_multi_items_dialog')
+ $self->js->run('kivi.Part.close_picker_dialogs')
->append('#assembly_rows', $html)
->run('kivi.Part.renumber_positions')
->run('kivi.Part.assembly_recalc')
}
sub action_show_multi_items_dialog {
- require SL::DB::PartsGroup;
$_[0]->render('part/_multi_items_dialog', { layout => 0 },
- part_type => 'assortment',
- partfilter => '', # can I get at the current input of the partpicker here?
- all_partsgroups => SL::DB::Manager::PartsGroup->get_all);
+ all_partsgroups => SL::DB::Manager::PartsGroup->get_all
+ );
}
sub action_multi_items_update_result {
}
sub action_part_picker_search {
- $_[0]->render('part/part_picker_search', { layout => 0 }, parts => $_[0]->parts);
+ $_[0]->render('part/part_picker_search', { layout => 0 });
}
sub action_part_picker_result {
- $_[0]->render('part/_part_picker_result', { layout => 0 });
+ $_[0]->render('part/_part_picker_result', { layout => 0 }, parts => $_[0]->parts);
}
sub action_show {
<td></td>
<td></td>
<td align="right">[% 'Part' | $T8 %]:</td>
- <td>[% L.part_picker('add_items[+].parts_id' , '' , style='width: 300px' , class="add_assembly_item_input") %][% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
+ <td>[% L.part_picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assembly_picker', action={set_multi_items='kivi.Part.set_multi_assembly_items', on_enter_match_one='kivi.Part.add_assembly_item'}) %]</td>
<td>[%- L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %]</td>
- <td>[% L.button_tag('kivi.Part.show_multi_items_dialog("assembly",' _ SELF.part.id _ ')', LxERP.t8('Add multiple items')) %]</td>
+ <td>[% L.button_tag('$("#assembly_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items')) %]</td>
+ <td>[% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
[% ELSE %]
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
- [% END %]
<td></td>
+ [% END %]
<td align="right">[% 'Totals' | $T8 %]:</td>
<td></td>
<td id="items_sellprice_sum" class="numeric">[%- LxERP.format_amount(items_sellprice_sum, 2, 0) %]</td>
<td></td>
<td></td>
<td align="right">[% 'Part' | $T8 %]:</td>
- <td>[% L.part_picker('add_items[+].parts_id' , '' , style='width: 300px' , class="add_assortment_item_input") %][% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
+ <td>[% L.part_picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assortment_picker', action={set_multi_items='kivi.Part.set_multi_assortment_items'}) %]</td>
<td>[%- L.button_tag("kivi.Part.add_assortment_item()", LxERP.t8("Add")) %]</td>
- <td>[% L.button_tag('kivi.Part.show_multi_items_dialog("assortment",' _ SELF.part.id _ ')', LxERP.t8('Add multiple items')) %]</td>
- <td></td>
+ <td>[% L.button_tag('$("#assortment_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items')) %]</td>
+ <td>[% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
[% ELSE %]
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
+ <td></td>
[% END %]
<td></td>
<td align="right">[% 'Totals' | $T8 %]:</td>