-<div id='oils-selfck-user-banner'></div>
+<div id='oils-selfck-user-info'>
+ <div id='oils-selfck-user-banner'></div>
+ <div id='oils-selfck-user-details' class='hidden'>
+ <div id='oils-selfck-user-name'></div>
+ <div id='oils-selfck-user-home-ou'></div>
+ <div id='oils-selfck-user-profile'></div>
+ <div id='oils-selfck-user-address'></div>
+ </div>
+</div>
<div id='oils-selfck-logo-div'>
<img src='[% ctx.media_prefix %]/images/eg_logo.jpg'/>
</div>
"FAIL_PART_no_matchpoint": "System rules do not define how to handle this item",
"FAIL_PART_no_user": "The system could not find this patron",
"FAIL_PART_transit_range": "The item cannot transit this far",
- "PAYMENT_INVALID_USER_XACT_ID" : "We cannot proceed with the payment, because your account was updated from another location. Please refresh the interface or log out and back in to retrieve the latest account information"
+ "PAYMENT_INVALID_USER_XACT_ID" : "We cannot proceed with the payment, because your account was updated from another location. Please refresh the interface or log out and back in to retrieve the latest account information",
+ "ADDRESS": "${0} ${1}<br/>${2}, ${3} ${4}",
}
location.href = location.href;
}
-SelfCheckManager.prototype.activateStaffMode = function() {
+SelfCheckManager.prototype.activateStaffMode = function(permorgs) {
+ var self = this;
+
+ // make sure this staff account has the needed permission here
+ if (permorgs.indexOf(Number(this.staff.ws_ou())) == -1) return;
+
this.staffMode = true;
+
openils.Util.show(
dojo.byId('oils-selfck-nav-checkin').parentNode,
'inline'
openils.Util.show(dojo.byId('oils-selfchk-staff-actions'));
- var self = this;
dojo.byId('oils-selfchk-staff-logout').onclick = function() {
self.logoutStaff();
- }
+ };
}
// are we in staff mode?
new openils.User().getPermOrgList(['SELFCHECK_STAFF_MODE'],
- function(orglist) { if (orglist.length) self.activateStaffMode() }
+ function(orglist) { self.activateStaffMode(orglist) },
+ true, true
);
this.circTbody = dojo.byId('oils-selfck-circ-tbody');
// retrieve the fleshed user by id
this.patron = fieldmapper.standardRequest(
['open-ils.actor', 'open-ils.actor.user.fleshed.retrieve.authoritative'],
- {params : [this.authtoken, patron_id]}
+ {params : [this.authtoken, patron_id,
+ [ 'card',
+ 'cards',
+ 'addresses',
+ 'billing_address',
+ 'mailing_address',
+ 'profile'
+ ]
+ ]}
);
var evt = openils.Event.parse(this.patron);
} else {
this.handleAlert('', false, 'login-success');
- dojo.byId('oils-selfck-user-banner').innerHTML =
- dojo.string.substitute(localeStrings.WELCOME_BANNER, [this.patron.first_given_name()]);
+
+ if (this.staffMode) {
+ this.drawPatronInfo();
+
+ } else {
+ dojo.byId('oils-selfck-user-banner').innerHTML =
+ dojo.string.substitute(localeStrings.WELCOME_BANNER,
+ [this.patron.first_given_name()]);
+ }
+
+
this.drawCircPage();
}
}
+SelfCheckManager.prototype.drawPatronInfo = function() {
+
+ openils.Util.show('oils-selfck-user-details');
+
+ var patron = this.patron;
+
+ dojo.byId('oils-selfck-user-name').innerHTML =
+ openils.User.formalName(patron);
+
+ dojo.byId('oils-selfck-user-home-ou').innerHTML =
+ fieldmapper.aou.findOrgUnit(patron.home_ou()).shortname();
+
+ dojo.byId('oils-selfck-user-profile').innerHTML =
+ patron.profile().name();
+
+ var addr = patron.mailing_address() ||
+ patron.billing_address() ||
+ patron.addresses()[0];
+
+ if (addr) {
+
+ dojo.byId('oils-selfck-user-address').innerHTML =
+ dojo.string.substitute(localeStrings.ADDRESS, [
+ addr.street1(),
+ addr.street2() || '',
+ addr.city(),
+ addr.state(),
+ addr.post_code()
+ ]);
+
+ } else {
+ dojo.byId('oils-selfck-user-address').innerHTML = '';
+ }
+}
+
SelfCheckManager.prototype.handleAlert = function(message, shouldPopup, sound) {
console.log("Handling alert " + message);