forked from svs/misfit
/
index.html.haml
216 lines (206 loc) · 7.96 KB
/
index.html.haml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
.shaded
.tab
- if @client.loans.size > 0
.graph
= ofc2(550, 300, 'http://' + request.env['HTTP_HOST'] + url(:graph_data, :action => 'client', :id => @client.id, :scope_unit => 'months', :scope_size => 3) )
%h1{:width => '50%' }== Client: <i>#{@client.name}</i>
%p.menu-strip
= link_to('edit client details', params[:controller]=="data_entry/clients" ? url(:enter_clients, :action => 'edit', :id => @client) : resource(@branch, @center, @client, :edit), :class => "edit")
- if @client.tags and @client.tags.include?(:insincere)
%h3.blocked
This client is insincere and is not elgible for a loan
- elsif not @client.active
%h3.blocked
This client is not active anymore.
-if @client.inactive_reason=='death_of_client' or @client.inactive_reason=='death_of_spouse'
=link_to('Click here for claim processing', resource(@client, :claims))
- else
= link_to 'add a new loan', resource(@branch, @center, @client, :loans, :new), :class => "add"
%table.narrow.form{ :style =>'width:50%' }
%tr.odd
%td{:rowspan => "15"}
- if @client.picture.url=="/images/no_photo.jpg"
= image_tag @client.picture.url(:thumb)
- else
%a.enlarge_image{:href => @client.picture.url(:original)}
= image_tag @client.picture.url(:thumb)
%td
Name
%td
%b
= @client.name
== (id: #{@client.id}, ref: #{@client.reference})
%tr
%td Spouse name
%td
= @client.spouse_name
%tr.odd
%td Manager
%td= link_to @center.manager.name, resource(@center.manager)
%tr
%td At center
%td
= link_to @client.center.name, resource(@client.center)
== (of branch #{link_to @branch.name, resource(@branch)})
%br/
%span.greytext
center managed by:
= link_to @center.branch.manager.name, resource(@center.manager)
%tr.odd
%td
Group
%td
-if @client.client_group
=@client.client_group.name
-else
Not associated with a group yet (
=link_to('Edit', resource(@branch, @center, @client, :edit))
to change)
%tr
%td
Fees applicable
%td
- @client.fee_schedule.each do |date, fees|
- fees.each do |fee, amount|
= fee.description
%tr.odd
%td
Fees paid
%td
== #{(@client.total_fees_paid).to_currency} / #{(@client.total_fees_applicable).to_currency}
- if @client.fees_paid?
%span.green Paid
- total_attendance_client = @client.attendances.count
- total_absent_client = @client.attendances(:status => "absent").count
- if total_attendance_client > 0
%tr
%td
Attendance(%)
%td
= ((1-(total_absent_client.to_f/total_attendance_client.to_f)) * 100).round(2)
.shaded
%div.tab_container
%ul.tabs
%li#loans Loans
%li#comments Comments
%li#audit Audits
%li#trail History
%li#documents Documents
%li#insurance Insurance
%li#payments Repayments
%li#attendance Attendance
%li#misc Miscellaneous
%div.tab
%h2== Loans for client <i>#{@client.name}</i>
- if @loans.blank?
%p
%i== #{@client.name} has no loans yet.
- else
%table.narrow.form{ :width => '100%' }
%thead
%tr
%th
%th id
%th amount
%th interest
%th installments
%th disbursement
%th repaid
%th status
%th actions
%tbody
- for loan in @loans
%tr{ :class => cycle('odd','') }
%td
%td
= link_to loan.id, url(:quick_link, "loans", loan.id)
%td
%b= (loan.amount).to_currency
%td
%b= format("%.2f%", loan.interest_rate * 100)
%td
== #{loan.number_of_installments}, #{loan.installment_frequency.to_s}
%td
- if loan.disbursal_date
= loan.disbursal_date
%br/
%span.greytext
- if loan.scheduled_disbursal_date == loan.disbursal_date
as scheduled
- else
= difference_in_days(loan.scheduled_disbursal_date, loan.disbursal_date, ['days earlier', 'days later'])
== (#{loan.scheduled_disbursal_date})
- else
%i not disbursed yet
%br/
%span.greytext
scheduled for
= loan.scheduled_disbursal_date
%td
= format("%.2f%", loan.principal_received_up_to(Date.today).to_f / loan.amount * 100)
%td
- if loan.get_status == :written_off
%b written off
%br/
%span.greytext
by
= link_to loan.written_off_by.name, resource(loan.written_off_by)
on
= loan.written_off_on
- else
= loan.status.to_s.camelcase(' ')
%br/
%span.greytext
- if loan.payments.empty?
nothing repaid yet
- else
last repayment on
= loan.payments.last(:order => [:received_on]).received_on
%td
= link_to 'view details', url_for_loan(loan)
|
= link_to 'edit', url_for_loan(loan, 'edit')
|
= link_to 'record repayment', url_for_loan(loan, "payments/new")
%tfoot
%tr
%td{ :colspan => 9 }
%div.tab
= partial 'comments/index', :object => @client
%p
%h3 Add a comment
= partial 'comments/form'
%div.tab
%input{:type => "hidden", :name => "_load_remote", :value => resource(:audit_items, :id => @client.id, :model => "Client")}
%div.tab
%input{:type => "hidden", :name => "_load_remote", :value => audit_trail_url}
%div.tab
%input{:type => "hidden", :name => "_load_remote", :value => resource(:documents, :parent_id => @client.id, :parent_model => Client)}
%div.tab
%h3 Insurance Policies
= link_to "Add an insurance policy", resource(@client, :insurance_policies, :new), :class => "add"
%table
%tr
%td
- if @client.insurance_policies.blank?
No insurance policies.
- else
- @client.insurance_policies.each do |ip|
= link_to ip.description, resource(@client, ip)
%br
%div.tab
%input{:type => "hidden", :name => "_load_remote", :value => resource(@branch, @center, @client, :payments)}
%div.tab
%input{:type => "hidden", :name => "_load_remote", :value => resource( @client, :attendances)}
%div.tab
%fieldset
%legend Applicable Fees
- if @client.applicable_fees.empty?
= form_for(@loan, :action => url(:controller => 'clients', :action => :levy_fees, :id => @client.id)) do
= submit 'Re-apply Fees'
- else
= partial "applicable_fees/list", :layout => false, :applicable_fees => @client.applicable_fees, :return_url => resource(@branch, @center, @client) + "#misc"
- if [:admin, :mis_manager].include?(session.user.role)
.box
- @applicable_fee = ApplicableFee.new(:applicable_type => 'Client', :applicable_id => @client.id)
= partial "applicable_fees/form", :layout => false, :object => @client