[% USE HTML %][% USE LxERP %][% USE L %]
[% FORM.title %]
[%- INCLUDE 'common/flash.html' %]
[% L.hidden_tag('action', 'CsvImport/dispatch') %] [% L.hidden_tag('profile.type', SELF.profile.type) %]

[%- LxERP.t8('Import profiles') %]

[%- IF SELF.profile.id %] [%- END %] [%- IF SELF.all_profiles.size %] [%- END %]
[%- LxERP.t8('Current profile') %]: [%- HTML.escape(SELF.profile.name) %]
[%- LxERP.t8('Existing profiles') %]: [% L.select_tag('profile.id', L.options_for_select(SELF.all_profiles, title => 'name', default => SELF.profile.id), style => 'width: 300px') %] [% L.submit_tag('action_new', LxERP.t8('Load profile')) %] [% L.submit_tag('action_destroy', LxERP.t8('Delete profile'), confirm => LxERP.t8('Do you really want to delete this object?')) %]
[%- LxERP.t8('Save settings as') %]: [% L.input_tag('profile.name', '', style => 'width: 300px') %]
[% L.checkbox_tag('profile.is_default', label => LxERP.t8('Make default profile')) %]
[% L.submit_tag('action_save', LxERP.t8('Save profile')) %]

[%- LxERP.t8('Help on column names') %]

[% LxERP.t8("Show help text") %]

[%- LxERP.t8('Settings') %]

[% SET custom_sep_char = SELF.sep_char %] [% FOREACH entry = SELF.all_sep_chars %] [%- END %] [% SET custom_quote_char = SELF.quote_char %] [% FOREACH entry = SELF.all_quote_chars %] [%- END %] [% SET custom_escape_char = SELF.escape_char %] [% FOREACH entry = SELF.all_escape_chars %] [%- END %] [%- IF SELF.type == 'parts' %] [%- INCLUDE 'csv_import/_form_parts.html' %] [%- ELSIF SELF.type == 'customers_vendors' %] [%- INCLUDE 'csv_import/_form_customers_vendors.html' %] [%- END %] [%- IF SELF.file.exists %] [%- END %]
[%- LxERP.t8('Number Format') %]: [% SET options = L.options_for_select([ '1.000,00', '1000,00', '1,000.00', '1000.00' ], default => SELF.profile.get('numberformat')) %] [% L.select_tag('settings.numberformat', options, style => 'width: 300px') %]
[%- LxERP.t8('Charset') %]: [% L.select_tag('settings.charset', L.options_for_select(SELF.all_charsets, default => SELF.profile.get('charset')), style => 'width: 300px') %]
[%- LxERP.t8('Separator') %]: [% IF SELF.sep_char == entry.first %] [% SET custom_sep_char = '' %] [%- END %] [% L.radio_button_tag('sep_char', value => entry.first, label => entry.last, checked => SELF.sep_char == entry.first) %] [% L.radio_button_tag('sep_char', value => 'custom', checked => custom_sep_char != '') %] [% L.input_tag('custom_sep_char', custom_sep_char, size => 3, maxlength => 1) %]
[%- LxERP.t8('Quote character') %]: [% IF SELF.quote_char == entry.first %] [% SET custom_quote_char = '' %] [%- END %] [% L.radio_button_tag('quote_char', value => entry.first, label => entry.last, checked => SELF.quote_char == entry.first) %] [% L.radio_button_tag('quote_char', value => 'custom', checked => custom_quote_char != '') %] [% L.input_tag('custom_quote_char', custom_quote_char, size => 3, maxlength => 1) %]
[%- LxERP.t8('Escape character') %]: [% IF SELF.escape_char == entry.first %] [% SET custom_escape_char = '' %] [%- END %] [% L.radio_button_tag('escape_char', value => entry.first, label => entry.last, checked => SELF.escape_char == entry.first) %] [% L.radio_button_tag('escape_char', value => 'custom', checked => custom_escape_char != '') %] [% L.input_tag('custom_escape_char', custom_escape_char, size => 3, maxlength => 1) %]
[%- LxERP.t8('Check for duplicates') %]: [% opts = [ [ 'no_check', LxERP.t8('Do not check for duplicates') ], [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ], [ 'check_db', LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %] [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
[%- LxERP.t8('Import file') %]: [% L.input_tag('file', '', type => 'file', accept => '*') %]
[%- LxERP.t8('Existing file on server') %]: [%- LxERP.t8('Uploaded on #1, size #2 kB', SELF.file.displayable_mtime, LxERP.format_amount(SELF.file.size / 1024, 2)) %]
[% L.submit_tag('action_test', LxERP.t8('Test and preview')) %] [% IF (SELF.import_status == 'tested') && SELF.num_importable %] [% L.submit_tag('action_import', LxERP.t8('Import')) %] [%- END %]
[%- IF SELF.import_status %] [%- IF SELF.errors %] [%- PROCESS 'csv_import/_errors.html' %] [%- END %] [%- PROCESS 'csv_import/_result.html' %] [%- PROCESS 'csv_import/_preview.html' %] [%- END %]