-
-
Notifications
You must be signed in to change notification settings - Fork 473
/
expenses.html.erb
158 lines (148 loc) · 7.89 KB
/
expenses.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact expenses", 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| %>
<%= form.hidden_field :placeholder, value: true %>
<%= render "/shared/error_messages", resource: @case_contact %>
<div class="card-style-1 pl-25 mb-10 pr-50">
<div class="d-flex gap-1">
<h4 class="mb-3"><label>1. Travel Details</label></h4>
<p class="text-dark">(optional)</p>
</div>
<% if current_organization.show_driving_reimbursement && show_volunteer_reimbursement(@casa_cases) %>
<div class="field want-driving-reimbursement form-group">
<h5 class="mb-3"><label>a. Do you require driving reimbursement for this case contact?</label></h5>
<div class="form-check radio-style mb-20">
<%= form.radio_button :want_driving_reimbursement, true,
required: false,
class: 'form-check-input' %>
<%= form.label "Yes", class: "form-check-label",
for: "case_contact_want_driving_reimbursement_true" %>
</div>
<div class="form-check radio-style mb-20">
<%= form.radio_button :want_driving_reimbursement, false,
required: false,
class: 'form-check-input' %>
<%= form.label "No", class: "form-check-label",
for: "case_contact_want_driving_reimbursement_false" %>
</div>
</div>
<div class="field miles-driven form-group">
<h5 class="mb-3"><%= form.label :miles_driven, "b. Total miles driven" %></h5>
<div class="input-style-1">
<% if form.object.new_record? && @case_contact.miles_driven == 0 %>
<input class="form-control" min="0" max="10000" type="number" value="0" name="case_contact[miles_driven]" autocomplete="off" id="case_contact_miles_driven">
<% else %>
<%= form.number_field :miles_driven, class: "form-control", min: "0", max: 10000, placeholder: "0" %>
<% end %>
</div>
</div>
<div class="field volunteer-address form-group">
<h5 class="mb-3"><label>c. Your current address (for reimbursement check)</label></h5>
<div class="input-style-1 mb-0">
<%= form.text_field :volunteer_address, value: @case_contact.decorate.address_of_volunteer, disabled: @case_contact.address_field_disabled?, class: "input-style-1" %>
</div>
</div>
<% end %>
</div>
<% if Pundit.policy(current_user, @case_contact).additional_expenses_allowed? %>
<div class="card-style-1 pl-25 mb-10 pr-50">
<div class="d-flex gap-1">
<h4 class="mb-3"><label>2. Other Expenses</label></h4>
<p class="text-dark">(optional)</p>
</div>
<div class="other-expenses">
<ol>
<% @case_contact.decorate.additional_expenses_count %>
<% if @case_contact.additional_expenses.any? %>
<%= form.fields_for :additional_expenses do |ff| %>
<li>
<div class="expense-container row">
<div class="input-style-1 col-sm-3">
<h5><%= form.label :additional_expense, "a. Expense amount" %></h5>
<div class="input-group">
<span class="dollar-sign">
<%= ff.number_field :other_expense_amount,
placeholder: "0",
class: "form-control other-expense-amount",
min: "0", max: 1000, step: 0.01 %>
</span>
</div>
</div>
<div class="input-style-1 col">
<h5><%= form.label :other_expenses_describe, "b. Expense details" %></h5>
<%= ff.text_field :other_expenses_describe,
placeholder: "Enter additional details",
class: "form-control other-expenses-describe" %>
</div>
</div>
</li>
<% end %>
<% end %>
<% if @case_contact.decorate.additional_expenses_count < 10 %>
<%= form.fields_for :additional_expenses, AdditionalExpense.new do |ff| %>
<li>
<div class="expense-container row">
<div class="input-style-1 col-sm-3">
<h5><%= form.label :additional_expense, "a. Expense amount" %></h5>
<div class="input-group">
<span class="dollar-sign">
<%= ff.number_field :other_expense_amount,
placeholder: "0",
class: "form-control other-expense-amount",
min: "0", max: 1000, step: 0.01 %>
</span>
</div>
</div>
<div class="input-style-1 col">
<h5><%= form.label :other_expenses_describe, "b. Expense details" %></h5>
<%= ff.text_field :other_expenses_describe,
placeholder: "Enter additional details",
class: "form-control other-expenses-describe" %>
</div>
</div>
</li>
<% end %>
<% (9 - @case_contact.decorate.additional_expenses_count).times do |i| %>
<%= form.fields_for :additional_expenses, AdditionalExpense.new do |ff| %>
<div class="expense-container row d-none" id="<%= if @case_contact.decorate.additional_expenses_count === 0
then "expense" + (i + 2).to_s
else "expense" + ((@case_contact.decorate.additional_expenses_count) + (i + 2)).to_s
end %>">
<div class="input-style-1 col-sm-3">
<h5><%= form.label :additional_expense, "a. Expense amount" %></h5>
<div class="input-group">
<span class="dollar-sign">
<%= ff.number_field :other_expense_amount,
placeholder: "0",
class: "form-control other-expense-amount",
min: "0", max: 1000, step: 0.01 %>
</span>
</div>
</div>
<div class="input-style-1 col">
<h5><%= form.label :other_expenses_describe, "b. Expense details" %></h5>
<%= ff.text_field :other_expenses_describe,
placeholder: "Enter additional details",
class: "form-control other-expenses-describe" %>
</div>
</div>
<% end %>
<% end %>
<% end %>
</ol>
<% if @case_contact.decorate.additional_expenses_count < 10 %>
<button type="button" class="btn-sm main-btn primary-btn-outline btn-hover" id="add-another-expense">+ Add Another Expense</button>
<% end %>
</div>
</div>
<% end %>
<div class="actions mb-10 d-flex justify-content-end gap-2">
<%= link_to previous_wizard_path(case_contact_id: @case_contact.id), class: "btn-sm main-btn primary-btn-outline btn-hover" do %>
Back
<% end %>
<%= button_tag( type: "submit" , class: "btn-sm main-btn primary-btn btn-hover" ) do %>
<i class="lni lni-checkmark-circle mr-5"></i> Submit
<% end %>
</div>
<% end %>
</div>