render the shipping category in the invoice.

This commit is contained in:
Mohamed ABDELLANI
2023-11-13 10:18:10 +01:00
parent 9d87449730
commit db653fc945
4 changed files with 10 additions and 7 deletions

View File

@@ -5,6 +5,10 @@ class Invoice
class ShippingMethod < Invoice::DataPresenter::Base
attributes :id, :name, :require_ship_address
invoice_generation_attributes :id
def category
I18n.t "invoice_shipping_category_#{require_ship_address ? 'delivery' : 'pickup'}"
end
end
end
end

View File

@@ -37,8 +37,8 @@
= item.display_amount_with_adjustments_and_with_taxes
%tr
%td
%strong= "#{t(:shipping)} "
= "( #{t(:invoice_shipping_type)} #{raw(@order.shipping_method.name)} )"
%strong= "#{@order.shipping_method.category} : "
= "(#{raw(@order.shipping_method.name)})"
%td{:align => "right"}
%td{:align => "right"}
%td{:align => "right"}

View File

@@ -1996,7 +1996,8 @@ en:
invoice_cancel_and_replace_invoice: "cancels and replaces invoice"
tax_invoice: "TAX INVOICE"
tax_total: "Total tax (%{rate}):"
invoice_shipping_type: "Type:"
invoice_shipping_category_delivery: "Delivery"
invoice_shipping_category_pickup: "Pickup"
total_excl_tax: "Total (Excl. tax):"
total_incl_tax: "Total (Incl. tax):"
total_all_tax: "Total tax:"

View File

@@ -546,8 +546,7 @@ describe '
expect(page).to have_content "#{enterprise_fee.name} fee by $104.35 15.0% $120.00"
expect(page).to have_content "coordinator #{user1.enterprises.first.name}"
# Shipping
expect(page).to have_content "Shipping ( Type: $91.41 10.0% $100.55"
expect(page).to have_content "#{shipping_method_name} )"
expect(page).to have_content "Delivery :(#{shipping_method_name}) $91.41 10.0% $100.55"
# Tax totals
expect(page).to have_content "Total tax (10.0%): $9.14 " \
"Total tax (15.0%): $15.65 Total tax (20.0%): $250.08"
@@ -650,8 +649,7 @@ describe '
expect(page).to have_content "#{enterprise_fee.name} fee by $120.00 15.0% $138.00"
expect(page).to have_content "coordinator #{user1.enterprises.first.name}"
# Shipping
expect(page).to have_content "Shipping ( Type: $100.55 10.0% $110.61"
expect(page).to have_content "#{shipping_method_name} )"
expect(page).to have_content "Delivery :(#{shipping_method_name}) $100.55 10.0% $110.61"
# Tax totals
expect(page).to have_content "Total tax (10.0%): $10.06 " \
"Total tax (15.0%): $18.00 Total tax (20.0%): $300.09"