|
1 | | -<div class="container-fluid"> |
2 | | - <h2>Request</h2> |
3 | | - Title: <%= @request.title %><br> |
4 | | - Category: <%= @request.category %><br> |
5 | | - Quantity Needed: <%= @request.quantity_needed %><br> |
6 | | - Quantity Remaining: <%= @request.quantity_remaining %><br> |
7 | | - Condition: <%= @request.condition %><br> |
8 | | - Description: <%= @request.description %><br> |
9 | | - Region: <%= @request.charity.region %><br> |
10 | | - Prefecture: <%= @request.charity.prefecture %><br> |
11 | | - Status: <%= @request.status %><br> |
12 | | -</div> |
13 | | -<!--Links--> |
14 | | -<%= link_to "Back to Requests", requests_path %><br> |
15 | | -<%= link_to "View Offers", request_offers_path(@request) %><br> |
16 | | -<% if policy(@request).edit? %> |
17 | | - <%= link_to "Edit Request", edit_request_path(@request) %> |
18 | | -<% end %> |
19 | | -<% if policy(Offer.new(request: @request)).new? %> |
20 | | - <%= link_to "Make an Offer", new_request_offer_path(@request) %> |
21 | | -<% end %><br> |
22 | | -<!--Offers--> |
23 | | -<div class="container-fluid"> |
24 | | - <% @request.offers.each do |offer| %> |
25 | | - <h4>Offer from: <%= offer.donor.display_name %></h4> |
26 | | - Condition: <%= offer.condition %><br> |
27 | | - Can be sent: <%= offer.can_ship_by %><br> |
28 | | - Message: <%= offer.message %><br> |
29 | | - Quantity Offered: <%= offer.quantity_offered %><br> |
30 | | - Status: <%= offer.status %><br> |
31 | | - Tracking Number: <%= offer.tracking_number %><br> |
32 | | - <% end %> |
| 1 | +<div class="container mt-5 mb-4"> |
| 2 | + <div class="mb-3"> |
| 3 | + <%= link_to requests_path, class: "btn btn-outline-secondary" do %> |
| 4 | + ← Back to Requests |
| 5 | + <% end %> |
| 6 | + </div> |
| 7 | + <div class="row align-items-stretch g-4"> |
| 8 | + <div class="col-lg-5"> |
| 9 | + <div class="tall-card p-3 h-100"> |
| 10 | + <div class="row pt-2"> |
| 11 | + <div class="col-lg-7"> |
| 12 | + <h2> <%=@request.title %> </h2> |
| 13 | + </div> |
| 14 | + <div class="col-lg-4"> |
| 15 | + <h3> <%= @request.quantity_remaining - @request.quantity_needed %> / <%= @request.quantity_needed %> </h3> |
| 16 | + <%= @request.urgency %> |
| 17 | + </div> |
| 18 | + </div> |
| 19 | + <div> |
| 20 | + <h4> Region: </h4> |
| 21 | + <p> <%= @request.charity.prefecture %> - <%= @request.charity.region %> </p> |
| 22 | + </div> |
| 23 | + <div> |
| 24 | + <h4> Condition: </h4> |
| 25 | + <p> <%= @request.condition %> </p> |
| 26 | + </div> |
| 27 | + <div> |
| 28 | + <h4> Description: </h4> |
| 29 | + <p> <%= @request.description %> </p> |
| 30 | + </div> |
| 31 | + <div> |
| 32 | + <p> <%= @request.status %> </p> |
| 33 | + </div> |
| 34 | + <% if policy(@request).edit? %> |
| 35 | + <%= link_to "Edit Request", edit_request_path(@request), class: "btn btn-outline-secondary" %> |
| 36 | + <% end %> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + <div class="col-lg-6 mx-3"> |
| 40 | + <% if current_user.charity? && current_user.charity == @request.charity %> |
| 41 | + <h2> Offers </h2> |
| 42 | + <% if @offers.empty? %> |
| 43 | + No offers yet |
| 44 | + <% else %> |
| 45 | + <% @offers.each do |offer| %> |
| 46 | + <div class="small-card offer-card p-2 mb-3 |
| 47 | + <%= 'approved-offer' if offer.status == 'approved' %> |
| 48 | + <%= 'rejected-offer' if offer.status == 'rejected' %>"> |
| 49 | + <div class="row"> |
| 50 | + <div class="col-lg-9"> |
| 51 | + <h3> <%= offer.donor.display_name %> </h3> |
| 52 | + </div> |
| 53 | + <div class="col-lg-3"> |
| 54 | + <h3> <%= offer.quantity_offered %> </h3> |
| 55 | + </div> |
| 56 | + <p> <%= offer.donor.region if offer.donor.region %> </p> |
| 57 | + <p> Condition: <%= offer.condition %> </p> |
| 58 | + <p> Can be sent: <%= offer.can_ship_by.strftime("%b %e") %> </p> |
| 59 | + <p> Message: <%= offer.message %> </p> |
| 60 | + <p> Status: <%= offer.status %> </p> |
| 61 | + <p> Tracking Number: <%= offer.tracking_number %> </p> |
| 62 | + </div> |
| 63 | + <% if offer.status == "submitted" %> |
| 64 | + <div class="row"> |
| 65 | + <div class="col-lg-6"> |
| 66 | + <% if policy(offer).approve? %> |
| 67 | + <%= button_to "Approve Offer", approve_offer_path(offer), method: :patch, class: "btn btn-success" %> |
| 68 | + <% end %> |
| 69 | + </div> |
| 70 | + <div class="col-lg-6"> |
| 71 | + <% if policy(offer).reject? %> |
| 72 | + <%=button_to "Reject Offer", reject_offer_path(offer), method: :patch, class: "btn btn-danger" %> |
| 73 | + <% end %> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + <% end %> |
| 77 | + </div> |
| 78 | + <% end %> |
| 79 | + <% end %> |
| 80 | + <% else %> |
| 81 | + <% if policy(Offer.new(request: @request)).new? %> |
| 82 | + <%= link_to "Make an Offer", new_request_offer_path(@request), class: "small-card offer-card p-2 mb-3" %> |
| 83 | + <% end %> |
| 84 | + <% end %> |
| 85 | + </div> |
| 86 | + </div> |
33 | 87 | </div> |
0 commit comments