|
| 1 | +<div class="<%= stimulus_id %>" data-controller="<%= stimulus_id %>"> |
| 2 | + <div class="rounded p-2"> |
| 3 | + <%= render component('ui/panel').new(title: @shipment.number) do |panel| %> |
| 4 | + <% panel.with_section(wide: true, high: true) do %> |
| 5 | + <div class="rounded-b-lg overflow-hidden"> |
| 6 | + <table class="table-auto w-full"> |
| 7 | + <thead> |
| 8 | + <tr> |
| 9 | + <th class="text-left body-small-bold text-gray-800 bg-gray-15 px-6 py-3 leading-none">Product</th> |
| 10 | + <th class="text-left body-small-bold text-gray-800 bg-gray-15 px-6 py-3 leading-none w-16">Quantity</th> |
| 11 | + <th class="text-left body-small-bold text-gray-800 bg-gray-15 px-6 py-3 leading-none w-16 whitespace-nowrap">Total Price</th> |
| 12 | + <th class="text-left body-small-bold text-gray-800 bg-gray-15 px-6 py-3 leading-none w-16"><span class="sr-only">Actions</span></th> |
| 13 | + </tr> |
| 14 | + </thead> |
| 15 | + <tbody> |
| 16 | + <% |
| 17 | + shipment_manifest = Spree::ShippingManifest.new( |
| 18 | + inventory_units: @shipment.last.inventory_units.where(carton_id: nil), |
| 19 | + ).items.sort_by { |item| item.line_item.created_at } |
| 20 | + %> |
| 21 | + |
| 22 | + <% shipment_manifest.each do |item| %> |
| 23 | + <tr class="border-gray-100 border-t"> |
| 24 | + <td class="px-6 py-4"> |
| 25 | + <div class="flex gap-2 grow"> |
| 26 | + <% variant = item.variant %> |
| 27 | + <%= render component("ui/thumbnail").new( |
| 28 | + src: (variant.images.first || variant.product.gallery.images.first)&.url(:small), |
| 29 | + alt: variant.name |
| 30 | + ) %> |
| 31 | + <div class="flex-col"> |
| 32 | + <div class="leading-5 text-black body-small-bold"><%= variant.name %></div> |
| 33 | + <div class="leading-5 text-gray-500 body-small"> |
| 34 | + SKU: <%= variant.sku %> |
| 35 | + <%= variant.options_text.presence&.prepend("- ") %> |
| 36 | + </div> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + </td> |
| 40 | + <td class="px-6 py-4"> |
| 41 | + <span class="text-gray-500 body-small whitespace-nowrap"> |
| 42 | + <% item.states.each do |state, count| %> |
| 43 | + <%= count %> x <%= t(state, scope: '.inventory_states') %> |
| 44 | + <% end %> |
| 45 | + </span> |
| 46 | + </td> |
| 47 | + <td class="px-6 py-4"> |
| 48 | + <span class="text-gray-500 body-small"><%= item.line_item.display_amount %></span> |
| 49 | + </td> |
| 50 | + <td class="px-6 py-4 text-right"> |
| 51 | + <%= form_for(item.line_item, url: '#', method: :delete) do |f| %> |
| 52 | + <%= render component('ui/button').new( |
| 53 | + scheme: :ghost, |
| 54 | + size: :s, |
| 55 | + title: t("spree.delete"), |
| 56 | + icon: 'close-line', |
| 57 | + "data-controller": "confirm", |
| 58 | + "data-confirm-text-value": t("spree.are_you_sure"), |
| 59 | + ) %> |
| 60 | + <% end %> |
| 61 | + </td> |
| 62 | + </tr> |
| 63 | + <% end %> |
| 64 | + <tr class="border-gray-100 border-t"> |
| 65 | + <td colspan="4" class="px-6 py-4"> |
| 66 | + <%= form_for(@shipment, url: '#') do |f| %> |
| 67 | + <%= render component("ui/forms/field").select( |
| 68 | + f, |
| 69 | + :shipping_method, |
| 70 | + Spree::ShippingMethod.order(:name).pluck(:name, :id), |
| 71 | + class: "mb-4" |
| 72 | + ) %> |
| 73 | + |
| 74 | + <%= render component("ui/forms/field").text_field( |
| 75 | + f, |
| 76 | + :tracking |
| 77 | + ) %> |
| 78 | + <% end %> |
| 79 | + </td> |
| 80 | + </tr> |
| 81 | + </tbody> |
| 82 | + </table> |
| 83 | + </div> |
| 84 | + <% end %> |
| 85 | + <% end %> |
| 86 | + </div> |
| 87 | +</div> |
0 commit comments