mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
AddEnableProducersToEditOrdersToEnterprises
With system spec for setting the preference. The enterprise edit page seems under-tested..
This commit is contained in:
@@ -9,6 +9,7 @@ module Api
|
||||
:preferred_shopfront_message, :preferred_shopfront_closed_message,
|
||||
:preferred_shopfront_taxon_order, :preferred_shopfront_producer_order,
|
||||
:preferred_shopfront_order_cycle_order, :show_customer_names_to_suppliers,
|
||||
:show_customer_contacts_to_suppliers,
|
||||
:preferred_shopfront_product_sorting_method, :owner, :contact, :users, :tag_groups,
|
||||
:default_tag_group, :require_login, :allow_guest_orders, :allow_order_changes,
|
||||
:logo, :promo_image, :terms_and_conditions,
|
||||
|
||||
@@ -33,7 +33,8 @@ module PermittedAttributes
|
||||
:preferred_product_selection_from_inventory_only, :preferred_shopfront_message,
|
||||
:preferred_shopfront_closed_message, :preferred_shopfront_taxon_order,
|
||||
:preferred_shopfront_producer_order, :preferred_shopfront_order_cycle_order,
|
||||
:show_customer_names_to_suppliers, :preferred_shopfront_product_sorting_method,
|
||||
:show_customer_names_to_suppliers, :show_customer_contacts_to_suppliers,
|
||||
:preferred_shopfront_product_sorting_method,
|
||||
:preferred_invoice_order_by_supplier,
|
||||
:preferred_product_low_stock_display,
|
||||
:hide_ofn_navigation, :white_label_logo, :white_label_logo_link,
|
||||
|
||||
@@ -111,3 +111,15 @@
|
||||
.five.columns.omega
|
||||
= f.radio_button :show_customer_names_to_suppliers, false
|
||||
= f.label :show_customer_names_to_suppliers, t('.customer_names_false'), value: :false
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
%label= t '.customer_contacts_in_reports'
|
||||
%div{'ofn-with-tip' => t('.customer_contacts_tip')}
|
||||
%a= t 'admin.whats_this'
|
||||
.three.columns
|
||||
= f.radio_button :show_customer_contacts_to_suppliers, true
|
||||
= f.label :show_customer_contacts_to_suppliers, t('.customer_contacts_true'), value: :true
|
||||
.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
|
||||
|
||||
@@ -1350,6 +1350,10 @@ en:
|
||||
customer_names_tip: "Enable your suppliers to see your customers names in reports"
|
||||
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"
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddShowCustomerContactsToSuppliersToEnterprises < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :enterprises, :show_customer_contacts_to_suppliers, :boolean, default: false,
|
||||
null: false
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2025_01_28_031518) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2025_03_04_234657) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "plpgsql"
|
||||
@@ -230,6 +230,8 @@ ActiveRecord::Schema[7.0].define(version: 2025_01_28_031518) do
|
||||
t.text "white_label_logo_link"
|
||||
t.boolean "hide_groups_tab", default: false
|
||||
t.string "external_billing_id", limit: 128
|
||||
t.boolean "enable_producers_to_edit_orders", default: false, null: false
|
||||
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
|
||||
|
||||
@@ -100,6 +100,10 @@ RSpec.describe '
|
||||
expect(page).not_to have_checked_field "enterprise_require_login_false"
|
||||
# expect(page).to have_checked_field "enterprise_enable_subscriptions_false"
|
||||
|
||||
choose('enterprise[show_customer_contacts_to_suppliers]', option: true)
|
||||
|
||||
# See also "setting ordering preferences" tested separately.
|
||||
|
||||
scroll_to(:bottom)
|
||||
accept_alert do
|
||||
scroll_to(:bottom)
|
||||
@@ -216,6 +220,7 @@ RSpec.describe '
|
||||
"enterprise_preferred_product_selection_from_inventory_only_false"
|
||||
)
|
||||
|
||||
# Save changes
|
||||
click_button 'Update'
|
||||
|
||||
expect(flash_message).to eq('Enterprise "Eaterprises" has been successfully updated!')
|
||||
@@ -246,6 +251,7 @@ RSpec.describe '
|
||||
)
|
||||
expect(page).to have_checked_field "enterprise_require_login_true"
|
||||
expect(page).to have_checked_field "enterprise_enable_subscriptions_true"
|
||||
expect(page).to have_checked_field 'enterprise[show_customer_contacts_to_suppliers]', with: true
|
||||
|
||||
# Back navigation loads the tab content
|
||||
page.execute_script('window.history.back()')
|
||||
|
||||
Reference in New Issue
Block a user