Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5a577869

Von Hans Peter Schlaepfer vor mehr als 5 Jahren hinzugefügt

  • ID 5a5778690d576dc50a3209255c219a6463a6d7ed
  • Vorgänger ccbe3efb
  • Nachfolger a8253337

Neues kivitendo Design Aenderungen in templates/webpages/wh/..

Unterschiede anzeigen:

templates/webpages/wh/warehouse_selection_assembly.html
1
[%- USE T8 %]
2
[%- USE L %]
3
[%- USE HTML %][%- USE JavaScript %][%- USE LxERP %][%- USE P -%]
1
[% USE T8 %]
2
[% USE L %]
3
[% USE HTML %]
4
[% USE JavaScript %]
5
[% USE LxERP %]
6
[% USE P %]
7

  
4 8
<h1>[% title %]</h1>
5 9

  
6
 <script type="text/javascript">
7
  <!--
8
      warehouses = new Array();
9
      [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
10
      warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
11
      warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
12
      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
13
      [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
10
<script type="text/javascript"><!--
11
  warehouses = new Array();
12
  [% USE WAREHOUSES_it = Iterator(WAREHOUSES) %]
13
  [% FOREACH warehouse = WAREHOUSES_it %]
14
    warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
15
    warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
16
    warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
17
    [% USE BINS_it = Iterator(warehouse.BINS) %]
18
    [% FOREACH bin = BINS_it %]
14 19
      warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]] = new Array();
15 20
      warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
16 21
      warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
17
      [% END %]
18
      [% END %]
22
    [% END %]
23
  [% END %]
19 24

  
20
      function warehouse_selected(warehouse_id, bin_id) {
21
        var control = document.getElementById("bin_id");
25
  function warehouse_selected(warehouse_id, bin_id) {
26
    var control = document.getElementById("bin_id");
22 27

  
23
        for (var i = control.options.length - 1; i >= 0; i--) {
24
          control.options[i] = null;
25
        }
28
    for (var i = control.options.length - 1; i >= 0; i--) {
29
      control.options[i] = null;
30
    }
26 31

  
27
        var warehouse_index = 0;
32
    var warehouse_index = 0;
28 33

  
29
        for (i = 0; i < warehouses.length; i++)
30
          if (warehouses[i]['id'] == warehouse_id) {
31
            warehouse_index = i;
32
            break;
33
          }
34
    for (i = 0; i < warehouses.length; i++)
35
      if (warehouses[i]['id'] == warehouse_id) {
36
        warehouse_index = i;
37
        break;
38
      }
34 39

  
35
        var warehouse = warehouses[warehouse_index];
36
        var bin_index = 0;
40
    var warehouse = warehouses[warehouse_index];
41
    var bin_index = 0;
37 42

  
38
        for (i = 0; i < warehouse['bins'].length; i++)
39
          if (warehouse['bins'][i]['id'] == bin_id) {
40
            bin_index = i;
41
            break;
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
      }
43 48

  
44
        for (i = 0; i < warehouse['bins'].length; i++) {
45
          control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
46
        }
49
    for (i = 0; i < warehouse['bins'].length; i++) {
50
      control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
51
    }
47 52

  
48 53

  
49
        control.options[bin_index].selected = true;
50
      }
54
    control.options[bin_index].selected = true;
55
  }
51 56

  
52
      $(function() {
53
        warehouse_selected([% warehouse_id %], [% bin_id %]);
54
      })
55
    -->
56
 </script>
57
  $(function() {
58
    warehouse_selected([% warehouse_id %], [% bin_id %]);
59
  })
60
--></script>
57 61

  
58
 <form name="Form" method="post" action="wh.pl" id="form">
62
<form name="Form" method="post" action="wh.pl" id="form">
63
<div class="wrapper">
59 64

  
60
  [% IF saved_message %]
65
[% IF saved_message %]
61 66
  <p>[% saved_message %]</p>
62
  [% END %]
67
[% END %]
63 68

  
64
  <p>
65
   <table>
66
    <tr>
67
     <th align="right" nowrap>[% 'Assembly' | $T8 %]</th>
68
     <td>
69
      [% P.part.picker("parts_id", parts_id, part_type="assembly", class="initial_focus", fat_set_item="1") %]
70
     </td>
71
    </tr>
72 69

  
70
<table class="tbl-horizontal">
71
  <tbody>
73 72
    <tr>
74
     <th align="right" nowrap>[% 'Destination warehouse' | $T8 %]</th>
75
     <td>
76
      <select name="warehouse_id" id="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
