mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Change second step order: Customer Details instead of Order Details
This second step comes from a first one, which is Set Distribution
This commit is contained in:
@@ -42,6 +42,10 @@ module Spree
|
||||
@order.update_order!
|
||||
end
|
||||
|
||||
if params[:set_distribution_step] && @order.update(order_params)
|
||||
return redirect_to spree.admin_order_customer_path(@order)
|
||||
end
|
||||
|
||||
unless order_params.present? && @order.update(order_params) && @order.line_items.present?
|
||||
if @order.line_items.empty? && !params[:suppress_error_msg]
|
||||
@order.errors.add(:line_items, Spree.t('errors.messages.blank'))
|
||||
@@ -55,7 +59,7 @@ module Spree
|
||||
redirect_to spree.edit_admin_order_path(@order)
|
||||
else
|
||||
# Jump to next step if order is not complete
|
||||
redirect_to spree.admin_order_customer_path(@order)
|
||||
redirect_to spree.admin_order_payments_path(@order)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
= render 'spree/admin/orders/_form/distribution_fields'
|
||||
-# This param passed to stop validation error in next page due to no line items in order yet:
|
||||
= hidden_field_tag 'suppress_error_msg', "true"
|
||||
= hidden_field_tag "set_distribution_step", "true"
|
||||
= button_tag :class => 'secondary radius expand small', :id => 'update-button' do
|
||||
%i.icon-arrow-right
|
||||
= t(:next)
|
||||
|
||||
@@ -44,22 +44,22 @@
|
||||
|
||||
%nav.menu
|
||||
%ul
|
||||
- order_details_classes = "active" if current == "Order Details"
|
||||
%li{ class: order_details_classes }
|
||||
= link_to_with_icon 'icon-edit', t(:order_details), spree.edit_admin_order_url(@order)
|
||||
|
||||
- customer_details_classes = "active" if current == "Customer Details"
|
||||
%li{ class: customer_details_classes }
|
||||
= link_to_with_icon 'icon-user', t(:customer_details), spree.admin_order_customer_url(@order)
|
||||
|
||||
- adjustments_classes = "active" if current == "Adjustments"
|
||||
%li{ class: adjustments_classes }
|
||||
= link_to_with_icon 'icon-cogs', t(:adjustments), spree.admin_order_adjustments_url(@order)
|
||||
- order_details_classes = "active" if current == "Order Details"
|
||||
%li{ class: order_details_classes }
|
||||
= link_to_with_icon 'icon-edit', t(:order_details), spree.edit_admin_order_url(@order)
|
||||
|
||||
- payments_classes = "active" if current == "Payments"
|
||||
%li{ class: payments_classes }
|
||||
= link_to_with_icon 'icon-credit-card', t(:payments), spree.admin_order_payments_url(@order)
|
||||
|
||||
- adjustments_classes = "active" if current == "Adjustments"
|
||||
%li{ class: adjustments_classes }
|
||||
= link_to_with_icon 'icon-cogs', t(:adjustments), spree.admin_order_adjustments_url(@order)
|
||||
|
||||
- if @order.completed?
|
||||
- authorizations_classes = "active" if current == "Return Authorizations"
|
||||
%li{ class: authorizations_classes }
|
||||
|
||||
Reference in New Issue
Block a user