-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create multiple page states for stock transfers
- Loading branch information
Showing
4 changed files
with
111 additions
and
101 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
backend/app/views/spree/admin/stock_transfers/_search.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<% content_for :table_filter do %> | ||
<div data-hook="admin_stock_transfers_index_search"> | ||
<%= search_form_for [:admin, @search] do |f| %> | ||
<div class="field-block alpha four columns"> | ||
<div class="field"> | ||
<%= f.label nil, Spree::StockLocation.model_name.human %> | ||
<%= f.select :source_location_id_or_destination_location_id_eq, options_from_collection_for_select(@stock_locations, :id, :name, params[:q][:source_location_id_or_destination_location_id_eq]), {include_blank: true}, {class: 'select2 fullwidth'} %> | ||
</div> | ||
</div> | ||
|
||
<div class="field-block alpha four columns"> | ||
<div class="date-range-filter field"> | ||
<%= f.label nil, Spree.t(:date_range) %> | ||
<div class="date-range-fields"> | ||
<%= f.text_field :created_at_gt, class: 'datepicker datepicker-from', include_blank: true, value: params[:q][:created_at_gt], placeholder: Spree.t(:start) %> | ||
|
||
<span class="range-divider"> | ||
<i class="fa fa-arrow-right"></i> | ||
</span> | ||
|
||
<%= f.text_field :created_at_lt, class: 'datepicker datepicker-to', include_blank: true, value: params[:q][:created_at_lt], placeholder: Spree.t(:stop) %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="field-block alpha four columns"> | ||
<div class="field"> | ||
<%= f.label nil, Spree::StockTransfer.human_attribute_name(:number) %> | ||
<%= f.text_field :number_cont, value: params[:q][:number_cont] %> | ||
</div> | ||
</div> | ||
|
||
<div class="field-block alpha four columns"> | ||
<div class="field checkbox"> | ||
<label> | ||
<%= f.check_box :closed_at_null, { checked: @show_only_open }, '1', '0' %> | ||
<%= Spree.t(:show_only_open_transfers) %> | ||
</label> | ||
</div> | ||
</div> | ||
|
||
<div class="clearfix"></div> | ||
|
||
<div class="actions filter-actions"> | ||
<div data-hook="admin_stock_transfers_index_search_buttons"> | ||
<%= button Spree.t(:filter_results) %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> |
50 changes: 50 additions & 0 deletions
50
backend/app/views/spree/admin/stock_transfers/_stock_transfer_table.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<%= render 'search' %> | ||
|
||
<% if @stock_transfers.any? %> | ||
<table class="index" id="listing_stock_transfers"> | ||
<thead> | ||
<tr> | ||
<th><%= sort_link @search, :number, Spree.t(:number) %></th> | ||
<th><%= sort_link @search, :from, Spree.t(:from) %></th> | ||
<th><%= sort_link @search, :to, Spree.t(:to) %></th> | ||
<th><%= sort_link @search, :expected_items, Spree.t(:expected) %></th> | ||
<th><%= sort_link @search, :received_items, Spree.t(:received) %></th> | ||
<th><%= sort_link @search, :shipped_at, Spree.t(:shipped) %></th> | ||
<th><%= sort_link @search, :status, Spree.t(:status) %></th> | ||
<th class="actions"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @stock_transfers.each do |stock_transfer| %> | ||
<tr id="<%= spree_dom_id stock_transfer %>" class="<%= cycle('odd', 'even') %>"> | ||
<td><%= handle_stock_transfer(stock_transfer) %></td> | ||
<td><%= stock_transfer.source_location.name %></td> | ||
<td><%= stock_transfer.destination_location.try(:name) %></td> | ||
<td class="align-center"><%= stock_transfer.expected_item_count %></td> | ||
<td class="align-center"><%= stock_transfer.received_item_count %></td> | ||
<td><%= stock_transfer.shipped_at.try(:to_date) %></td> | ||
<td> | ||
<span class="pill pill-<%= stock_transfer.closed? ? 'complete' : 'pending' %>"> | ||
<%= Spree.t(stock_transfer.closed? ? :closed : :open) %> | ||
</span> | ||
</td> | ||
<td class="actions"> | ||
<% if stock_transfer.receivable? && can?(:edit, stock_transfer) %> | ||
<%= link_to_with_icon 'download', Spree.t('actions.receive'), receive_admin_stock_transfer_path(stock_transfer), no_text: true, data: { action: 'green' } %> | ||
<% elsif !stock_transfer.closed? && can?(:edit, stock_transfer) %> | ||
<%= link_to_with_icon 'edit', Spree.t('actions.edit'), stock_transfer_edit_or_ship_path(stock_transfer), no_text: true, data: { action: 'edit' } %> | ||
<% elsif can?(:show, stock_transfer) %> | ||
<%= link_to_with_icon 'eye', Spree.t(:show), admin_stock_transfer_path(stock_transfer), no_text: true, data: { action: 'green' } %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% else %> | ||
<div class="alpha sixteen columns no-objects-found"> | ||
<%= render 'spree/admin/shared/no_objects_found', | ||
resource: Spree::StockTransfer, | ||
new_resource_url: new_object_url %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters