obdev/app/views/employments/edit.html.erb

40 lines
1.6 KiB
Plaintext

<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<h1 class="mb-4 text-center">Edit Employment</h1>
<%= form_with(model: @employment, url: employment_path(@employment), method: :patch, local: true, html: { class: 'needs-validation', novalidate: true }) do |form| %>
<% if @employment.errors.any? %>
<div id="error_explanation" class="alert alert-danger" role="alert">
<h4><%= pluralize(@employment.errors.count, "error") %> prohibited this employment from being saved:</h4>
<ul>
<% @employment.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="mb-3">
<%= form.label :start_date, class: 'form-label' %>
<%= form.date_field :start_date, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :end_date, class: 'form-label' %>
<%= form.date_field :end_date, class: 'form-control' %>
</div>
<div class="actions">
<%= form.submit "Update Employment", class: 'btn btn-dark' %>
</div>
<% end %>
<div class="mt-3 d-flex justify-content-between">
<%= link_to 'Back to Participant', participant_path(@employment.participant), class: 'btn btn-secondary' %>
<%= link_to 'Delete Employment', employment_path(@employment), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %>
</div>
</div>
</div>
</div>