-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add status to Request Requests default to ‘pending’ when created. Volunteers may optionally claim the request or mark it ready for delivery when items have been pulled from inventory. Adds the following methods: - For a given request: `.pending?`, `.claimed?`, `.delivery_ready?` - For all requests: `Request.pending`, `Request.claimed`, `Request.delivery_ready` will give lists of all Requests with the used status * Added initial volunteer requests view * Extracted shared block to partial * Added seeding of Requests and its item changes * add ability to change status of request for volunteers * add blank checkoxes * Add settled to item_change * Add item settling to interface * add limited stock & out of stock messages, started ability to remove from inventory * add limited/outof stock message to item selection for volunteers * Moved settle view to seperate view Co-authored-by: Nicholas Grana <[email protected]>
- Loading branch information
1 parent
d1dbd5c
commit d9ce3d8
Showing
14 changed files
with
307 additions
and
11 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
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
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,25 @@ | ||
|
||
<%= form_with(model: request, html: { class: 'pure-form pure-form-stacked' }) do |form| %> | ||
|
||
<% if request.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(request.errors.count, "error") %> prohibited this request from being saved:</h2> | ||
|
||
<ul> | ||
<% request.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="margins-needed"> | ||
<%= render partial: 'form_helpers/item_selection', locals: { form: form, parent_f: :request, send_to_settle: send_to_settle } %> | ||
|
||
<div class="actions"> | ||
<% send_to_settle ||= false %> | ||
<%= form.hidden_field :send_to_settle, value: send_to_settle %> | ||
<%= form.submit %> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="volunteer-request-list-block"> | ||
<% @itemsToStock = request.getItemStock() %> | ||
<ul> | ||
<% request.item_changes.limit(5).each do |item| %> | ||
<li> | ||
<%= item.description %> | ||
<% if @itemsToStock.keys.any?(item.id) %> | ||
<% if @itemsToStock[item.id] > 0 %> | ||
- Limited Stock (<%= @itemsToStock[item.id] =%>) | ||
<% else %> | ||
- Out of Stock | ||
<% end %> | ||
<% end %> | ||
|
||
</li> | ||
|
||
<% end %> | ||
|
||
<% if request.item_changes.count > 5 %> | ||
<li><i><%= request.item_changes.count - 5 %> more items</i></li> | ||
<% end %> | ||
</ul> | ||
|
||
<b><i>Due in <%= time_ago_in_words(request.due_time) %></i></b> | ||
|
||
<p><%= link_to 'View', settle_request_path(request) %></p> | ||
</div> |
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,78 @@ | ||
|
||
<div class="margins-needed"> | ||
<h1>Request a Donation: Summary</h1> | ||
<h2>Please review and confirm the summary of your request:</h2> | ||
|
||
<p> | ||
<strong>Urgency:</strong> | ||
<%= Request::URGENCIES.key(@request.urgency) %> | ||
</p> | ||
|
||
<p> | ||
<strong>Full name:</strong> | ||
<%= @request.full_name %> | ||
</p> | ||
|
||
<p> | ||
<strong>Email:</strong> | ||
<%= @request.email %> | ||
</p> | ||
|
||
<p> | ||
<strong>Phone:</strong> | ||
<%= @request.phone %> | ||
</p> | ||
|
||
<% if @request.meet %> | ||
<p> | ||
<strong>County:</strong> | ||
<%= Request::COUNTIES.key(@request.county) %> | ||
|
||
</p> | ||
<% else %> | ||
<p> | ||
<strong>Address:</strong> | ||
<%= @request.address %> | ||
</p> | ||
<% end %> | ||
|
||
<p> | ||
<strong>Availability:</strong> | ||
<%= @request.availability %> | ||
</p> | ||
|
||
<p> | ||
<strong>Comments:</strong> | ||
<%= @request.comments %> | ||
</p> | ||
|
||
<% if current_user&.volunteer? %> | ||
<strong>Order Status:</strong> | ||
<%= @request.status.titleize %> | ||
<br> | ||
<% end %> | ||
|
||
<p> | ||
<strong>Requested Items:</strong> | ||
<% if current_user&.volunteer? %> | ||
<%= render partial: "item_change_form", locals: { request: @request, send_to_settle: current_user&.volunteer? } %> | ||
<% else %> | ||
<%@request.item_changes.each do |item|%> | ||
<p><%= item.description %> | ||
<%end%> | ||
<% end %> | ||
</p> | ||
|
||
<% if current_user&.volunteer? && @request.status == "pending" %> | ||
<%= link_to "Mark Ready for Delivery", requests_next_status_path(@request), class: "home-link" %> | ||
<br> | ||
<% end %> | ||
|
||
<% if current_user&.volunteer? && @request.status == "delivery_ready" %> | ||
<%= link_to "Mark Order Complete", requests_next_status_path(@request), class: "home-link" %> | ||
<br> | ||
<% end %> | ||
|
||
<%= link_to 'Edit', edit_request_path(@request) %> | | ||
<%= link_to 'Back', :back %> | ||
</div> |
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,9 @@ | ||
<h1>Pending Requests (<%= Request.pending.count %>)</h1> | ||
<% Request.pending.each do |pending_request| %> | ||
<%= render partial: 'volunteer_request_block', locals: { request: pending_request } %> | ||
<% end %> | ||
|
||
<h1>Ready to Deliver (<%= Request.delivery_ready.count %>)</h1> | ||
<% Request.delivery_ready.each do |delivery_ready| %> | ||
<%= render partial: 'volunteer_request_block', locals: { request: delivery_ready } %> | ||
<% end %> |
Oops, something went wrong.