-
-
Notifications
You must be signed in to change notification settings - Fork 472
/
details.html.erb
99 lines (90 loc) · 5.16 KB
/
details.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact details", step: @page, total_steps: @total_pages)) %>
<div>
<%= form_with(model: @case_contact, url: wizard_path(nil, case_contact_id: @case_contact.id), local: true, id: "casa-contact-form", class: "component-validated-form") do |form| %>
<%= render "/shared/error_messages", resource: @case_contact %>
<div class="card-style-1 pl-25 mb-10">
<h4 class="mb-20"><label for="case_contact_casa_case">1. Select the relevant <%= "case".pluralize(@casa_cases.count) %> for this contact <span class="red-letter">*</span></label></h4>
<div class="d-flex flex-column gap-4">
<%= form.hidden_field :draft_case_ids, multiple: true, value: nil %>
<%= render "relevant_cases", form: form, options: @casa_cases, selected_items: @selected_cases, casa_cases: @casa_cases %>
</div>
</div>
<div class="card-style-1 pl-25 pr-25 mb-10">
<div id="contact-type-form" class="d-flex flex-column gap-4">
<h4 id="contact-type-label"><label>2. Select All Contact Types</label><span class="red-letter"> *</span></h4>
<%= render "contact_types", form: form, options: @contact_types, selected_items: @selected_contact_type_ids, casa_cases: @casa_cases %>
</div>
</div>
<div id="enter-contact-details" class="card-style-1 pl-25 mb-10">
<h4 class="mb-3"><label>3. Record contact details</label><span class="red-letter"> *</span></h4>
<div class="">
<h5 classs="mb-3"><label>a. Was contact made?</label></h5>
<div class="form-check radio-style mb-20">
<%= form.radio_button :contact_made, true,
checked: @case_contact.contact_made,
required: true,
class: ["form-check-input", "case-contacts-form-checkbox"] %>
<%= form.label "Yes", class: "form-check-label",
for: "case_contact_contact_made_true" %>
</div>
<div class="form-check radio-style mb-20">
<%= form.radio_button :contact_made, false,
checked: set_contact_made_false(@case_contact),
required: true,
class: ["form-check-input", "case-contacts-form-checkbox"] %>
<%= form.label "No", class: "form-check-label",
for: "case_contact_contact_made_false" %>
</div>
</div>
<div class="field contact-medium form-group">
<h5 classs="mb-3"><label>b. How was contact made?</label></h5>
<%= form.collection_radio_buttons(:medium_type, contact_mediums, 'value', 'label') do |b| %>
<div class="form-check radio-style mb-20">
<%= b.radio_button(class: ["form-check-input", "case-contacts-form-checkbox"]) %>
<%= b.label(class: "form-check-label") %>
</div>
<% end %>
</div>
<div class="pr-50">
<h5 class="mb-3"><%= form.label :occurred_at, "c. Date of contact" %></h5>
<div class="input-style-1">
<% min_date = CaseContact::MINIMUM_DATE %>
<% current_date = Date.current %>
<% initial_value = @case_contact.occurred_at&.to_date || current_date %>
<%= form.date_field :occurred_at,
value: initial_value.to_fs(:iso8601),
max: current_date.to_fs(:iso8601),
min: min_date.to_fs(:iso8601),
class: "form-control card-style-1" %>
</div>
</div>
<div class="pr-50 ">
<h5 class="mb-3"><label>d. Duration of contact</label></h5>
<%= render(Form::HourMinuteDurationComponent.new(form: form, hour_value: duration_hours(@case_contact), minute_value: duration_minutes(@case_contact))) %>
</div>
</div>
<div class="card-style-1 pl-25 pr-25 mb-10">
<h4 class="mb-20 details__topics-label">Court Report Topics <span class="content-1">(optional)</span></h4>
<div>
<% if @case_contact.contact_topic_answers.any? %>
<%= form.fields_for(:contact_topic_answers) do |f| %>
<div class="form-check checkbox-style mb-10 ml-5">
<%= f.check_box :selected, class: ["form-check-input", "casa-case-id"] %>
<%= f.label :selected, f.object.contact_topic.question, class: "form-check-label" %>
</div>
<% end %>
<% elsif current_user.casa_admin? %>
Visit <%= link_to "Manage Case Contact Topics", edit_casa_org_path(current_user.casa_org_id) %> to set your organization Court report topics.
<% else %>
Your organization has not set any Court Report Topics yet. Contact your admin to learn more.
<% end %>
</div>
</div>
<div class="actions mb-10 case-contacts-form-buttons">
<%= link_to leave_case_contacts_form_path, class: "btn-sm main-btn #{@case_contact.draft_case_ids.empty? ? 'danger' : 'primary'}-btn-outline btn-hover", data: { controller: "alert", "action": "alert#confirm", "alert-ignore-value": !@case_contact.draft_case_ids.empty?, "alert-title-value": "Discard draft?", "alert-message-value": "Are you sure? If you don't save and continue to the next step, this draft will not be recoverable." } do %>
Back
<% end %>
<%= render(Form::SubmitButtonComponent.new(last_step: @case_contact.form_steps.last, current_step: :details)) %>
</div>
<% end %>
</div>