obdev/app/views/participants/show.html.erb

115 lines
3.4 KiB
Plaintext
Raw Normal View History

<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<h1 class="mb-4 text-center">Participant Details</h1>
<div class="card">
<div class="card-body">
<p class="card-text">
<strong>Name:</strong>
<%= @participant.first_name %> <%= @participant.last_name %>
</p>
<p class="card-text">
<strong>Address:</strong>
<%= @participant.address %>
</p>
<p class="card-text">
<strong>Phone:</strong>
<%= @participant.phone %>
</p>
<p class="card-text">
<strong>Email:</strong>
<%= @participant.email %>
</p>
<p class="card-text">
<strong>MCI:</strong>
<%= @participant.mci %>
</p>
<p class="card-text">
<strong>DOB:</strong>
<%= @participant.dob.strftime('%B %d, %Y') if @participant.dob.present? %>
</p>
<p class="card-text">
<strong>SSN:</strong>
<%= @participant.ssn %>
</p>
<p class="card-text">
<strong>Gender:</strong>
<%= @participant.gender %>
</p>
<!-- Repeat this pattern for other attributes like phone, email, etc. -->
</div>
</div>
<div class="mt-3 d-flex justify-content-between">
<%= link_to 'Edit', edit_participant_path(@participant), class: "btn btn-dark" %>
<%= link_to 'Back to List', participants_path, class: "btn btn-secondary" %>
</div>
</div>
</div>
</div>
<h2 class="mt-4">Linked Workers</h2>
<table class="table table-striped">
<thead class="table-dark">
<tr>
<th>Worker Name</th>
<th>Start Date</th>
<th>End Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @employments.each do |employment| %>
<tr>
<td><%= employment.worker&.full_name || 'No Worker Assigned' %></td>
<td><%= employment.start_date.strftime('%B %d, %Y') if employment.start_date.present? %></td>
<td><%= employment.end_date.strftime('%B %d, %Y') if employment.end_date.present? %></td>
<td>
<%= link_to worker_path(employment.worker), class: 'btn btn-sm btn-secondary' do %>
<i class="bi bi-eye"></i> <!-- Eyeball icon for 'Show' -->
<% end %>
<%= link_to edit_employment_path(employment), class: 'btn btn-sm btn-warning' do %>
<i class="bi bi-pencil-fill"></i> <!-- Pencil icon for 'Edit' -->
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= form_with(model: [@participant, @employment], url: link_worker_participant_path(@participant), method: :post, class: 'row g-3') do |form| %>
<div class="col-md-6">
<%= form.label :worker_id, "Select Worker", class: 'form-label' %>
<%= form.collection_select :worker_id, Worker.all, :id, :full_name, { include_blank: true, prompt: "Select a Worker" }, { class: 'form-select' } %>
</div>
<div class="col-md-3">
<%= form.label :start_date, class: 'form-label' %>
<%= form.date_field :start_date, class: 'form-control' %>
</div>
<div class="col-md-3">
<%= form.label :end_date, class: 'form-label' %>
<%= form.date_field :end_date, class: 'form-control' %>
</div>
<div class="col-12">
<%= form.submit "Link Worker", class: 'btn btn-dark' %>
</div>
<% end %>