From eba84b2e153963151b7c2d016cf9559c9424a147 Mon Sep 17 00:00:00 2001 From: viehlieb Date: Tue, 14 Feb 2023 16:51:22 +0100 Subject: [PATCH] add modal to choose column order for custom csv file --- app/views/orders/_custom_csv_form.html.haml | 15 +++++++++++++++ app/views/orders/custom_csv.js.haml | 3 +++ config/locales/de.yml | 3 +++ config/locales/en.yml | 4 ++++ config/locales/es.yml | 3 +++ config/locales/fr.yml | 3 +++ config/locales/nl.yml | 3 +++ 7 files changed, 34 insertions(+) create mode 100644 app/views/orders/_custom_csv_form.html.haml create mode 100644 app/views/orders/custom_csv.js.haml diff --git a/app/views/orders/_custom_csv_form.html.haml b/app/views/orders/_custom_csv_form.html.haml new file mode 100644 index 00000000..87295af0 --- /dev/null +++ b/app/views/orders/_custom_csv_form.html.haml @@ -0,0 +1,15 @@ += simple_form_for :custom_csv,format: :csv, :url => order_path(@order, view: @view, format: :csv), method: :get do |f| + .modal-header + = close_button :modal + .h3=I18n.t('.orders.custom_csv.description') + .modal-body + = f.input :first, as: :select, collection: custom_csv_collection, label: "1. " + I18n.t('.orders.custom_csv.column') + = f.input :second, as: :select, collection: custom_csv_collection, required: false, label: "2. " + I18n.t('.orders.custom_csv.column') + = f.input :third, as: :select, collection: custom_csv_collection, required: false, label: "3. " + I18n.t('.orders.custom_csv.column') + = f.input :fourth, as: :select, collection: custom_csv_collection, required: false, label: "4. " + I18n.t('.orders.custom_csv.column') + = f.input :fifth, as: :select, collection: custom_csv_collection, required: false, label: "5. " + I18n.t('.orders.custom_csv.column') + = f.input :sixth, as: :select, collection: custom_csv_collection, required: false, label: "6. " + I18n.t('.orders.custom_csv.column') + = f.input :seventh, as: :select, collection: custom_csv_collection, required: false, label: "7. " + I18n.t('.orders.custom_csv.column') + .modal-footer + = link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'} + = f.submit class: 'btn btn-primary' diff --git a/app/views/orders/custom_csv.js.haml b/app/views/orders/custom_csv.js.haml new file mode 100644 index 00000000..41a6ec83 --- /dev/null +++ b/app/views/orders/custom_csv.js.haml @@ -0,0 +1,3 @@ +$('#modalContainer').html('#{j(render("custom_csv_form"))}'); +$('#modalContainer').modal(); +$('#modalContainer').submit(function() {$('#modalContainer').modal('hide');}); \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index 5a1a5b35..740d6a2b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1463,6 +1463,9 @@ de: units_ordered: Bestellte Einheiten create: notice: Die Bestellung wurde erstellt. + custom_csv: + description: Wähle die Attribute und deren Reihenfolge für die zu erzeugende CSV Datei + column: Spalte edit: title: 'Bestellung bearbeiten: %{name}' edit_amount: diff --git a/config/locales/en.yml b/config/locales/en.yml index 59e94385..87c27e21 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1473,6 +1473,9 @@ en: units_ordered: Units ordered create: notice: The order was created. + custom_csv: + description: Please choose the order as well as the attributes for the csv file + column: column edit: title: 'Edit order: %{name}' edit_amount: @@ -1626,6 +1629,7 @@ en: who_ordered: Who ordered? order_download_button: article_pdf: Article PDF + custom_csv: Custom CSV download_file: Download file fax_csv: Fax CSV fax_pdf: Fax PDF diff --git a/config/locales/es.yml b/config/locales/es.yml index 620ec3bb..d8f1c31e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1259,6 +1259,9 @@ es: units_ordered: Unidades pedidas create: notice: Se ha creado el pedido + custom_csv: + description: Por favor elija el orden de los atributos así como los atributos para el archivo csv + column: columna edit: title: 'Edita pedido: %{name}' edit_amount: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 4dbdb864..0953b0db 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1010,6 +1010,9 @@ fr: units_ordered: Unités commandées create: notice: La commande a bien été définie. + custom_csv: + description: Veuillez choisir l'ordre des attributs ainsi que les attributs pour le fichier csv + column: colonne edit: title: 'Modifier la commande: %{name}' edit_amount: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 4c97dda4..9b13ab79 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1438,6 +1438,9 @@ nl: units_ordered: Bestelde eenheden create: notice: De bestelling is aangemaakt. + custom_csv: + description: Kies de volgorde van de attributen en de attributen voor het csv-bestand + column: kolom edit: title: 'Bestelling aanpassen: %{name}' edit_amount: