mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Get shipping method from Shipment in order details
This again gets the shipping method from the last shipment. It also extracts partials for delivery and pickup shipping methods.
This commit is contained in:
25
app/views/spree/shared/_delivery_shipment_details.html.haml
Normal file
25
app/views/spree/shared/_delivery_shipment_details.html.haml
Normal file
@@ -0,0 +1,25 @@
|
||||
.order-summary.text-small
|
||||
%strong= shipment.shipping_method.name
|
||||
.pad
|
||||
.text-big
|
||||
= t :order_delivery_time
|
||||
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
|
||||
%p.text-small.text-skinny.pre-line
|
||||
%em= shipment.shipping_method.description.andand.html_safe || ""
|
||||
.order-summary.text-small
|
||||
%strong
|
||||
= t :order_delivery_address
|
||||
.pad
|
||||
%p.text-small
|
||||
= order.ship_address.firstname + " " + order.ship_address.lastname
|
||||
%br
|
||||
= order.ship_address.full_address
|
||||
%br
|
||||
= order.ship_address.phone
|
||||
- if order.special_instructions.present?
|
||||
%br
|
||||
%p.light.small
|
||||
%strong
|
||||
= t :order_special_instructions
|
||||
%br
|
||||
= order.special_instructions
|
||||
@@ -29,60 +29,11 @@
|
||||
= order.bill_address.phone
|
||||
|
||||
.columns.large-6
|
||||
- if order.shipping_method.andand.require_ship_address
|
||||
// Delivery option
|
||||
.order-summary.text-small
|
||||
%strong= order.shipping_method.name
|
||||
.pad
|
||||
.text-big
|
||||
= t :order_delivery_time
|
||||
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
|
||||
%p.text-small.text-skinny.pre-line
|
||||
%em= order.shipping_method.description.andand.html_safe || ""
|
||||
.order-summary.text-small
|
||||
%strong
|
||||
= t :order_delivery_address
|
||||
.pad
|
||||
%p.text-small
|
||||
= order.ship_address.firstname + " " + order.ship_address.lastname
|
||||
%br
|
||||
= order.ship_address.full_address
|
||||
%br
|
||||
= order.ship_address.phone
|
||||
- if order.special_instructions.present?
|
||||
%br
|
||||
%p.light.small
|
||||
%strong
|
||||
= t :order_special_instructions
|
||||
%br
|
||||
= order.special_instructions
|
||||
- shipment = order.shipments.last
|
||||
- if shipment.shipping_method.andand.require_ship_address
|
||||
= render 'spree/shared/delivery_shipment_details', order: order, shipment: shipment
|
||||
- else
|
||||
// Collection option
|
||||
.order-summary.text-small
|
||||
%strong= order.shipping_method.name
|
||||
.pad
|
||||
.text-big
|
||||
= t :order_pickup_time
|
||||
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
|
||||
%p.text-small.text-skinny.pre-line
|
||||
%em= order.shipping_method.description.andand.html_safe || ""
|
||||
|
||||
- if order.order_cycle.pickup_instructions_for(order.distributor).present?
|
||||
%br
|
||||
%p.text-small
|
||||
%strong
|
||||
= t :order_pickup_instructions
|
||||
%br
|
||||
#{order.order_cycle.pickup_instructions_for(order.distributor)}
|
||||
|
||||
- if order.special_instructions.present?
|
||||
%br
|
||||
%p.light.small
|
||||
%strong
|
||||
= t :order_special_instructions
|
||||
%br
|
||||
= order.special_instructions
|
||||
|
||||
= render 'spree/shared/pickup_shipment_details', order: order, shipment: shipment
|
||||
%br
|
||||
.row
|
||||
.columns.large-12
|
||||
|
||||
25
app/views/spree/shared/_pickup_shipment_details.html.haml
Normal file
25
app/views/spree/shared/_pickup_shipment_details.html.haml
Normal file
@@ -0,0 +1,25 @@
|
||||
.order-summary.text-small
|
||||
%strong= order.shipments.last.shipping_method.name
|
||||
.pad
|
||||
.text-big
|
||||
= t :order_pickup_time
|
||||
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
|
||||
%p.text-small.text-skinny.pre-line
|
||||
%em= order.shipments.last.shipping_method.description.andand.html_safe || ""
|
||||
|
||||
- if order.order_cycle.pickup_instructions_for(order.distributor).present?
|
||||
%br
|
||||
%p.text-small
|
||||
%strong
|
||||
= t :order_pickup_instructions
|
||||
%br
|
||||
#{order.order_cycle.pickup_instructions_for(order.distributor)}
|
||||
|
||||
- if order.special_instructions.present?
|
||||
%br
|
||||
%p.light.small
|
||||
%strong
|
||||
= t :order_special_instructions
|
||||
%br
|
||||
= order.special_instructions
|
||||
|
||||
@@ -21,6 +21,11 @@ feature "Order Management", js: true do
|
||||
quick_login_as user
|
||||
end
|
||||
|
||||
it 'shows the name of the shipping method' do
|
||||
visit spree.order_path(order)
|
||||
expect(find('#order')).to have_content(shipping_method.name)
|
||||
end
|
||||
|
||||
context "when the distributor doesn't allow changes to be made to orders" do
|
||||
before do
|
||||
order.distributor.update_attributes(allow_order_changes: false)
|
||||
|
||||
Reference in New Issue
Block a user