Lines 61-66
function moneyFormat(textObj) {
Link Here
|
61 |
} |
61 |
} |
62 |
//]]> |
62 |
//]]> |
63 |
</script> |
63 |
</script> |
|
|
64 |
<style type="text/css"> |
65 |
.ball { |
66 |
background-color: rgba(0,0,0,0); |
67 |
border: 25px solid rgba(240,192,71,0.9); |
68 |
opacity: .9; |
69 |
border-top: 25px solid rgba(0,0,0,0); |
70 |
border-left: 25px solid rgba(0,0,0,0); |
71 |
border-radius: 150px; |
72 |
box-shadow: 0 0 35px #f0c047; |
73 |
width: 140px; |
74 |
height: 140px; |
75 |
margin: 50px auto; |
76 |
-moz-animation: spin 1s infinite linear; |
77 |
-webkit-animation: spin 1s infinite linear; |
78 |
} |
79 |
|
80 |
.ball1 { |
81 |
background-color: rgba(0,0,0,0); |
82 |
border: 25px solid rgba(240,192,71,0.9); |
83 |
opacity: .9; |
84 |
border-top: 25px solid rgba(0,0,0,0); |
85 |
border-left: 25px solid rgba(0,0,0,0); |
86 |
border-radius: 150px; |
87 |
box-shadow: 0 0 15px #f0c047; |
88 |
width: 70px; |
89 |
height: 70px; |
90 |
margin: 0 auto; |
91 |
position: relative; |
92 |
top: -205px; |
93 |
-moz-animation: spinoff .5s infinite linear; |
94 |
-webkit-animation: spinoff .5s infinite linear; |
95 |
} |
96 |
|
97 |
@-moz-keyframes spin { |
98 |
0% { |
99 |
-moz-transform: rotate(0deg); |
100 |
} |
101 |
|
102 |
100% { |
103 |
-moz-transform: rotate(360deg); |
104 |
}; |
105 |
} |
106 |
|
107 |
@-moz-keyframes spinoff { |
108 |
0% { |
109 |
-moz-transform: rotate(0deg); |
110 |
} |
111 |
|
112 |
100% { |
113 |
-moz-transform: rotate(-360deg); |
114 |
}; |
115 |
} |
116 |
|
117 |
@-webkit-keyframes spin { |
118 |
0% { |
119 |
-webkit-transform: rotate(0deg); |
120 |
} |
121 |
|
122 |
100% { |
123 |
-webkit-transform: rotate(360deg); |
124 |
}; |
125 |
} |
126 |
|
127 |
@-webkit-keyframes spinoff { |
128 |
0% { |
129 |
-webkit-transform: rotate(0deg); |
130 |
} |
131 |
|
132 |
100% { |
133 |
-webkit-transform: rotate(-360deg); |
134 |
}; |
135 |
} |
136 |
|
137 |
.office-button { |
138 |
background:#eee; |
139 |
border:solid 2px rgba(240,192,71,1); |
140 |
border-radius: 5px; |
141 |
font:3em Verdana; |
142 |
margin:10px; |
143 |
min-width:100px; |
144 |
height:100px; |
145 |
outline:none; |
146 |
box-shadow:0 0 2px rgba(240,192,71,1); |
147 |
} |
148 |
.selected { |
149 |
background:#afa; |
150 |
border:solid 4px rgba(50,2020,50,1); |
151 |
box-shadow:0 0 2px rgba(50,2020,50,1); |
152 |
} |
153 |
.office-button::-moz-focus-inner { |
154 |
border:0; |
155 |
} |
156 |
#add_new_office { |
157 |
cursor:pointer; |
158 |
} |
159 |
</style> |
64 |
</head> |
160 |
</head> |
65 |
<body id="pat_paycollect" class="pat"> |
161 |
<body id="pat_paycollect" class="pat"> |
66 |
[% INCLUDE 'header.inc' %] |
162 |
[% INCLUDE 'header.inc' %] |
Lines 98-105
function moneyFormat(textObj) {
Link Here
|
98 |
</div> |
194 |
</div> |
99 |
[% END %] |
195 |
[% END %] |
100 |
|
196 |
|
|
|
197 |
[% IF ( startSending ) %] |
198 |
<div><h2>Processing payment [% payment.Id %] - Please complete the payment [% IF ( payment.Office ) %]at cash register [% payment.Office %][% ELSE %] at any cash register[% END %].</h2> |
199 |
<div class="ball"></div> |
200 |
<div class="ball1"></div> |
201 |
</div> |
202 |
<div><p> |
203 |
Current status: |
204 |
<span id="status"> |
205 |
<span class="connecting">Connecting to the cash register.</span> |
206 |
<span class="pending" style="display:none">Payment is pending. Please complete the payment and navigate back to <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=10902939">Account</a>.</span> |
207 |
<span class="paid" style="display:none">Payment is completed.</span> |
208 |
<span class="cancelled" style="display:none">Payment was cancelled.</span> |
209 |
<span class="processing" style="display:none">Payment is completed, but Koha is still processing it.</span> |
210 |
</span> |
211 |
</p> |
212 |
<button type="button" id="recheck">Update payment status</button> |
213 |
</div> |
214 |
<script type="text/javascript"> |
215 |
$(document).ready(function() { |
216 |
$.ajax({ |
217 |
url: "/cgi-bin/koha/members/paycollect.pl", |
218 |
type: "post", |
219 |
dataType: "json", |
220 |
data: JSON.stringify([% json_payment %]), |
221 |
contentType: "application/json" |
222 |
}).done(function(data){ |
223 |
var response = jQuery.parseJSON(JSON.stringify(data)); |
224 |
|
225 |
handlePOSResponse(data); |
226 |
}); |
227 |
$("#recheck").click(function() { |
228 |
$.get("/api/v1/pos/cpu/" + [% payment.Id %], function(data) { |
229 |
var response = jQuery.parseJSON(JSON.stringify(data)); |
230 |
|
231 |
handlePOSResponse(response); |
232 |
}); |
233 |
}); |
234 |
}); |
235 |
|
236 |
function handlePOSResponse(response){ |
237 |
$("span[id='status']").children().css("display","none"); |
238 |
if (response.Status == 0 || response.status == "cancelled") { |
239 |
$("span.cancelled").css("display", "inline-block"); |
240 |
colorBall("red"); |
241 |
|
242 |
if (response.error) { |
243 |
alert(_("Error: ") + JSON.stringify(response)); |
244 |
} |
245 |
|
246 |
window.location.replace("/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]"); |
247 |
} |
248 |
else if (response.Status == 1 || response.status == "paid") { |
249 |
$("span.paid").css("display", "inline-block"); |
250 |
colorBall("green"); |
251 |
window.location.replace("/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]"); |
252 |
} |
253 |
else if (response.Status == 2 || response.status == "pending") { |
254 |
$("span.pending").css("display", "inline-block"); |
255 |
} |
256 |
else if (response.status == "processing") { |
257 |
$("span.processing").css("display", "inline-block"); |
258 |
} |
259 |
else if (response.Status == 97) { |
260 |
$("span.cancelled").css("display", "inline-block"); |
261 |
colorBall("red"); |
262 |
alert(_("Duplicate transaction number: ") + JSON.stringify(response)); |
263 |
} |
264 |
else if (response.Status == 98) { |
265 |
$("span.cancelled").css("display", "inline-block"); |
266 |
colorBall("red"); |
267 |
alert(_("Cash register server system error: ") + JSON.stringify(response)); |
268 |
} |
269 |
else if (response.Status == 99) { |
270 |
$("span.cancelled").css("display", "inline-block"); |
271 |
colorBall("red"); |
272 |
alert(_("Payment request is malformed: ") + JSON.stringify(response)); |
273 |
} |
274 |
else { |
275 |
$("span.cancelled").css("display", "inline-block"); |
276 |
alert(_("Error: ") + JSON.stringify(response)); |
277 |
} |
278 |
} |
279 |
|
280 |
function colorBall(color) { |
281 |
if (color == "red"){ |
282 |
$(".ball").css("border", "25px solid rgba(204,0,0,0.9)"); |
283 |
$(".ball1").css("border", "25px solid rgba(204,0,0,0.9)"); |
284 |
$(".ball").css("box-shadow", "0 0 35px rgb(204,0,0)"); |
285 |
$(".ball1").css("box-shadow", "0 0 15px rgb(204,0,0)"); |
286 |
} else if (color == "green") { |
287 |
$(".ball").css("border", "25px solid rgba(0,204,0,0.9)"); |
288 |
$(".ball1").css("border", "25px solid rgba(0,204,0,0.9)"); |
289 |
$(".ball").css("box-shadow", "0 0 35px rgb(0,204,0)"); |
290 |
$(".ball1").css("box-shadow", "0 0 15px rgb(0,204,0)"); |
291 |
} |
292 |
} |
293 |
</script> |
294 |
[% ELSE %] |
101 |
[% IF ( pay_individual ) %] |
295 |
[% IF ( pay_individual ) %] |
102 |
<form name="payindivfine" id="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl"> |
296 |
<form name="payindivfine" id="payindivfine" onsubmit="return validatePayment(this)" method="post" action="/cgi-bin/koha/members/paycollect.pl"> |
103 |
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" /> |
297 |
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" /> |
104 |
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" /> |
298 |
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" /> |
105 |
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" /> |
299 |
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" /> |
Lines 147-153
function moneyFormat(textObj) {
Link Here
|
147 |
<!-- default to paying all --> |
341 |
<!-- default to paying all --> |
148 |
<input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/> |
342 |
<input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/> |
149 |
</li> |
343 |
</li> |
|
|
344 |
<li> |
345 |
[% INCLUDE offices %] |
346 |
</li> |
150 |
</ol> |
347 |
</ol> |
|
|
348 |
<div> |
151 |
</fieldset> |
349 |
</fieldset> |
152 |
|
350 |
|
153 |
<div class="action"><input type="submit" name="submitbutton" value="Confirm" /> |
351 |
<div class="action"><input type="submit" name="submitbutton" value="Confirm" /> |
Lines 216-227
function moneyFormat(textObj) {
Link Here
|
216 |
<label for="selected_accts_notes">Note: </label> |
414 |
<label for="selected_accts_notes">Note: </label> |
217 |
<textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea> |
415 |
<textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea> |
218 |
</li> |
416 |
</li> |
|
|
417 |
<li> |
418 |
[% INCLUDE offices %] |
419 |
</li> |
219 |
</ol> |
420 |
</ol> |
220 |
</fieldset> |
421 |
</fieldset> |
221 |
<div class="action"><input type="submit" name="submitbutton" value="Confirm" /> |
422 |
<div class="action"><input type="submit" name="submitbutton" value="Confirm" /> |
222 |
<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div> |
423 |
<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div> |
223 |
</form> |
424 |
</form> |
224 |
[% END %] |
425 |
[% END %] |
|
|
426 |
[% END %] |
225 |
</div></div> |
427 |
</div></div> |
226 |
</div> |
428 |
</div> |
227 |
</div> |
429 |
</div> |
Lines 231-234
function moneyFormat(textObj) {
Link Here
|
231 |
</div> |
433 |
</div> |
232 |
</div> |
434 |
</div> |
233 |
[% INCLUDE 'intranet-bottom.inc' %] |
435 |
[% INCLUDE 'intranet-bottom.inc' %] |
|
|
436 |
[% BLOCK offices %] |
437 |
[% IF POSIntegration %] |
438 |
[% IF POSIntegration_in_branch %] |
439 |
<label for="offices">Select office:</label> |
440 |
<div id="offices"></div> |
441 |
<input type="hidden" name="Office" id="office" /> |
442 |
<span id="add_new_office"><a>Add new office</a></span> |
443 |
<div id="office_form" style="display:none"> |
444 |
<label for="office_new">Office:</label><input type="text" name="office_new" id="office_new" /> |
445 |
<button id="new_office" type="button">Add new office</button> |
446 |
<p>Offices are stored as a browser cookie. Currently stored offices will disappear and need to be added again if you clear the browser cookies.</p> |
447 |
<p>You can delete a stored office by first selecting it, and then pressing the delete-key on your keyboard.</p> |
448 |
</div> |
449 |
[% ELSE %] |
450 |
<span id="add_new_office"><a>Add new office</a></span> |
451 |
<div id="office_form" style="display:none"> |
452 |
<p>Cash register integration has not been enabled for your branch. In order to enable cash register integration in this branch ([% branch %]), please contact a superlibrarian. Koha payment types need to be mapped into your cash register item numbers.</p> |
453 |
</div> |
454 |
[% END%] |
455 |
[% END %] |
456 |
[% END %] |
457 |
[% IF POSIntegration %] |
458 |
<script type="text/javascript"> |
459 |
$(document).ready(function() { |
460 |
$("#add_new_office").click(function() { |
461 |
if ($("#office_form").css("display") == "none") { |
462 |
$("#office_form").css("display", "block"); |
463 |
} else { |
464 |
$("#office_form").css("display", "none"); |
465 |
} |
466 |
}); |
467 |
[% IF POSIntegration_in_branch %] |
468 |
loadCashRegisters(); |
469 |
$("#new_office").click(function() { |
470 |
if ($("#office_new").val().length > 0) { |
471 |
newOffice($("#office_new").val()); |
472 |
} |
473 |
}); |
474 |
|
475 |
$("#office").bind("enterKey",function(e) { |
476 |
if ($("#office_new").val().length > 0) { |
477 |
newOffice($("#office_new").val()); |
478 |
} |
479 |
}); |
480 |
$("#office_new").keyup(function(e) { |
481 |
if(e.keyCode == 13) { |
482 |
$(this).trigger("enterKey"); |
483 |
} |
484 |
}); |
485 |
|
486 |
$("body").on("click", "button[id*=office-]", function() { |
487 |
selectOffice(this); |
488 |
}); |
489 |
$("body").on("keyup", "button[id*=office-]", function(e) { |
490 |
if(e.keyCode == 46) { |
491 |
deleteOffice(this); |
492 |
} |
493 |
}); |
494 |
[% END %] |
495 |
}); |
496 |
[% IF POSIntegration_in_branch %] |
497 |
function selectOffice(button) { |
498 |
// Deselect all other buttons |
499 |
$.each($("button[id*=office-]"), function(key, obj) { |
500 |
$(obj).attr("class", "office-button"); |
501 |
}) |
502 |
$(button).attr("class", "office-button selected"); |
503 |
|
504 |
$("#office").val($(button).attr("id").substr(7)); |
505 |
} |
506 |
function newOffice(office) { |
507 |
var offices = getOffices(); |
508 |
|
509 |
if (offices == null) { |
510 |
offices = []; |
511 |
} |
512 |
if (offices.indexOf(office) > -1) { |
513 |
return offices; |
514 |
} |
515 |
offices.push(office); |
234 |
|
516 |
|
|
|
517 |
$.each(offices, function(key, val){ |
518 |
if (!$("#office-"+val).length) { |
519 |
$("#offices").append('<button id="office-'+val+'" type="button" class="office-button">'+val+'</button>'); |
520 |
} |
521 |
}); |
522 |
|
523 |
setCookie("offices", JSON.stringify(offices), "100*365"); |
524 |
|
525 |
$("#office_new").val(""); |
526 |
return offices; |
527 |
} |
528 |
function deleteOffice(obj) { |
529 |
var offices = getOffices(); |
530 |
|
531 |
if (offices == null) { |
532 |
return null; |
533 |
} |
534 |
|
535 |
$(obj).remove(); |
536 |
|
537 |
var index = offices.indexOf($(obj).attr("id").substr(7)); |
538 |
|
539 |
offices.splice(index, 1); |
540 |
|
541 |
if ($("#office").val() == $(obj).attr("id").substr(7)) { |
542 |
$("#office").val(""); |
543 |
} |
544 |
setCookie("offices", JSON.stringify(offices), "100*365"); |
545 |
|
546 |
return offices; |
547 |
} |
548 |
function loadCashRegisters() { |
549 |
var offices = getOffices(); |
550 |
|
551 |
if (offices == null) { |
552 |
return null; |
553 |
} |
554 |
$.each(offices, function(key, val){ |
555 |
if (!$("#office-"+val).length) { |
556 |
$("#offices").append('<button id="office-'+val+'" type="button" class="office-button">'+val+'</button>'); |
557 |
} |
558 |
}); |
559 |
} |
560 |
function getOffices() { |
561 |
var cookie; |
562 |
var name = "offices="; |
563 |
var ca = document.cookie.split(';'); |
564 |
for(var i=0; i<ca.length; i++) { |
565 |
var c = ca[i]; |
566 |
while (c.charAt(0)==' ') c = c.substring(1); |
567 |
if (c.indexOf(name) == 0) cookie = c.substring(name.length,c.length); |
568 |
} |
569 |
|
570 |
if (!cookie) { |
571 |
return null; |
572 |
} |
573 |
|
574 |
return JSON.parse(cookie); |
575 |
} |
576 |
|
577 |
function setCookie(cname, cvalue, exdays) { |
578 |
var d = new Date(); |
579 |
d.setTime(d.getTime() + (exdays*24*60*60*1000)); |
580 |
var expires = "expires="+d.toUTCString(); |
581 |
document.cookie = cname + "=" + cvalue + "; " + expires; |
582 |
} |
583 |
|
584 |
function validatePayment(obj) { |
585 |
if ($("#office").val().length == 0) { |
586 |
alert(_("Please select office")); |
587 |
return false; |
588 |
} |
589 |
$(obj)[0].submit(); |
590 |
} |
591 |
[% END %] |
592 |
</script> |
593 |
[% END %] |