Revision 96145038
Von Bernd Bleßmann vor 4 Monaten hinzugefügt
- ID 96145038a7ff693efd5fd07c0f058caa76922105
- Vorgänger a833c262
SL/Controller/Warehouse.pm | ||
---|---|---|
47 | 47 |
my ($self) = @_; |
48 | 48 |
|
49 | 49 |
my $wh_id = $::form->{wh_id}; |
50 |
my $bin_id = $::form->{bin_id}; |
|
50 | 51 |
my $bin_dom_id = $::form->{bin_dom_id} || 'bin'; |
51 | 52 |
|
52 | 53 |
my $bins = $wh_id ? SL::DB::Warehouse->new(id => $wh_id)->load->bins_sorted_naturally |
53 | 54 |
: [{id => '', description => ''}]; |
54 | 55 |
|
55 |
$self->js->run('kivi.Warehouse.wh_bin_select_update_bins', $bin_dom_id, [map { {key => $_->{id}, value => $_->{description}} } @$bins]) |
|
56 |
$self->js->run('kivi.Warehouse.wh_bin_select_update_bins', |
|
57 |
$bin_dom_id, |
|
58 |
[map { {key => $_->{id}, value => $_->{description}} } @$bins], |
|
59 |
$bin_id) |
|
56 | 60 |
->render; |
57 | 61 |
} |
58 | 62 |
|
js/kivi.Warehouse.js | ||
---|---|---|
3 | 3 |
ns.wh_changed = function(target) { |
4 | 4 |
const wh_id = $(target).val(); |
5 | 5 |
const bin_dom_id = $(target).data('bin-dom-id'); |
6 |
const bin_id = $('#' + bin_dom_id).val(); |
|
7 |
|
|
6 | 8 |
$.post("controller.pl", { action: 'Warehouse/wh_bin_select_update_bins', |
7 | 9 |
wh_id: wh_id, |
10 |
bin_id: bin_id, |
|
8 | 11 |
bin_dom_id: bin_dom_id }, |
9 | 12 |
kivi.eval_json_result); |
10 | 13 |
}; |
11 | 14 |
|
12 |
ns.wh_bin_select_update_bins = function(bin_dom_id, bins) { |
|
15 |
ns.wh_bin_select_update_bins = function(bin_dom_id, bins, selected_bin) {
|
|
13 | 16 |
const $bin_select = $('#' + bin_dom_id); |
14 | 17 |
$bin_select.empty(); |
18 |
|
|
15 | 19 |
$.each(bins, function(idx, elt) { |
16 |
$bin_select.append($('<option/>', {value: elt.key, text: elt.value})); |
|
20 |
if (elt.key == selected_bin) { |
|
21 |
$bin_select.append($('<option/>', {value: elt.key, text: elt.value, selected: 1})); |
|
22 |
} else { |
|
23 |
$bin_select.append($('<option/>', {value: elt.key, text: elt.value})); |
|
24 |
} |
|
17 | 25 |
}); |
18 | 26 |
}; |
19 | 27 |
|
Auch abrufbar als: Unified diff
Presenter Lagerplatz: Beim Laden vorbelegte Auswahl berücksichtigen