Revision 7fbadb1d
Von Cem Aydin vor etwa 2 Jahren hinzugefügt
templates/design40_webpages/common/select_warehouse_bin.html | ||
---|---|---|
1 |
[% USE T8 %] |
|
2 |
[% USE HTML %] |
|
3 |
[% USE LxERP %] |
|
4 |
[% USE JavaScript %] |
|
5 |
|
|
6 |
<script type="text/javascript" src="js/common.js"></script> |
|
7 |
<script type="text/javascript"> |
|
8 |
warehouses = new Array(); |
|
9 |
[% USE WAREHOUSES_it = Iterator(WAREHOUSES) %] |
|
10 |
[% FOREACH warehouse = WAREHOUSES_it %] |
|
11 |
warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array(); |
|
12 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %]; |
|
13 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array(); |
|
14 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][0] = new Array(); |
|
15 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][0]['description'] = "---"; |
|
16 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][0]['id'] = ""; |
|
17 |
[% USE BINS_it = Iterator(warehouse.BINS) %] |
|
18 |
[% FOREACH bin = BINS_it %] |
|
19 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count %]] = new Array(); |
|
20 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count %]]['description'] = "[% JavaScript.escape(bin.description) %]"; |
|
21 |
warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count %]]['id'] = [% bin.id %]; |
|
22 |
[% END %] |
|
23 |
[% END %] |
|
24 |
|
|
25 |
function warehouse_selected(warehouse_id, bin_id) { |
|
26 |
var control = document.getElementById("bin_id"); |
|
27 |
|
|
28 |
for (var i = control.options.length - 1; i >= 0; i--) { |
|
29 |
control.options[i] = null; |
|
30 |
} |
|
31 |
|
|
32 |
var warehouse_index = 0; |
|
33 |
|
|
34 |
for (i = 0; i < warehouses.length; i++) |
|
35 |
if (warehouses[i]['id'] == warehouse_id) { |
|
36 |
warehouse_index = i; |
|
37 |
break; |
|
38 |
} |
|
39 |
|
|
40 |
var warehouse = warehouses[warehouse_index]; |
|
41 |
var bin_index = 0; |
|
42 |
|
|
43 |
for (i = 0; i < warehouse['bins'].length; i++) |
|
44 |
if (warehouse['bins'][i]['id'] == bin_id) { |
|
45 |
bin_index = i; |
|
46 |
break; |
|
47 |
} |
|
48 |
|
|
49 |
for (i = 0; i < warehouse['bins'].length; i++) { |
|
50 |
control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']); |
|
51 |
} |
|
52 |
|
|
53 |
|
|
54 |
control.options[bin_index].selected = true; |
|
55 |
} |
|
56 |
|
|
57 |
$(function() { |
|
58 |
warehouse_selected([% warehouse_id %], [% bin_id %]); |
|
59 |
}) |
|
60 |
</script> |
Auch abrufbar als: Unified diff
design40: common/select_warehouse_bin.html Template kopiert
- Einrückung angepasst
- HTML Kommentare aus script Tag entfernt (nicht mehr nötig,
siehe z.B. https://stackoverflow.com/questions/808816/are-html-comments-inside-script-tags-a-best-practice )