Line 0
Link Here
|
|
|
1 |
[% USE Koha %] |
2 |
[% USE KohaDates %] |
3 |
[% USE Currency %] |
4 |
|
5 |
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your fines and charges |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% BLOCK cssinclude %][% END %] |
8 |
|
9 |
|
10 |
</head> |
11 |
<body id="opac-account" class="scrollto"> |
12 |
[% INCLUDE 'masthead.inc' %] |
13 |
|
14 |
<div class="main"> |
15 |
<ul class="breadcrumb"> |
16 |
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> |
17 |
<li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">›</span></li> |
18 |
<li><a href="#">Your fines and charges</a></li> |
19 |
</ul> |
20 |
|
21 |
<div class="container-fluid"> |
22 |
<div class="row-fluid"> |
23 |
<div class="span2"> |
24 |
<div id="navigation"> |
25 |
[% INCLUDE 'navigation.inc' IsPatronPage=1 %] |
26 |
</div> |
27 |
</div> |
28 |
<div class="span10"> |
29 |
<div id="useraccount" class="maincontent"> |
30 |
[% IF error %] |
31 |
<div id="error" class="dialog alert"> |
32 |
<p><strong>Error:</strong> there was an problem processing your payment</p> |
33 |
|
34 |
[% IF error == "PAYPAL_UNABLE_TO_CONNECT" %] |
35 |
<p>Unable to connect to PayPal.</p> |
36 |
<p>Please try again later.</p> |
37 |
[% ELSIF error == "PAYPAL_ERROR_PROCESSING" %] |
38 |
<p>Unable to verify payment.</p> |
39 |
<p>Please contact the library to verify your payment.</p> |
40 |
[% END %] |
41 |
</div> |
42 |
[% ELSIF credit %] |
43 |
<div class="dialog message"> |
44 |
<p><strong>Payment applied:</strong> your payment of [% credit.amount_paid %] has been applied to your account</p> |
45 |
</div> |
46 |
[% END %] |
47 |
|
48 |
<a href="/cgi-bin/koha/opac-account.pl">Return to fine details</a> |
49 |
</div> <!-- / #useraccount --> |
50 |
</div> <!-- / .span10 --> |
51 |
</div> <!-- / .row-fluid --> |
52 |
</div> <!-- / .container-fluid --> |
53 |
</div> <!-- / .main --> |
54 |
|
55 |
[% INCLUDE 'opac-bottom.inc' %] |
56 |
[% INCLUDE 'datatables.inc' %] |
57 |
|
58 |
<script type="text/javascript"> |
59 |
//<![CDATA[ |
60 |
$(document).ready(function() { |
61 |
$('#account-credits').hide(); |
62 |
$('#account-debits-switcher').click(function() { |
63 |
$('#account-debits').slideUp(); |
64 |
$('#account-credits').slideDown(); |
65 |
}); |
66 |
$('#account-credits-switcher').click(function() { |
67 |
$('#account-credits').slideUp(); |
68 |
$('#account-debits').slideDown(); |
69 |
}); |
70 |
|
71 |
var anOpen = []; |
72 |
var sImageUrl = "[% interface %]/[% theme %]/images/"; |
73 |
|
74 |
var debitsTable = $('#debits-table').dataTable( { |
75 |
"bProcessing": true, |
76 |
"aoColumns": [ |
77 |
{ |
78 |
"mDataProp": null, |
79 |
"sClass": "control center", |
80 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
81 |
}, |
82 |
{ "mDataProp": "debit_id" }, |
83 |
{ "mDataProp": "description" }, |
84 |
{ "mDataProp": "type" }, |
85 |
{ "mDataProp": "amount_original" }, |
86 |
{ "mDataProp": "amount_outstanding" }, |
87 |
{ "mDataProp": "created_on" }, |
88 |
{ "mDataProp": "updated_on" }, |
89 |
{ |
90 |
/* Payment selection checkboxes */ |
91 |
[% UNLESS Koha.Preference('EnablePayPalOpacPayments') %] |
92 |
"bVisible": false, |
93 |
[% END %] |
94 |
"mDataProp": null, |
95 |
"sDefaultContent": "", |
96 |
"fnRender": function ( o, val ) { |
97 |
return val; |
98 |
}, |
99 |
"mRender": function ( data, type, full ) { |
100 |
if ( full.amount_outstanding_unformatted > 0 ) { |
101 |
return "<input class='pay-checkbox' name='debit_id' value='" + full.debit_id + "' type='checkbox'/>" |
102 |
+ "<input type='hidden' id='amount_outstanding_" + full.debit_id + "' value='" + full.amount_outstanding_unformatted + "'/>"; |
103 |
} |
104 |
} |
105 |
}, |
106 |
], |
107 |
"aaData": [ |
108 |
[% FOREACH d IN debits %] |
109 |
{ |
110 |
[% PROCESS format_data data=d highlight='debit' %] |
111 |
|
112 |
// Data for related item if there is one linked |
113 |
"title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title %]", |
114 |
"biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]", |
115 |
"barcode": "[% d.item.barcode || d.deleted_item.barcode %]", |
116 |
"itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted |
117 |
|
118 |
|
119 |
// Data for related issue if there is one linked |
120 |
[% IF d.issue %] |
121 |
[% SET table = 'issue' %] |
122 |
[% ELSIF d.old_issue %] |
123 |
[% SET table = 'old_issue' %] |
124 |
[% END %] |
125 |
|
126 |
[% IF table %] |
127 |
"issue": { |
128 |
[% PROCESS format_data data=d.$table %] |
129 |
}, |
130 |
[% END %] |
131 |
|
132 |
|
133 |
"account_offsets": [ |
134 |
[% FOREACH ao IN d.account_offsets %] |
135 |
{ |
136 |
[% PROCESS format_data data=ao highlight='offset'%] |
137 |
|
138 |
"credit": { |
139 |
[% PROCESS format_data data=ao.credit highlight='credit' %] |
140 |
} |
141 |
}, |
142 |
[% END %] |
143 |
] |
144 |
|
145 |
}, |
146 |
[% END %] |
147 |
] |
148 |
} ); |
149 |
|
150 |
$('#debits-table td.control').live( 'click', function () { |
151 |
var nTr = this.parentNode; |
152 |
var i = $.inArray( nTr, anOpen ); |
153 |
|
154 |
if ( i === -1 ) { |
155 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
156 |
var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' ); |
157 |
$('div.innerDetails', nDetailsRow).slideDown(); |
158 |
anOpen.push( nTr ); |
159 |
} |
160 |
else { |
161 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
162 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
163 |
debitsTable.fnClose( nTr ); |
164 |
anOpen.splice( i, 1 ); |
165 |
} ); |
166 |
} |
167 |
} ); |
168 |
|
169 |
var creditsTable = $('#credits-table').dataTable( { |
170 |
"bProcessing": true, |
171 |
"aoColumns": [ |
172 |
{ |
173 |
"mDataProp": null, |
174 |
"sClass": "control center", |
175 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
176 |
}, |
177 |
{ "mDataProp": "credit_id" }, |
178 |
{ "mDataProp": "notes" }, |
179 |
{ "mDataProp": "type" }, |
180 |
{ "mDataProp": "amount_paid" }, |
181 |
{ "mDataProp": "amount_remaining" }, |
182 |
{ "mDataProp": "created_on" }, |
183 |
{ "mDataProp": "updated_on" } |
184 |
], |
185 |
"aaData": [ |
186 |
[% FOREACH c IN credits %] |
187 |
{ |
188 |
[% PROCESS format_data data=c highlight='credit' %] |
189 |
|
190 |
"account_offsets": [ |
191 |
[% FOREACH ao IN c.account_offsets %] |
192 |
{ |
193 |
[% PROCESS format_data data=ao highlight='offset' %] |
194 |
|
195 |
"debit": { |
196 |
[% PROCESS format_data data=ao.debit highlight='debit' %] |
197 |
} |
198 |
}, |
199 |
[% END %] |
200 |
] |
201 |
|
202 |
}, |
203 |
[% END %] |
204 |
] |
205 |
} ); |
206 |
|
207 |
$('#credits-table td.control').live( 'click', function () { |
208 |
var nTr = this.parentNode; |
209 |
var i = $.inArray( nTr, anOpen ); |
210 |
|
211 |
if ( i === -1 ) { |
212 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
213 |
var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' ); |
214 |
$('div.innerDetails', nDetailsRow).slideDown(); |
215 |
anOpen.push( nTr ); |
216 |
} |
217 |
else { |
218 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
219 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
220 |
creditsTable.fnClose( nTr ); |
221 |
anOpen.splice( i, 1 ); |
222 |
} ); |
223 |
} |
224 |
} ); |
225 |
|
226 |
// Allow only numbers in ammount to pay |
227 |
$('#amount_to_pay').keypress(function(event) { |
228 |
end = $(this).val().split('.')[1]; |
229 |
if (typeof end === 'undefined') { |
230 |
end = ''; |
231 |
} |
232 |
|
233 |
if ( ( ( event.which != 46 || $(this).val().indexOf('.') != -1 ) && ( event.which < 48 || event.which > 57 ) ) || ( end.length > 1 ) ) { |
234 |
event.preventDefault(); |
235 |
} |
236 |
}); |
237 |
|
238 |
// Update the "amount to pay" field whenever a fee checkbox is changed |
239 |
// Note, this is just a payment suggestion and can be changed to any amount |
240 |
$(".pay-checkbox" ).change(function() { |
241 |
var sum = 0; |
242 |
$("input[name='debit_id']:checked" ).each(function(i,n){ |
243 |
sum += parseFloat( $( "#amount_outstanding_" + $(this).val() ).val() ); |
244 |
}); |
245 |
$('#amount_to_pay').val( sum.toFixed(2) ); |
246 |
}); |
247 |
|
248 |
} ); |
249 |
|
250 |
function fnFormatDebitDetails( debitsTable, nTr ) { |
251 |
var oData = debitsTable.fnGetData( nTr ); |
252 |
|
253 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
254 |
|
255 |
var account_offsets = oData.account_offsets; |
256 |
|
257 |
sOut += "<ul>"; |
258 |
if ( oData.title ) { |
259 |
sOut += "<li>" + _("Title: "); |
260 |
if ( oData.biblionumber ) { |
261 |
sOut += "<a href='/cgi-bin/koha/opac-detail.pl?biblionumber=" + oData.biblionumber + "'>"; |
262 |
} |
263 |
|
264 |
sOut += oData.title; |
265 |
|
266 |
if ( oData.biblionumber ) { |
267 |
sOut += "</a>"; |
268 |
} |
269 |
|
270 |
sOut += "</li>"; |
271 |
} |
272 |
|
273 |
if ( oData.barcode ) { |
274 |
sOut += "<li>" + _("Barcode: ") + oData.barcode + "</li>"; |
275 |
} |
276 |
|
277 |
if ( oData.notes ) { |
278 |
sOut += "<li>" + _("Notes: ") + oData.notes + "</li>"; |
279 |
} |
280 |
|
281 |
sOut += "</ul>"; |
282 |
|
283 |
if ( account_offsets.length ) { |
284 |
sOut += |
285 |
"<div class='innerDetails'>" + |
286 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
287 |
"<thead>" + |
288 |
"<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" + |
289 |
"<tr>" + |
290 |
"<th>" + _("ID") + "</th>" + |
291 |
"<th>" + _("Created on") + "</th>" + |
292 |
"<th>" + _("Payment amount") + "</th>" + |
293 |
"<th>" + _("Applied amount") + "</th>" + |
294 |
"<th>" + _("Type") + "</th>" + |
295 |
"<th>" + _("Notes") + "</th>" + |
296 |
"</tr>" + |
297 |
"</thead>" + |
298 |
"<tbody>"; |
299 |
|
300 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
301 |
ao = account_offsets[i]; |
302 |
sOut += |
303 |
"<tr>" + |
304 |
"<td>" + ao.credit_id + "</td>" + |
305 |
"<td>" + ao.created_on + "</td>" + |
306 |
"<td>" + ao.credit.amount_paid + "</td>" + |
307 |
"<td>" + ao.amount + "</td>" + |
308 |
"<td>" + ao.credit.type + "</td>" + |
309 |
"<td>" + ao.credit.notes + "</td>" + |
310 |
"</tr>"; |
311 |
} |
312 |
|
313 |
sOut += |
314 |
"</tbody>"+ |
315 |
"</table>"; |
316 |
} |
317 |
|
318 |
sOut += |
319 |
"</div>"; |
320 |
|
321 |
return sOut; |
322 |
} |
323 |
|
324 |
function fnFormatCreditDetails( creditsTable, nTr ) { |
325 |
var oData = creditsTable.fnGetData( nTr ); |
326 |
|
327 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
328 |
|
329 |
var account_offsets = oData.account_offsets; |
330 |
|
331 |
if ( account_offsets.length ) { |
332 |
sOut += |
333 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
334 |
"<thead>" + |
335 |
"<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" + |
336 |
"<tr>" + |
337 |
"<th>" + _("ID") + "</th>" + |
338 |
"<th>" + _("Description") + "</th>" + |
339 |
"<th>" + _("Type") + "</th>" + |
340 |
"<th>" + _("Amount") + "</th>" + |
341 |
"<th>" + _("Remaining") + "</th>" + |
342 |
"<th>" + _("Created on") + "</th>" + |
343 |
"<th>" + _("Updated on") + "</th>" + |
344 |
"<th>" + _("Notes") + "</th>" + |
345 |
"</tr>" + |
346 |
"</thead>" + |
347 |
"<tbody>"; |
348 |
|
349 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
350 |
ao = account_offsets[i]; |
351 |
sOut += |
352 |
"<tr>" + |
353 |
"<td>" + ao.debit.debit_id + "</td>" + |
354 |
"<td>" + ao.debit.description + "</td>" + |
355 |
"<td>" + ao.debit.type + "</td>" + |
356 |
"<td>" + ao.debit.amount_original + "</td>" + |
357 |
"<td>" + ao.debit.amount_outstanding + "</td>" + |
358 |
"<td>" + ao.debit.created_on + "</td>" + |
359 |
"<td>" + ao.debit.updated_on + "</td>" + |
360 |
"<td>" + ao.debit.notes + "</td>" + |
361 |
"</tr>"; |
362 |
} |
363 |
|
364 |
sOut += |
365 |
"</tbody>"+ |
366 |
"</table>"; |
367 |
} |
368 |
|
369 |
sOut += |
370 |
"</div>"; |
371 |
|
372 |
return sOut; |
373 |
} |
374 |
|
375 |
//]]> |
376 |
</script> |
377 |
|
378 |
[% BLOCK jsinclude %][% END %] |
379 |
|
380 |
[% BLOCK format_data %] |
381 |
[% FOREACH key IN data.result_source.columns %] |
382 |
[% IF key.match('^amount') %] |
383 |
"[% key %]": "[% data.$key FILTER $Currency %]", |
384 |
"[% key %]_unformatted": "[% data.$key %]", |
385 |
[% ELSIF key.match('_on$') %] |
386 |
"[% key %]": "[% data.$key | $KohaDates %]", |
387 |
"[% key %]_unformatted": "[% data.$key %]", |
388 |
[% ELSE %] |
389 |
"[% key %]": "[% data.$key %]", |
390 |
[% END %] |
391 |
[% END %] |
392 |
[% END %] |