'ui.patron.edit.aua.state.suggest',
'ui.patron.edit.aua.state.show',
'ui.admin.work_log.max_entries',
- 'ui.admin.patron_log.max_entries'
+ 'ui.admin.patron_log.max_entries',
+ 'circ.patron_expires_soon_warning'
]).then(settings => {
this.context.settingsCache = settings;
return this.circ.applySettings();
return alerts;
});
}
+
+ patronStatusColor(patron: IdlObject, summary: PatronSummary): string {
+
+ if (patron.barred() === 't') {
+ return 'PATRON_BARRED';
+ }
+
+ if (patron.active() === 'f') {
+ return 'PATRON_INACTIVE';
+ }
+
+ if (summary.stats.fines.balance_owed > 0) {
+ return 'PATRON_HAS_BILLS';
+ }
+
+ if (summary.stats.checkouts.overdue > 0) {
+ return 'PATRON_HAS_OVERDUES';
+ }
+
+ if (summary.alerts.accountExpired || summary.alerts.accountExpiresSoon) {
+ return 'PATRON_EXPIRED';
+ }
+
+ if (patron.notes().length > 0) {
+ return 'PATRON_HAS_NOTES';
+ }
+
+ if (summary.stats.checkouts.lost > 0) {
+ return 'PATRON_HAS_LOST';
+ }
+
+ let penalty: string;
+ let penaltyCount = 0;
+
+ patron.standing_penalties().some(p => {
+
+ if (p.standing_penalty().staff_alert() === 't' ||
+ p.standing_penalty().block_list()) {
+ penalty = 'PATRON_HAS_STAFF_ALERT';
+ return true;
+ }
+
+ if (p.standing_penalty().block_list()) {
+ // Penalties without a block are just Notes
+ penaltyCount++;
+ }
+
+ const name = p.standing_penalty();
+
+ switch (name) {
+ case 'PATRON_EXCEEDS_CHECKOUT_COUNT':
+ case 'PATRON_EXCEEDS_OVERDUE_COUNT':
+ case 'PATRON_EXCEEDS_FINES':
+ penalty = name;
+ return true;
+ }
+ });
+
+ if (penalty) { return penalty; }
+
+ if (penaltyCount === 1) {
+ return 'ONE_PENALTY';
+ } else if (penaltyCount > 1) {
+ return 'MULTIPLE_PENALTIES';
+ }
+
+ if (patron.alert_message()) {
+ return 'PATRON_HAS_ALERT';
+ }
+
+ if (patron.juvenile() === 't') {
+ return 'PATRON_JUVENILE';
+ }
+
+ return 'NO_PENALTIES';
+ }
}