|
1 | 1 | <% content_for(:header) do %> |
2 | | - Order <%= @order.number %> |
| 2 | + Order <%= @order_header.number %> |
3 | 3 | <% end %> |
4 | | -<%= turbo_stream_from "orders_order_#{@order.uid}" %> |
| 4 | +<%= turbo_stream_from "orders_order_#{@order_header.uid}" %> |
5 | 5 | <% content_for(:actions) do %> |
6 | 6 | <%= secondary_action_button do %> |
7 | | - <%= order_history_link(@order.uid) %> |
| 7 | + <%= order_history_link(@order_header.uid) %> |
8 | 8 | <% end %> |
9 | 9 |
|
10 | 10 | <%= secondary_action_button do %> |
11 | | - <%= link_to "Invoice", invoice_path(@order.uid) %> |
12 | | - <% end if @invoice.issued? %> |
| 11 | + <%= link_to "Invoice", invoice_path(@order_header.uid) %> |
| 12 | + <% end if @order_header.invoice_issued? %> |
13 | 13 |
|
14 | 14 | <%= secondary_action_button do %> |
15 | 15 | <%= link_to 'Back', orders_path %> |
16 | 16 | <% end %> |
17 | 17 |
|
18 | 18 | <%= primary_action_button do %> |
19 | | - <%= link_to 'Edit', edit_order_path(@order.uid) %> |
20 | | - <% end if @order.state == "Draft" %> |
| 19 | + <%= link_to 'Edit', edit_order_path(@order_header.uid) %> |
| 20 | + <% end if @order_header.state == "Draft" %> |
21 | 21 |
|
22 | | - <% if @order.state == "Submitted" %> |
23 | | - <%= button_to("Pay", pay_order_path(@order.uid), class: "mr-3 ml-3 inline-flex items-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 border-transparent text-white bg-blue-600 hover:bg-blue-700") %> |
| 22 | + <% if @order_header.state == "Submitted" %> |
| 23 | + <%= button_to("Pay", pay_order_path(@order_header.uid), class: "mr-3 ml-3 inline-flex items-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 border-transparent text-white bg-blue-600 hover:bg-blue-700") %> |
24 | 24 | <% end %> |
25 | 25 |
|
26 | | - <% if @order.state == "Paid" %> |
27 | | - <%= button_to("Return", order_returns_path(order_id: @order.uid), class: "ml-3 inline-flex items-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-50 border-gray-300 text-gray-700 bg-white hover:bg-gray-50") %> |
| 26 | + <% if @order_header.state == "Paid" %> |
| 27 | + <%= button_to("Return", order_returns_path(order_id: @order_header.uid), class: "ml-3 inline-flex items-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-50 border-gray-300 text-gray-700 bg-white hover:bg-gray-50") %> |
28 | 28 | <% end %> |
29 | 29 |
|
30 | | - <% if (@order.state == "Submitted") %> |
31 | | - <%= button_to("Cancel Order", cancel_order_path(@order.uid), class: "inline-flex items-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-50 border-gray-300 text-gray-700 bg-white hover:bg-gray-50") %> |
| 30 | + <% if @order_header.state == "Submitted" %> |
| 31 | + <%= button_to("Cancel Order", cancel_order_path(@order_header.uid), class: "inline-flex items-center px-4 py-2 border rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-50 border-gray-300 text-gray-700 bg-white hover:bg-gray-50") %> |
32 | 32 | <% end %> |
33 | 33 | <% end %> |
34 | 34 |
|
35 | 35 | <dl class="mb-8"> |
36 | 36 | <dt class="font-bold">Customer</dt> |
37 | | - <dd class="mb-2"><%= @order.customer || "None" %></dd> |
| 37 | + <dd class="mb-2"><%= @order_header.customer || "None" %></dd> |
38 | 38 | <dt class="font-bold">State</dt> |
39 | | - <dd class="mb-2" id="<%= "orders_order_#{@order.uid}_state" %>"><%= @order.state %></dd> |
| 39 | + <dd class="mb-2" id="<%= "orders_order_#{@order_header.uid}_state" %>"><%= @order_header.state %></dd> |
40 | 40 | <dt class="font-bold">Shipping Details</dt> |
41 | 41 | <dd class="mb-2"> |
42 | | - <% unless @shipment&.full_address.present? %> |
| 42 | + <% unless @order_header.shipping_address_present? %> |
43 | 43 | Shipping address is missing. |
44 | 44 | <% end %> |
45 | 45 | </dd> |
46 | 46 | <dd class="mb-2"> |
47 | | - <% unless @shipment&.full_address.present? %> |
| 47 | + <% unless @order_header.shipping_address_present? %> |
48 | 48 | <%= link_to "Add shipment address", |
49 | | - edit_order_shipping_address_path(@order.uid), |
| 49 | + edit_order_shipping_address_path(@order_header.uid), |
50 | 50 | class: 'px-2 py-1 border rounded-md shadow-sm text-xs font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 border-transparent text-white bg-blue-600 hover:bg-blue-700' |
51 | 51 | %> |
52 | 52 | <% else %> |
53 | 53 | Your shipment has been queued for processing. |
54 | 54 | <% end %> |
55 | 55 | </dd> |
56 | | - <% if @order.state != "Draft" %> |
| 56 | + <% if @order_header.state != "Draft" %> |
57 | 57 | <dt class="font-bold">Billing Details</dt> |
58 | 58 | <dd class="mb-2"> |
59 | | - <% if @invoice.issued? %> |
60 | | - <%= link_to @invoice.number, invoice_path(@order.uid) %> |
61 | | - <% elsif !@invoice.address_present? %> |
| 59 | + <% if @order_header.invoice_issued? %> |
| 60 | + <%= link_to @order_header.invoice_number, invoice_path(@order_header.uid) %> |
| 61 | + <% elsif !@order_header.billing_address_present? %> |
62 | 62 | Billing address is missing. |
63 | 63 | <%= link_to "Add billing address", |
64 | | - edit_order_billing_address_path(@order.uid), |
| 64 | + edit_order_billing_address_path(@order_header.uid), |
65 | 65 | class: 'px-2 py-1 border rounded-md shadow-sm text-xs font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 border-transparent text-white bg-blue-600 hover:bg-blue-700' |
66 | 66 | %> |
67 | 67 | <% else %> |
68 | 68 | Invoice not issued |
69 | 69 | <%= button_to "Issue now", |
70 | | - order_invoice_path(@order.uid), |
| 70 | + order_invoice_path(@order_header.uid), |
71 | 71 | class: 'px-2 py-1 border rounded-md shadow-sm text-xs font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 border-transparent text-white bg-blue-600 hover:bg-blue-700' |
72 | 72 | %> |
73 | 73 | <% end %> |
|
0 commit comments