mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Bring views/spree/admin/orders/_shipment and views/spree/admin/orders/_shipment_manifest from spree backend
This commit is contained in:
120
app/views/spree/admin/orders/_shipment.html.erb
Normal file
120
app/views/spree/admin/orders/_shipment.html.erb
Normal file
@@ -0,0 +1,120 @@
|
||||
<div id="<%= "shipment_#{shipment.id}" %>">
|
||||
<%= render :partial => "spree/admin/variants/split", :formats => :js %>
|
||||
<fieldset class="no-border-bottom">
|
||||
<legend align="center" class="stock-location" data-hook="stock-location">
|
||||
<span class="shipment-number"><%= shipment.number %></span>
|
||||
-
|
||||
<span class="shipment-state"><%= Spree.t("shipment_states.#{shipment.state}") %></span>
|
||||
<%= Spree.t(:package_from) %>
|
||||
<strong class="stock-location-name" data-hook="stock-location-name">'<%= shipment.stock_location.name %>'</strong>
|
||||
<% if shipment.ready? and can? :update, shipment %>
|
||||
-
|
||||
<%= link_to 'ship', '#', :class => 'ship button icon-arrow-right', :data => {'shipment-number' => shipment.number} %>
|
||||
<% end %>
|
||||
</legend>
|
||||
</fieldset>
|
||||
|
||||
<table class="stock-contents index" data-hook="stock-contents">
|
||||
<colgroup>
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 30%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 15%;" />
|
||||
</colgroup>
|
||||
|
||||
<thead>
|
||||
<th colspan="2"><%= Spree.t(:item_description) %></th>
|
||||
<th><%= Spree.t(:price) %></th>
|
||||
<th><%= Spree.t(:quantity) %></th>
|
||||
<th><%= Spree.t(:total) %></th>
|
||||
<th class="orders-actions actions" data-hook="admin_order_form_line_items_header_actions"></th>
|
||||
</thead>
|
||||
|
||||
<tbody data-shipment-number="<%= shipment.number %>" data-order-number="<%= order.number %>">
|
||||
<%= render 'spree/admin/orders/shipment_manifest', order: order, shipment: shipment %>
|
||||
|
||||
<% unless shipment.shipped? %>
|
||||
<tr class="edit-method hidden total">
|
||||
<td colspan="5">
|
||||
<div class="field alpha five columns">
|
||||
<%= label_tag 'selected_shipping_rate_id', Spree.t(:shipping_method) %>
|
||||
<%= select_tag :selected_shipping_rate_id,
|
||||
options_for_select(shipment.shipping_rates.backend.map {|sr| ["#{sr.name} #{sr.display_price}", sr.id] }, shipment.selected_shipping_rate_id),
|
||||
{:class => 'select2 fullwidth', :data => {'shipment-number' => shipment.number } } %>
|
||||
</div>
|
||||
|
||||
<% if shipment.adjustment && shipment.adjustment.closed? %>
|
||||
<div class="field omega four columns">
|
||||
<label><%= Spree.t(:associated_adjustment_closed) %></label>
|
||||
<ul>
|
||||
<li><%= radio_button_tag :open_adjustment, 'yes', false, :data => {'shipment-number' => shipment.number } %> Yes</li>
|
||||
<li><%= radio_button_tag :open_adjustment, 'no', true, :data => {'shipment-number' => shipment.number } %> No</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<% if can? :update, shipment %>
|
||||
<%= link_to '', '#', :class => 'save-method icon_link icon-ok no-text with-tip',
|
||||
:data => {'shipment-number' => shipment.number, :action => 'save'}, title: Spree.t('actions.save') %>
|
||||
<%= link_to '', '#', :class => 'cancel-method icon_link icon-cancel no-text with-tip',
|
||||
:data => {:action => 'cancel'}, :title => Spree.t('actions.cancel') %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr class="show-method total">
|
||||
<td colspan="4">
|
||||
<% if shipment.adjustment.present? %>
|
||||
<strong><%= shipment.adjustment.label %>: <%= shipment.shipping_method.name %></strong>
|
||||
<% else %>
|
||||
<%= Spree.t(:cannot_set_shipping_method_without_address) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="total" align="center">
|
||||
<% if shipment.adjustment.present? %>
|
||||
<span><%= shipment.adjustment.display_amount %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if shipment.adjustment.present? && !shipment.shipped? %>
|
||||
<td class="actions">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
||||
<tr class="edit-tracking hidden total">
|
||||
<td colspan="5">
|
||||
<label><%= Spree.t(:tracking_number) %>:</label>
|
||||
<%= text_field_tag :tracking, shipment.tracking %>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<% if can? :update, shipment %>
|
||||
<%= link_to '', '#', :class => 'save-tracking icon_link icon-ok no-text with-tip', :data => {'shipment-number' => shipment.number, :action => 'save'}, :title => Spree.t('actions.save') %>
|
||||
<%= link_to '', '#', :class => 'cancel-tracking icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel') %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="show-tracking total">
|
||||
<td colspan="5">
|
||||
<% if shipment.tracking.present? %>
|
||||
<strong><%= Spree.t(:tracking) %>:</strong> <%= shipment.tracking %>
|
||||
<% else %>
|
||||
<%= Spree.t(:no_tracking_present) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<% 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 %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
33
app/views/spree/admin/orders/_shipment_manifest.html.erb
Normal file
33
app/views/spree/admin/orders/_shipment_manifest.html.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
<% shipment.manifest.each do |item| %>
|
||||
<% line_item = order.find_line_item_by_variant(item.variant) %>
|
||||
|
||||
<tr class="stock-item" data-item-quantity="<%= item.quantity %>">
|
||||
<td class="item-image"><%= mini_image(item.variant) %></td>
|
||||
<td class="item-name">
|
||||
<%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
|
||||
</td>
|
||||
<td class="item-price align-center"><%= line_item.single_money.to_html %></td>
|
||||
<td class="item-qty-show align-center">
|
||||
<% item.states.each do |state,count| %>
|
||||
<%= count %> x <%= state.humanize.downcase %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% unless shipment.shipped? %>
|
||||
<td class="item-qty-edit hidden">
|
||||
<%= number_field_tag :quantity, item.quantity, :min => 0, :class => "line_item_quantity", :size => 5 %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="item-total align-center"><%= line_item_shipment_price(line_item, item.quantity) %></td>
|
||||
<% unless shipment.shipped? %>
|
||||
<td class="cart-item-delete actions" data-hook="cart_item_delete">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user