diff --git a/app/views/vendors/show.html.erb b/app/views/vendors/show.html.erb index 67237ac..3655f2e 100644 --- a/app/views/vendors/show.html.erb +++ b/app/views/vendors/show.html.erb @@ -43,3 +43,44 @@ + + + + +
+
+

Linked Participants

+ <% if @vendor.participants.any? %> + + + + + + + + + + + <% @vendor.service_contracts.each do |contract| %> + + <% participant = contract.participant %> + + + + + + <% end %> + +
Participant NameStart DateEnd DateActions
<%= participant ? "#{participant.first_name} #{participant.last_name}" : 'No Participant Assigned' %><%= contract.start_date.strftime('%B %d, %Y') if contract.start_date.present? %><%= contract.end_date.strftime('%B %d, %Y') if contract.end_date.present? %> + <%= link_to participant_path(participant), class: 'btn btn-sm btn-secondary' do %> + + <% end %> + <%= link_to edit_service_contract_path(contract), class: 'btn btn-sm btn-info' do %> + + <% end %> +
+ <% else %> +

No linked participants.

+ <% end %> +
+
diff --git a/app/views/workers/show.html.erb b/app/views/workers/show.html.erb index 92849d5..1299e83 100644 --- a/app/views/workers/show.html.erb +++ b/app/views/workers/show.html.erb @@ -66,8 +66,12 @@ <%= 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 'View', participant_path(participant), class: 'btn btn-sm btn-secondary' %> - <%= link_to 'Edit', edit_employment_path(employment), class: 'btn btn-sm btn-info' %> + <%= link_to participant_path(participant), class: 'btn btn-sm btn-secondary' do %> + + <% end %> + <%= link_to edit_employment_path(employment), class: 'btn btn-sm btn-info' do %> + + <% end %> <% end %> @@ -97,11 +101,12 @@ <%= form.date_field :end_date, class: 'form-control' %> -
+
<%= form.submit "Link Participant", class: 'btn btn-dark' %>
<% end %> + <%# JavaScript for Participant Autocomplete %>