From 946a1d32fe2e1b4cb39e056e39ec12c7d61ccaeb Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 9 Mar 2021 17:44:17 -0500 Subject: [PATCH] LP1904036 Bills, Current admin UI sample data Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../eg2/src/app/share/util/sample-data.service.ts | 23 ++++++++++++++++++++++ .../staff/admin/server/print-template.component.ts | 20 +++++++++++++++---- .../sql/Pg/upgrade/XXXX.data.angular-patron.sql | 2 +- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/util/sample-data.service.ts b/Open-ILS/src/eg2/src/app/share/util/sample-data.service.ts index d159d6d6ba..34cf8575b6 100644 --- a/Open-ILS/src/eg2/src/app/share/util/sample-data.service.ts +++ b/Open-ILS/src/eg2/src/app/share/util/sample-data.service.ts @@ -81,6 +81,25 @@ const DATA = { {title: 'Piano concerto no. 1 (1926) ; Rhapsody, op. 1 (1904)'}, {title: 'Piano concertos 2 & 3 & the devil makes me?'}, {title: 'Composition student recital, April 6, 2000, Huntington University / composition students of Daniel Bédard'}, + ], + mbt: [ + {id: 1, xact_start: new Date().toISOString()}, + {id: 2, xact_start: new Date().toISOString()}, + {id: 3, xact_start: new Date().toISOString()} + ], + mbts: [ + { balance_owed: 1, + last_billing_note: 'a note', + last_billing_ts: new Date().toISOString(), + last_billing_type: 'Overdue Materials', + last_payment_note: '', + last_payment_ts: new Date().toISOString(), + last_payment_type: 'cash_payment', + total_owed: 5, + total_paid: 3, + xact_start: new Date().toISOString(), + xact_type: 'circulation' + } ] }; @@ -117,6 +136,10 @@ export class SampleDataService { const time = new Date().getTime(); return new Date(future ? time + rando : time - rando); } + + randomDateIso(future: boolean = false): string { + return this.randomDate(future).toISOString(); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts index 0276005cb3..3cd8d56b14 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts @@ -49,7 +49,8 @@ export class PrintTemplateComponent implements OnInit { // Keys map to print template names sampleData: any = { patron_address: {}, - holds_for_bib: {} + holds_for_bib: {}, + bills_current: {} }; constructor( @@ -83,7 +84,7 @@ export class PrintTemplateComponent implements OnInit { // vanilla hashes are easier to work with in the admin UI. // Classes for which sample data exists - const classes = ['au', 'ac', 'aua', 'ahr', 'acp', 'mwde']; + const classes = ['au', 'ac', 'aua', 'ahr', 'acp', 'mwde', 'mbt', 'mbts']; const samples: any = {}; classes.forEach(class_ => samples[class_] = this.idl.toHash(this.samples.listOfThings(class_, 10))); @@ -91,13 +92,13 @@ export class PrintTemplateComponent implements OnInit { // Wide holds are hashes instead of IDL objects. // Add fields as needed. const wide_holds = [{ - request_time: this.samples.randomDate().toISOString(), + request_time: this.samples.randomDateIso(), ucard_barcode: samples.ac[0].barcode, usr_family_name: samples.au[0].family_name, usr_alias: samples.au[0].alias, cp_barcode: samples.acp[0].barcode }, { - request_time: this.samples.randomDate().toISOString(), + request_time: this.samples.randomDateIso(), ucard_barcode: samples.ac[1].barcode, usr_family_name: samples.au[1].family_name, usr_alias: samples.au[1].alias, @@ -110,6 +111,17 @@ export class PrintTemplateComponent implements OnInit { }; this.sampleData.holds_for_bib = wide_holds; + + // Flesh the summary + samples.mbt[0].summary = samples.mbts[0]; + samples.mbt[1].summary = samples.mbts[1]; + samples.mbt[2].summary = samples.mbts[2]; + + this.sampleData.bills_current.xacts = [ + samples.mbt[0], + samples.mbt[1], + samples.mbt[2] + ]; } onTabChange(evt: NgbTabChangeEvent) { diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql index 79130f9f3b..5517680e0b 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql @@ -59,7 +59,7 @@ UPDATE config.print_template SET active = TRUE WHERE name = 'patron_address'; -- insert then update for easier iterative development tweaks INSERT INTO config.print_template (name, label, owner, active, locale, content_type, template) -VALUES ('bills_current', 'Bills Current', 1, TRUE, 'en-US', 'text/html', ''); +VALUES ('bills_current', 'Bills, Current', 1, TRUE, 'en-US', 'text/html', ''); */ UPDATE config.print_template SET template = $TEMPLATE$ -- 2.11.0