-
-
Notifications
You must be signed in to change notification settings - Fork 573
Expand file tree
/
Copy pathshow.html.erb
More file actions
121 lines (119 loc) · 4.72 KB
/
show.html.erb
File metadata and controls
121 lines (119 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<% content_for :title, "Requests - #{@request.id} - #{current_organization.name}" %>
<h1>
Request
<small>from <%= @request.partner.name %></small>
</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><%= link_to(dashboard_path) do %>
<i class="fa fa-dashboard"></i> Home
<% end %>
</li>
<li class="breadcrumb-item"><%= link_to "Requests", requests_path %></li>
<li class="breadcrumb-item"><a href="#"> Request from <%= @request.partner.name %>
at <%= @request.created_at.to_fs(:distribution_date) %></a></li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">This request was sent on <%= @request.created_at.to_fs(:distribution_date) %></h3>
</div>
<div class="card-body p-0">
<table class="table">
<thead>
<tr>
<th>Request was sent by:</th>
<th>Request Sender:</th>
<th>Request Type:</th>
<th>Request Status:</th>
<th>Comments:</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @request.partner.name %></td>
<td><%= @request.partner_user&.formatted_email %></td>
<td><%= @request.request_type&.humanize %></td>
<td><%= render partial: "status", locals: {status: @request.status} %></td>
<td><%= @request.comments || 'None' %></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body p-0">
<table class="table">
<thead>
<tr>
<th>Item</th>
<th>Quantity</th>
<% if @custom_units %>
<th>Units (if applicable)</th>
<% end %>
<% if @default_storage_location %>
<th>Default storage location inventory</th>
<% end %>
<th>Total Inventory</th>
</tr>
</thead>
<tbody>
<% @item_requests.each do |item_request| %>
<tr>
<td><%= item_request.item_name %></td>
<td><%= item_request.quantity %></td>
<% if @custom_units %>
<td><%= item_request.request_unit&.pluralize(item_request.quantity.to_i) %></td>
<% end %>
<% if @default_storage_location %>
<% on_hand_for_location = @inventory.quantity_for(storage_location: @location&.id, item_id: item_request.item_id) %>
<td><%= on_hand_for_location&.positive? ? on_hand_for_location : 'N/A' %></td>
<% end %>
<% on_hand = @inventory.quantity_for(item_id: item_request.item_id) %>
<td><%= on_hand || 0 %></td>
</tr>
<% end %>
<tr>
<td>Total (Quota)</td>
<td>
<%= @request.total_items %>
<%= quota_display(@request.partner) %>
</td>
<td />
</tr>
</tbody>
</table>
</div>
<div class="card-footer flex flex-row space-x-2">
<% unless @request.status_cancelled? %>
<%= submit_button_to start_request_path(@request), {text: "Fulfill request", size: "md"} unless @request.distribution %>
<% end %>
<%= view_button_to(distribution_path(@request.distribution), {text: "View Associated Distribution", size: "md"}) if @request.distribution %>
<%= print_button_to print_picklist_request_path(@request), { format: :pdf, text: "Print", size: "md" } %>
<% unless @request.status_fulfilled? || @request.status_cancelled? %>
<%= button_to 'Cancel', new_request_cancelation_path(request_id: @request.id),
method: :get, data: { disable_with: "Please wait..." }, form_class: 'd-inline', class: 'btn btn-danger btn-md' %>
<% end %>
</div>
</div>
</div>
</div>
</div>
</section>