From be18244abcec6efbdf83f5c7c74a51123e6f23d2 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Mon, 15 Jul 2019 15:37:24 +0100 Subject: [PATCH] Bring views/spree/admin/orders/_shipment and views/spree/admin/orders/_shipment_manifest from spree backend --- .../spree/admin/orders/_shipment.html.erb | 120 ++++++++++++++++++ .../admin/orders/_shipment_manifest.html.erb | 33 +++++ 2 files changed, 153 insertions(+) create mode 100644 app/views/spree/admin/orders/_shipment.html.erb create mode 100644 app/views/spree/admin/orders/_shipment_manifest.html.erb diff --git a/app/views/spree/admin/orders/_shipment.html.erb b/app/views/spree/admin/orders/_shipment.html.erb new file mode 100644 index 0000000000..109f6e00fb --- /dev/null +++ b/app/views/spree/admin/orders/_shipment.html.erb @@ -0,0 +1,120 @@ +
"> + <%= render :partial => "spree/admin/variants/split", :formats => :js %> +
+ + <%= shipment.number %> + - + <%= Spree.t("shipment_states.#{shipment.state}") %> + <%= Spree.t(:package_from) %> + '<%= shipment.stock_location.name %>' + <% if shipment.ready? and can? :update, shipment %> + - + <%= link_to 'ship', '#', :class => 'ship button icon-arrow-right', :data => {'shipment-number' => shipment.number} %> + <% end %> + +
+ + + + + + + + + + + + + + + + + + + + + <%= render 'spree/admin/orders/shipment_manifest', order: order, shipment: shipment %> + + <% unless shipment.shipped? %> + + + + + <% end %> + + + + + <% if shipment.adjustment.present? && !shipment.shipped? %> + + <% end %> + + + + + + + + + + + + +
<%= Spree.t(:item_description) %><%= Spree.t(:price) %><%= Spree.t(:quantity) %><%= Spree.t(:total) %>
+ <% if shipment.adjustment.present? %> + <%= shipment.adjustment.label %>: <%= shipment.shipping_method.name %> + <% else %> + <%= Spree.t(:cannot_set_shipping_method_without_address) %> + <% end %> + + <% if shipment.adjustment.present? %> + <%= shipment.adjustment.display_amount %> + <% end %> + + <% if can? :update, shipment %> + <%= link_to '', '#', :class => 'edit-method icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %> + <% end %> +
+ <% if shipment.tracking.present? %> + <%= Spree.t(:tracking) %>: <%= shipment.tracking %> + <% else %> + <%= Spree.t(:no_tracking_present) %> + <% end %> + + <% if can? :update, shipment %> + <%= link_to '', '#', :class => 'edit-tracking icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %> + <% end %> +
+
diff --git a/app/views/spree/admin/orders/_shipment_manifest.html.erb b/app/views/spree/admin/orders/_shipment_manifest.html.erb new file mode 100644 index 0000000000..2568e9e791 --- /dev/null +++ b/app/views/spree/admin/orders/_shipment_manifest.html.erb @@ -0,0 +1,33 @@ +<% shipment.manifest.each do |item| %> + <% line_item = order.find_line_item_by_variant(item.variant) %> + + + <%= mini_image(item.variant) %> + + <%= item.variant.product.name %>
<%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %> + + <%= line_item.single_money.to_html %> + + <% item.states.each do |state,count| %> + <%= count %> x <%= state.humanize.downcase %> + <% end %> + + <% unless shipment.shipped? %> + + <%= number_field_tag :quantity, item.quantity, :min => 0, :class => "line_item_quantity", :size => 5 %> + + <% end %> + <%= line_item_shipment_price(line_item, item.quantity) %> + <% unless shipment.shipped? %> + + <% if can? :update, item %> + <%= link_to '', '#', :class => 'save-item icon_link icon-ok no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %> + <%= link_to '', '#', :class => 'cancel-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %> + <%= link_to '', '#', :class => 'edit-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %> + <%= link_to '', '#', :class => 'split-item icon_link icon-resize-horizontal no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %> + <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove', :confirm => Spree.t(:are_you_sure)}, :title => Spree.t('delete') %> + <% end %> + + <% end %> + +<% end %>