77
       [%- FOREACH warehouse = WAREHOUSES %]
78
       <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
79
       [%- END %]
80
      </select>
81
     </td>
73
      <th>[% 'Assembly' | $T8 %]</th>
74
      <td>[% P.part.picker("parts_id", parts_id, part_type="assembly", class="initial_focus", fat_set_item="1", class="wi-lightwide") %] </td>
82 75
    </tr>
83

  
84 76
    <tr>
85
     <th align="right" nowrap>[% 'Destination bin' | $T8 %]:</th>
86
     <td><select id="bin_id" name="bin_id"></select></td>
77
      <th>[% 'Destination warehouse' | $T8 %]</th>
78
      <td>
79
        <select name="warehouse_id" id="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)" class="wi-lightwide">
80
          [% FOREACH warehouse = WAREHOUSES %]
81
            <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
82
          [% END %]
83
        </select>
84
      </td>
87 85
    </tr>
88

  
89 86
    <tr>
90
     <th align="right" nowrap>[% 'Charge number' | $T8 %]</th>
91
     <td><input name="chargenumber" size="30" value="[% HTML.escape(chargenumber) %]"></td>
87
      <th>[% 'Destination bin' | $T8 %]</th>
88
      <td><select id="bin_id" name="bin_id" class="wi-lightwide"></select></td>
92 89
    </tr>
93

  
94
    [% IF INSTANCE_CONF.get_show_bestbefore %]
95 90
    <tr>
96
     <th align="right" nowrap>[% 'Best Before' | $T8 %]</th>
97
     <td>
98
      [% L.date_tag('bestbefore', bestbefore) %]
99
     </td>
91
      <th>[% 'Charge number' | $T8 %]</th>
92
      <td><input type="text" name="chargenumber" class="wi-lightwide" value="[% HTML.escape(chargenumber) %]"></td>
100 93
    </tr>
94
    [% IF INSTANCE_CONF.get_show_bestbefore %]
95
      <tr>
96
        <th>[% 'Best Before' | $T8 %]</th>
97
        <td><span class="wi-date">[% L.date_tag('bestbefore', bestbefore) %]</span> </td>
98
      </tr>
101 99
    [% END %]
102

  
103 100
    <tr>
104
     <th align="right" nowrap>[% 'Quantity' | $T8 %]</th>
105
     <td>
106
      <input name="qty" size="10" value="[% HTML.escape(LxERP.format_amount(qty)) %]">
107
      <select name="unit">
108
       [%- FOREACH unit = UNITS %]<option[% IF unit.selected %] selected[% END %]>[% HTML.escape(unit.name) %]</option>[% END %]
109
      </select>
110
     </td>
101
      <th>[% 'Quantity' | $T8 %]</th>
102
      <td>
103
        <input type="text" name="qty" class="wi-verysmall" value="[% HTML.escape(LxERP.format_amount(qty)) %]">
104
        <select name="unit" class="wi-small">
105
          [% FOREACH unit = UNITS %]
106
            <option[% IF unit.selected %] selected[% END %]>[% HTML.escape(unit.name) %]</option>
107
          [% END %]
108
        </select>
109
      </td>
111 110
    </tr>
112

  
113 111
    <tr>
114
     <th align="right" nowrap>[% 'Optional comment' | $T8 %]</th>
115
     <td><input name="comment" size="30" value="[% HTML.escape(comment) %]"></td>
112
      <th>[% 'Optional comment' | $T8 %]</th>
113
      <td><input type="text" name="comment" class="wi-lightwide" value="[% HTML.escape(comment) %]">
114
      </td>
116 115
    </tr>
116
  </tbody>
117
</table>
117 118

  
118
   </table>
119
  </p>
120
 </form>
119
</div>
120
</form>
121 121

  
122 122
<script type='text/javascript'>
123
$(function(){
124
  $('#parts_id').on('set_item:PartPicker', function(event, item) {
125
    if (!item.warehouse_id)
126
      return;
127

  
128
    $('#warehouse_id').val(item.warehouse_id);
129
    warehouse_selected(item.warehouse_id, item.bin_id);
130
  });
131
})
123
  $(function(){
124
    $('#parts_id').on('set_item:PartPicker', function(event, item) {
125
      if (!item.warehouse_id)
126
        return;
127

  
128
      $('#warehouse_id').val(item.warehouse_id);
129
      warehouse_selected(item.warehouse_id, item.bin_id);
130
    });
131
  })
132 132
</script>

Auch abrufbar als: Unified diff