|
2 | 2 | <div class="container-fluid"> |
3 | 3 | <div class="row mb-2"> |
4 | 4 | <div class="col-sm-6"> |
5 | | - <% content_for :title, "Requests - #{@request.id} - #{current_organization.name}" %> |
| 5 | + <% content_for :title, "Requests - #{@request_info.request.id} - #{current_organization.name}" %> |
6 | 6 | <h1> |
7 | 7 | Request |
8 | | - <small>from <%= @request.partner.name %></small> |
| 8 | + <small>from <%= @request_info.request.partner.name %></small> |
9 | 9 | </h1> |
10 | 10 | </div> |
11 | 11 | <div class="col-sm-6"> |
|
15 | 15 | <% end %> |
16 | 16 | </li> |
17 | 17 | <li class="breadcrumb-item"><%= link_to "Requests", requests_path %></li> |
18 | | - <li class="breadcrumb-item"><a href="#"> Request from <%= @request.partner.name %> |
19 | | - at <%= @request.created_at.to_fs(:distribution_date) %></a></li> |
| 18 | + <li class="breadcrumb-item"><a href="#"> Request from <%= @request_info.request.partner.name %> |
| 19 | + at <%= @request_info.request.created_at.to_fs(:distribution_date) %></a></li> |
20 | 20 | </ol> |
21 | 21 | </div> |
22 | 22 | </div> |
|
29 | 29 | <div class="col-12"> |
30 | 30 | <div class="card"> |
31 | 31 | <div class="card-header"> |
32 | | - <h3 class="card-title">This request was sent on <%= @request.created_at.to_fs(:distribution_date) %></h3> |
| 32 | + <h3 class="card-title">This request was sent on <%= @request_info.request.created_at.to_fs(:distribution_date) %></h3> |
33 | 33 | </div> |
34 | 34 | <div class="card-body p-0"> |
35 | 35 | <table class="table"> |
|
44 | 44 | </thead> |
45 | 45 | <tbody> |
46 | 46 | <tr> |
47 | | - <td><%= @request.partner.name %></td> |
48 | | - <td><%= @request.partner_user&.formatted_email %></td> |
49 | | - <td><%= @request.request_type&.humanize %></td> |
50 | | - <td><%= render partial: "status", locals: {status: @request.status} %></td> |
51 | | - <td><%= @request.comments || 'None' %></td> |
| 47 | + <td><%= @request_info.request.partner.name %></td> |
| 48 | + <td><%= @request_info.request.partner_user&.formatted_email %></td> |
| 49 | + <td><%= @request_info.request.request_type&.humanize %></td> |
| 50 | + <td><%= render partial: "status", locals: {status: @request_info.request.status} %></td> |
| 51 | + <td><%= @request_info.request.comments || 'None' %></td> |
52 | 52 | </tr> |
53 | 53 | </table> |
54 | 54 | </div> |
|
67 | 67 | <tr> |
68 | 68 | <th>Item</th> |
69 | 69 | <th>Quantity</th> |
70 | | - <% if @custom_units %> |
| 70 | + <% if @request_info.custom_units %> |
71 | 71 | <th>Units (if applicable)</th> |
72 | 72 | <% end %> |
73 | | - <% if @default_storage_location %> |
| 73 | + <% if @request_info.default_storage_location %> |
74 | 74 | <th>Default storage location inventory</th> |
75 | 75 | <% end %> |
76 | 76 | <th>Total Inventory</th> |
77 | 77 | </tr> |
78 | 78 | </thead> |
79 | 79 | <tbody> |
80 | | - <% @item_requests.each do |item_request| %> |
| 80 | + <% @request_info.item_requests.each do |item_request| %> |
81 | 81 | <tr> |
82 | 82 | <td><%= item_request.item_name %></td> |
83 | 83 | <td><%= item_request.quantity %></td> |
84 | | - <% if @custom_units %> |
| 84 | + <% if @request_info.custom_units %> |
85 | 85 | <td><%= item_request.request_unit&.pluralize(item_request.quantity.to_i) %></td> |
86 | 86 | <% end %> |
87 | | - <% if @default_storage_location %> |
88 | | - <% on_hand_for_location = @inventory.quantity_for(storage_location: @location&.id, item_id: item_request.item_id) %> |
| 87 | + <% if @request_info.default_storage_location %> |
| 88 | + <% on_hand_for_location = @request_info.inventory.quantity_for(storage_location: @request_info.location&.id, item_id: item_request.item_id) %> |
89 | 89 | <td><%= on_hand_for_location&.positive? ? on_hand_for_location : 'N/A' %></td> |
90 | 90 | <% end %> |
91 | | - <% on_hand = @inventory.quantity_for(item_id: item_request.item_id) %> |
| 91 | + <% on_hand = @request_info.inventory.quantity_for(item_id: item_request.item_id) %> |
92 | 92 | <td><%= on_hand || 0 %></td> |
93 | 93 | </tr> |
94 | 94 | <% end %> |
95 | 95 | <tr> |
96 | 96 | <td>Total (Quota)</td> |
97 | 97 | <td> |
98 | | - <%= @request.total_items %> |
99 | | - <%= quota_display(@request.partner) %> |
| 98 | + <%= @request_info.request.total_items %> |
| 99 | + <%= quota_display(@request_info.request.partner) %> |
100 | 100 | </td> |
101 | 101 | <td /> |
102 | 102 | </tr> |
103 | 103 | </tbody> |
104 | 104 | </table> |
105 | 105 | </div> |
106 | 106 | <div class="card-footer flex flex-row space-x-2"> |
107 | | - <%= submit_button_to start_request_path(@request), {text: "Fulfill request", size: "md"} unless @request.distribution %> |
108 | | - <%= view_button_to(distribution_path(@request.distribution), {text: "View Associated Distribution", size: "md"}) if @request.distribution %> |
109 | | - <%= print_button_to print_picklist_request_path(@request), { format: :pdf, text: "Print", size: "md" } %> |
110 | | - <%= button_to 'Cancel', new_request_cancelation_path(request_id: @request.id), |
| 107 | + <%= submit_button_to start_request_path(@request_info.request), {text: "Fulfill request", size: "md"} unless @request_info.request.distribution %> |
| 108 | + <%= view_button_to(distribution_path(@request_info.request.distribution), {text: "View Associated Distribution", size: "md"}) if @request_info.request.distribution %> |
| 109 | + <%= print_button_to print_picklist_request_path(@request_info.request), { format: :pdf, text: "Print", size: "md" } %> |
| 110 | + <%= button_to 'Cancel', new_request_cancelation_path(request_id: @request_info.request.id), |
111 | 111 | method: :get, data: { disable_with: "Please wait..." }, form_class: 'd-inline', class: 'btn btn-danger btn-md' %> |
112 | 112 | </div> |
113 | 113 | </div> |
|
0 commit comments