diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 1f9bf91ed78..e8c38f0b739 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -58,4 +58,9 @@ def enterprise_fee_ids(orders) .where(order_id: orders.map(&:id)) .pluck(:originator_id) end + + def datepicker_time(datetime) + datetime = Time.zone.parse(datetime) if datetime.is_a? String + datetime.strftime('%Y-%m-%d %H:%M') + end end diff --git a/app/jobs/backorder_job.rb b/app/jobs/backorder_job.rb index 174fe125ff5..c8ce3f64a17 100644 --- a/app/jobs/backorder_job.rb +++ b/app/jobs/backorder_job.rb @@ -40,6 +40,8 @@ def place_backorder(order) user = order.distributor.owner items = backorderable_items(order) + return if items.empty? + # We are assuming that all variants are linked to the same wholesale # shop and its catalog: reference_link = items[0].variant.semantic_links[0].semantic_id diff --git a/app/models/spree/payment.rb b/app/models/spree/payment.rb index e10920d4b84..6479694df9c 100644 --- a/app/models/spree/payment.rb +++ b/app/models/spree/payment.rb @@ -155,7 +155,6 @@ def ensure_correct_adjustment if adjustment adjustment.originator = payment_method adjustment.label = adjustment_label - adjustment.amount = payment_method.compute_amount(self) adjustment.save elsif !processing_refund? && payment_method.present? payment_method.create_adjustment(adjustment_label, self, true) diff --git a/app/views/admin/reports/_date_range_form.html.haml b/app/views/admin/reports/_date_range_form.html.haml index 040344e6224..c8ffae0a4d3 100644 --- a/app/views/admin/reports/_date_range_form.html.haml +++ b/app/views/admin/reports/_date_range_form.html.haml @@ -1,14 +1,17 @@ -# Field used for ransack search. This date range is mostly used for Spree::Order -# so default field is 'completed_at' - field ||= 'completed_at' -- start_date ||= params[:q].try(:[], :completed_at_gt) -- end_date ||= params[:q].try(:[], :completed_at_lt) +- start_field = "#{field}_gt" +- end_field = "#{field}_lt" +- query = params[:q].to_h +- start_date = datepicker_time(query[start_field].presence || 3.months.ago.beginning_of_day) +- end_date = datepicker_time(query[end_field].presence || Time.zone.tomorrow.beginning_of_day) .row.date-range-filter .alpha.two.columns= label_tag nil, t(:date_range) .omega.fourteen.columns .field-block.omega.four.columns - .date-range-fields{ data: { controller: "flatpickr", "flatpickr-mode-value": "range", "flatpickr-enable-time-value": true , "flatpickr-default-hour": 0 } } + .date-range-fields{ data: { controller: "flatpickr", "flatpickr-mode-value": "range", "flatpickr-enable-time-value": true , "flatpickr-default-hour": 0, "flatpickr-default-date": [start_date, end_date] } } = text_field_tag nil, nil, class: "datepicker fullwidth", data: { "flatpickr-target": "instance", action: "flatpickr_clear@window->flatpickr#clear" } - = text_field_tag "q[#{field}_gt]", nil, data: { "flatpickr-target": "start" }, style: "display: none", value: start_date - = text_field_tag "q[#{field}_lt]", nil, data: { "flatpickr-target": "end" }, style: "display: none", value: end_date + = text_field_tag "q[#{start_field}]", nil, data: { "flatpickr-target": "start" }, style: "display: none", value: start_date + = text_field_tag "q[#{end_field}]", nil, data: { "flatpickr-target": "end" }, style: "display: none", value: end_date diff --git a/app/views/admin/reports/filters/_packing.html.haml b/app/views/admin/reports/filters/_packing.html.haml index a23fcd6a9bc..d7075126410 100755 --- a/app/views/admin/reports/filters/_packing.html.haml +++ b/app/views/admin/reports/filters/_packing.html.haml @@ -1,5 +1,5 @@ = render partial: 'admin/reports/date_range_form', - locals: { f: f, field: 'order_completed_at', start_date: params[:q].try(:[], :order_completed_at_gt), end_date: params[:q].try(:[], :order_completed_at_lt) } + locals: { f: f, field: 'order_completed_at' } .row .alpha.two.columns= label_tag nil, t(:report_hubs) @@ -14,4 +14,4 @@ .row .alpha.two.columns= label_tag nil, t(:report_customers_cycle) .omega.fourteen.columns - = select_tag("q[order_cycle_id_in]", options_for_select(report_order_cycle_options(@data.order_cycles), params.dig(:q, :order_cycle_id_in)), {class: "select2 fullwidth", multiple: true}) \ No newline at end of file + = select_tag("q[order_cycle_id_in]", options_for_select(report_order_cycle_options(@data.order_cycles), params.dig(:q, :order_cycle_id_in)), {class: "select2 fullwidth", multiple: true}) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5c3c0ca5859..d3348dc9a44 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -155,7 +155,7 @@ config.omniauth :openid_connect, { name: :openid_connect, issuer: "https://login.lescommuns.org/auth/realms/data-food-consortium", - scope: [:openid, :profile, :email], + scope: [:openid, :profile, :email, :offline_access], response_type: :code, uid_field: "email", discovery: true, diff --git a/config/locales/ar.yml b/config/locales/ar.yml index f1f1c34056e..e73bcf31379 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -46,12 +46,12 @@ ar: price: "السعر" primary_taxon_id: "نوع المنتج " shipping_category_id: "نوع الشحن" - variant_unit_name: "اسم وحدة النوع" - unit_value: "قيمةالوحدة" spree/variant: primary_taxon: "نوع المنتج " shipping_category_id: "نوع الشحن" supplier: "المورد" + variant_unit_name: "اسم وحدة النوع" + unit_value: "قيمةالوحدة" spree/credit_card: base: "بطاقة ائتمان" number: "رقم " @@ -1146,6 +1146,8 @@ ar: Visit Discover Regenerative

+ vine: + enable: "الاتصال" actions: edit_profile: الإعدادات properties: الخصائص @@ -4190,12 +4192,15 @@ ar: new_variant: "نوع جديد" form: sku: "SKU" - price: "السعر" unit_price: "سعر الوحدة" display_as: "عرض ب" display_name: "اسم العرض" display_as_placeholder: 'على سبيل المثال 2 كجم' display_name_placeholder: 'على سبيل المثال طماطم' + unit: وحدة + price: السعر + unit_value: قيمةالوحدة + variant_category: الفئة autocomplete: out_of_stock: "غير متوفر" producer_name: "المنتج" diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 60c89def8a4..1f3b64a2e05 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -46,12 +46,12 @@ ca: price: "Preu" primary_taxon_id: "Categoria del producte" shipping_category_id: "Categoria d'enviament" - variant_unit_name: "Nom de la unitat de la variant" - unit_value: "Valor de la unitat" spree/variant: primary_taxon: "Categoria del producte" shipping_category_id: "Categoria d'enviament" supplier: "Proveïdora" + variant_unit_name: "Nom de la unitat de la variant" + unit_value: "Valor de la unitat" spree/credit_card: base: "Targeta de crèdit" number: "Número" @@ -1200,6 +1200,8 @@ ca: loading: "S'està carregant" discover_regen: loading: "S'està carregant" + vine: + enable: "Connecta" actions: edit_profile: Configuració properties: Propietats @@ -4068,12 +4070,15 @@ ca: new_variant: "Nova variant" form: sku: "Número de referència (SKU)" - price: "Preu" unit_price: "Preu unitari" display_as: "Mostra com" display_name: "Nom de visualització" display_as_placeholder: 'per exemple. 2 kg' display_name_placeholder: 'per exemple. Tomàquets' + unit: Unitat + price: Preu + unit_value: Valor de la unitat + variant_category: Categoria autocomplete: out_of_stock: "Fora d'existència" producer_name: "Productor" diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 785410d1e67..b74eaa5e258 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -49,12 +49,12 @@ cy: price: "Pris" primary_taxon_id: "Categori Cynnyrch" shipping_category_id: "Categori dosbarthu." - variant_unit_name: "Enw Uned Amrywiol" - unit_value: "Gwerth yr uned" spree/variant: primary_taxon: "Categori Cynnyrch" shipping_category_id: "Categori Anfon" supplier: "Cyflenwr" + variant_unit_name: "Enw Uned Amrywiolyn" + unit_value: "Gwerth yr uned" spree/credit_card: base: "Cerdyn credyd" number: "Rhif" @@ -1260,6 +1260,8 @@ cy: disable: "Rhoi’r gorau i rannu" loading: "Yn llwytho" link_label: "Rheoli’r rhestru" + vine: + enable: "Adnoddau" actions: edit_profile: Gosodiadau properties: Manylion @@ -4320,12 +4322,15 @@ cy: new_variant: "Amrywiolyn newydd" form: sku: "Cod y Cynnyrch" - price: "Pris" unit_price: "Pris Uned" display_as: "Arddangos fel" display_name: "Enw Arddangos" display_as_placeholder: 'e.e. 2 kg' display_name_placeholder: 'e.e. Tomatos' + unit: Uned + price: Pris + unit_value: Gwerth yr uned + variant_category: Categori autocomplete: out_of_stock: "Allan o stoc" producer_name: "Cynhyrchydd" diff --git a/config/locales/de_CH.yml b/config/locales/de_CH.yml index b79e46a5212..2f19c4fc43f 100644 --- a/config/locales/de_CH.yml +++ b/config/locales/de_CH.yml @@ -35,11 +35,11 @@ de_CH: price: "Preis" primary_taxon_id: "Produktkategorie" shipping_category_id: "Lieferkategorie" - variant_unit_name: "Name der Varianteneinheit" spree/variant: primary_taxon: "Produktkategorie" shipping_category_id: "Lieferkategorie" supplier: "Lieferant" + variant_unit_name: "Name der Varianteneinheit" spree/credit_card: base: "Kreditkarte" number: "Kreditkartennummer" @@ -1112,6 +1112,8 @@ de_CH: loading: "Wird geladen ..." discover_regen: loading: "Wird geladen ..." + vine: + enable: "Über OFN" actions: edit_profile: Einstellungen properties: Eigenschaften @@ -3974,12 +3976,14 @@ de_CH: new_variant: "Neue Produktvariante" form: sku: "Artikelnummer" - price: "Preis" unit_price: "Grundpreis" display_as: "Anzeigen als" display_name: "Variantenname" display_as_placeholder: 'z. B. 2 kg' display_name_placeholder: 'z. B. Tomaten' + unit: Einheit + price: Preis + variant_category: Kategorie autocomplete: out_of_stock: "nicht vorrätig" producer_name: "Produzent" diff --git a/config/locales/de_DE.yml b/config/locales/de_DE.yml index 9a3baf10213..a73378322c5 100644 --- a/config/locales/de_DE.yml +++ b/config/locales/de_DE.yml @@ -49,12 +49,12 @@ de_DE: price: "Preis" primary_taxon_id: "Produktkategorie" shipping_category_id: "Lieferkategorie" - variant_unit_name: "Name der Varianteneinheit" - unit_value: "Menge" spree/variant: primary_taxon: "Produktkategorie" shipping_category_id: "Lieferkategorie" supplier: "Lieferant" + variant_unit_name: "Name der Varianteneinheit" + unit_value: "Menge" spree/credit_card: base: "Kreditkarte" number: "Kreditkartennummer" @@ -1240,6 +1240,8 @@ de_DE: loading: "Wird geladen ..." discover_regen: loading: "Wird geladen ..." + vine: + enable: "Über OFN" actions: edit_profile: Einstellungen properties: Eigenschaften @@ -4250,12 +4252,15 @@ de_DE: new_variant: "Neue Produktvariante" form: sku: "Artikelnummer" - price: "Preis" unit_price: "Grundpreis" display_as: "Anzeigen als" display_name: "Variantenname" display_as_placeholder: 'z. B. 2 kg' display_name_placeholder: 'z. B. Tomaten' + unit: Einheit + price: Preis + unit_value: Menge + variant_category: Kategorie autocomplete: out_of_stock: "nicht vorrätig" producer_name: "Produzent" diff --git a/config/locales/el.yml b/config/locales/el.yml index 6a869a85517..73380856fcd 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -46,12 +46,12 @@ el: price: "Τιμή" primary_taxon_id: "Κατηγορία προϊόντος" shipping_category_id: "Κατηγορία μεταφορικών" - variant_unit_name: "Όνομα μεταβλητής" - unit_value: "Τιμή μεταβλητής" spree/variant: primary_taxon: "Κατηγορία προϊόντος" shipping_category_id: "Κατηγορία μεταφοράς" supplier: "Προμηθευτής" + variant_unit_name: "Όνομα μεταβλητής" + unit_value: "Τιμή μεταβλητής" spree/credit_card: base: "Κάρτα πιστωτική/χρεωστική" number: "Αριθμός" @@ -1314,6 +1314,10 @@ el: target="_blank">Μάθετε περισσότερα για το Discover Regenerative

+ vine: + enable: "Σύνδεση" + disable: "Αποσύνδεση." + need_to_be_manager: "Μόνο οι διαχειριστές μπορούν να συνδέουν εφαρμογές." actions: edit_profile: Ρυθμήσεις properties: Ιδιότητες @@ -4326,12 +4330,16 @@ el: new_variant: "Νέα παραλλαγή" form: sku: "SKU" - price: "Τιμή" unit_price: "Τιμή Μονάδας" display_as: "Εμφάνιση Ως" display_name: "Εμφανιζόμενο όνομα" display_as_placeholder: 'π.χ. 2 κιλά' display_name_placeholder: 'π.χ. Ντομάτες' + unit_scale: "Κλίμακα μονάδας" + unit: Μονάδα + price: Τιμή + unit_value: Τιμή μεταβλητής + variant_category: Κατηγορία autocomplete: out_of_stock: "Εκτός αποθέματος" producer_name: "Παραγωγός" diff --git a/config/locales/en_AU.yml b/config/locales/en_AU.yml index 8b44d39ea06..aa2a74a1017 100644 --- a/config/locales/en_AU.yml +++ b/config/locales/en_AU.yml @@ -30,11 +30,11 @@ en_AU: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -955,6 +955,8 @@ en_AU: Visit Discover Regenerative

+ vine: + enable: "Open Road" actions: edit_profile: Settings properties: Properties @@ -3630,12 +3632,14 @@ en_AU: new_variant: "New Variant" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_BE.yml b/config/locales/en_BE.yml index 56e6423f035..69fc68c3531 100644 --- a/config/locales/en_BE.yml +++ b/config/locales/en_BE.yml @@ -29,11 +29,11 @@ en_BE: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -885,6 +885,8 @@ en_BE: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Connect" actions: edit_profile: Settings properties: Properties @@ -3288,9 +3290,11 @@ en_BE: option_types: "Option Types" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_CA.yml b/config/locales/en_CA.yml index 57ad4e05b83..60d92f8cf6e 100644 --- a/config/locales/en_CA.yml +++ b/config/locales/en_CA.yml @@ -49,13 +49,13 @@ en_CA: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit: "Unit Scale" - variant_unit_name: "Variant Unit Name" - unit_value: "Unit value" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit: "Unit Scale" + variant_unit_name: "Variant Unit Name" + unit_value: "Unit value" spree/credit_card: base: "Credit Card" number: "Number" @@ -1372,6 +1372,10 @@ en_CA: Learn more about the Waterloo Food Directory.

