diff --git a/app/controllers/spree/admin/orders_controller.rb b/app/controllers/spree/admin/orders_controller.rb index 0030d969ea..c7bd070146 100644 --- a/app/controllers/spree/admin/orders_controller.rb +++ b/app/controllers/spree/admin/orders_controller.rb @@ -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 diff --git a/app/views/spree/admin/orders/set_distribution.html.haml b/app/views/spree/admin/orders/set_distribution.html.haml index 3579619185..9c2955647f 100644 --- a/app/views/spree/admin/orders/set_distribution.html.haml +++ b/app/views/spree/admin/orders/set_distribution.html.haml @@ -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) diff --git a/app/views/spree/admin/shared/_order_tabs.html.haml b/app/views/spree/admin/shared/_order_tabs.html.haml index 4f4c70bfca..8b46243b08 100644 --- a/app/views/spree/admin/shared/_order_tabs.html.haml +++ b/app/views/spree/admin/shared/_order_tabs.html.haml @@ -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 }