diff --git a/app/services/permitted_attributes/enterprise.rb b/app/services/permitted_attributes/enterprise.rb index c25c82a585..5d780bfea3 100644 --- a/app/services/permitted_attributes/enterprise.rb +++ b/app/services/permitted_attributes/enterprise.rb @@ -39,6 +39,7 @@ module PermittedAttributes :preferred_product_low_stock_display, :hide_ofn_navigation, :white_label_logo, :white_label_logo_link, :hide_groups_tab, :external_billing_id, + :enable_producers_to_edit_orders ] end end diff --git a/app/views/admin/enterprises/form/_shop_preferences.html.haml b/app/views/admin/enterprises/form/_shop_preferences.html.haml index 33f4a5f792..096753b879 100644 --- a/app/views/admin/enterprises/form/_shop_preferences.html.haml +++ b/app/views/admin/enterprises/form/_shop_preferences.html.haml @@ -123,3 +123,17 @@ .five.columns.omega = f.radio_button :show_customer_contacts_to_suppliers, false = f.label :show_customer_contacts_to_suppliers, t('.customer_contacts_false'), value: :false + = radio_button :enterprise, :show_customer_names_to_suppliers, false + = label :enterprise_show_customer_names_to_suppliers, t('.customer_names_false'), value: :false + +.row + .three.columns.alpha + %label= t('.producers_to_edit_orders') + %div{'ofn-with-tip' => t('.producers_to_edit_orders_tip')} + %a= t 'admin.whats_this' + .three.columns + = radio_button :enterprise, :enable_producers_to_edit_orders, true + = label :enterprise_enable_producers_to_edit_orders, t('.producers_edit_orders_true'), value: :true + .five.columns.omega + = radio_button :enterprise, :enable_producers_to_edit_orders, false + = label :enterprise_enable_producers_to_edit_orders, t('.producers_edit_orders_false'), value: :false diff --git a/config/locales/en.yml b/config/locales/en.yml index f0d5938f2f..3e49a801f9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1348,12 +1348,16 @@ en: enable_subscriptions_true: "Enabled" customer_names_in_reports: "Customer Names in Reports" customer_names_tip: "Enable your suppliers to see your customers names in reports" + producers_to_edit_orders: "Ability for producers to edit orders" + producers_to_edit_orders_tip: "Enable your suppliers to see orders containing their products, and edit quantity and weight for their own products only." customer_names_false: "Disabled" customer_names_true: "Enabled" customer_contacts_in_reports: "Customer contact details in reports" customer_contacts_tip: "Enable your suppliers to see your customer email and phone numbers in reports" customer_contacts_false: "Disabled" customer_contacts_true: "Enabled" + producers_edit_orders_false: "Disabled" + producers_edit_orders_true: "Enabled" shopfront_message: "Shopfront Message" shopfront_message_placeholder: > An optional message to welcome customers and explain how to shop with you. If text is entered here it will be displayed in a home tab when customers first arrive at your shopfront. diff --git a/db/migrate/20250202121858_add_enable_producers_to_edit_orders_to_enterprises.rb b/db/migrate/20250202121858_add_enable_producers_to_edit_orders_to_enterprises.rb new file mode 100644 index 0000000000..842427aca4 --- /dev/null +++ b/db/migrate/20250202121858_add_enable_producers_to_edit_orders_to_enterprises.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddEnableProducersToEditOrdersToEnterprises < ActiveRecord::Migration[7.0] + def change + add_column :enterprises, :enable_producers_to_edit_orders, :boolean, default: false, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index fe7789113b..ad2af62ff7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -230,7 +230,6 @@ ActiveRecord::Schema[7.0].define(version: 2025_03_04_234657) do t.text "white_label_logo_link" t.boolean "hide_groups_tab", default: false t.string "external_billing_id", limit: 128 - t.boolean "show_customer_contacts_to_suppliers", default: false, null: false t.index ["address_id"], name: "index_enterprises_on_address_id" t.index ["is_primary_producer", "sells"], name: "index_enterprises_on_is_primary_producer_and_sells" t.index ["name"], name: "index_enterprises_on_name", unique: true