Add unit price field to New Product form

- Add a new i18n key for the content of the tooltip:  js.shopfront.unit_price_tooltip.admin
 - Display unit price readonly field near the price field
 - Still fake values, needs to be updated
This commit is contained in:
Jean-Baptiste Bellet
2021-03-05 10:57:46 +01:00
parent 3060670466
commit b494cd2f8b
2 changed files with 28 additions and 10 deletions

View File

@@ -45,33 +45,48 @@
.sixteen.columns.alpha
.eight.columns.alpha
= render 'spree/admin/products/primary_taxon_form', f: f
.three.columns
.four.columns
= f.field_container :price do
= f.label :price, t(".price")
%span.required *
%br/
= f.text_field :price, class: 'fullwidth'
= f.error_message_on :price
- if feature? :unit_price, spree_current_user
.four.columns{ ng: { app: 'ofn.admin'}}
= f.field_container :unit_price do
= f.label :unit_price, t(".unit_price")
%question-mark-with-tooltip{"question-mark-with-tooltip" => "_",
"question-mark-with-tooltip-append-to-body" => "true",
"question-mark-with-tooltip-placement" => "top",
"question-mark-with-tooltip-animation" => true,
key: "'js.shopfront.unit_price_tooltip.admin'"}
%br/
= f.text_field :price, class: '', disabled: true, value: "value"
%span{style: "color: #757575"}
unit
%div{style: "color: black"}
= t(".unit_price_legend")
.sixteen.columns.alpha
.three.columns
- if Spree::TaxCategory.any?
= render 'spree/admin/products/tax_category_form', f: f
- else
 
.five.columns.omega
= render 'spree/admin/products/shipping_category_form', f: f
.five.columns
= f.field_container :on_hand do
= f.label :on_hand, t(".on_hand")
%br/
= f.text_field :on_hand, class: 'fullwidth'
= f.error_message_on :on_hand
.two.columns.omega
.three.columns.omega
= f.field_container :on_demand do
= f.label :on_demand, t(".on_demand")
%br/
= f.check_box :on_demand
= f.error_message_on :on_demand
.sixteen.columns.alpha
.four.columns
- if Spree::TaxCategory.any?
= render 'spree/admin/products/tax_category_form', f: f
- else
 
.four.columns.omega
= render 'spree/admin/products/shipping_category_form', f: f
.sixteen.columns.alpha
= f.field_container :description do

View File

@@ -2784,6 +2784,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
price_breakdown: "Price breakdown"
unit_price_tooltip:
shopfront: "This is the unit price of this product. It allows you to compare the price of products independent of packaging sizes & weights."
admin: "The unit price increases transparency by allowing your customers to easily compare prices between different products and packaging sizes. Note, that the final unit price displayed in the shopfront might differ as it is includes taxes & fees."
variants:
on_demand:
"yes": "On demand"
@@ -3478,6 +3479,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using
value: "Value"
unit_name: "Unit name"
price: "Price"
unit_price: "Unit Price"
unit_price_legend: "Calculated based on the item price"
on_hand: "On Hand"
on_demand: "On Demand"
product_description: "Product Description"