+ vine: + enable: "Donate" + disable: "Disconnect" + need_to_be_manager: "Only managers can connect apps." actions: edit_profile: Settings properties: Properties @@ -4429,12 +4433,16 @@ en_CA: new_variant: "New Variant" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit_scale: "Unit scale" + unit: Unit + price: Price + unit_value: Unit value + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_DE.yml b/config/locales/en_DE.yml index 7ad857a099c..2ef0f5b7de6 100644 --- a/config/locales/en_DE.yml +++ b/config/locales/en_DE.yml @@ -29,11 +29,11 @@ en_DE: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -893,6 +893,8 @@ en_DE: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Connect" actions: edit_profile: Settings properties: Properties @@ -3303,9 +3305,11 @@ en_DE: option_types: "Option Types" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_FR.yml b/config/locales/en_FR.yml index 397d8abd330..9ce7d1040b1 100644 --- a/config/locales/en_FR.yml +++ b/config/locales/en_FR.yml @@ -49,13 +49,13 @@ en_FR: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit: "Unit Scale" - variant_unit_name: "Variant Unit Name" - unit_value: "Unit value" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit: "Unit Scale" + variant_unit_name: "Variant Unit Name" + unit_value: "Unit value" spree/credit_card: base: "Credit Card" number: "Number" @@ -107,6 +107,9 @@ en_FR: count_on_hand: using_producer_stock_settings_but_count_on_hand_set: "must be blank because using producer stock settings" limited_stock_but_no_count_on_hand: "must be specified because forcing limited stock" + connected_apps: + vine: + api_request_error: "An error occured when connecting to Vine API" messages: confirmation: "doesn't match %{attribute}" blank: "can't be blank" @@ -717,6 +720,7 @@ en_FR: connected_apps_enabled: discover_regen: Discover Regenerative portal affiliate_sales_data: DFC anonymised orders API for research purposes + vine: Voucher Integration Engine (VINE) update: resource: Connected app settings customers: @@ -1375,6 +1379,26 @@ en_FR: target="_blank">Learn more about Discover Regenerative

+ vine: + title: "Voucher Integration Engine (VINE)" + tagline: "Allow redemption of VINE vouchers in your shopfront." + enable: "About" + disable: "Disconnect" + need_to_be_manager: "Only managers can connect apps." + vine_api_key: "VINE API Key" + vine_secret: "VINE secret" + description_html: | +

+ To enable VINE for your enterprise, enter your API key and secret. +

+

+ VINE + +

+ api_parameters_empty: "Please enter an API key and a secret" + api_parameters_error: "Check you entered your API key and secret correctly, contact your instance manager if the error persists" + connection_error: "API connection error, please try again" + setup_error: "VINE API is not configured, please contact your instance manager" actions: edit_profile: Settings properties: Properties @@ -4433,12 +4457,16 @@ en_FR: new_variant: "New Variant" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit_scale: "Unit scale" + unit: Unit + price: Price + unit_value: Unit value + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_GB.yml b/config/locales/en_GB.yml index abb45424da6..72e767ed983 100644 --- a/config/locales/en_GB.yml +++ b/config/locales/en_GB.yml @@ -49,12 +49,12 @@ en_GB: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" - unit_value: "Unit value" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" + unit_value: "Unit value" spree/credit_card: base: "Credit Card" number: "Number" @@ -1331,6 +1331,10 @@ en_GB: target="_blank">Learn more about Discover Regenerative

+ vine: + enable: "Resources" + disable: "Disconnect" + need_to_be_manager: "Only managers can connect apps." actions: edit_profile: Settings properties: Properties @@ -4373,12 +4377,16 @@ en_GB: new_variant: "New Variant" form: sku: "Product Code" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit_scale: "Unit scale" + unit: Unit + price: Price + unit_value: Unit value + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_IE.yml b/config/locales/en_IE.yml index 164d2cd2cd1..3a9fb80208e 100644 --- a/config/locales/en_IE.yml +++ b/config/locales/en_IE.yml @@ -49,12 +49,12 @@ en_IE: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" - unit_value: "Unit value" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" + unit_value: "Unit value" spree/credit_card: base: "Credit Card" number: "Number" @@ -1286,6 +1286,9 @@ en_IE: target="_blank">Learn more about Discover Regenerative

+ vine: + enable: "Resources" + disable: "Disconnect" actions: edit_profile: Settings properties: Properties @@ -4319,12 +4322,16 @@ en_IE: new_variant: "New Variant" form: sku: "Product Code" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit_scale: "Unit scale" + unit: Unit + price: Price + unit_value: Unit value + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_IN.yml b/config/locales/en_IN.yml index da3d13ef1d8..4915a98f83a 100644 --- a/config/locales/en_IN.yml +++ b/config/locales/en_IN.yml @@ -29,11 +29,11 @@ en_IN: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -918,6 +918,8 @@ en_IN: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Pricing" actions: edit_profile: Settings properties: Properties @@ -3532,12 +3534,14 @@ en_IN: new_variant: "New Variant" form: sku: "Product Code" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_NZ.yml b/config/locales/en_NZ.yml index b450a432421..f5b47a61d2e 100644 --- a/config/locales/en_NZ.yml +++ b/config/locales/en_NZ.yml @@ -33,11 +33,11 @@ en_NZ: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -1112,6 +1112,8 @@ en_NZ: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Connect" actions: edit_profile: Settings properties: Properties @@ -3881,12 +3883,14 @@ en_NZ: new_variant: "New Variant" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'eg. 2 kg' display_name_placeholder: 'eg. Tomatoes' + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_PH.yml b/config/locales/en_PH.yml index bbf4e265134..e10a40481fa 100644 --- a/config/locales/en_PH.yml +++ b/config/locales/en_PH.yml @@ -29,11 +29,11 @@ en_PH: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -908,6 +908,8 @@ en_PH: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Connect" actions: edit_profile: Settings properties: Properties @@ -3469,10 +3471,12 @@ en_PH: new_variant: "New Variant" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_US.yml b/config/locales/en_US.yml index 0e67d1a5ab0..ca8f3ba0b0c 100644 --- a/config/locales/en_US.yml +++ b/config/locales/en_US.yml @@ -31,11 +31,11 @@ en_US: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -1073,6 +1073,8 @@ en_US: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Pricing" actions: edit_profile: Settings properties: Properties @@ -3896,12 +3898,14 @@ en_US: new_variant: "New Variant" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" display_name: "Display Name" display_as_placeholder: 'For example, 2 kg' display_name_placeholder: 'For example, Tomatoes' + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/en_ZA.yml b/config/locales/en_ZA.yml index 066c08bad28..faccf97832c 100644 --- a/config/locales/en_ZA.yml +++ b/config/locales/en_ZA.yml @@ -29,11 +29,11 @@ en_ZA: price: "Price" primary_taxon_id: "Product Category" shipping_category_id: "Shipping Category" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product Category" shipping_category_id: "Shipping Category" supplier: "Supplier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Credit Card" number: "Number" @@ -909,6 +909,8 @@ en_ZA: loading: "Loading" discover_regen: loading: "Loading" + vine: + enable: "Connect" actions: edit_profile: Settings properties: Properties @@ -3363,9 +3365,11 @@ en_ZA: and: "and" form: sku: "SKU" - price: "Price" unit_price: "Unit Price" display_as: "Display As" + unit: Unit + price: Price + variant_category: Category autocomplete: out_of_stock: "Out of Stock" producer_name: "Producer" diff --git a/config/locales/es.yml b/config/locales/es.yml index 999bbd91323..36da47b18ca 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -46,12 +46,12 @@ es: price: "Precio" primary_taxon_id: "categoría del producto" shipping_category_id: "Categoría de envío" - variant_unit_name: "Nombre de la unidad de la variante" - unit_value: "Valor unidad" spree/variant: primary_taxon: "categoría del producto" shipping_category_id: "Categoría de envío" supplier: "Proveedora" + variant_unit_name: "Nombre de la unidad de la variante" + unit_value: "Valor unidad" spree/credit_card: base: "Tarjeta de crédito" number: "Número" @@ -1143,6 +1143,8 @@ es: loading: "Cargando" discover_regen: loading: "Cargando" + vine: + enable: "Conectar" actions: edit_profile: Configuración properties: Propiedades @@ -4052,12 +4054,15 @@ es: new_variant: "Nueva Variante" form: sku: "SKU" - price: "Precio" unit_price: "Precio por unidad" display_as: "Mostrar como" display_name: "Nombre para mostrar" display_as_placeholder: 'p. ej. 2 Kg' display_name_placeholder: 'p. ej. Tomates' + unit: Unidad + price: Precio + unit_value: Valor unidad + variant_category: Categoría autocomplete: out_of_stock: "Agotado" producer_name: "Productora" diff --git a/config/locales/es_CO.yml b/config/locales/es_CO.yml index a07b4b5025d..4b056d360ff 100644 --- a/config/locales/es_CO.yml +++ b/config/locales/es_CO.yml @@ -31,11 +31,11 @@ es_CO: price: "Precio" primary_taxon_id: "Categoría del producto" shipping_category_id: "Categoría de envío" - variant_unit_name: "Nombre de la unidad de la variante" spree/variant: primary_taxon: "Categoría del producto" shipping_category_id: "Categoría de envío" supplier: "Proveedora" + variant_unit_name: "Nombre de la unidad de la variante" spree/credit_card: base: "Tarjeta de crédito" number: "Número" @@ -941,6 +941,8 @@ es_CO: loading: "Cargando" discover_regen: loading: "Cargando" + vine: + enable: "Conectar" actions: edit_profile: Configuración properties: Propiedades @@ -3592,12 +3594,14 @@ es_CO: new_variant: "Nueva variante" form: sku: "SKU" - price: "Precio" unit_price: "Precio por unidad" display_as: "Mostrar como" display_name: "Nombre para mostrar" display_as_placeholder: 'p.ej. 2 kilogramos' display_name_placeholder: 'p.ej. Tomates' + unit: Unidad + price: Precio + variant_category: Categoría autocomplete: out_of_stock: "Agotado" producer_name: "Productor" diff --git a/config/locales/es_CR.yml b/config/locales/es_CR.yml index a9d6a6a2bf4..e2f449690d5 100644 --- a/config/locales/es_CR.yml +++ b/config/locales/es_CR.yml @@ -33,11 +33,11 @@ es_CR: price: "Precio" primary_taxon_id: "Categoría del producto" shipping_category_id: "Categoría de envío" - variant_unit_name: "Nombre de la unidad de la variante" spree/variant: primary_taxon: "Categoría del producto" shipping_category_id: "Categoría de envío" supplier: "Proveedor" + variant_unit_name: "Nombre de la unidad de la variante" spree/credit_card: base: "Tarjeta de crédito" number: "Número" @@ -1118,6 +1118,8 @@ es_CR: loading: "Cargando" discover_regen: loading: "Cargando" + vine: + enable: "Conectar" actions: edit_profile: Configuración properties: Propiedades @@ -3930,10 +3932,12 @@ es_CR: new_variant: "Nueva variante" form: sku: "SKU" - price: "Precio" unit_price: "Precio por unidad" display_as: "Mostrar como" display_name: "Nombre para mostrar" + unit: Unidad + price: Precio + variant_category: Categoría autocomplete: out_of_stock: "Agotado" producer_name: "Productor" diff --git a/config/locales/es_US.yml b/config/locales/es_US.yml index a34437e942d..8a6dd1a2529 100644 --- a/config/locales/es_US.yml +++ b/config/locales/es_US.yml @@ -31,11 +31,11 @@ es_US: price: "Precio" primary_taxon_id: "categoría del producto" shipping_category_id: "Categoría de envío" - variant_unit_name: "Nombre de la unidad de la variante" spree/variant: primary_taxon: "categoría del producto" shipping_category_id: "Categoría de envío" supplier: "Proveedor" + variant_unit_name: "Nombre de la unidad de la variante" spree/credit_card: base: "Tarjeta de crédito" number: "Número" @@ -1072,6 +1072,8 @@ es_US: loading: "Cargando" discover_regen: loading: "Cargando" + vine: + enable: "Conectar" actions: edit_profile: Configuración properties: Propiedades @@ -3846,12 +3848,14 @@ es_US: new_variant: "Nueva Variante" form: sku: "SKU" - price: "Precio" unit_price: "Precio por unidad" display_as: "Mostrar como" display_name: "Nombre para mostrar" display_as_placeholder: 'p. ej. 2 Kg' display_name_placeholder: 'p. ej. Tomates' + unit: Unidad + price: Precio + variant_category: Categoría autocomplete: out_of_stock: "Agotado" producer_name: "Productora" diff --git a/config/locales/fil_PH.yml b/config/locales/fil_PH.yml index a0e9ac8c90f..2fa301129e6 100644 --- a/config/locales/fil_PH.yml +++ b/config/locales/fil_PH.yml @@ -29,11 +29,11 @@ fil_PH: price: "Presyo" primary_taxon_id: "Kategorya ng Produkto" shipping_category_id: "Kategorya ng Pagpapadala" - variant_unit_name: "pangalan ng yunit ng variant" spree/variant: primary_taxon: "Kategorya ng Produkto" shipping_category_id: "Kategorya ng Pagpapadala" supplier: "Supplier" + variant_unit_name: "pangalan ng yunit ng variant" spree/credit_card: base: "Credit Card" number: "Bilang" @@ -909,6 +909,8 @@ fil_PH: loading: "naglo-load" discover_regen: loading: "naglo-load" + vine: + enable: "Kumonekta" actions: edit_profile: Settings properties: mga katangian @@ -3480,10 +3482,12 @@ fil_PH: new_variant: "bagong variant" form: sku: "SKU" - price: "presyo" unit_price: "Presyo kada Yunit" display_as: "Ipakita Bilang" display_name: "Pangalan na nakikita" + unit: yunit + price: presyo + variant_category: kategorya autocomplete: out_of_stock: "Walang stock" producer_name: "Producer" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c34700e4743..2de63fe888b 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -49,13 +49,13 @@ fr: price: "Prix" primary_taxon_id: "Catégorie Produit" shipping_category_id: "Condition de transport" - variant_unit: "Unité" - variant_unit_name: "Unité de la variante" - unit_value: "Nb unités" spree/variant: primary_taxon: "Catégorie Produit" shipping_category_id: "Condition de transport" supplier: "Fournisseur" + variant_unit: "Unité" + variant_unit_name: "Unité de la variante" + unit_value: "Nb unités" spree/credit_card: base: "Carte de crédit" number: "N° commande" @@ -1377,6 +1377,10 @@ fr: target="_blank">En savoir plus sur Discover Regenerative

