-
-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new table with collapsible locations for banks with many locations
The "Items, Quantity, and Location" table has a nasty horizontal scroll if the bank has many locations, which can be common for banks that allow volunteers to take inventory back to their residences to package into kits. This is very unwieldly for them, but other banks with few locations have a great scannable view of where their inventory is. We're reproducing this table with the locations collapsed under a heading for banks with many locations in a new tab to preserve the experience for banks with few locations. ExpandableTable from AdminLTE is being used to handle the expansion. Location is being stored slightly differently in the query to make it easier to access.
- Loading branch information
1 parent
ba8660b
commit 27d84ec
Showing
5 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<% row_item = row.last %> | ||
<tr data-widget="expandable-table" aria-expanded="false"> | ||
<td><%= link_to(row_item[:item_name], item_url(row_item[:item_id])) %></td> | ||
<td class="numeric"><%= row_item[:quantity] %></td> | ||
<td class="numeric"><%= row_item[:item_on_hand_minimum_quantity] %></td> | ||
<td class="numeric"><%= row_item[:item_on_hand_recommended_quantity] %></td> | ||
</tr> | ||
<tr class="expandable-body"> | ||
<td colspan="4"> | ||
<% row_item[:locations].each do |location_name, quantity| %> | ||
<p><%= "#{location_name} - #{quantity} units" %></p> | ||
<% end %> | ||
</td> | ||
</tr> |
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,20 @@ | ||
<div class="tab-pane fade" id="custom-tabs-three-inventory" role="tabpanel" aria-labelledby="custom-tabs-three-inventory-tab"> | ||
<div class='flex justify-end mb-4'> | ||
<%= new_button_to new_item_path(organization_id: current_organization), {text: "New Item"} %> | ||
</div> | ||
|
||
<table class="table table-items-location"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th class="numeric">Quantity</th> | ||
<th class="numeric">Minimum Quantity</th> | ||
<th class="numeric">Recommended Quantity</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render partial: "item_row_inventory", collection: @items_by_storage_collection_and_quantity, as: :row %> | ||
</tbody> | ||
</table> | ||
</div><!-- /.box-body.table-responsive --> | ||
|
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