Mandantenkonfiguration: Druckvorlagen konfigurieren können
[kivitendo-erp.git] / templates / webpages / client_config / form.html
1 [%- USE L %][% USE LxERP %][% USE HTML %][%- USE JavaScript -%]
2  <script type="text/javascript" src="js/common.js"></script>
3  <script type="text/javascript" src="js/parts_language_selection.js"></script>
4  <script type="text/javascript">
5   <!--
6 var warehouses = [
7  [%- USE warehouses_it = Iterator(SELF.all_warehouses) %][%- FOREACH warehouse = warehouses_it %]
8   { id:   [% warehouse.id %],
9     bins: [
10      [% USE bins_it = Iterator(warehouse.bins_sorted) %][% FOREACH bin = bins_it %]
11       { id: [% bin.id %], description: "[% JavaScript.escape(bin.description) %]" }[% UNLESS bins_it.last %],[% END %]
12      [% END %]
13    ] }[% UNLESS warehouses_it.last %],[% END %]
14  [% END %]
15 ];
16
17 function warehouse_selected(warehouse_id, bin_id, bin_id_name) {
18   // bin_id_name is optional and only used in client_config.html
19   bin_id_name = bin_id_name || 'bin_id';
20
21   // Remove all bins safe for the empty entry
22   var bin_select = $('#' + bin_id_name);
23   bin_select.find('option').filter('[value!=""]').remove();
24
25   // Find selected warehouse
26   var warehouse = warehouses.filter(function(elt) { return elt.id == warehouse_id; })[0];
27   if (!warehouse)
28     return;
29
30   // Add bins as options to select.
31   $(warehouse.bins).each(function(idx, bin) {
32     bin_select.append($('<option>', { value: bin.id, selected: bin.id == bin_id }).text(bin.description));
33   });
34 }
35
36 function enable_template_controls() {
37   var existing = $('#use_templates_existing').prop('checked');
38   $('#defaults_templates').prop('disabled', !existing);
39   $('#new_templates,#new_master_templates').prop('disabled', existing);
40 }
41
42 $(function() {
43   warehouse_selected([% SELF.defaults.warehouse_id || -1 %], [% SELF.defaults.bin_id || -1 %], 'bin_id');
44   warehouse_selected([% SELF.defaults.warehouse_id_ignore_onhand || -1 %], [% SELF.defaults.bin_id_ignore_onhand || -1 %], 'bin_id_ignore_onhand');
45
46   enable_template_controls();
47   $('#use_templates_existing,#use_templates_new').change(enable_template_controls);
48 })
49     -->
50  </script>
51 <h1>[% title | html %]</h1>
52
53 [% PROCESS 'common/flash.html' %]
54
55 <form action='controller.pl' method='POST'>
56  <div class="tabwidget">
57   <ul>
58    <li><a href="#miscellaneous">[% LxERP.t8('Miscellaneous') %]</a></li>
59    <li><a href="#ranges_of_numbers">[% LxERP.t8('Ranges of numbers') %]</a></li>
60    <li><a href="#default_accounts">[% LxERP.t8('Default Accounts') %]</a></li>
61    <li><a href="#posting_configuration">[% LxERP.t8('Posting Configuration') %]</a></li>
62    <li><a href="#datev_check_configuration">[% LxERP.t8('DATEV check configuration') %]</a></li>
63    <li><a href="#orders_deleteable">[% LxERP.t8('Orders / Delivery Orders deleteable') %]</a></li>
64    <li><a href="#warehouse">[% LxERP.t8('Warehouse') %]</a></li>
65   </ul>
66
67 [% PROCESS 'client_config/_ranges_of_numbers.html' %]
68 [% PROCESS 'client_config/_default_accounts.html' %]
69 [% PROCESS 'client_config/_posting_configuration.html' %]
70 [% PROCESS 'client_config/_datev_check_configuration.html' %]
71 [% PROCESS 'client_config/_orders_deleteable.html' %]
72 [% PROCESS 'client_config/_warehouse.html' %]
73 [% PROCESS 'client_config/_miscellaneous.html' %]
74
75  <div>
76   [%- L.hidden_tag('action',  'ClientConfig/dispatch')  %]
77   [%- L.submit_tag('action_save',  LxERP.t8('Save'))  %]
78  </div>
79
80 </form>