Revert "Artikel-Klassifizierung"
[kivitendo-erp.git] / templates / webpages / csv_import / form.html
index 24af07e..3796ced 100644 (file)
@@ -2,8 +2,7 @@
 [%- USE LxERP %]
 [%- USE L %]
 [%- USE T8 %]
-
- <div class="listtop">[% FORM.title %]</div>
+ <h1>[% FORM.title %]</h1>
 
  [%- INCLUDE 'common/flash.html' %]
 
   [% L.hidden_tag('action', 'CsvImport/dispatch') %]
   [% L.hidden_tag('profile.type', SELF.profile.type) %]
 
+ [%- IF SELF.profile.get('dont_edit_profile') %]
+  [% L.hidden_tag('force_profile', 1) %]
+  [% L.hidden_tag('profile.id', SELF.profile.id) %]
+ [%- ELSE %]
   <h2>[%- LxERP.t8('Import profiles') %]</h2>
 
   <table>
     [% LxERP.t8("Assemblies can not be imported (yet). But the type column is used for sanity checks on price updates in order to prevent that articles with the wrong type will be updated.") %]
    </p>
 
-[%- ELSIF SELF.type == 'orders' %]
+[%- ELSIF SELF.type == 'inventories' %]
+   <p>
+    [%- LxERP.t8('One of the columns "qty" or "target_qty" must be given. If "target_qty" is given, the quantity to transfer for each transfer will be calculate, so that the quantity for this part, warehouse and bin will result in the given "target_qty" after each transfer.') %]
+   </p>
+
+[%- ELSIF SELF.type == 'orders' OR SELF.type == 'ar_transactions' %]
    <p>
     [1]:
     [% LxERP.t8('The column "datatype" must be present and must be at the same position / column in each data set. The values must be the row names (see settings) for order and item data respectively.') %]
    <tr>
     <th align="right">[%- LxERP.t8('Number Format') %]:</th>
     <td colspan="10">
-     [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00'], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
+     [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00', "1'000.00"], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
     </td>
    </tr>
 
  [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
 [%- ELSIF SELF.type == 'contacts' %]
  [%- INCLUDE 'csv_import/_form_contacts.html' %]
+[%- ELSIF SELF.type == 'inventories' %]
+ [%- INCLUDE 'csv_import/_form_inventories.html' %]
 [%- ELSIF SELF.type == 'orders' %]
  [%- INCLUDE 'csv_import/_form_orders.html' %]
+[%- ELSIF SELF.type == 'ar_transactions' %]
+ [%- INCLUDE 'csv_import/_form_artransactions.html' %]
+[%- ELSIF SELF.type == 'bank_transactions' %]
+ [%- INCLUDE 'csv_import/_form_banktransactions.html' %]
 [%- END %]
 
    <tr>
   </div>
   <hr>
 
+[%- UNLESS SELF.worker.is_multiplexed %]
+  <h2>[% 'Mappings (csv_import)' | $T8 %]</h2>
+
+  <div class="mappings_toggle"[% UNLESS SELF.deferred || SELF.import_status %] style="display:none"[% END %]>
+   <a href="#" onClick="javascript:$('.mappings_toggle').toggle()">[% LxERP.t8("Show mappings (csv_import)") %]</a>
+  </div>
+  <div class="mappings_toggle"[% IF SELF.deferred || SELF.import_status %] style="display:none"[% END %]>
+   <p><a href="#" onClick="javascript:$('.mappings_toggle').toggle()">[% LxERP.t8("Hide mappings (csv_import)") %]</a></p>
+
+    <p>[% 'These mappings can be used to map heading from non standard csv files to known columns. These will also be saved in profiles, so you can save profiles for every source of formats.' | $T8 %]</p>
+
+  <table id="csv_import_mappings">
+   <tr class=listheading>
+    <th></th>
+    <th>[% 'Text in CSV File' | $T8 %]</th>
+    <th>[% 'Known Column' | $T8 %]</th>
+   </tr>
+   <tr id='mapping_empty' style='display:none'>
+    <td colspan=3>[% 'There is nothing here yet (csv_import)' | $T8 %]</td>
+   </tr>
+[%- FOREACH row = SELF.mappings %]
+   [% PROCESS 'csv_import/_mapping_item.html', item=row IF row.from %]
+[%- END %]
+   [% PROCESS 'csv_import/_mapping_item.html', item={} %]
+  </table>
+
+  <input type=button id='add_empty_mapping_line' value='[% 'Add empty line (csv_import)' | $T8 %]'>
+  <input type=button id='add_mapping_from_upload' value='[% 'Add headers from last uploaded file (csv_import)' | $T8 %]'>
+
+  </div>
+  <hr>
+[%- END %]
   [% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
+[%- END %]
   [% L.submit_tag('action_import', LxERP.t8('Import'), style='display:none') %]
 
  </form>
           return true;
         alert('[% LxERP.t8('Please enter a profile name.') %]');
         return false;
-      })
+      });
+      $('#add_empty_mapping_line').click(function(){
+        $.get('controller.pl', { action: 'CsvImport/add_empty_mapping_line', 'profile.type': $('#profile_type').val() }, kivi.eval_json_result);
+      });
+      $('#add_mapping_from_upload').click(function(){
+        $.get('controller.pl?action_add_mapping_from_upload=1', $('form').serialize() , kivi.eval_json_result);
+      });
+      $('#csv_import_mappings').on('click', '.remove_line', function(){ $(this).closest('tr').remove(); if (1==$('#csv_import_mappings tr:visible').length) $('#mapping_empty').show() });
     });
     -->
  </script>