+ vine: + enable: "A propos" + disable: "Déconnecter" + need_to_be_manager: "Seuls les gestionnaires peuvent connecter des applications." actions: edit_profile: Paramètres properties: Labels / propriétés @@ -4491,12 +4495,16 @@ fr: new_variant: "Nouvelle variante" form: sku: "Référence Produit" - price: "Prix" unit_price: "Prix unitaire" display_as: "Unité affichée" display_name: "Nom affiché" display_as_placeholder: 'ex. 2 kg' display_name_placeholder: 'ex. Tomates' + unit_scale: "Unité" + unit: Unité affichée + price: Prix + unit_value: Nb unités + variant_category: Catégorie autocomplete: out_of_stock: "En rupture de stock" producer_name: "Producteur" diff --git a/config/locales/fr_BE.yml b/config/locales/fr_BE.yml index 1ed23be29e4..f2d317d5efe 100644 --- a/config/locales/fr_BE.yml +++ b/config/locales/fr_BE.yml @@ -46,12 +46,12 @@ fr_BE: price: "Prix" primary_taxon_id: "Catégorie de Produit" shipping_category_id: "Catégorie de livraison" - variant_unit_name: "Nom de la variante" - unit_value: "Valeur unitaire" spree/variant: primary_taxon: "Catégorie de Produit" shipping_category_id: "Catégorie de livraison" supplier: "Disitributeur·trice" + variant_unit_name: "Nom de la variante" + unit_value: "Valeur unitaire" spree/credit_card: base: "Carte de crédit" number: "N° commande" @@ -193,6 +193,7 @@ fr_BE: no_default_card: "Pas de carte de paiement par défaut pour cet acheteur" shipping_method: not_available_to_shop: "n'est pas disponible pour %{shop}" + card_details: "Détails de la carte" customer_instructions: "Précisions pour la personne qui achète" devise: passwords: @@ -485,10 +486,13 @@ fr_BE: clone: Dupliquer delete: Supprimer remove: Supprimer + preview: Aperçu image: edit: Modifier product_preview: + product_preview: Aperçu du produit shop_tab: Comptoir + product_details_tab: Détails du produit adjustments: skipped_changing_canceled_order: "Vous ne pouvez pas modifier une commande annulée." begins_at: Commence @@ -1182,6 +1186,8 @@ fr_BE: loading: "Chargement en cours" discover_regen: loading: "Chargement en cours" + vine: + enable: "Se connecter" actions: edit_profile: Paramètres properties: Labels / propriétés @@ -1469,6 +1475,9 @@ fr_BE: pack_by_customer: Préparation des commandes par Acheteur·euse pack_by_supplier: Préparation des commandes par Producteur·trice pack_by_product: Préparation des commandes par produit + display: + report_is_big: "Ce rapport est volumineux et peut ralentir votre appareil." + display_anyway: "Afficher quand même" download: button: "Télécharger le rapport" show: @@ -1722,6 +1731,7 @@ fr_BE: stripe: use_saved_card: Utiliser la carte enregistrée save_card: Enregistrer la carte pour une utilisation ultérieure + create_new_card: ou entrez les détails de la nouvelle carte ci-dessous explaination: Vous pouvez vérifier et confirmer votre commande à l'étape suivante qui comprend les coûts finaux. submit: Suivant - Récapitulatif de la commande cancel: Retour à Vos coordonnées @@ -1730,7 +1740,7 @@ fr_BE: apply_voucher: Appliquer le bon d'achat placeholder: Entrer le code du bon d'achat confirm_delete: Êtes-vous sûr de vouloir supprimer le bon ? - warning_forfeit_remaining_amount: "Remarque : si le total de votre commande est inférieur à votre bon, vous ne pourrez peut-être pas dépenser la valeur restante." + warning_forfeit_remaining_amount: "Remarque : si le total de votre commande est inférieur à votre bon, vous ne pourrez peut-être pas dépenser la valeur restante." step3: delivery_details: title: Détails de livraison @@ -3626,6 +3636,7 @@ fr_BE: email: Email account_updated: "Compte mis à jour!" email_updated: "Le compte sera mis à jour une fois la nouvelle adresse-mail confirmée" + show_api_key_view_toggled: "L'affichage de la clé API a été modifié !" my_account: "Mon compte" date: "Date" time: "Heure" @@ -4013,12 +4024,16 @@ fr_BE: new_variant: "Nouvelle variante" form: sku: "Référence produit" - price: "Prix" unit_price: "Prix unitaire" display_as: "Unité affichéé" display_name: "Nom d'affichage" display_as_placeholder: 'Ex: 2 kilo' display_name_placeholder: 'ex: Tomates' + unit_scale: "Unité" + unit: Unité + price: Prix + unit_value: Valeur unitaire + variant_category: Catégorie autocomplete: out_of_stock: "Pas en stock" producer_name: "Producteur·trice" @@ -4232,6 +4247,7 @@ fr_BE: key_cleared: "clé effacée" shipment: cannot_ready: "Impossible de préparer l'expédition." + toggle_api_key_view: "Afficher la vue de la clé API pour l'utilisateur" unit: unité per_unit: Montant par unité datetime: diff --git a/config/locales/fr_CA.yml b/config/locales/fr_CA.yml index 894430b7b79..66b41e828be 100644 --- a/config/locales/fr_CA.yml +++ b/config/locales/fr_CA.yml @@ -49,13 +49,13 @@ fr_CA: price: "Prix" primary_taxon_id: "Catégorie Produit" shipping_category_id: "Condition de transport" - variant_unit: "Unit Scale" - variant_unit_name: "Unité de la variante" - unit_value: "Nb unités" spree/variant: primary_taxon: "Catégorie Produit" shipping_category_id: "Condition de transport" supplier: "Fournisseur" + variant_unit: "Unit Scale" + variant_unit_name: "Unité de la variante" + unit_value: "Nb unités" spree/credit_card: base: "Carte de crédit" number: "N° commande" @@ -1375,6 +1375,10 @@ fr_CA: En savoir plus sur le Annuaire alimentaire de Waterloo.

+ vine: + enable: "Se connecter" + disable: "Déconnecter" + need_to_be_manager: "Seuls les gestionnaires peuvent connecter des applications." actions: edit_profile: Paramètres properties: Labels / propriétés @@ -4472,12 +4476,16 @@ fr_CA: new_variant: "Nouvelle variante" form: sku: "Référence Produit" - price: "Prix" unit_price: "Prix unitaire" display_as: "Afficher comme" display_name: "Nom affiché" display_as_placeholder: 'ex. 2 kg' display_name_placeholder: 'ex. Tomates' + unit_scale: "Échelle d'unité" + unit: Unité + price: Prix + unit_value: Nb unités + variant_category: Catégorie autocomplete: out_of_stock: "En rupture de stock" producer_name: "Producteur" diff --git a/config/locales/fr_CH.yml b/config/locales/fr_CH.yml index f43a96e2ffa..be8e5b4129b 100644 --- a/config/locales/fr_CH.yml +++ b/config/locales/fr_CH.yml @@ -31,11 +31,11 @@ fr_CH: price: "Prix" primary_taxon_id: "Catégorie Produit" shipping_category_id: "Condition de transport" - variant_unit_name: "Unité de la variante" spree/variant: primary_taxon: "Catégorie Produit" shipping_category_id: "Condition de transport" supplier: "Fournisseur" + variant_unit_name: "Unité de la variante" spree/credit_card: base: "Carte de crédit" number: "N° commande" @@ -1105,6 +1105,8 @@ fr_CH: loading: "Chargement en cours" discover_regen: loading: "Chargement en cours" + vine: + enable: "A propos" actions: edit_profile: Paramètres properties: Labels / propriétés @@ -4002,12 +4004,14 @@ fr_CH: new_variant: "Nouvelle variante" form: sku: "Référence Produit" - price: "Prix" unit_price: "Prix unitaire" display_as: "Unité affichée" display_name: "Nom affiché" display_as_placeholder: 'ex. 2 kg' display_name_placeholder: 'ex. Tomates' + unit: Unité + price: Prix + variant_category: Catégorie autocomplete: out_of_stock: "En rupture de stock" producer_name: "Producteur" diff --git a/config/locales/fr_CM.yml b/config/locales/fr_CM.yml index 2431e13e231..b7003f505cd 100644 --- a/config/locales/fr_CM.yml +++ b/config/locales/fr_CM.yml @@ -31,11 +31,11 @@ fr_CM: price: "Prix" primary_taxon_id: "Catégorie Produit" shipping_category_id: "Condition de transport" - variant_unit_name: "Unité de la variante" spree/variant: primary_taxon: "Catégorie Produit" shipping_category_id: "Condition de transport" supplier: "Fournisseur" + variant_unit_name: "Unité de la variante" spree/credit_card: base: "Carte de crédit" number: "N° commande" @@ -1029,6 +1029,8 @@ fr_CM: loading: "Chargement en cours" discover_regen: loading: "Chargement en cours" + vine: + enable: "A propos" actions: edit_profile: Paramètres properties: Labels / propriétés @@ -3896,12 +3898,14 @@ fr_CM: new_variant: "Nouvelle variante" form: sku: "Référence Produit" - price: "Prix" unit_price: "Prix unitaire" display_as: "Unité affichée" display_name: "Nom affiché" display_as_placeholder: 'ex. 2 kg' display_name_placeholder: 'ex. Tomates' + unit: Unité + price: Prix + variant_category: Catégorie autocomplete: out_of_stock: "En rupture de stock" producer_name: "Producteur" diff --git a/config/locales/hi.yml b/config/locales/hi.yml index 2b5980c30b6..9697b6fa323 100644 --- a/config/locales/hi.yml +++ b/config/locales/hi.yml @@ -49,12 +49,12 @@ hi: price: "कीमत" primary_taxon_id: "उत्पाद की श्रेणी" shipping_category_id: "शिपिंग श्रेणी" - variant_unit_name: "वेरिएंट यूनिट का नाम" - unit_value: "यूनिट वैल्यू" spree/variant: primary_taxon: "उत्पाद की श्रेणी" shipping_category_id: "शिपिंग श्रेणी" supplier: "आपूर्तिकर्ता" + variant_unit_name: "वेरिएंट यूनिट का नाम" + unit_value: "यूनिट वैल्यू" spree/credit_card: base: "क्रेडिट कार्ड" number: "नंबर" @@ -1233,6 +1233,8 @@ hi: loading: "लोड हो रहा" discover_regen: loading: "लोड हो रहा" + vine: + enable: "मूल्य निर्धारण" actions: edit_profile: सेटिंग्स properties: प्रॉपर्टीज़ @@ -4235,12 +4237,15 @@ hi: new_variant: "नया वैरिएंट" form: sku: "SKU" - price: "कीमत" unit_price: "यूनिट की कीमत" display_as: "इस रूप में प्रदर्शित करें" display_name: "नाम प्रदर्शित करें" display_as_placeholder: 'उदाहरण 2 किलोग्राम' display_name_placeholder: 'उदाहरण टमाटर' + unit: यूनिट + price: कीमत + unit_value: यूनिट वैल्यू + variant_category: श्रेणी autocomplete: out_of_stock: "आउट ऑफ स्टॉक" producer_name: "उत्पादक" diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 927a200f0fa..57f38011201 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -49,12 +49,12 @@ hu: price: "Ár" primary_taxon_id: "Termékkategória" shipping_category_id: "Szállítási mód" - variant_unit_name: "Változat egység neve" - unit_value: "Egység értéke" spree/variant: primary_taxon: "Termékkategória" shipping_category_id: "Szállítási mód" supplier: "Beszállító" + variant_unit_name: "Változat egység neve" + unit_value: "Egység értéke" spree/credit_card: base: "Hitelkártya" number: "Szám" @@ -1323,6 +1323,10 @@ hu: target="_blank"> Tudj meg többet a Regeneratív gyakorlatokról.

