[open-ils-commits] r15217 - in trunk/Open-ILS/web: js/dojo/openils/circ/nls js/ui/default/circ/selfcheck templates/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 21 17:22:13 EST 2009
Author: erickson
Date: 2009-12-21 17:22:07 -0500 (Mon, 21 Dec 2009)
New Revision: 15217
Modified:
trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2
trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2
Log:
added support for cherry-picking transactions to pay
Modified: trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js 2009-12-21 21:28:16 UTC (rev 15216)
+++ trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js 2009-12-21 22:22:07 UTC (rev 15217)
@@ -17,6 +17,7 @@
'ITEM_NOT_CATALOGED' : 'Item ${0} was not found in the system. Try re-scanning the item.',
'WORKSTATION_REQUIRED' : 'A workstation is required to log in to selfcheck. You can set the workstation name with URL param "ws". \n\nWould you like to register a new workstation for this self-check interface?',
'WORKSTATION_EXISTS' : 'This workstation has already been registered. Would you like to use it for this self-check station?',
- 'CC_PAYABLE_BALANCE' : 'You have \$${0} in fines payable by credit card.'
+ 'CC_PAYABLE_BALANCE' : 'Total amount to pay: \$${0}',
+ 'TOTAL_FINES_SELECTED' : 'Selected total: \$${0}'
}
Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-12-21 21:28:16 UTC (rev 15216)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-12-21 22:22:07 UTC (rev 15217)
@@ -668,15 +668,25 @@
SelfCheckManager.prototype.drawPayFinesPage = function() {
this.goToTab('payment');
+ // find the total selected amount
+ var total = 0;
+ dojo.forEach(
+ dojo.query('[name=selector]', this.finesTbody),
+ function(input) {
+ if(input.checked)
+ total += Number(input.getAttribute('balance_owed'));
+ }
+ );
+ total = total.toFixed(2);
+
dojo.byId('oils-selfck-cc-payment-summary').innerHTML =
dojo.string.substitute(
localeStrings.CC_PAYABLE_BALANCE,
- [this.creditPayableBalance]
+ [total]
);
oilsSelfckCCNumber.attr('value', '');
oilsSelfckCCMonth.attr('value', '01');
- oilsSelfckCCAmount.attr('value', this.creditPayableBalance);
oilsSelfckCCYear.attr('value', new Date().getFullYear());
oilsSelfckCCFName.attr('value', this.patron.first_given_name());
oilsSelfckCCLName.attr('value', this.patron.family_name());
@@ -741,23 +751,20 @@
}
}
- var funds = oilsSelfckCCAmount.attr('value');
- xacts = this.finesData.sort(
- function(a, b) {
- if(a.transaction.xact_start() < b.transaction.xact_start())
- return -1;
- return 1;
+ // find the selected transactions
+ dojo.forEach(
+ dojo.query('[name=selector]', this.finesTbody),
+ function(input) {
+ if(input.checked) {
+ args.payments.push([
+ input.getAttribute('xact'),
+ Number(input.getAttribute('balance_owed')).toFixed(2)
+ ]);
+ }
}
);
- for(var i in xacts) {
- var xact = xacts[i].transaction;
- var paying = Math.min(funds, xact.balance_owed());
- args.payments.push([xact.id(), paying]);
- funds -= paying;
- if(funds <= 0) break;
- }
var resp = fieldmapper.standardRequest(
['open-ils.circ', 'open-ils.circ.money.payment'],
@@ -794,28 +801,72 @@
while(this.finesTbody.childNodes[0])
this.finesTbody.removeChild(this.finesTbody.childNodes[0]);
+ // when user clicks on a selector checkbox, update the total owed
+ var updateSelected = function() {
+ var total = 0;
+ dojo.forEach(
+ dojo.query('[name=selector]', this.finesTbody),
+ function(input) {
+ if(input.checked)
+ total += Number(input.getAttribute('balance_owed'));
+ }
+ );
+
+ total = total.toFixed(2);
+ dojo.byId('oils-selfck-selected-total').innerHTML =
+ dojo.string.substitute(localeStrings.TOTAL_FINES_SELECTED, [total]);
+ }
+
+ // wire up the batch on/off selector
+ var sel = dojo.byId('oils-selfck-fines-selector');
+ sel.onchange = function() {
+ dojo.forEach(
+ dojo.query('[name=selector]', this.finesTbody),
+ function(input) {
+ input.checked = sel.checked;
+ }
+ );
+ };
+
var self = this;
var handler = function(dataList) {
+
self.finesCount = dataList.length;
self.finesData = dataList;
+
for(var i in dataList) {
+
var data = dataList[i];
var row = self.finesTemplate.cloneNode(true);
var type = data.transaction.xact_type();
+
if(type == 'circulation') {
self.byName(row, 'type').innerHTML = type;
self.byName(row, 'details').innerHTML = data.record.title();
+
} else if(type == 'grocery') {
self.byName(row, 'type').innerHTML = 'Miscellaneous'; // Go ahead and head off any confusion around "grocery". TODO i18n
self.byName(row, 'details').innerHTML = data.transaction.last_billing_type();
}
+
self.byName(row, 'total_owed').innerHTML = data.transaction.total_owed();
self.byName(row, 'total_paid').innerHTML = data.transaction.total_paid();
self.byName(row, 'balance').innerHTML = data.transaction.balance_owed();
+
+ // row selector
+ var selector = self.byName(row, 'selector')
+ selector.onchange = updateSelected;
+ selector.setAttribute('xact', data.transaction.id());
+ selector.setAttribute('balance_owed', data.transaction.balance_owed());
+ selector.checked = true;
+
self.finesTbody.appendChild(row);
}
+
+ updateSelected();
}
+
fieldmapper.standardRequest(
['open-ils.actor', 'open-ils.actor.user.transactions.have_balance.fleshed'],
{ async : true,
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 2009-12-21 21:28:16 UTC (rev 15216)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 2009-12-21 22:22:07 UTC (rev 15217)
@@ -1,3 +1,5 @@
+<span id='oils-selfck-selected-total'></span>
+<span style='padding-left:5px;'><a class='hidden' href='javascript:void(0);' id='oils-selfck-pay-fines-link'>Pay Fines</a></span>
<div id='oils-selfck-fines-table-div'>
<table id='oils-selfck-fines-table' class='oils-selfck-item-table'>
<thead>
@@ -2,2 +4,3 @@
<tr>
+ <td><input type='checkbox' checked='checked' id='oils-selfck-fines-selector'/></td>
<td>Type</td>
@@ -11,6 +14,7 @@
</thead>
<tbody id='oils-selfck-fines-tbody'>
<tr id='oils-selfck-fines-row'>
+ <td><input type='checkbox' name='selector' checked='checked'/></td>
<td name='type'></td>
<td name='details'></td>
<td name='total_owed'></td>
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-12-21 21:28:16 UTC (rev 15216)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-12-21 22:22:07 UTC (rev 15217)
@@ -10,7 +10,6 @@
<div id='oils-selfck-bottom-div'>
<div id='oils-selfck-content-div'>
<div id='oils-selfck-content-header'>
- <span><a class='hidden' href='javascript:void(0);' id='oils-selfck-pay-fines-link'>Pay Fines</a></span>
<span><a id='oils-selfck-print-list-link' href='javascript:void(0);'>Print List</a></span>
</div>
<div id='oils-selfck-circ-page' class='hidden'>
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2 2009-12-21 21:28:16 UTC (rev 15216)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2 2009-12-21 22:22:07 UTC (rev 15217)
@@ -2,10 +2,6 @@
<table id='oils-selfck-cc-payment-table'>
<tbody>
<tr>
- <td>Amount</td>
- <td><input dojoType='dijit.form.TextBox' jsId='oilsSelfckCCAmount' required='true'/></td>
- </tr>
- <tr>
<td>Credit Card #</td>
<td><input dojoType='dijit.form.TextBox' jsId='oilsSelfckCCNumber' required='true'/></td>
</tr>
More information about the open-ils-commits
mailing list