-[%- USE T8 %][%- USE L %][% USE LxERP %]
+[%- USE L %][% USE LxERP %][% USE HTML %][%- USE JavaScript -%]
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript">
+ <!--
+var warehouses = [
+ [%- USE warehouses_it = Iterator(SELF.all_warehouses) %][%- FOREACH warehouse = warehouses_it %]
+ { id: [% warehouse.id %],
+ bins: [
+ [% USE bins_it = Iterator(warehouse.bins_sorted) %][% FOREACH bin = bins_it %]
+ { id: [% bin.id %], description: "[% JavaScript.escape(bin.description) %]" }[% UNLESS bins_it.last %],[% END %]
+ [% END %]
+ ] }[% UNLESS warehouses_it.last %],[% END %]
+ [% END %]
+];
+function warehouse_selected(warehouse_id, bin_id, bin_id_name) {
+ // bin_id_name is optional and only used in client_config.html
+ bin_id_name = bin_id_name || 'bin_id';
+
+ // Remove all bins safe for the empty entry
+ var bin_select = $('#' + bin_id_name);
+ bin_select.find('option').filter('[value!=""]').remove();
+
+ // Find selected warehouse
+ var warehouse = warehouses.filter(function(elt) { return elt.id == warehouse_id; })[0];
+ if (!warehouse)
+ return;
+
+ // Add bins as options to select.
+ $(warehouse.bins).each(function(idx, bin) {
+ bin_select.append($('<option>', { value: bin.id, selected: bin.id == bin_id }).text(bin.description));
+ });
+}
+
+function enable_template_controls() {
+ var existing = $('#use_templates_existing').prop('checked');
+ $('#defaults_templates').prop('disabled', !existing);
+ $('#new_templates,#new_master_templates').prop('disabled', existing);
+}
+
+$(function() {
+ warehouse_selected([% SELF.defaults.warehouse_id || -1 %], [% SELF.defaults.bin_id || -1 %], 'bin_id');
+ warehouse_selected([% SELF.defaults.warehouse_id_ignore_onhand || -1 %], [% SELF.defaults.bin_id_ignore_onhand || -1 %], 'bin_id_ignore_onhand');
+
+ enable_template_controls();
+ $('#use_templates_existing,#use_templates_new').change(enable_template_controls);
+})
+ -->
+ </script>
<h1>[% title | html %]</h1>
[% PROCESS 'common/flash.html' %]
<form action='controller.pl' method='POST'>
+ <div class="tabwidget">
+ <ul>
+ <li><a href="#miscellaneous">[% LxERP.t8('Miscellaneous') %]</a></li>
+ <li><a href="#ranges_of_numbers">[% LxERP.t8('Ranges of numbers') %]</a></li>
+ <li><a href="#default_accounts">[% LxERP.t8('Default Accounts') %]</a></li>
+ <li><a href="#posting_configuration">[% LxERP.t8('Posting Configuration') %]</a></li>
+ <li><a href="#datev_check_configuration">[% LxERP.t8('DATEV check configuration') %]</a></li>
+ <li><a href="#orders_deleteable">[% LxERP.t8('Orders / Delivery Orders deleteable') %]</a></li>
+ <li><a href="#warehouse">[% LxERP.t8('Warehouse') %]</a></li>
+ <li><a href="#features">[% LxERP.t8('Features') %]</a></li>
+ </ul>
+
+[% PROCESS 'client_config/_ranges_of_numbers.html' %]
+[% PROCESS 'client_config/_default_accounts.html' %]
+[% PROCESS 'client_config/_posting_configuration.html' %]
+[% PROCESS 'client_config/_datev_check_configuration.html' %]
+[% PROCESS 'client_config/_orders_deleteable.html' %]
+[% PROCESS 'client_config/_warehouse.html' %]
+[% PROCESS 'client_config/_features.html' %]
+[% PROCESS 'client_config/_miscellaneous.html' %]
-<table>
- <tr class='listheading'>
- <th colspan="3">[% 'Posting Configuration' | $T8 %]</th>
- </tr>
- <tr>
- <td align="right">[% 'Payments Changeable' | $T8 %]</td>
- <td>[% L.select_tag('payments_changeable', SELF.payment_options, value_key => 'value', title_key => 'title', default => SELF.payments_changeable) %]</td>
- <td>[% 'Should payments be and when should they be changeable after posting?' | $T8 %]</td>
- </tr>
-</table>
-
-<br>
-
-[%- L.hidden_tag('action', 'ClientConfig/dispatch') %]
-[%- L.submit_tag('action_save', LxERP.t8('Save')) %]
+ <div>
+ [%- L.hidden_tag('action', 'ClientConfig/dispatch') %]
+ [%- L.submit_tag('action_save', LxERP.t8('Save')) %]
+ </div>
</form>