Adding alert to shopfront to alert user to presence of orders open for editing

This commit is contained in:
Rob Harrington
2017-04-12 15:50:01 +10:00
parent 47011e11ff
commit b55036e165
4 changed files with 23 additions and 2 deletions

View File

@@ -24,5 +24,18 @@ module Spree
distributor_id: current_distributor.id,
order_cycle_id: current_order_cycle.id)
end
def changeable_orders_link_path
changeable_orders.one? ? spree.order_path(changeable_orders.first) : spree.account_path
end
def shop_changeable_orders_alert_html
t(:shop_changeable_orders_alert_html,
count: changeable_orders.count,
path: changeable_orders_link_path,
order: changeable_orders.first.number,
shop: current_distributor.name,
oc_close: l(current_order_cycle.orders_close_at, format: :long))
end
end
end

View File

@@ -8,6 +8,11 @@
= inject_shop_enterprises
%shop.darkswarm
- if changeable_orders.any?
.alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } }
= shop_changeable_orders_alert_html
%a.close{ ng: { click: "close()" } } ×
- content_for :order_cycle_form do
%div{"ng-controller" => "OrderCycleChangeCtrl", "ng-cloak" => true}

View File

@@ -5,8 +5,7 @@
%i{ ng: { class: "{ 'ofn-i_007-caret-right': !showBought, 'ofn-i_005-caret-down': showBought}"} }
= t(:orders_bought_items_notice, count: @order.finalised_line_items.count)
%td.text-right{ colspan: 3 }
- edit_path = changeable_orders.count > 1 ? spree.user_path : spree.order_path(changeable_orders.first)
%a.edit-finalised.button.radius.expand.small{ href: edit_path, ng: { class: "{secondary: !showBought, primary: showBought}" } }
%a.edit-finalised.button.radius.expand.small{ href: changeable_orders_link_path, ng: { class: "{secondary: !showBought, primary: showBought}" } }
= t(:orders_bought_edit_button)
%i.ofn-i_007-caret-right

View File

@@ -892,6 +892,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using
hubs_distance: Closest to
hubs_distance_filter: "Show me shops near %{location}"
shop_changeable_orders_alert_html:
one: Your order with <a href='%{path}'>%{shop} / %{order}</a> is open for review. You can make changes until %{oc_close}.
other: You have <a href='%{path}'>%{count} orders with %{shop}</a> currently open for review.
products_clear_all: Clear all
products_showing: "Showing:"
products_with: with