mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Create ShipOrder component
This commit is contained in:
7
app/components/ship_order_component.html.haml
Normal file
7
app/components/ship_order_component.html.haml
Normal file
@@ -0,0 +1,7 @@
|
||||
= 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= t('spree.admin.orders.shipment.mark_as_shipped_message')
|
||||
%div{class: "margin-bottom-30"}
|
||||
= hidden_field_tag :id, @order.id
|
||||
= check_box_tag :send_shipment_email, "1", true
|
||||
= label_tag :send_shipment_email, t('spree.admin.orders.shipment.mark_as_shipped_label_message')
|
||||
7
app/components/ship_order_component.rb
Normal file
7
app/components/ship_order_component.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ShipOrderComponent < ViewComponent::Base
|
||||
def initialize(order:)
|
||||
@order = order
|
||||
end
|
||||
end
|
||||
@@ -11,13 +11,7 @@
|
||||
%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= t('.mark_as_shipped_message')
|
||||
%div{class: "margin-bottom-30"}
|
||||
= hidden_field_tag :id, order.id
|
||||
= check_box_tag :send_shipment_email
|
||||
= label_tag :send_shipment_email, t('.mark_as_shipped_label_message')
|
||||
= render ShipOrderComponent.new(order: order)
|
||||
|
||||
%table.stock-contents.index
|
||||
%colgroup
|
||||
|
||||
@@ -48,14 +48,7 @@
|
||||
= render partial: 'admin/shared/tooltip', locals: {link_class: "icon_link with-tip icon-edit no-text" ,link: edit_admin_order_path(order), link_text: "", tooltip_text: t('spree.admin.orders.index.edit')}
|
||||
- if order.ready_to_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= t('spree.admin.orders.shipment.mark_as_shipped_message')
|
||||
%div{class: "margin-bottom-30"}
|
||||
= hidden_field_tag :id, order.id
|
||||
= check_box_tag :send_shipment_email, "1", true
|
||||
= label_tag :send_shipment_email, t('spree.admin.orders.shipment.mark_as_shipped_label_message')
|
||||
|
||||
= render ShipOrderComponent.new(order: order)
|
||||
= render partial: 'admin/shared/tooltip_button', locals: {button_class: "icon-road icon_link with-tip no-text", reflex_data_id: order.id.to_s, tooltip_text: t('spree.admin.orders.index.ship'), shipment: true}
|
||||
|
||||
- if order.payment_required? && order.pending_payments.reject(&:requires_authorization?).any?
|
||||
|
||||
Reference in New Issue
Block a user