Participant Details

Name: <%= @participant.first_name %> <%= @participant.last_name %>

Address: <%= @participant.address %>

Phone: <%= @participant.phone %>

Email: <%= @participant.email %>

MCI: <%= @participant.mci %>

DOB: <%= @participant.dob.strftime('%B %d, %Y') if @participant.dob.present? %>

SSN: <%= @participant.ssn %>

Gender: <%= @participant.gender %>

<%= link_to 'Edit', edit_participant_path(@participant), class: "btn btn-dark" %> <%= link_to 'Back to List', participants_path, class: "btn btn-secondary" %>

Linked Workers

<% @employments.each do |employment| %> <% end %>
Worker Name Start Date End Date Actions
<%= employment.worker&.full_name || 'No Worker Assigned' %> <%= employment.start_date.strftime('%B %d, %Y') if employment.start_date.present? %> <%= employment.end_date.strftime('%B %d, %Y') if employment.end_date.present? %> <%= link_to worker_path(employment.worker), class: 'btn btn-sm btn-secondary' do %> <% end %> <%= link_to edit_employment_path(employment), class: 'btn btn-sm btn-warning' do %> <% end %>

<%= form_with(model: [@participant, @employment], url: link_worker_participant_path(@participant), method: :post, class: 'row g-3') do |form| %>
<%= form.label :worker_id, "Add New Worker", class: 'form-label' %> <%= form.collection_select :worker_id, Worker.all, :id, :full_name, { include_blank: true, prompt: "Select a Worker" }, { class: 'form-select' } %>
<%= form.label :start_date, class: 'form-label' %> <%= form.date_field :start_date, class: 'form-control' %>
<%= form.label :end_date, class: 'form-label' %> <%= form.date_field :end_date, class: 'form-control' %>
<%= form.submit "Link Worker", class: 'btn btn-dark' %>
<% end %>