mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-07 22:46:06 +00:00
Add form field to set tax when creating adjustment on order. Display tax included in adjustments on order interface.
This commit is contained in:
@@ -24,6 +24,10 @@ module Spree
|
||||
update_attributes! included_tax: tax.round(2)
|
||||
end
|
||||
|
||||
def display_included_tax
|
||||
Spree::Money.new(included_tax, { :currency => currency })
|
||||
end
|
||||
|
||||
def has_tax?
|
||||
included_tax > 0
|
||||
end
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/ replace_contents "[data-hook='adjustment_row']"
|
||||
|
||||
%td.align-center.created_at= pretty_time(adjustment.created_at)
|
||||
%td.align-center.label= adjustment.label
|
||||
%td.align-center.amount= adjustment.display_amount.to_html
|
||||
%td.align-center.included-tax= adjustment.display_included_tax.to_html
|
||||
%td.actions
|
||||
= link_to_edit adjustment, no_text: true
|
||||
= link_to_delete adjustment, no_text: true
|
||||
@@ -0,0 +1,8 @@
|
||||
/ replace_contents "[data-hook='adjustmment_head']"
|
||||
|
||||
%tr
|
||||
%th= "#{t('spree.date')}/#{t('spree.time')}"
|
||||
%th= t(:description)
|
||||
%th= t(:amount)
|
||||
%th= t(:included_tax)
|
||||
%th.actions
|
||||
@@ -0,0 +1,6 @@
|
||||
/ replace_contents "[data-hook='admin_adjustment_form_fields']"
|
||||
|
||||
- if @adjustment.new_record?
|
||||
= render 'new_form', f: f
|
||||
- else
|
||||
= render 'edit_form', f: f
|
||||
17
app/views/spree/admin/adjustments/_new_form.html.haml
Normal file
17
app/views/spree/admin/adjustments/_new_form.html.haml
Normal file
@@ -0,0 +1,17 @@
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.field_container :amount do
|
||||
= f.label :amount, raw(t(:amount) + content_tag(:span, " *", :class => "required"))
|
||||
= text_field :adjustment, :amount, :class => 'fullwidth'
|
||||
= f.error_message_on :amount
|
||||
.omega.three.columns
|
||||
= f.field_container :tax_rate_id do
|
||||
= f.label :tax_rate_id, t(:tax)
|
||||
= select_tag :tax_rate_id, options_from_collection_for_select(Spree::TaxRate.all, :id, :name), prompt: t(:none), class: 'fullwidth'
|
||||
= f.error_message_on :tax_rate_id
|
||||
.row
|
||||
.alpha.omega.twelve.columns
|
||||
= f.field_container :label do
|
||||
= f.label :label, raw(t(:description) + content_tag(:span, " *", :class => "required"))
|
||||
= text_field :adjustment, :label, :class => 'fullwidth'
|
||||
= f.error_message_on :label
|
||||
@@ -38,3 +38,4 @@ en:
|
||||
footer_about_url: "About URL"
|
||||
footer_tos_url: "Terms of Service URL"
|
||||
invoice: "Invoice"
|
||||
included_tax: "Included tax"
|
||||
Reference in New Issue
Block a user