mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
send shipment email optionally from orders#edit page
This commit is contained in:
@@ -19,6 +19,8 @@ module Admin
|
||||
def ship
|
||||
@order.send_shipment_email = true if params[:send_shipment_email]
|
||||
if @order.ship
|
||||
return set_param_for_controller if request.url.match?('edit')
|
||||
|
||||
morph dom_id(@order), render(partial: "spree/admin/orders/table_row",
|
||||
locals: { order: @order.reload, success: true })
|
||||
else
|
||||
@@ -98,5 +100,9 @@ module Admin
|
||||
def editable_orders
|
||||
Permissions::Order.new(current_user).editable_orders
|
||||
end
|
||||
|
||||
def set_param_for_controller
|
||||
params[:id] = @order.number
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,16 @@
|
||||
= Spree.t("shipment_states.#{shipment.state}")
|
||||
- if shipment.ready? and can? :update, shipment
|
||||
= "-"
|
||||
= link_to t(:ship), '#', :class => 'ship button icon-arrow-right', :data => { 'shipment-number' => shipment.number }
|
||||
%button{"class": "ship button icon-arrow-right","data-controller": "modal-link",
|
||||
"data-action": "click->modal-link#open", "data-modal-link-target-value": "ship_order" }= t(:ship)
|
||||
%form
|
||||
= render ConfirmModalComponent.new(id: "ship_order", confirm_reflexes: "click->Admin::OrdersReflex#ship", controller: "orders", reflex: "Admin::Orders#ship") do
|
||||
%div{class: "margin-bottom-30"}
|
||||
%p This will mark the order as Shipped
|
||||
%div{class: "margin-bottom-30"}
|
||||
= hidden_field_tag :id, order.id
|
||||
= check_box_tag :send_shipment_email
|
||||
= label_tag :send_shipment_email, "Send email confirmation to customer"
|
||||
|
||||
%table.stock-contents.index
|
||||
%colgroup
|
||||
|
||||
Reference in New Issue
Block a user