From: Bill Erickson Date: Wed, 22 Jun 2022 22:20:59 +0000 (-0400) Subject: LP1840773 SCKO Angular X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=50df5b183fee602cfd907d4258c8247b20505778;p=working%2FEvergreen.git LP1840773 SCKO Angular Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/scko/fines.component.html b/Open-ILS/src/eg2/src/app/scko/fines.component.html new file mode 100644 index 0000000000..4ff46b06f0 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/scko/fines.component.html @@ -0,0 +1,36 @@ +
+ + + + + + + + + + + + + + + + + + + +
TypeDetailsTotal BilledTotal PaidBalance Owed
+ + Circulation + + + Miscellaneous + + + + {{displayValue(xact, 'title')}} + + + {{xact.summary().last_billing_type()}} + + {{xact.summary().total_owed() | currency}}{{xact.summary().total_paid() | currency}}{{xact.summary().balance_owed() | currency}}
+
diff --git a/Open-ILS/src/eg2/src/app/scko/fines.component.ts b/Open-ILS/src/eg2/src/app/scko/fines.component.ts new file mode 100644 index 0000000000..c69d089e1d --- /dev/null +++ b/Open-ILS/src/eg2/src/app/scko/fines.component.ts @@ -0,0 +1,67 @@ +import {Component, OnInit, ViewEncapsulation} from '@angular/core'; +import {Router, ActivatedRoute, NavigationEnd} from '@angular/router'; +import {switchMap, tap} from 'rxjs/operators'; +import {AuthService} from '@eg/core/auth.service'; +import {PcrudService} from '@eg/core/pcrud.service'; +import {NetService} from '@eg/core/net.service'; +import {IdlObject} from '@eg/core/idl.service'; +import {SckoService} from './scko.service'; + + +@Component({ + templateUrl: 'fines.component.html' +}) + +export class SckoFinesComponent implements OnInit { + + xacts: IdlObject[] = []; + + constructor( + private router: Router, + private route: ActivatedRoute, + private net: NetService, + private auth: AuthService, + private pcrud: PcrudService, + public scko: SckoService + ) {} + + ngOnInit() { + + if (!this.scko.patronSummary) { + this.router.navigate(['/scko']); + return; + } + + this.pcrud.search('mbts', + { usr: this.scko.patronSummary.id, + xact_finish: null, + balance_owed: {'<>' : 0} + }, {}, {atomic: true} + ).pipe(switchMap(sums => { + + return this.pcrud.search('mbt', {id: sums.map(s => s.id())}, + { order_by: 'xact_start', + flesh: 5, + flesh_fields: { + mbt: ['summary', 'circulation', 'grocery'], + circ: ['target_copy'], + acp: ['call_number'], + acn: ['record'], + bre: ['flat_display_entries'] + }, + select: {bre : ['id']} + } + ).pipe(tap(xact => this.xacts.push(xact))) + })).toPromise(); + } + + displayValue(xact: IdlObject, field: string): string { + const entry = + xact.circulation().target_copy().call_number().record().flat_display_entries() + .filter(e => e.name() === field)[0]; + + return entry ? entry.value() : ''; + } + +} + diff --git a/Open-ILS/src/eg2/src/app/scko/routing.module.ts b/Open-ILS/src/eg2/src/app/scko/routing.module.ts index 82378e2cb3..08814530a1 100644 --- a/Open-ILS/src/eg2/src/app/scko/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/scko/routing.module.ts @@ -4,6 +4,7 @@ import {SckoComponent} from './scko.component'; import {SckoCheckoutComponent} from './checkout.component'; import {SckoItemsComponent} from './items.component'; import {SckoHoldsComponent} from './holds.component'; +import {SckoFinesComponent} from './fines.component'; const routes: Routes = [{ path: '', @@ -17,6 +18,9 @@ const routes: Routes = [{ }, { path: 'holds', component: SckoHoldsComponent + }, { + path: 'fines', + component: SckoFinesComponent }] }]; diff --git a/Open-ILS/src/eg2/src/app/scko/scko.module.ts b/Open-ILS/src/eg2/src/app/scko/scko.module.ts index 6b4ef7f9a8..67ebe36a80 100644 --- a/Open-ILS/src/eg2/src/app/scko/scko.module.ts +++ b/Open-ILS/src/eg2/src/app/scko/scko.module.ts @@ -13,6 +13,7 @@ import {SckoSummaryComponent} from './summary.component'; import {SckoCheckoutComponent} from './checkout.component'; import {SckoItemsComponent} from './items.component'; import {SckoHoldsComponent} from './holds.component'; +import {SckoFinesComponent} from './fines.component'; @NgModule({ declarations: [ @@ -21,7 +22,8 @@ import {SckoHoldsComponent} from './holds.component'; SckoSummaryComponent, SckoCheckoutComponent, SckoItemsComponent, - SckoHoldsComponent + SckoHoldsComponent, + SckoFinesComponent ], imports: [ EgCommonModule, diff --git a/Open-ILS/src/eg2/src/app/scko/summary.component.html b/Open-ILS/src/eg2/src/app/scko/summary.component.html index cdcb24a5b2..94730fd8f9 100644 --- a/Open-ILS/src/eg2/src/app/scko/summary.component.html +++ b/Open-ILS/src/eg2/src/app/scko/summary.component.html @@ -64,7 +64,7 @@ total holds. @@ -79,7 +79,7 @@