+ vine: + enable: "Csatlakozás" + disable: "Lecsatlakozás" + need_to_be_manager: "Csak a megfelelő jogosultsággal rendelkező felhasználók csatlakoztathatnak alkalmazásokat." actions: edit_profile: Beállítások properties: Tulajdonságok @@ -4362,12 +4366,16 @@ hu: new_variant: "Új Változat" form: sku: "SKU" - price: "Ár" unit_price: "Egységár" display_as: "Megjelenítés mint" display_name: "Megjelenítendő név" display_as_placeholder: 'például. 2 kg''' display_name_placeholder: 'például. paradicsom' + unit_scale: "Mértékegység skála" + unit: Mértékegység + price: Ár + unit_value: Egység értéke + variant_category: Kategória autocomplete: out_of_stock: "Nincs raktáron" producer_name: "Termelő" diff --git a/config/locales/it.yml b/config/locales/it.yml index bd377afd9d3..bf37062fa51 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -46,12 +46,12 @@ it: price: "Prezzo" primary_taxon_id: "Categoria Prodotto" shipping_category_id: "Categoria Spedizioni" - variant_unit_name: "Nome Unità Variante" - unit_value: "Valore unità" spree/variant: primary_taxon: "Categoria Prodotto" shipping_category_id: "Categoria Spedizioni" supplier: "Fornitore" + variant_unit_name: "Nome Unità Variante" + unit_value: "Valore unità" spree/credit_card: base: "Carta di Credito" number: "Numero" @@ -1150,6 +1150,8 @@ it: loading: "Caricamento" discover_regen: loading: "Caricamento" + vine: + enable: "Blog" actions: edit_profile: Impostazioni properties: Proprietà @@ -4091,12 +4093,15 @@ it: new_variant: "Nuova variante" form: sku: "Codice ID" - price: "Prezzo" unit_price: "Prezzo unitario" display_as: "Visualizza come" display_name: "Nome da visualizzare" display_as_placeholder: 'es. 2 kg' display_name_placeholder: 'es. Pomodori' + unit: Unità + price: Prezzo + unit_value: Valore unità + variant_category: Categoria autocomplete: out_of_stock: "Esaurito" producer_name: "Produttore" diff --git a/config/locales/it_CH.yml b/config/locales/it_CH.yml index 9d745d7a5f2..bcf299093a7 100644 --- a/config/locales/it_CH.yml +++ b/config/locales/it_CH.yml @@ -31,11 +31,11 @@ it_CH: price: "Prezzo" primary_taxon_id: "Categoria prodotto" shipping_category_id: "Categoria Spedizioni" - variant_unit_name: "Nome Unità Variante" spree/variant: primary_taxon: "Categoria prodotto" shipping_category_id: "Categoria Spedizioni" supplier: "Fornitore" + variant_unit_name: "Nome Unità Variante" spree/credit_card: base: "Carta di Credito" number: "Numero" @@ -1079,6 +1079,8 @@ it_CH: loading: "Caricamento" discover_regen: loading: "Caricamento" + vine: + enable: "Blog" actions: edit_profile: Impostazioni properties: Proprietà @@ -3931,12 +3933,14 @@ it_CH: new_variant: "Nuova variante" form: sku: "Codice ID" - price: "Prezzo" unit_price: "Prezzo unitario" display_as: "Visualizza come" display_name: "Nome da visualizzare" display_as_placeholder: 'es. 2 kg' display_name_placeholder: 'es. Pomodori' + unit: Unità + price: Prezzo + variant_category: Categoria autocomplete: out_of_stock: "Esaurito" producer_name: "Produttore" diff --git a/config/locales/ko.yml b/config/locales/ko.yml index e4f508e1546..c77d9215fbe 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -31,11 +31,11 @@ ko: price: "가격" primary_taxon_id: "물품 목록" shipping_category_id: "전송물품 목록" - variant_unit_name: "변경된 구성 단위 이름" spree/variant: primary_taxon: "물품 목록" shipping_category_id: "전송물품 목록" supplier: "공급업체" + variant_unit_name: "변경된 구성 단위 이름" spree/credit_card: base: "신용카드" number: "숫자" @@ -1099,6 +1099,8 @@ ko: loading: "로딩 중" discover_regen: loading: "로딩 중" + vine: + enable: "함께하고 싶으시다면" actions: edit_profile: 설정 properties: 특성 @@ -3898,12 +3900,14 @@ ko: new_variant: "새로운 변경사항" form: sku: "재고 관리 단위" - price: "가격" unit_price: "단가" display_as: "다른 이름으로 표시" display_name: "이름 표시" display_as_placeholder: '예. 2 kg' display_name_placeholder: '예. Tomatoes' + unit: 단위 + price: 가격 + variant_category: 목록 autocomplete: out_of_stock: "품절" producer_name: "제공자" diff --git a/config/locales/ml.yml b/config/locales/ml.yml index 14407160c35..2db92efb786 100644 --- a/config/locales/ml.yml +++ b/config/locales/ml.yml @@ -49,12 +49,12 @@ ml: price: "വില" primary_taxon_id: "ഉൽപ്പന്ന വിഭാഗം" shipping_category_id: "ഷിപ്പിംഗ് വിഭാഗം" - variant_unit_name: "വേരിയന്റ് യൂണിറ്റിന്റെ പേര്" - unit_value: "യൂണിറ്റ് മൂല്യം" spree/variant: primary_taxon: "ഉൽപ്പന്ന വിഭാഗം" shipping_category_id: "അയക്കൽ വിഭാഗം" supplier: "വിതരണക്കാരൻ" + variant_unit_name: "വേരിയന്റ് യൂണിറ്റിന്റെ പേര്" + unit_value: "യൂണിറ്റ് മൂല്യം" spree/credit_card: base: "ക്രെഡിറ്റ് കാർഡ്" number: "നമ്പർ" @@ -1242,6 +1242,8 @@ ml: discover_regen: title: "റീജനറേറ്റീവ് കണ്ടെത്തുക" loading: "ലോഡിംഗ്" + vine: + enable: "ബന്ധിപ്പിക്കുക" actions: edit_profile: ക്രമീകരണങ്ങൾ properties: പ്രോപ്പർട്ടികൾ @@ -4262,12 +4264,15 @@ ml: new_variant: "പുതിയ വേരിയന്റ്" form: sku: "എസ്.കെ.യു" - price: "വില" unit_price: "യൂണിറ്റ് വില" display_as: "പ്രദർശന മാർഗ്ഗം" display_name: "പ്രദർശന നാമം" display_as_placeholder: 'ഉദാ. 2 കി.ഗ്രാം' display_name_placeholder: 'ഉദാ. തക്കാളി' + unit: യൂണിറ്റ് + price: വില + unit_value: യൂണിറ്റ് മൂല്യം + variant_category: വിഭാഗം autocomplete: out_of_stock: "സ്റ്റോക്കില്ല" producer_name: "പ്രൊഡ്യൂസർ" diff --git a/config/locales/mr.yml b/config/locales/mr.yml index 9129e1711b3..4db419b77e2 100644 --- a/config/locales/mr.yml +++ b/config/locales/mr.yml @@ -49,12 +49,12 @@ mr: price: "किंमत" primary_taxon_id: "उत्पादन श्रेणी" shipping_category_id: "शिपिंग श्रेणी" - variant_unit_name: "वेरिएंट युनिटचे नाव" - unit_value: "युनिट मूल्य" spree/variant: primary_taxon: "उत्पादन श्रेणी" shipping_category_id: "शिपिंग श्रेणी" supplier: "पुरवठादार" + variant_unit_name: "वेरिएंट युनिटचे नाव" + unit_value: "युनिट मूल्य" spree/credit_card: base: "क्रेडीट कार्ड" number: "क्रमांक" @@ -1221,6 +1221,9 @@ mr: create_custom_tab: "शॉपफ्रंटमध्ये कस्टम टॅब तयार करा" custom_tab_title: "कस्टम टॅबसाठी शीर्षक" custom_tab_content: "कस्टम टॅबसाठी मजकूर" + connected_apps: + vine: + enable: "किंमत" actions: edit_profile: सेटिंग्ज properties: 'गुणधर्म ' @@ -4148,12 +4151,14 @@ mr: new_variant: "नवीन प्रकार" form: sku: "SKU" - price: "किंमत" unit_price: "युनिट किंमत" display_as: "म्हणून प्रदर्शित करा" display_name: "डिस्प्ले नाव" display_as_placeholder: 'उदा. 2 किलो' display_name_placeholder: 'उदा. टोमॅटो' + price: किंमत + unit_value: युनिट मूल्य + variant_category: श्रेणी autocomplete: out_of_stock: "स्टॉक संपला" producer_name: "उत्पादक" diff --git a/config/locales/nb.yml b/config/locales/nb.yml index 9ed17d144c8..c89ea8b2fb0 100644 --- a/config/locales/nb.yml +++ b/config/locales/nb.yml @@ -49,12 +49,12 @@ nb: price: "Pris" primary_taxon_id: "Produktkategori" shipping_category_id: "Leveringskategori" - variant_unit_name: "Enhetsnavn Variant" - unit_value: "Enhetsverdi" spree/variant: primary_taxon: "Produktkategori" shipping_category_id: "Leveringskategori" supplier: "Leverandør" + variant_unit_name: "Enhetsnavn Variant" + unit_value: "Enhetsverdi" spree/credit_card: base: "Kredittkort" number: "Antall" @@ -1328,6 +1328,10 @@ nb: target="_blank">Lær mer om Discover Regenerativ

