Revision 96145038
Von Bernd Bleßmann vor 6 Monaten hinzugefügt
- ID 96145038a7ff693efd5fd07c0f058caa76922105
- Vorgänger a833c262
SL/Controller/Warehouse.pm | ||
---|---|---|
my ($self) = @_;
|
||
|
||
my $wh_id = $::form->{wh_id};
|
||
my $bin_id = $::form->{bin_id};
|
||
my $bin_dom_id = $::form->{bin_dom_id} || 'bin';
|
||
|
||
my $bins = $wh_id ? SL::DB::Warehouse->new(id => $wh_id)->load->bins_sorted_naturally
|
||
: [{id => '', description => ''}];
|
||
|
||
$self->js->run('kivi.Warehouse.wh_bin_select_update_bins', $bin_dom_id, [map { {key => $_->{id}, value => $_->{description}} } @$bins])
|
||
$self->js->run('kivi.Warehouse.wh_bin_select_update_bins',
|
||
$bin_dom_id,
|
||
[map { {key => $_->{id}, value => $_->{description}} } @$bins],
|
||
$bin_id)
|
||
->render;
|
||
}
|
||
|
js/kivi.Warehouse.js | ||
---|---|---|
ns.wh_changed = function(target) {
|
||
const wh_id = $(target).val();
|
||
const bin_dom_id = $(target).data('bin-dom-id');
|
||
const bin_id = $('#' + bin_dom_id).val();
|
||
|
||
$.post("controller.pl", { action: 'Warehouse/wh_bin_select_update_bins',
|
||
wh_id: wh_id,
|
||
bin_id: bin_id,
|
||
bin_dom_id: bin_dom_id },
|
||
kivi.eval_json_result);
|
||
};
|
||
|
||
ns.wh_bin_select_update_bins = function(bin_dom_id, bins) {
|
||
ns.wh_bin_select_update_bins = function(bin_dom_id, bins, selected_bin) {
|
||
const $bin_select = $('#' + bin_dom_id);
|
||
$bin_select.empty();
|
||
|
||
$.each(bins, function(idx, elt) {
|
||
$bin_select.append($('<option/>', {value: elt.key, text: elt.value}));
|
||
if (elt.key == selected_bin) {
|
||
$bin_select.append($('<option/>', {value: elt.key, text: elt.value, selected: 1}));
|
||
} else {
|
||
$bin_select.append($('<option/>', {value: elt.key, text: elt.value}));
|
||
}
|
||
});
|
||
};
|
||
|
Auch abrufbar als: Unified diff
Presenter Lagerplatz: Beim Laden vorbelegte Auswahl berücksichtigen