-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Item Inventory for Banks with many locations (#3784)
* 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. * Add new styling for expandable tabes to hint that they can be expanded when clicked. * Location name could be duplicated, so use id to identify the location instead. Resolves #3776
- Loading branch information
1 parent
33ceb9f
commit 14dcb6a
Showing
8 changed files
with
106 additions
and
7 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,22 @@ | ||
/* | ||
* Customized Styling for Exandable Tables - provided by AdminLTE | ||
* ExpandableTable - https://adminlte.io/docs/3.1/javascript/expandable-tables.html | ||
*/ | ||
|
||
/* | ||
* Default Expanded table has no indicator that the row is clickable. This styles an expand/collapse icon. | ||
* Expanded=true is minus, Expanded=false is plus | ||
*/ | ||
[data-widget="expandable-table"] { | ||
&[aria-expanded="true"] { | ||
td > .fa::before{ | ||
content: "\f068"; | ||
} | ||
} | ||
|
||
&[aria-expanded="false"] { | ||
td > .fa::before{ | ||
content: "\f067"; | ||
} | ||
} | ||
} |
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,18 @@ | ||
<% row_item = row.last %> | ||
<tr data-widget="expandable-table" aria-expanded="false"> | ||
<td><i class="fa" /></td> | ||
<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="5"> | ||
<p> | ||
<% row_item[:locations].each do |location| %> | ||
<%= link_to(location[:name], storage_location_url(location[:id])) %> | ||
<%= " - #{location[:quantity]} units" %><br> | ||
<% end %> | ||
</p> | ||
</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
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,21 @@ | ||
<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></th> | ||
<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