obdev/app/views/workers/index.html.erb

45 lines
1.4 KiB
Plaintext

<div class="container mt-5">
<h1 class="mb-4 text-center">Workers</h1>
<div class="text-center mt-3">
<%= link_to 'New Worker', new_worker_path, class: 'btn btn-dark mb-3' %>
</div>
<%= paginate @workers %>
<table class="table table-striped table-hover">
<thead class="table-light">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th>
<th>DOB</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @workers.each do |worker| %>
<tr>
<td><%= worker.first_name %></td>
<td><%= worker.last_name %></td>
<td><%= [worker.address_line_1, worker.address_line_2, worker.city, worker.state, worker.zip].compact.join(', ') %></td>
<td><%= worker.phone %></td>
<td><%= worker.email %></td>
<td><%= worker.dob.strftime('%B %d, %Y') if worker.dob %></td>
<td>
<%= link_to worker_path(worker), class: 'btn btn-sm btn-secondary' do %>
<i class="bi bi-eye"></i> <!-- Eyeball icon for 'Show' -->
<% end %>
<%= link_to edit_worker_path(worker), class: 'btn btn-sm btn-info' do %>
<i class="bi bi-pencil-fill" style="color: white;"></i> <!-- Pencil icon for 'Edit' -->
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>