[open-ils-commits] r16516 - in trunk/Open-ILS/web: js/ui/default/actor/user templates/default/actor/user (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu May 27 09:18:47 EDT 2010
Author: erickson
Date: 2010-05-27 09:18:45 -0400 (Thu, 27 May 2010)
New Revision: 16516
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
trunk/Open-ILS/web/templates/default/actor/user/register.tt2
trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2
Log:
added Replace Barcode option into new patron reg. interface. Also added a basic See All operation that shows all attached barcodes for a user, provides no editing capabilities
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2010-05-27 12:38:48 UTC (rev 16515)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2010-05-27 13:18:45 UTC (rev 16516)
@@ -42,6 +42,7 @@
var cloneUserObj;
var stageUser;
var optInSettings;
+var allCardsTemplate;
if(!window.xulG) var xulG = null;
@@ -123,10 +124,70 @@
loadSurveys();
checkClaimsReturnCountPerm();
checkClaimsNoCheckoutCountPerm();
+
+ dojo.connect(replaceBarcode, 'onClick', replaceCardHandler);
+ dojo.connect(allCards, 'onClick', drawAllCards);
+ if(patron.cards().length > 1)
+ dojo.removeClass(dojo.byId('uedit-all-barcodes'), 'hidden');
}
+function drawAllCards() {
+
+ var tbody = dojo.byId('uedit-all-cards-tbody');
+ if(!allCardsTemplate) {
+ allCardsTemplate = tbody.removeChild(dojo.byId('uedit-all-cards-tr-template'));
+ } else {
+ while(tbody.childNodes[0])
+ tbody.removeChild(tbody.childNodes[0]);
+ }
+
+ var first = true;
+ dojo.forEach(
+ [patron.card()].concat(patron.cards()), // grab the main card first
+ function(card) {
+ if(!first) {
+ if(card.id() == patron.card().id())
+ return;
+ }
+ var row = allCardsTemplate.cloneNode(true);
+ getByName(row, 'barcode').innerHTML = card.barcode();
+ getByName(row, 'active').appendChild(
+ openils.Util.isTrue(card.active()) ?
+ dojo.byId('true').cloneNode(true) :
+ dojo.byId('false').cloneNode(true)
+ );
+
+ tbody.appendChild(row);
+ first = false;
+ }
+ );
+
+ allCardsDialog.show();
+}
+
/**
+ * Mark the current card inactive, create a new primary card
+ */
+function replaceCardHandler() {
+ var input = findWidget('ac', 'barcode');
+ input.widget.attr('value', null);
+
+ // pull old car off the cards list so we don't have a dupe sitting in there
+ var old = patron.cards().filter(function(c){return (c.id() == patron.card().id())})[0];
+ old.active('f');
+ old.ischanged(1);
+
+ var newc = new fieldmapper.ac();
+ newc.id(uEditCardVirtId--);
+ newc.isnew(1);
+ newc.active('t');
+ patron.card(newc);
+ patron.cards().push(newc);
+}
+
+
+/**
* Loads a staged user and turns them into something the editor can understand
*/
function uEditLoadStageUser(stageUname) {
@@ -797,7 +858,7 @@
patron.isnew(1);
patron.id(-1);
card = new ac();
- card.id(uEditCardVirtId);
+ card.id(uEditCardVirtId--);
card.isnew(1);
patron.active(1);
patron.card(card);
Modified: trunk/Open-ILS/web/templates/default/actor/user/register.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2010-05-27 12:38:48 UTC (rev 16515)
+++ trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2010-05-27 13:18:45 UTC (rev 16516)
@@ -115,5 +115,34 @@
<div><a href='javascript:void(0);' id='uedit-dupe-address-link'></a></div>
</div>
+<div class='hidden'>
+ <span id='true' style='color:green;'>✓</span>
+ <span id='false' style='color:red;'>✗</span>
+ <div dojoType='dijit.Dialog' jsId='allCardsDialog'>
+ <table class='oils-generic-table' style='margin:10px;'>
+ <thead>
+ <tr>
+ <th>Barcode</th>
+ <th>Active</th>
+ </tr>
+ </thead>
+ <tbody id='uedit-all-cards-tbody'>
+ <tr id='uedit-all-cards-tr-template'>
+ <td><div name='barcode'></div></td>
+ <td><div name='active'></div></td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td colspan='2' style='text-align:center;'>
+ <button dojoType='dijit.form.Button' onClick='allCardsDialog.hide()'>Close</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+
[% END %]
Modified: trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2 2010-05-27 12:38:48 UTC (rev 16515)
+++ trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2 2010-05-27 13:18:45 UTC (rev 16516)
@@ -1,5 +1,11 @@
<tbody id='uedit-tbody'>
- <tr fmclass='ac' fmfield='barcode' required='required'/>
+ <tr fmclass='ac' fmfield='barcode' required='required'>
+ <td/><td/><td/>
+ <td><button dojoType='dijit.form.Button' jsId='replaceBarcode'>Replace Barcode</button></td>
+ <td id='uedit-all-barcodes' class='hidden'>
+ <button dojoType='dijit.form.Button' jsId='allCards'>See All</button>
+ </td>
+ </tr>
<tr fmclass='au' fmfield='usrname' required='required'/>
<tr fmclass='au' fmfield='passwd' required='required'/>
<tr fmclass='au' fmfield='passwd2' required='required'><td/><td>Verify Password</td><td/></tr>
More information about the open-ils-commits
mailing list