rubyforgood/casa

View on GitHub
app/views/other_duties/_form.html.erb

Summary

Maintainability
Test Coverage
<div class="title-wrapper pt-30">
  <div class="row align-items-center">
    <div class="col-md-6">
      <div class="title mb-30">
        <h1><%= title %></h1>
      </div>
    </div>
  </div>
</div>
<div class="card-style mb-30">
  <%= form_with(model: other_duty, local: true) do |form| %>
  <div class="alert-box danger-alert">
    <%= render "/shared/error_messages", resource: other_duty %>
  </div>
  <div class="input-style-1">
    <%= form.label :occurred_at, "Occurred On" %>
    <% occurred_at = @other_duty.occurred_at || Time.zone.now %>
    <%= form.date_field :occurred_at, value: occurred_at.to_date %>
  </div>

    <div class="row input-style-1">
      <label>Duty Duration</label>
      <div class="col-sm-6">
        <div class="input-style-1 duration-hours">
          <%= form.number_field :duration_hours,
                              min: 0,
                              size: "10",
                              value: duration_hours(other_duty),
                              required: true %> &nbsp; <span class="label-font-weight"> hour(s)</span>
        </div>
      </div>
      <div class="col-sm-6">
        <div class="input-style-1 duration-minutes">
          <%= form.number_field :duration_minutes,
                                min: 0,
                                size: "10",
                                value: duration_minutes(other_duty),
                                required: true %> &nbsp; <span class="label-font-weight"> minute(s)</span>
        </div>
      </div>
    </div>

    <div class="mb-30">
      <div class="input-style-1">
      <%= form.label :notes, "Enter Notes *" %>
        <%= form.text_area :notes, rows: 5, placeholder: "Enter notes here",
class: "cc-italic form-control", required: true %>
      </div>
    </div>
    <div class="actions mb-10">
      <%= button_tag(
            type: "submit",
            class: "btn-sm main-btn primary-btn btn-hover"
          ) do %>
          <i class="lni lni-checkmark-circle mr-10"></i> Submit
      <% end %>
    </div>
  <% end %>
</div>