-
-
Notifications
You must be signed in to change notification settings - Fork 527
/
Copy pathshow.html.erb
146 lines (143 loc) · 4.98 KB
/
show.html.erb
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<% content_for :title, "Product Drive - #{@product_drive.name} - #{current_organization.name}" %>
<h1>
Product Drive
<small>for <%= current_organization.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 "Product Drives", product_drives_path %></li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card">
<div class="card-body p-0">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Start Date</th>
<th>End Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @product_drive.name %></td>
<td class="text-left" class="date"><%= @product_drive.start_date.strftime("%m-%d-%Y") %></td>
<td class="text-left"><%= @product_drive.end_date&.strftime("%m-%d-%Y") %></td>
</tr>
</tbody>
</table>
</div>
<!-- /.card-body -->
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card">
<div class="card-body p-0">
<table class="table">
<thead>
<tr>
<th>Donation Id</th>
<th>Product Drive Participant</th>
<th>Storage Location</th>
<th>Quantity</th>
<th>In Kind Value</th>
</tr>
</thead>
<tbody>
<% @product_drive.donations.each do |donation| %>
<tr>
<td><%= link_to donation.id, donation %></td>
<td><%= donation.product_drive_participant_id ? donation.product_drive_participant.business_name : nil %></td>
<td><%= donation.storage_location.name %></td>
<td><%= donation.line_items.count(&:quantity) %></td>
<td><strong><%= dollar_value(donation.value_per_itemizable) %></strong></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<hr>
<p style="text-align: center">
To add additional donations to this product drive, please edit that donation and select this product drive from the appropriate dropdown.
</p>
<div class="card-footer clearfix">
<%= edit_button_to edit_product_drive_path(@product_drive), { text: "Make a correction", size: "md" } %>
<%= delete_button_to product_drive_path(@product_drive), { confirm: "Are you sure you want to permanently remove this product drive?", size: "md", enabled: ProductDriveDestroyService.can_destroy?(@product_drive, current_user)} %>
</div>
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card">
<div class="card-body p-0">
<table class="table">
<thead>
<tr>
<th>Business Name</th>
<th>Contact Name</th>
<th>Phone</th>
<th>Email</th>
<th>Address</th>
<th>Items for this Drive</th>
<th>Total Items (for all drives)</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% @product_drive.product_drive_participants.each do |participant| %>
<tr>
<td><%= participant.business_name %></td>
<td><%= participant.contact_name %></td>
<td><%= participant.phone %></td>
<td><%= participant.email %></td>
<td><%= participant.address %></td>
<td><%= participant.volume_by_product_drive(@product_drive.id) %></td>
<td><%= participant.volume %></td>
<td><%= participant.comment %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<!-- /.card-body -->
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>