+ vine: + enable: "Koble til" + disable: "Koble fra" + need_to_be_manager: "Bare ledere kan koble til apper." actions: edit_profile: Innstillinger properties: Egenskaper @@ -4358,12 +4362,16 @@ nb: new_variant: "Ny Variant" form: sku: "SKU" - price: "Pris" unit_price: "Enhetspris" display_as: "Vis som" display_name: "Visningsnavn" display_as_placeholder: 'f.eks. 2 kg' display_name_placeholder: 'f.eks. Tomater' + unit_scale: "Enhetsskala" + unit: Enhet + price: Pris + unit_value: Enhetsverdi + variant_category: Kategori autocomplete: out_of_stock: "Ikke på Lager" producer_name: "Produsent" diff --git a/config/locales/nl_BE.yml b/config/locales/nl_BE.yml index fa66bcaa060..d24f754e2ac 100644 --- a/config/locales/nl_BE.yml +++ b/config/locales/nl_BE.yml @@ -31,11 +31,11 @@ nl_BE: price: "Prijs" primary_taxon_id: "Product categorie" shipping_category_id: "Verzendcategorie" - variant_unit_name: "Variant Unit Name" spree/variant: primary_taxon: "Product categorie" shipping_category_id: "Verzendcategorie" supplier: "Leverancier" + variant_unit_name: "Variant Unit Name" spree/credit_card: base: "Kredietkaart" number: "Nummer" @@ -932,6 +932,8 @@ nl_BE: loading: "Aan het opladen" discover_regen: loading: "Aan het opladen" + vine: + enable: "Connecteer je " actions: edit_profile: Instellingen properties: Eigenschappen @@ -3491,12 +3493,14 @@ nl_BE: new_variant: "Nieuw variant" form: sku: "SKU" - price: "Prijs" unit_price: "Stukprijs" display_as: "Weergeven als" display_name: "Weergave naam" display_as_placeholder: 'bv. 2.kg' display_name_placeholder: 'bv. Tomaten' + unit: Unit + price: Prijs + variant_category: Categorie autocomplete: out_of_stock: "Geen voorraad" producer_name: "Producent" diff --git a/config/locales/pa.yml b/config/locales/pa.yml index a92d5db1312..c42c4c99658 100644 --- a/config/locales/pa.yml +++ b/config/locales/pa.yml @@ -46,12 +46,12 @@ pa: price: "ਕੀਮਤ" primary_taxon_id: "ਉਤਪਾਦ ਸ਼੍ਰੇਣੀ" shipping_category_id: "ਸ਼ਿਪਿੰਗ ਸ਼੍ਰੇਣੀ" - variant_unit_name: "ਵੇਰੀਐਂਟ ਯੂਨਿਟ ਦਾ ਨਾਮ" - unit_value: "ਯੂਨਿਟ ਵੈਲਯੂ" spree/variant: primary_taxon: "ਉਤਪਾਦ ਸ਼੍ਰੇਣੀ" shipping_category_id: "ਸ਼ਿਪਿੰਗ ਸ਼੍ਰੇਣੀ" supplier: "ਸਪਲਾਇਰ" + variant_unit_name: "ਵੇਰੀਐਂਟ ਯੂਨਿਟ ਦਾ ਨਾਮ" + unit_value: "ਯੂਨਿਟ ਵੈਲਯੂ" spree/credit_card: base: "ਕਰੇਡਿਟ ਕਾਰਡ" number: "ਨੰਬਰ" @@ -1217,6 +1217,8 @@ pa: loading: "ਲੋਡ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ" discover_regen: loading: "ਲੋਡ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ" + vine: + enable: "ਕਨੈਕਟ" actions: edit_profile: ਸੈਟਿੰਗਾਂ properties: ਪ੍ਰਾਪਰਟੀਜ਼ @@ -4129,12 +4131,15 @@ pa: new_variant: "ਨਵਾਂ ਵੇਰੀਐਂਟ" form: sku: "SKU" - price: "ਕੀਮਤ" unit_price: "ਯੂਨਿਟ ਦੀ ਕੀਮਤ" display_as: "ਇਸ ਤਰ੍ਹਾਂ ਪ੍ਰਦਰਸ਼ਿਤ ਕਰੋ" display_name: "ਡਿਸਪਲੇ ਕੀਤੇ ਜਾਣ ਵਾਲਾ ਨਾਂ" display_as_placeholder: 'ਜਿਵੇਂ ਕਿ 2 ਕਿਲੋ' display_name_placeholder: 'ਜਿਵੇਂ ਕਿ ਟਮਾਟਰ''' + unit: ਯੂਨਿਟ + price: ਕੀਮਤ + unit_value: ਯੂਨਿਟ ਵੈਲਯੂ + variant_category: ਸ਼੍ਰੇਣੀ autocomplete: out_of_stock: "ਸਟਾਕ ਵਿੱਚ ਨਹੀਂ ਹੈਂ" producer_name: "ਉਤਪਾਦਕ" diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 6578b1fff37..298d7006fce 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -26,11 +26,11 @@ pl: price: "Cena" primary_taxon_id: "Kategoria produktu" shipping_category_id: "Kategoria dostawy" - variant_unit_name: "Nazwa jednostki wariantu" spree/variant: primary_taxon: "Kategoria produktu" shipping_category_id: "Kategoria dostawy" supplier: "Dostawca" + variant_unit_name: "Nazwa jednostki wariantu" spree/credit_card: base: "Karta kredytowa" number: "Numer zamówienia" @@ -880,6 +880,9 @@ pl: email_not_confirmed: "Adres e-mail nie został potwierdzony" vouchers: customers: Klient + connected_apps: + vine: + enable: "Połącz się" actions: edit_profile: Ustawienia properties: Właściwości @@ -3455,11 +3458,13 @@ pl: new_variant: "New Variant" form: sku: "SKU" - price: "Cena" display_as: "Wyświetl jako" display_name: "Wyświetlana nazwa" display_as_placeholder: 'na przykład. 2 kg' display_name_placeholder: 'np. Pomidory' + unit: Jednostka + price: Cena + variant_category: Kategoria autocomplete: out_of_stock: "Obecnie brak na stanie" producer_name: "Producent" diff --git a/config/locales/pt.yml b/config/locales/pt.yml index e29dc251941..a7ebfd230f7 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -31,11 +31,11 @@ pt: price: "Preço" primary_taxon_id: "Categoria de Produto" shipping_category_id: "Categoria de Envio" - variant_unit_name: "Nome da Unidade da Variante" spree/variant: primary_taxon: "Categoria de Produto" shipping_category_id: "Categoria de Envio" supplier: "Fornecedor" + variant_unit_name: "Nome da Unidade da Variante" spree/credit_card: base: "Cartão de Crédito" number: "Número" @@ -972,6 +972,8 @@ pt: loading: "A carregar" discover_regen: loading: "A carregar" + vine: + enable: "Conectar" actions: edit_profile: Definições properties: Propriedades @@ -3457,12 +3459,14 @@ pt: new_variant: "Nova variante" form: sku: "SKU" - price: "Preço" unit_price: "Preço Unitário" display_as: "Mostrar como" display_name: "Nome a apresentar" display_as_placeholder: 'por ex. 2 kg' display_name_placeholder: 'por ex. Tomates' + unit: Unidade + price: Preço + variant_category: Categoria autocomplete: out_of_stock: "Sem Stock" producer_name: "Produtor" diff --git a/config/locales/pt_BR.yml b/config/locales/pt_BR.yml index 2cf1dc829b0..fb394fde76d 100644 --- a/config/locales/pt_BR.yml +++ b/config/locales/pt_BR.yml @@ -29,11 +29,11 @@ pt_BR: price: "Preço" primary_taxon_id: "Categoria de Produto" shipping_category_id: "Tipos de Frete" - variant_unit_name: "Nome da unidade variante" spree/variant: primary_taxon: "Categoria de Produto" shipping_category_id: "Tipos de Frete" supplier: "Fornecedor" + variant_unit_name: "Nome da Unidade da Variante" spree/credit_card: base: "Cartão de Crédito" number: "Número" @@ -1012,6 +1012,8 @@ pt_BR: loading: "Carregando" discover_regen: loading: "Carregando" + vine: + enable: "Conectar" actions: edit_profile: Configurações properties: Propriedades @@ -3780,12 +3782,14 @@ pt_BR: new_variant: "Nova Variante" form: sku: "SKU" - price: "Preço" unit_price: "Preço Unitário" display_as: "Mostrar Como" display_name: "Mostrar Nome" display_as_placeholder: 'ex. 2 kg' display_name_placeholder: 'ex. Tomates' + unit: Unidade + price: Preço + variant_category: Categoria autocomplete: out_of_stock: "Sem estoque" producer_name: "Produtor" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index aa6b6a1d6ab..c24ac4eaeab 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -49,12 +49,12 @@ ru: price: "Цена" primary_taxon_id: "Категория Товара" shipping_category_id: "Категория Доставки" - variant_unit_name: "Название Единицы Варианта" - unit_value: "Значение товара" spree/variant: primary_taxon: "Категория Товара" shipping_category_id: "Категория Доставки" supplier: "Поставщик" + variant_unit_name: "Название Единицы Варианта" + unit_value: "Значение товара" spree/credit_card: base: "Кредитная Карта" number: "Номер" @@ -1286,6 +1286,9 @@ ru: Ваша учетная запись Открытой Сети Продуктов подключена к Discover Regenerative. Добавьте или обновите информацию о своем списке Discover Regenerative здесь. link_label: "Управление списком" + vine: + enable: "Подключить" + disable: "Отключить" actions: edit_profile: Настройки properties: Свойства @@ -4374,12 +4377,16 @@ ru: new_variant: "Новый Вариант" form: sku: "SKU" - price: "Цена" unit_price: "Цена за единицу" display_as: "Показать как" display_name: "Показать имя" display_as_placeholder: 'напр. 2 кг' display_name_placeholder: 'напр. Помидоры' + unit_scale: "Единицы" + unit: Единица измерения + price: Цена + unit_value: Значение товара + variant_category: Категория autocomplete: out_of_stock: "Нет в Наличии" producer_name: "Производитель" diff --git a/config/locales/sv.yml b/config/locales/sv.yml index dd76a3b91db..a3e07a01bf0 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -567,6 +567,9 @@ sv: managers_tip: Andra användare med tillstånd att leda detta företag. vouchers: customers: Kund + connected_apps: + vine: + enable: "Anslut" actions: edit_profile: Inställningar properties: Egenskaper @@ -2349,9 +2352,11 @@ sv: price: "Pris" form: sku: "SKU" - price: "Pris" unit_price: "Styckpris" display_as: "Visa som" + unit: Enhet + price: Pris + variant_category: Kategori autocomplete: producer_name: "Producent" unit: "Enhet" diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 6d6465906c3..7e6b5d26f82 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -31,11 +31,11 @@ tr: price: "Fiyat" primary_taxon_id: "ÜRÜN KATEGORİSİ" shipping_category_id: "TESLİMAT KATEGORİSİ" - variant_unit_name: "Çeşit Birim Adı" spree/variant: primary_taxon: "ÜRÜN KATEGORİSİ" shipping_category_id: "TESLİMAT KATEGORİSİ" supplier: "TEDARİKÇİ" + variant_unit_name: "Çeşit Birim Adı" spree/credit_card: base: "Kredİ kartı" number: "Numara" @@ -1001,6 +1001,8 @@ tr: loading: "Yükleniyor" discover_regen: loading: "Yükleniyor" + vine: + enable: "Bağlan" actions: edit_profile: Ayarlar properties: ÖZELLİKLER @@ -3785,12 +3787,14 @@ tr: new_variant: "Yeni Çeşit" form: sku: "Stok Kodu" - price: "Fiyat" unit_price: "Birim Fiyat" display_as: "Gösterme Şekli" display_name: "Ekran adı" display_as_placeholder: 'Örn. 2 kg' display_name_placeholder: 'Örn. Domates' + unit: Birim + price: Fiyat + variant_category: Kategori autocomplete: out_of_stock: "Stokta Yok" producer_name: "Üretici" diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 785e0a1ce30..a26ad1db693 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -33,11 +33,11 @@ uk: price: "Ціна" primary_taxon_id: "Категорія товару" shipping_category_id: "Категорія доставки" - variant_unit_name: "Назва варіанта одиниці" spree/variant: primary_taxon: "Категорія товару" shipping_category_id: "Категорія доставки" supplier: "Постачальник" + variant_unit_name: "Назва варіанта одиниці" spree/credit_card: base: "Кредитна картка" number: "Номер" @@ -1116,6 +1116,8 @@ uk: loading: "Завантаження" discover_regen: loading: "Завантаження" + vine: + enable: "Підключитися" actions: edit_profile: Налаштування properties: Властивості @@ -4023,12 +4025,14 @@ uk: new_variant: "Новий Варіант" form: sku: "Артикул" - price: "Ціна" unit_price: "Ціна за од." display_as: "Відображати як" display_name: "Відображуване ім'я" display_as_placeholder: 'напр. 2 кг' display_name_placeholder: 'напр. Помідори' + unit: Одиниця + price: Ціна + variant_category: Категорія autocomplete: out_of_stock: "Немає в наявності" producer_name: "Виробник" diff --git a/config/routes/spree.rb b/config/routes/spree.rb index e9d21a66cb5..c6c84fddbec 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -83,8 +83,10 @@ end end - # duplicate old path for reference when admin_style_v3 enabled - resources :products_old, to: 'products#index', only: :index + if Rails.env.development? + # duplicate old path for reference when admin_style_v3 enabled + resources :products_old, to: 'products#index', only: :index + end get '/variants/search', :to => "variants#search", :as => :search_variants diff --git a/engines/order_management/app/services/order_management/order/updater.rb b/engines/order_management/app/services/order_management/order/updater.rb index 97b77ace28e..c31e2b929d0 100644 --- a/engines/order_management/app/services/order_management/order/updater.rb +++ b/engines/order_management/app/services/order_management/order/updater.rb @@ -240,7 +240,30 @@ def update_pending_payment return unless order.state.in? ["payment", "confirmation", "complete"] return unless order.pending_payments.any? - order.pending_payments.first.update_attribute :amount, order.total + @payment = order.pending_payments.first + return update_payment if @payment.adjustment.nil? + + # Update payment tax fees if needed + new_amount = @payment.payment_method.compute_amount(@payment) + if new_amount != @payment.adjustment.amount + update_payment_adjustment(new_amount) + end + + update_payment + end + + def update_payment + # Update payment with correct amount + @payment.update_attribute :amount, order.total + end + + def update_payment_adjustment(amount) + @payment.adjustment.update_attribute(:amount, amount) + + # Update order total to take into account updated payment fees + update_adjustment_total + update_order_total + persist_totals end end end diff --git a/engines/order_management/spec/services/order_management/order/updater_spec.rb b/engines/order_management/spec/services/order_management/order/updater_spec.rb index 4b1eb0689e2..458bb785ceb 100644 --- a/engines/order_management/spec/services/order_management/order/updater_spec.rb +++ b/engines/order_management/spec/services/order_management/order/updater_spec.rb @@ -121,7 +121,7 @@ module Order updater.update end - context "whith pending payments" do + context "with pending payments" do let(:order) { create(:completed_order_with_totals) } it "updates pending payments" do @@ -183,6 +183,19 @@ module Order expect { updater.update }.to change { payment.reload.amount }.from(10).to(20) end + + it "updates pending payments fees" do + calculator = build(:calculator_flat_percent_per_item, preferred_flat_percent: 10) + payment_method = create(:payment_method, name: "Percentage cash", calculator:) + payment = create(:payment, payment_method:, order:, amount: order.total) + + # update order so the order total will change + update_order_quantity(order) + order.payments.reload + + expect { updater.update }.to change { payment.reload.amount }.from(10).to(22) + .and change { payment.reload.adjustment.amount }.from(1).to(2) + end end context "with order in cart" do diff --git a/lib/open_food_network/feature_toggle.rb b/lib/open_food_network/feature_toggle.rb index a3b1d8b2537..bac5fa61db7 100644 --- a/lib/open_food_network/feature_toggle.rb +++ b/lib/open_food_network/feature_toggle.rb @@ -7,6 +7,19 @@ module OpenFoodNetwork # - http://localhost:3000/admin/feature-toggle/features # module FeatureToggle + def self.conditional_features + features = {} + if Rails.env.development? + features.merge!({ + "admin_style_v3" => <<~DESC, + Test the work-in-progress design updates. + DESC + }); + end + + features + end + # Please add your new feature here to appear in the Flipper UI. # We way move this to a YAML file when it becomes too awkward. # **WARNING:** Features not in this list will be removed. @@ -22,9 +35,6 @@ module FeatureToggle # Flipper.enable("dragon_mode") # CURRENT_FEATURES = { - "admin_style_v3" => <<~DESC, - Test the work-in-progress design updates. - DESC "api_reports" => <<~DESC, An API endpoint for reports at /api/v0/reports/:report_type(/:report_subtype) @@ -48,7 +58,7 @@ module FeatureToggle Activated for a user. The user (INRAE researcher) has access to anonymised sales. DESC - }.freeze + }.merge(conditional_features).freeze; # Features you would like to be enabled to start with. ACTIVE_BY_DEFAULT = { @@ -75,6 +85,9 @@ def self.setup! # Checks weather a feature is enabled for any of the given actors. def self.enabled?(feature_name, *actors) + # TODO: Need to remove these checks when we fully remove the toggle from development as well + # need this check as Flipper won't recognize 'admin_style_v3' as it is removed for server envs + return true if !Rails.env.development? && feature_name == :admin_style_v3 return Flipper.enabled?(feature_name) if actors.empty? actors.any? do |actor| diff --git a/package.json b/package.json index fcc82f57677..b515b4bb026 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "@floating-ui/dom": "^1.6.11", "@hotwired/stimulus": "^3.2", - "@hotwired/turbo": "^8.0.11", + "@hotwired/turbo": "^8.0.12", "@rails/webpacker": "5.4.4", "@stimulus-components/rails-nested-form": "^5.0.0", "cable_ready": "5.0.5", @@ -32,7 +32,7 @@ "stimulus-flatpickr": "^1.4.0", "stimulus_reflex": "3.5.1", "tom-select": "^2.3.1", - "trix": "^2.1.6", + "trix": "^2.1.7", "turbo_power": "^0.7.0", "webpack": "~4" }, diff --git a/spec/fixtures/vcr_cassettes/DfcRequest/refreshes_the_access_token_on_fail.yml b/spec/fixtures/vcr_cassettes/DfcRequest/refreshes_the_access_token_on_fail.yml index 9a14071f73f..8af0a0f99d2 100644 --- a/spec/fixtures/vcr_cassettes/DfcRequest/refreshes_the_access_token_on_fail.yml +++ b/spec/fixtures/vcr_cassettes/DfcRequest/refreshes_the_access_token_on_fail.yml @@ -19,7 +19,7 @@ http_interactions: message: OK headers: Date: - - Fri, 15 Mar 2024 05:44:06 GMT + - Thu, 17 Oct 2024 22:34:30 GMT Content-Type: - application/json;charset=UTF-8 Transfer-Encoding: @@ -29,14 +29,14 @@ http_interactions: Vary: - Accept-Encoding Set-Cookie: - - AUTH_SESSION_ID=1710481447.162.5206.870756|6055218c9898cae39f8ffd531999e49a; + - AUTH_SESSION_ID=1729204471.193.75356.242686|78230f584c0d7db97d376e98de5321dc; Path=/; Secure; HttpOnly Cache-Control: - no-cache, must-revalidate, no-transform, no-store Referrer-Policy: - no-referrer Strict-Transport-Security: - - max-age=15724800; includeSubDomains + - max-age=31536000; includeSubDomains X-Content-Type-Options: - nosniff X-Frame-Options: @@ -47,7 +47,7 @@ http_interactions: encoding: ASCII-8BIT string: '{"issuer":"https://login.lescommuns.org/auth/realms/data-food-consortium","authorization_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/auth","token_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/token","introspection_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/token/introspect","userinfo_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/userinfo","end_session_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/logout","frontchannel_logout_session_supported":true,"frontchannel_logout_supported":true,"jwks_uri":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/certs","check_session_iframe":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/login-status-iframe.html","grant_types_supported":["authorization_code","implicit","refresh_token","password","client_credentials","urn:openid:params:grant-type:ciba","urn:ietf:params:oauth:grant-type:device_code"],"acr_values_supported":["0","1"],"response_types_supported":["code","none","id_token","token","id_token token","code id_token","code token","code id_token token"],"subject_types_supported":["public","pairwise"],"id_token_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"id_token_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"id_token_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"userinfo_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512","none"],"userinfo_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"userinfo_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"request_object_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512","none"],"request_object_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"request_object_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"response_modes_supported":["query","fragment","form_post","query.jwt","fragment.jwt","form_post.jwt","jwt"],"registration_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/clients-registrations/openid-connect","token_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"token_endpoint_auth_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"introspection_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"introspection_endpoint_auth_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"authorization_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"authorization_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"authorization_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"claims_supported":["aud","sub","iss","auth_time","name","given_name","family_name","preferred_username","email","acr"],"claim_types_supported":["normal"],"claims_parameter_supported":true,"scopes_supported":["openid","microprofile-jwt","phone","roles","profile","email","address","web-origins","acr","offline_access"],"request_parameter_supported":true,"request_uri_parameter_supported":true,"require_request_uri_registration":true,"code_challenge_methods_supported":["plain","S256"],"tls_client_certificate_bound_access_tokens":true,"revocation_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/revoke","revocation_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"revocation_endpoint_auth_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"backchannel_logout_supported":true,"backchannel_logout_session_supported":true,"device_authorization_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/auth/device","backchannel_token_delivery_modes_supported":["poll","ping"],"backchannel_authentication_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/ext/ciba/auth","backchannel_authentication_request_signing_alg_values_supported":["PS384","ES384","RS384","ES256","RS256","ES512","PS256","PS512","RS512"],"require_pushed_authorization_requests":false,"pushed_authorization_request_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/ext/par/request","mtls_endpoint_aliases":{"token_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/token","revocation_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/revoke","introspection_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/token/introspect","device_authorization_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/auth/device","registration_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/clients-registrations/openid-connect","userinfo_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/userinfo","pushed_authorization_request_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/ext/par/request","backchannel_authentication_endpoint":"https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/ext/ciba/auth"},"authorization_response_iss_parameter_supported":true}' - recorded_at: Fri, 15 Mar 2024 05:44:05 GMT + recorded_at: Thu, 17 Oct 2024 22:34:30 GMT - request: method: post uri: https://login.lescommuns.org/auth/realms/data-food-consortium/protocol/openid-connect/token @@ -71,7 +71,7 @@ http_interactions: message: OK headers: Date: - - Fri, 15 Mar 2024 05:44:07 GMT + - Thu, 17 Oct 2024 22:34:31 GMT Content-Type: - application/json Transfer-Encoding: @@ -81,7 +81,7 @@ http_interactions: Vary: - Accept-Encoding Set-Cookie: - - AUTH_SESSION_ID=1710481448.492.2309.531618|6055218c9898cae39f8ffd531999e49a; + - AUTH_SESSION_ID=1729204472.43.75092.609685|78230f584c0d7db97d376e98de5321dc; Path=/; Secure; HttpOnly Cache-Control: - no-store @@ -90,7 +90,7 @@ http_interactions: Referrer-Policy: - no-referrer Strict-Transport-Security: - - max-age=15724800; includeSubDomains + - max-age=31536000; includeSubDomains X-Content-Type-Options: - nosniff X-Frame-Options: @@ -99,7 +99,7 @@ http_interactions: - 1; mode=block body: encoding: ASCII-8BIT - string: '{"access_token":"","expires_in":1800,"refresh_expires_in":28510621,"refresh_token":"","token_type":"Bearer","id_token":"","not-before-policy":0,"session_state":"989db9a7-584c-4eeb-bff5-db77b53e8def","scope":"openid - profile email"}' - recorded_at: Fri, 15 Mar 2024 05:44:07 GMT + string: '{"access_token":"","expires_in":1800,"refresh_expires_in":0,"refresh_token":"","token_type":"Bearer","id_token":"","not-before-policy":0,"session_state":"c2483b2c-607e-4996-9f5e-9ef85176ff75","scope":"openid + profile email offline_access"}' + recorded_at: Thu, 17 Oct 2024 22:34:31 GMT recorded_with: VCR 6.2.0 diff --git a/spec/jobs/backorder_job_spec.rb b/spec/jobs/backorder_job_spec.rb index 301be0cd7f2..79d2ec88461 100644 --- a/spec/jobs/backorder_job_spec.rb +++ b/spec/jobs/backorder_job_spec.rb @@ -104,6 +104,14 @@ # Clean up after ourselves: perform_enqueued_jobs(only: CompleteBackorderJob) end + + it "succeeds when no work to be done" do + # The database can change before the job is run. So maybe there's nothing + # to do. + expect { + subject.place_backorder(order) + }.not_to raise_error + end end describe "#place_order" do diff --git a/spec/support/features/datepicker_helper.rb b/spec/support/features/datepicker_helper.rb index 03758c7c344..74444316a53 100644 --- a/spec/support/features/datepicker_helper.rb +++ b/spec/support/features/datepicker_helper.rb @@ -12,13 +12,22 @@ def select_dates_from_daterangepicker(from, to) # Once the datepicker is open, # it simply consist to select the 'from' date and then the 'to' date select_date_from_datepicker(from) - select_date_from_datepicker(to, from) + select_date_from_datepicker(to) end - def select_date_from_datepicker(date, reference_date = Time.zone.today) - navigate_datepicker_to_month(date, reference_date) - find('.flatpickr-calendar.open .flatpickr-days .flatpickr-day:not(.prevMonthDay)', - text: date.strftime("%e").to_s.strip, exact_text: true, match: :first).click + def select_date_from_datepicker(date) + within ".flatpickr-calendar.open" do + # Unfortunately, flatpickr doesn't notice a change of year when we do + # + # fill_in "Year", with: date.year + # + # A working alternative is: + find(".cur-year").send_keys(date.year.to_s) + select date.strftime("%B"), from: "Month" + + aria_date = date.strftime("%B %-d, %Y") + find("[aria-label='#{aria_date}']").click + end end def select_datetime_from_datepicker(datetime) @@ -29,38 +38,16 @@ def select_datetime_from_datepicker(datetime) find(".flatpickr-calendar.open .flatpickr-minute").set datetime.strftime("%M").to_s.strip end - def navigate_datepicker_to_month(date, reference_date) - month_and_year = date.strftime("%-m %Y") - - until datepicker_month_and_year == month_and_year.upcase - if date < reference_date - navigate_datepicker_to_previous_month - elsif date > reference_date - navigate_datepicker_to_next_month - end - end - end - - def navigate_datepicker_to_previous_month - find('.flatpickr-calendar.open .flatpickr-months .flatpickr-prev-month').click - end - - def navigate_datepicker_to_next_month - find('.flatpickr-calendar.open .flatpickr-months .flatpickr-next-month').click - end - - def datepicker_month_and_year - month = find(".flatpickr-calendar.open .flatpickr-current-month " \ - "select.flatpickr-monthDropdown-months").value.to_i + 1 - year = find(".flatpickr-calendar.open .flatpickr-current-month " \ - ".numInputWrapper .cur-year").value - "#{month} #{year}" - end - def pick_datetime(calendar_selector, datetime_selector) find(calendar_selector).click select_datetime_from_datepicker datetime_selector find("body").send_keys(:escape) end + + def close_datepicker + within(".flatpickr-calendar.open") do + click_button "Close" + end + end end end diff --git a/spec/system/admin/bulk_product_update_spec.rb b/spec/system/admin/bulk_product_update_spec.rb deleted file mode 100644 index 704cc30407f..00000000000 --- a/spec/system/admin/bulk_product_update_spec.rb +++ /dev/null @@ -1,954 +0,0 @@ -# frozen_string_literal: true - -require 'system_helper' - -RSpec.describe ' - As an Administrator - I want to be able to manage products in bulk (with the old Products screen) -' do - include AdminHelper - include AuthenticationHelper - include WebHelper - - before { Flipper.disable(:admin_style_v3) } - - describe "listing products" do - before do - login_as_admin - end - - it "displays a list of products" do - p1 = FactoryBot.create(:product) - p2 = FactoryBot.create(:product) - visit spree.admin_products_path - - expect(page).to have_field "product_name", with: p1.name - expect(page).to have_field "product_name", with: p2.name - end - - it "displays a select box for suppliers, with the appropriate supplier selected" do - s1 = FactoryBot.create(:supplier_enterprise) - s2 = FactoryBot.create(:supplier_enterprise) - s3 = FactoryBot.create(:supplier_enterprise) - p1 = FactoryBot.create(:product, supplier_id: s2.id) - p2 = FactoryBot.create(:product, supplier_id: s3.id) - - visit spree.admin_products_path - # the supplier dropdown is on the variant row, so we expand all for the dropdown to be visible - click_expand_all - - expect(page).to have_select "producer_id", with_options: [s1.name, s2.name, s3.name], - selected: s2.name - expect(page).to have_select "producer_id", with_options: [s1.name, s2.name, s3.name], - selected: s3.name - end - - it "displays an on hand count in a span for each product" do - p1 = FactoryBot.create(:product) - v1 = p1.variants.first - v1.update_attribute(:on_demand, false) - v1.update_attribute(:on_hand, 4) - - visit spree.admin_products_path - - within "#p_#{p1.id}" do - expect(page).to have_selector "span[name='on_hand']", text: "4" - end - end - - it "displays 'on demand' for any variant that is available on demand" do - p1 = FactoryBot.create(:product) - v1 = FactoryBot.create(:variant, product: p1, on_hand: 4) - v2 = FactoryBot.create(:variant, product: p1, on_hand: 0, on_demand: true) - - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 1 - find("a.view-variants").click - - expect(page).not_to have_selector "span[name='on_hand']", text: "On demand" - expect(page).to have_field "variant_on_hand", with: "4" - expect(page).not_to have_field "variant_on_hand", with: "" - expect(page).to have_selector "span[name='variant_on_hand']", text: "On demand" - end - - it "displays a select box for the unit of measure for the product's variants" do - create(:product, variant_unit: 'weight', variant_unit_scale: 1, - variant_unit_name: '') - - visit spree.admin_products_path - click_expand_all - - expect(page).to have_select "variant_unit_with_scale", selected: "Weight (g)" - end - - it "displays a text field for the item name when unit is set to 'Items'" do - create(:product, variant_unit: 'items', variant_unit_scale: nil, - variant_unit_name: 'packet') - - visit spree.admin_products_path - click_expand_all - - expect(page).to have_select "variant_unit_with_scale", selected: "Items" - expect(page).to have_field "variant_unit_name", with: "packet" - end - end - - describe "listing variants" do - before do - login_as_admin - end - - it "displays a list of variants for each product" do - v1 = FactoryBot.create(:variant, display_name: "something1" ) - v2 = FactoryBot.create(:variant, display_name: "something2" ) - - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 2 - all("a.view-variants").each(&:click) - - expect(page).to have_field "product_name", with: v1.product.name - expect(page).to have_field "product_name", with: v2.product.name - expect(page).to have_field "variant_display_name", with: v1.display_name - expect(page).to have_field "variant_display_name", with: v2.display_name - end - - it "displays an on_hand input (for each variant) for each product" do - p1 = FactoryBot.create(:product) - v0 = p1.variants.first - v0.update_attribute(:on_demand, false) - v1 = FactoryBot.create(:variant, product: p1, on_hand: 15) - v1.update_attribute(:on_demand, false) - p1.variants << v1 - v2 = FactoryBot.create(:variant, product: p1, on_hand: 6) - v2.update_attribute(:on_demand, false) - p1.variants << v2 - - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 1 - all("a.view-variants").each(&:click) - - expect(page).to have_selector "span[name='on_hand']", - text: p1.variants.to_a.sum(&:on_hand).to_s - expect(page).to have_field "variant_on_hand", with: "15" - expect(page).to have_field "variant_on_hand", with: "6" - end - - it "displays a price input (for each variant) for each product" do - p1 = create(:product, price: 2.0) - v1 = create(:variant, product: p1, price: 12.75) - v2 = create(:variant, product: p1, price: 2.50) - - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 1 - all("a.view-variants").each(&:click) - - expect(page).to have_field "variant_price", with: "12.75" - expect(page).to have_field "variant_price", with: "2.5" - end - - it "displays a unit value field (for each variant) for each product" do - p1 = create(:product, price: 2.0, variant_unit: "weight", variant_unit_scale: "1000") - v1 = create(:variant, product: p1, price: 12.75, unit_value: 1200, variant_unit_scale: "1000", - unit_description: "(small bag)", display_as: "bag") - v2 = create(:variant, product: p1, price: 2.50, unit_value: 4800, variant_unit_scale: "1000", - unit_description: "(large bag)", display_as: "bin") - - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 1 - - all("a.view-variants").each(&:click) - - expect(page).to have_field "variant_unit_value_with_description", with: "1.2 (small bag)" - expect(page).to have_field "variant_unit_value_with_description", with: "4.8 (large bag)" - expect(page).to have_field "variant_display_as", with: "bag" - expect(page).to have_field "variant_display_as", with: "bin" - end - - context "with variant overrides" do - let!(:product) { create(:product) } - let(:variant) { product.variants.first } - let(:hub) { create(:distributor_enterprise) } - let!(:override) { create(:variant_override, variant:, hub: ) } - let(:variant_overrides_tip) { - "This variant has %d override(s)" % 1 - } - - it "displays an icon indicating a variant has overrides" do - visit spree.admin_products_path - - find("a.view-variants").click - - within "tr#v_#{variant.id}" do - expect(page).to have_selector( - "span.icon-warning-sign[data-powertip='#{variant_overrides_tip}']" - ) - end - end - end - end - - it "creating a new product" do - create(:stock_location) - - supplier = create(:supplier_enterprise) - distributor = create(:distributor_enterprise) - shipping_category = create(:shipping_category) - taxon = create(:taxon) - - login_as_admin - visit spree.admin_products_path - - find("a", text: "NEW PRODUCT").click - expect(page).to have_content "NEW PRODUCT" - - fill_in 'product_name', with: 'Big Bag Of Apples' - select supplier.name, from: 'product_supplier_id' - select 'Weight (g)', from: 'product_variant_unit_with_scale' - fill_in 'product_unit_value', with: '100' - fill_in 'product_price', with: '10.00' - select taxon.name, from: 'product_primary_taxon_id' - select shipping_category.name, from: 'product_shipping_category_id' - click_button 'Create' - - expect(URI.parse(current_url).path).to eq spree.admin_products_path - expect(flash_message).to eq 'Product "Big Bag Of Apples" has been successfully created!' - expect(page).to have_field "product_name", with: 'Big Bag Of Apples' - end - - context "creating new variants" do - let(:supplier) { create(:supplier_enterprise) } - let!(:new_supplier) { create(:supplier_enterprise) } - let!(:product) { - create(:product, variant_unit: 'weight', variant_unit_scale: 1000, supplier_id: supplier.id) - } # Weight (kg) - - before do - login_as_admin - visit spree.admin_products_path - - # I should see an add variant button - page.find('a.view-variants').click - end - - it "handle the default behaviour" do - # When I add three variants - page.find('a.add-variant').click - page.find('a.add-variant').click - - # They should be added, and should not see edit buttons for new variants - expect(page).to have_selector "tr.variant", count: 3 - expect(page).to have_selector "a.edit-variant", count: 1 - - # When I remove two, they should be removed - accept_alert do - page.all('a.delete-variant').first.click - end - expect(page).to have_selector "tr.variant", count: 2 - page.all('a.delete-variant').first.click - expect(page).to have_selector "tr.variant", count: 1 - - # When I fill out variant details and hit update - select new_supplier.name, from: 'producer_id' - tomselect_select "Weight (kg)", from: "variant_unit_with_scale" - fill_in "variant_display_name", with: "Case of 12 Bottles" - fill_in "variant_unit_value_with_description", with: "3 (12x250 mL bottles)" - fill_in "variant_display_as", with: "Case" - fill_in "variant_price", with: "4.0" - fill_in "variant_on_hand", with: "10" - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - - updated_variant = Spree::Variant.where(deleted_at: nil).last - expect(updated_variant.display_name).to eq "Case of 12 Bottles" - expect(updated_variant.unit_value).to eq 3000 - expect(updated_variant.unit_description).to eq "(12x250 mL bottles)" - expect(updated_variant.display_as).to eq "Case" - expect(updated_variant.price).to eq 4.0 - expect(updated_variant.on_hand).to eq 10 - expect(updated_variant.supplier).to eq new_supplier - - # Then I should see edit buttons for the new variant - expect(page).to have_selector "a.edit-variant" - end - - context "handle the 'on_demand' variant case creation" do - let(:v1) { create(:variant, product:, on_hand: 4, supplier:) } - let(:v2) { create(:variant, product:, on_demand: true, supplier:) } - - before do - product.variants << v1 - product.variants << v2 - - visit spree.admin_products_path - page.find('a.view-variants').click - end - - it "when variant unit value is: '120'" do - within "tr#v_#{v2.id}" do - page.find(".add-variant").click - end - - within "tr#v_-1" do - select supplier.name, from: 'producer_id' - tomselect_select "Weight (kg)", from: "variant_unit_with_scale" - fill_in "variant_unit_value_with_description", with: "120" - fill_in "variant_price", with: "6.66" - end - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - end - - it "creating a variant with unit value is: '120g' and 'on_hand' filled" do - within "tr#v_#{v2.id}" do - page.find(".add-variant").click - end - - within "tr#v_-1" do - tomselect_select "Weight (g)", from: "variant_unit_with_scale" - fill_in "variant_unit_value_with_description", with: "120g" - fill_in "variant_price", with: "6.66" - fill_in "variant_on_hand", with: "222" - end - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")) - .to have_content "Variant unit value can't be blank" - end - - it "creating a variant with unit value is: '120g' and 'on_demand' checked" do - scroll_to(:bottom) - - within "tr#v_#{v2.id}" do - page.find(".add-variant").click - end - - within "tr#v_-1" do - tomselect_select "Weight (g)", from: "variant_unit_with_scale" - fill_in "variant_unit_value_with_description", with: "120g" - fill_in "variant_price", with: "6.66" - check "variant_on_demand" - end - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")) - .to have_content "Variant unit value can't be blank" - end - end - end - - it "updating product attributes" do - s1 = create(:supplier_enterprise) - create(:supplier_enterprise) - create(:taxon) - t2 = create(:taxon) - p = create(:product, supplier_id: s1.id, variant_unit: 'volume', variant_unit_scale: 1, - primary_taxon: t2, sku: "OLD SKU") - variant = p.variants.first - - login_as_admin - visit spree.admin_products_path - - toggle_columns /^Category?/i, "Inherits Properties?", "SKU" - - within "tr#p_#{p.id}" do - page.find('a.view-variants').click - - expect(page).to have_field "product_name", with: p.name - expect(page).to have_checked_field "inherits_properties" - expect(page).to have_field "product_sku", with: p.sku - - fill_in "product_name", with: "Big Bag Of Potatoes" - uncheck "inherits_properties" - fill_in "product_sku", with: "NEW SKU" - end - within "tr#v_#{variant.id}" do - expect(page).to have_select "variant_unit_with_scale", selected: "Volume (L)" - - tomselect_select "Weight (kg)", from: "variant_unit_with_scale" - end - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - - p.reload - expect(p.name).to eq "Big Bag Of Potatoes" - expect(p.inherits_properties).to be false - expect(p.sku).to eq "NEW SKU" - - variant.reload - expect(variant.variant_unit).to eq "weight" - expect(variant.variant_unit_scale).to eq 1000 # Kg - end - - it "updating a product with a variant unit of 'items'" do - p = create(:product, variant_unit: 'weight', variant_unit_scale: 1000) - - login_as_admin - visit spree.admin_products_path - - page.find('a.view-variants').click - - expect(page).to have_select "variant_unit_with_scale", selected: "Weight (kg)" - - select "Items", from: "variant_unit_with_scale" - fill_in "variant_unit_name", with: "loaf" - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - - variant = p.variants.first - expect(variant.variant_unit).to eq "items" - expect(variant.variant_unit_scale).to be_nil - expect(variant.variant_unit_name).to eq "loaf" - end - - it "updating a product with variants" do - s1 = create(:supplier_enterprise) - s2 = create(:supplier_enterprise) - p = create(:product, supplier_id: s1.id, variant_unit: 'volume', variant_unit_scale: 0.001, - price: 3.0, unit_value: 0.25, unit_description: '(bottle)' ) - v = p.variants.first - v.update_attribute(:sku, "VARIANTSKU") - v.update_attribute(:on_demand, false) - v.update_attribute(:on_hand, 9) - - login_as_admin - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 1 - find("a.view-variants").click - - toggle_columns "SKU" - - expect(page).to have_field "variant_sku", with: "VARIANTSKU" - expect(page).to have_field "variant_price", with: "3.0" - expect(page).to have_field "variant_unit_value_with_description", with: "250 (bottle)" - expect(page).to have_field "variant_on_hand", with: "9" - expect(page).to have_selector "span[name='on_hand']", text: "9" - - select "Volume (L)", from: "variant_unit_with_scale" - fill_in "variant_sku", with: "NEWSKU" - fill_in "variant_price", with: "4.0" - fill_in "variant_on_hand", with: "10" - fill_in "variant_unit_value_with_description", with: "2 (8x250 mL bottles)" - - expect(page).to have_selector "span[name='on_hand']", text: "10" - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - - v.reload - expect(v.sku).to eq "NEWSKU" - expect(v.price).to eq 4.0 - expect(v.on_hand).to eq 10 - expect(v.unit_value).to eq 2 # 2L in L - expect(v.unit_description).to eq "(8x250 mL bottles)" - end - - it "updating delegated attributes of variants in isolation" do - p = FactoryBot.create(:product) - v = FactoryBot.create(:variant, product: p, price: 3.0) - - login_as_admin - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants", count: 1 - find("a.view-variants").click - - expect(page).to have_field "variant_price", with: "3.0" - - within "#v_#{v.id}" do - fill_in "variant_price", with: "10.0" - end - - within "#save-bar" do - click_button 'Save Changes' - end - - expect(page.find("#status-message")).to have_content "Changes saved." - - v.reload - expect(v.price).to eq 10.0 - end - - it "updating a product mutiple times without refresh" do - p = FactoryBot.create(:product, name: 'original name') - login_as_admin - - visit spree.admin_products_path - - expect(page).to have_field "product_name", with: "original name" - - fill_in "product_name", with: "new name 1" - - within "#save-bar" do - click_button 'Save Changes' - end - - expect(page.find("#status-message")).to have_content "Changes saved." - p.reload - expect(p.name).to eq "new name 1" - - fill_in "product_name", with: "new name 2" - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - p.reload - expect(p.name).to eq "new name 2" - - fill_in "product_name", with: "original name" - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - p.reload - expect(p.name).to eq "original name" - end - - it "updating a product after cloning a product" do - p = FactoryBot.create(:product, name: "product 1") - login_as_admin - - visit spree.admin_products_path - - expect(page).to have_selector "a.clone-product", count: 1 - find("a.clone-product").click - expect(page).to have_field "product_name", with: "COPY OF #{p.name}" - - within "#p_#{p.id}" do - fill_in "product_name", with: "new product name" - end - - within "#save-bar" do - click_button 'Save Changes' - end - expect(page.find("#status-message")).to have_content "Changes saved." - - p.reload - expect(p.name).to eq "new product name" - end - - it "updating when a filter has been applied" do - s1 = create(:supplier_enterprise) - s2 = create(:supplier_enterprise) - p1 = FactoryBot.create(:simple_product, name: "product1", supplier_id: s1.id) - p2 = FactoryBot.create(:simple_product, name: "product2", supplier_id: s2.id) - - login_as_admin - visit spree.admin_products_path - - select2_select s1.name, from: "producer_filter" - apply_filters - - sleep 2 # wait for page to initialise - - expect(page).not_to have_field "product_name", with: p2.name - fill_in "product_name", with: "new product1" - - within "#save-bar" do - click_button 'Save Changes' - end - - expect(page.find("#status-message")).to have_content "Changes saved." - p1.reload - expect(p1.name).to eq "new product1" - end - - describe "using action buttons" do - describe "using delete buttons" do - let!(:p1) { FactoryBot.create(:product) } - let!(:p2) { FactoryBot.create(:product) } - let!(:v1) { p1.variants.first } - let!(:v2) { p2.variants.first } - let!(:v3) { FactoryBot.create(:variant, product: p2 ) } - - before do - login_as_admin - visit spree.admin_products_path - end - - it "shows a delete button for products, which deletes the appropriate product when clicked" do - expect(page).to have_selector "a.delete-product", count: 2 - - within "tr#p_#{p1.id}" do - accept_alert do - find("a.delete-product").click - end - end - - expect(page).to have_selector "a.delete-product", count: 1 - - visit spree.admin_products_path - - expect(page).to have_selector "a.delete-product", count: 1 - end - - it "shows a delete button for variants, which deletes the appropriate variant when clicked" do - expect(page).to have_selector "a.view-variants" - all("a.view-variants").each(&:click) - - expect(page).to have_selector "a.delete-variant", count: 3 - - within "tr#v_#{v3.id}" do - accept_alert do - find("a.delete-variant").click - end - end - - expect(page).to have_selector "a.delete-variant", count: 2 - - visit spree.admin_products_path - expect(page).to have_selector "a.view-variants" - all("a.view-variants").select(&:visible?).each(&:click) - - expect(page).to have_selector "a.delete-variant", count: 2 - end - end - - describe "using edit buttons" do - let!(:p1) { FactoryBot.create(:product) } - let!(:p2) { FactoryBot.create(:product) } - let!(:v1) { p1.variants.first } - let!(:v2) { p2.variants.first } - - before do - login_as_admin - visit spree.admin_products_path - end - - it "shows edit product button, which takes user to the standard edit page of that product" do - expect(page).to have_selector "a.edit-product", count: 2 - - within "tr#p_#{p1.id}" do - find("a.edit-product").click - end - - expect(URI.parse(current_url).path).to eq spree.edit_admin_product_path(v1.product.id) - end - - it "shows edit product button, which takes user to the standard edit page " \ - "for that product, url includes selected filter" do - expect(page).to have_selector "a.edit-product", count: 2 - - # Set a filter - select2_select v1.supplier.name, from: "producer_filter" - apply_filters - - within "tr#p_#{p1.id}" do - find("a.edit-product").click - end - - uri = URI.parse(current_url) - expect("#{uri.path}?#{uri.query}").to eq spree.edit_admin_product_path( - v1.product.id, producerFilter: v1.supplier.id - ) - end - - it "shows edit variant button, which takes user to the standard edit page for it" do - expect(page).to have_selector "a.view-variants" - all("a.view-variants").each(&:click) - - expect(page).to have_selector "a.edit-variant", count: 2 - - within "tr#v_#{v1.id}" do - find("a.edit-variant").click - end - - uri = URI.parse(current_url) - expect(URI.parse(current_url).path).to eq spree.edit_admin_product_variant_path( - v1.product.id, v1.id - ) - end - - it "shows edit variant button, which takes the user to the standard edit page " \ - "for that variant, url includes selected filter" do - expect(page).to have_selector "a.view-variants" - all("a.view-variants").each(&:click) - - expect(page).to have_selector "a.edit-variant", count: 2 - - # Set a filter - select2_select v1.supplier.name, from: "producer_filter" - apply_filters - - within "tr#v_#{v1.id}" do - find("a.edit-variant").click - end - - uri = URI.parse(current_url) - expect("#{uri.path}?#{uri.query}").to eq spree.edit_admin_product_variant_path( - v1.product.id, v1.id, producerFilter: v1.supplier.id - ) - end - end - - describe "using clone buttons" do - it "shows clone product button, which dupes it & adds it to the page when clicked" do - p1 = FactoryBot.create(:product, name: "P1") - p2 = FactoryBot.create(:product, name: "P2") - p3 = FactoryBot.create(:product, name: "P3") - p1_supplier = p1.variants.first.supplier - - login_as_admin - visit spree.admin_products_path - - expect(page).to have_selector "a.clone-product", count: 3 - - within "tr#p_#{p1.id}" do - find("a.clone-product").click - end - expect(page).to have_selector "a.clone-product", count: 4 - click_expand_all - expect(page).to have_field "product_name", with: "COPY OF #{p1.name}" - expect(page).to have_select "producer_id", selected: p1_supplier.name.to_s - - visit spree.admin_products_path - - click_expand_all - expect(page).to have_selector "a.clone-product", count: 4 - expect(page).to have_field "product_name", with: "COPY OF #{p1.name}" - expect(page).to have_select "producer_id", selected: p1_supplier.name.to_s - end - end - end - - describe "using the page" do - describe "using column display dropdown" do - it "shows a column display dropdown, which shows a list of columns when clicked" do - FactoryBot.create(:simple_product) - login_as_admin - visit spree.admin_products_path - - expect(page).to have_selector "th", text: "NAME" - expect(page).to have_selector "th", text: "PRODUCER" - expect(page).to have_selector "th", text: "PRICE" - expect(page).to have_selector "th", text: "ON HAND" - - toggle_columns /^.{0,1}Producer$/i - - expect(page).not_to have_selector "th", text: "Producer" - expect(page).to have_selector "th", text: "NAME" - expect(page).to have_selector "th", text: "PRICE" - expect(page).to have_selector "th", text: "ON HAND" - end - end - - describe "using filtering controls" do - it "displays basic filtering controls which filter the product list" do - s1 = create(:supplier_enterprise) - s2 = create(:supplier_enterprise) - p1 = FactoryBot.create(:simple_product, name: "product1", supplier_id: s1.id) - p2 = FactoryBot.create(:simple_product, name: "product2", supplier_id: s2.id) - - login_as_admin - visit spree.admin_products_path - - # Page shows the filter controls - expect(page).to have_select "producer_filter", visible: false - expect(page).to have_select "category_filter", visible: false - - # All products are shown when no filter is selected - expect(page).to have_field "product_name", with: p1.name - expect(page).to have_field "product_name", with: p2.name - - # Set a filter - select2_select s1.name, from: "producer_filter" - apply_filters - - # Products are hidden when filtered out - expect(page).to have_field "product_name", with: p1.name - expect(page).not_to have_field "product_name", with: p2.name - - # Clearing filters - click_button "Clear Filters" - apply_filters - - # All products are shown again - expect(page).to have_field "product_name", with: p1.name - expect(page).to have_field "product_name", with: p2.name - end - end - end - - context "as an enterprise manager" do - let(:supplier_managed1) { create(:supplier_enterprise, name: 'Supplier Managed 1') } - let(:supplier_managed2) { create(:supplier_enterprise, name: 'Supplier Managed 2') } - let(:supplier_unmanaged) { create(:supplier_enterprise, name: 'Supplier Unmanaged') } - let(:supplier_permitted) { create(:supplier_enterprise, name: 'Supplier Permitted') } - let(:distributor_managed) { create(:distributor_enterprise, name: 'Distributor Managed') } - let(:distributor_unmanaged) { create(:distributor_enterprise, name: 'Distributor Unmanaged') } - let!(:product_supplied) { create(:product, supplier_id: supplier_managed1.id, price: 10.0) } - let!(:product_not_supplied) { create(:product, supplier_id: supplier_unmanaged.id) } - let!(:product_supplied_permitted) { - create(:product, name: 'Product Permitted', supplier_id: supplier_permitted.id, price: 10.0) - } - let(:product_supplied_inactive) { - create(:product, supplier_id: supplier_managed1.id, price: 10.0) - } - - let!(:supplier_permitted_relationship) do - create(:enterprise_relationship, parent: supplier_permitted, child: supplier_managed1, - permissions_list: [:manage_products]) - end - - before do - @enterprise_user = create(:user) - @enterprise_user.enterprise_roles.build(enterprise: supplier_managed1).save - @enterprise_user.enterprise_roles.build(enterprise: supplier_managed2).save - @enterprise_user.enterprise_roles.build(enterprise: distributor_managed).save - - login_as @enterprise_user - end - - it "shows only products that I supply" do - visit spree.admin_products_path - - expect(page).to have_field 'product_name', with: product_supplied.name - expect(page).to have_field 'product_name', with: product_supplied_permitted.name - expect(page).not_to have_field 'product_name', with: product_not_supplied.name - end - - it "shows only suppliers that I manage or have permission to" do - visit spree.admin_products_path - click_expand_all - - expect(page) - .to have_select( - 'producer_id', - with_options: [supplier_managed1.name, supplier_managed2.name, supplier_permitted.name], - selected: supplier_managed1.name, - ) - expect(page).not_to have_select 'producer_id', with_options: [supplier_unmanaged.name] - end - - it "shows inactive products that I supply" do - product_supplied_inactive - - visit spree.admin_products_path - - expect(page).to have_field 'product_name', with: product_supplied_inactive.name - end - - it "allows me to create a product" do - taxon = create(:taxon, name: 'Fruit') - shipping_category = create(:shipping_category) - - visit spree.admin_products_path - - find("a", text: "NEW PRODUCT").click - expect(page).to have_content 'NEW PRODUCT' - expect(page).to have_select 'product_supplier_id', - with_options: [supplier_managed1.name, supplier_managed2.name, - supplier_permitted.name] - - within 'fieldset#new_product' do - fill_in 'product_name', with: 'Big Bag Of Apples' - select supplier_permitted.name, from: 'product_supplier_id' - select 'Weight (g)', from: 'product_variant_unit_with_scale' - fill_in 'product_unit_value', with: '100' - fill_in 'product_price', with: '10.00' - select taxon.name, from: 'product_primary_taxon_id' - select shipping_category.name, from: 'product_shipping_category_id' - end - click_button 'Create' - - expect(URI.parse(current_url).path).to eq spree.admin_products_path - expect(flash_message).to eq 'Product "Big Bag Of Apples" has been successfully created!' - expect(page).to have_field "product_name", with: 'Big Bag Of Apples' - end - - it "allows me to update a product" do - p = product_supplied_permitted - v = p.variants.first - v.update_attribute(:on_demand, false) - - visit spree.admin_products_path - - within "tr#p_#{p.id}" do - expect(page).to have_field "product_name", with: p.name - - fill_in "product_name", with: "Big Bag Of Potatoes" - - find("a.view-variants").click - end - - within "#v_#{v.id}" do - expect(page).to have_select "producer_id", selected: supplier_permitted.name - - select supplier_managed2.name, from: 'producer_id' - select "Weight (kg)", from: "variant_unit_with_scale" - fill_in "variant_price", with: "20" - fill_in "variant_on_hand", with: "18" - fill_in "variant_display_as", with: "Big Bag" - end - - click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Changes saved." - - p.reload - v.reload - expect(p.name).to eq "Big Bag Of Potatoes" - expect(v.variant_unit).to eq "weight" - expect(v.variant_unit_scale).to eq 1000 # Kg - expect(v.supplier).to eq supplier_managed2 - expect(v.display_as).to eq "Big Bag" - expect(v.price).to eq 20.0 - expect(v.on_hand).to eq 18 - end - end - - describe "Updating product image" do - let!(:product) { create(:simple_product, name: "Carrots") } - - it "displays product images and image upload modal" do - login_as_admin - visit spree.admin_products_path - - within "table#listing_products tr#p_#{product.id}" do - # Displays product images - expect(page).to have_selector "td.image" - - # Shows default image when no image set - expect(page).to have_css "img[src='/noimage/mini.png']" - @old_thumb_src = page.find("a.image-modal img")['src'] - - # Click image - page.find("a.image-modal").click - end - - # Shows upload modal - expect(page).to have_selector "div.reveal-modal" - - within "div.reveal-modal" do - # Shows preview of current image - expect(page).to have_css "img.preview" - - # Upload a new image file - attach_file 'image-upload', Rails.public_path.join('500.jpg'), visible: false - - # Shows spinner whilst loading - expect(page).to have_css ".spinner" - end - - expect(page).not_to have_css ".spinner" - expect(page).not_to have_selector "div.reveal-modal" - - within "table#listing_products tr#p_#{product.id}" do - # New thumbnail is shown in image column - @new_thumb_src = page.find("a.image-modal img")['src'] - expect(@old_thumb_src).not_to eq @new_thumb_src - - page.find("a.image-modal").click - end - - expect(page).to have_selector "div.reveal-modal" - end - end - - def apply_filters - page.find('.button.icon-search').click - end - - def click_expand_all - find("a", text: "EXPAND ALL").click - end -end diff --git a/spec/system/admin/order_cycles/edit_spec.rb b/spec/system/admin/order_cycles/edit_spec.rb index adb91dee0e7..f6223edfad9 100644 --- a/spec/system/admin/order_cycles/edit_spec.rb +++ b/spec/system/admin/order_cycles/edit_spec.rb @@ -41,11 +41,8 @@ # change date range field value find('#order_cycle_orders_close_at').click - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker expect(page).to have_content('You have unsaved changes') # click save to open warning modal @@ -66,11 +63,8 @@ # change date range field value find('#order_cycle_orders_close_at').click - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker # click save to open warning modal click_button('Save') @@ -102,11 +96,8 @@ # Now change date range field value find('#order_cycle_orders_close_at').click - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker expect(page).to have_content('You have unsaved changes') click_button('Save') @@ -137,11 +128,8 @@ # change date range field value find('#order_cycle_orders_close_at').click - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker expect(page).to have_content('You have unsaved changes') @@ -175,11 +163,8 @@ # Now change date range field value find('#order_cycle_orders_close_at').click - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker expect(page).to have_content('You have unsaved changes') sleep(2) diff --git a/spec/system/admin/order_cycles/list_spec.rb b/spec/system/admin/order_cycles/list_spec.rb index 0d16945a793..6e4b7fd22c0 100644 --- a/spec/system/admin/order_cycles/list_spec.rb +++ b/spec/system/admin/order_cycles/list_spec.rb @@ -182,12 +182,8 @@ find('input.datetimepicker', match: :first).click end - # Sets the value to test_value then looks for the close button and click it - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker test_value - find("button", text: "Close").click - end + select_datetime_from_datepicker test_value + close_datepicker # Should no more have opened flatpickr expect(page).not_to have_selector '.flatpickr-calendar.open' @@ -213,11 +209,8 @@ within("tr.order-cycle-#{order_cycle.id}") do find('input.datetimepicker', match: :first).click end - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker expect(page).to have_content('You have unsaved changes') # click save to open warning modal @@ -237,11 +230,8 @@ within("tr.order-cycle-#{order_cycle.id}") do find('input.datetimepicker', match: :first).click end - within(".flatpickr-calendar.open") do - expect(page).to have_selector '.shortcut-buttons-flatpickr-buttons' - select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") - find("button", text: "Close").click - end + select_datetime_from_datepicker Time.zone.parse("2024-03-30 00:00") + close_datepicker expect(page).to have_content('You have unsaved changes') click_button('Save') diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index 685e1174cbf..61a056e9c72 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -179,19 +179,22 @@ def new_order_with_distribution(distributor, order_cycle) context "When adding a product on an order with transaction fee" do let(:order_with_fees) { create(:completed_order_with_fees, user:, distributor:, order_cycle: ) } - it 'recalculates transaction fee' do + it "recalculates transaction fee and order total" do login_as_admin visit spree.edit_admin_order_path(order_with_fees) - adjustment_for_transaction_fee = order_with_fees.all_adjustments.payment_fee.eligible.first - transaction_fee = adjustment_for_transaction_fee.amount + # Fee is $5 per item and we have two line items + expect(page).to have_css("#order_adjustments", text: 10.00) + expect(page).to have_css(".order-total", text: 36.00) - expect(page.find("#order_adjustments").text).to have_content(transaction_fee) + expect { + select2_select product.name, from: 'add_variant_id', search: true + find('button.add_variant').click + }.to change { order_with_fees.payments.first.adjustment.amount }.from(10.00).to(15.00) + .and change { order_with_fees.reload.total }.from(36.00).to(63.99) - select2_select product.name, from: 'add_variant_id', search: true - find('button.add_variant').click - expect(page).to have_css("#order_adjustments", - text: adjustment_for_transaction_fee.reload.amount) + expect(page).to have_css("#order_adjustments", text: 15.00) + expect(page).to have_css(".order-total", text: 63.99) end end diff --git a/spec/system/admin/reports/customers_report_spec.rb b/spec/system/admin/reports/customers_report_spec.rb new file mode 100644 index 00000000000..bd51a0a949d --- /dev/null +++ b/spec/system/admin/reports/customers_report_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require "system_helper" + +RSpec.describe "Customers report" do + include AuthenticationHelper + + let(:enterprise_user) { create(:enterprise_user) } + let(:distributor) { enterprise_user.enterprises[0] } + + it "can be rendered" do + login_as enterprise_user + visit admin_reports_path + + within "table.index" do + click_link "Customers" + end + run_report + + expect(table_headers).to eq( + [ + [ + "First Name", "Last Name", "Billing Address", "Email", "Phone", + "Hub", "Hub Address", "Shipping Method", "Total Number of Orders", + "Total incl. tax ($)", "Last completed order date", + ] + ] + ) + end + + it "displays filtered data by default" do + old_order = create( + :completed_order_with_totals, distributor:, completed_at: 4.months.ago + ) + new_order = create(:completed_order_with_totals, distributor:) + future_order = create( + :completed_order_with_totals, distributor:, completed_at: 1.day.from_now + ) + + login_as enterprise_user + visit admin_report_path(report_type: :customers) + run_report + + rows = find("table.report__table").all("tbody tr") + expect(rows.count).to eq 1 + expect(rows[0].all("td")[3].text).to eq new_order.email + expect(page).not_to have_content old_order.email + expect(page).not_to have_content future_order.email + end +end diff --git a/spec/system/admin/reports_spec.rb b/spec/system/admin/reports_spec.rb index 57d7dfff22a..072c546646a 100644 --- a/spec/system/admin/reports_spec.rb +++ b/spec/system/admin/reports_spec.rb @@ -151,28 +151,6 @@ end end - describe "Can access Customers reports and generate customers report" do - before do - login_as_admin - visit admin_reports_path - end - - it "customers report" do - within "table.index" do - click_link "Customers" - end - run_report - - rows = find("table.report__table").all("thead tr") - table = rows.map { |r| r.all("th").map { |c| c.text.strip } } - expect(table.sort).to eq([ - ["First Name", "Last Name", "Billing Address", "Email", "Phone", "Hub", "Hub Address", - "Shipping Method", "Total Number of Orders", "Total incl. tax ($)", - "Last completed order date"] - ].sort) - end - end - describe "Order cycle management report" do before do login_as_admin diff --git a/spec/system/admin/unit_price_spec.rb b/spec/system/admin/unit_price_spec.rb index 6375af57e87..64fee273e11 100644 --- a/spec/system/admin/unit_price_spec.rb +++ b/spec/system/admin/unit_price_spec.rb @@ -66,13 +66,14 @@ it "creating a new variant with a comma separated decimal price" do product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1") login_as_admin + visit spree.admin_dashboard_path(locale: 'es') visit spree.admin_product_variants_path product click_link 'Nueva Variante' tomselect_select "Peso (g)", from: "Unit scale" - click_on "Unit" # activate popout - fill_in "Unit value", with: "1" + click_on "Unidad" # activate popout + fill_in "Valor unidad", with: "1" fill_in 'Precio', with: '1,5' expect(find_field("Precio por unidad", disabled: true).value).to eq '1.500,00 $ / kg' diff --git a/spec/system/consumer/checkout/summary_spec.rb b/spec/system/consumer/checkout/summary_spec.rb index b17229ff1f9..cf5e8c4fe90 100644 --- a/spec/system/consumer/checkout/summary_spec.rb +++ b/spec/system/consumer/checkout/summary_spec.rb @@ -10,6 +10,7 @@ include StripeStubs include PaypalHelper include AuthenticationHelper + include UIComponentHelper let!(:zone) { create(:zone_with_member) } let(:supplier) { create(:supplier_enterprise) } @@ -48,7 +49,6 @@ before do login_as(user) - visit checkout_path end context "summary step" do diff --git a/yarn.lock b/yarn.lock index 4fbb5c78bc6..b52c301a6e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1129,10 +1129,10 @@ resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.2.2.tgz#071aab59c600fed95b97939e605ff261a4251608" integrity sha512-eGeIqNOQpXoPAIP7tC1+1Yc1yl1xnwYqg+3mzqxyrbE5pg5YFBZcA6YoTiByJB6DKAEsiWtl6tjTJS4IYtbB7A== -"@hotwired/turbo@^8.0.11": - version "8.0.11" - resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.11.tgz#d18ec698d507493b98f7e4bfdb967ada52466ac1" - integrity sha512-gU1h7ZCFOOKhbA2D+ELMO7KU3Y9Xkoz4VWOK/zA37EsoRht3NJzU/19w/etx0O1qnhL+Rl8VCJ7sVsK1DVbJ3A== +"@hotwired/turbo@^8.0.12": + version "8.0.12" + resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.12.tgz#50aa8345d7f62402680c6d2d9814660761837001" + integrity sha512-l3BiQRkD7qrnQv6ms6sqPLczvwbQpXt5iAVwjDvX0iumrz6yEonQkNAzNjeDX25/OJMFDTxpHjkJZHGpM9ikWw== "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -8892,10 +8892,10 @@ tr46@^2.1.0: dependencies: punycode "^2.1.1" -trix@^2.1.6: - version "2.1.6" - resolved "https://registry.yarnpkg.com/trix/-/trix-2.1.6.tgz#a7897cd67e03e6c8664df5dd31365bf87366e8db" - integrity sha512-NHX69IkQz/JEQWI++sRryleXWo1PuN8GKjvU+jYgMX6UbN2Pzfg6k46RpmdRl+1q0SyoGbyOZDoFUpNwEdjtXA== +trix@^2.1.7: + version "2.1.7" + resolved "https://registry.yarnpkg.com/trix/-/trix-2.1.7.tgz#239dc3fbba87ce30eea44286ea09865c7fbab10f" + integrity sha512-RyFmjLJfxP2nuAKqgVqJ40wk4qoYfDQtyi71q6ozkP+X4EOILe+j5ll5g/suvTyMx7BacGszNWzjnx9Vbj17sw== ts-pnp@^1.1.6: version "1.2.0"