Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Stock Transfers list UX fixes

Damian Legawiec58eb603a05ee
diff --git a/backend/app/views/spree/admin/stock_transfers/index.html.erb b/backend/app/views/spree/admin/stock_transfers/index.html.erb
index 49eeecb326..2ea6d65666 100644
--- a/backend/app/views/spree/admin/stock_transfers/index.html.erb
+++ b/backend/app/views/spree/admin/stock_transfers/index.html.erb
@@ -6,68 +6,73 @@
<%= button_link_to Spree.t(:new_stock_transfer), new_admin_stock_transfer_path, { icon: 'add.svg', class: 'btn-success' } %>
<% end if can? :create, Spree::StockTransfer %>
-<div data-hook="admin_orders_index_search" class="card bg-light mb-3">
- <div class="card-body">
- <fieldset>
- <legend class="border-bottom"><%= Spree.t(:search) %></legend>
- <%= search_form_for @q, url: admin_stock_transfers_path do |f| %>
+<% content_for :table_filter do %>
+ <div data-hook="admin_orders_index_search">
+ <%= search_form_for @q, url: admin_stock_transfers_path do |f| %>
- <div class="row mb-0">
- <div class="col-12 col-lg-4">
- <div class="form-group">
- <%= f.label :reference_cont, Spree.t(:reference_contains) %>
- <%= f.text_field :reference_cont, class: 'form-control' %>
- </div>
- </div>
-
- <div class="col-12 col-lg-4">
- <div class="form-group">
- <%= f.label :source_location, Spree.t(:source) %>
- <%= f.select :source_location_id_eq,
- options_from_collection_for_select(@stock_locations, :id, :name, @q.source_location_id_eq),
- { include_blank: true }, class: 'select2' %>
- </div>
+ <div class="row mb-0">
+ <div class="col-12 col-lg-4">
+ <div class="form-group">
+ <%= f.label :reference_cont, Spree.t(:reference_contains) %>
+ <%= f.text_field :reference_cont, class: 'form-control' %>
</div>
+ </div>
- <div class="col-12 col-lg-4">
- <div class="form-group">
- <%= f.label :destination_location, Spree.t(:destination) %>
- <%= f.select :destination_location_id_eq,
- options_from_collection_for_select(@stock_locations, :id, :name, @q.destination_location_id_eq),
- { include_blank: true }, class: 'select2' %>
- </div>
+ <div class="col-12 col-lg-4">
+ <div class="form-group">
+ <%= f.label :source_location, Spree.t(:source) %>
+ <%= f.select :source_location_id_eq,
+ options_from_collection_for_select(@stock_locations, :id, :name, @q.source_location_id_eq),
+ { include_blank: true }, class: 'select2 js-filterable' %>
</div>
</div>
- <div class="form-actions">
- <div data-hook="admin_stock_transfers_index_search_buttons">
- <%= button Spree.t(:filter_results), 'search.svg' %>
+ <div class="col-12 col-lg-4">
+ <div class="form-group">
+ <%= f.label :destination_location, Spree.t(:destination) %>
+ <%= f.select :destination_location_id_eq,
+ options_from_collection_for_select(@stock_locations, :id, :name, @q.destination_location_id_eq),
+ { include_blank: true }, class: 'select2 js-filterable' %>
</div>
</div>
- <% end %>
- </fieldset>
+ </div>
+
+ <div class="form-actions" data-hook="admin_stock_transfers_index_search_buttons">
+ <%= button Spree.t(:filter_results), 'search.svg' %>
+ </div>
+ <% end %>
</div>
-</div>
+<% end %>
<% if @stock_transfers.any? %>
<div class="table-responsive">
<table class="table" id='listing_stock_transfers' data-hook>
<thead>
<tr data-hook='stock_transfers_header'>
- <th><%= Spree.t(:created_at) %></th>
+ <th><%= Spree.t(:number) %></th>
<th><%= Spree.t(:reference) %></th>
<th><%= Spree.t(:source) %></th>
<th><%= Spree.t(:destination) %></th>
+ <th><%= Spree.t(:created_at) %></th>
<th class='actions'></th>
</tr>
</thead>
<tbody>
<% @stock_transfers.each do |stock_transfer| %>
<tr id="<%= spree_dom_id stock_transfer %>" data-hook="stock_transfer_row">
- <td><%= link_to stock_transfer.created_at.strftime('%F %T %Z'), admin_stock_transfer_path(stock_transfer) %></td>
+ <td><%= link_to stock_transfer.number, admin_stock_transfer_path(stock_transfer) %></td>
<td><%= stock_transfer.reference %></td>
- <td><%= stock_transfer.source_location.try(:name) %></td>
- <td><%= stock_transfer.destination_location.try(:name) %></td>
+ <td>
+ <% if stock_transfer.source_location.present? %>
+ <%= stock_transfer.source_location.name %>
+ <% end %>
+ </td>
+ <td>
+ <% if stock_transfer.destination_location.present? %>
+ <%= stock_transfer.destination_location.name %>
+ <% end %>
+ </td>
+ <td><%= stock_transfer.created_at.strftime('%F %T %Z') %></td>
<td class="actions actions-1">
<%= link_to_with_icon 'show', Spree.t(:show), admin_stock_transfer_path(stock_transfer), class: 'btn btn-outline-secondary btn-sm', no_text: true, data: {action: 'view'} %>
</td>