Skip to content

Commit

Permalink
Fees: Fee brief view
Browse files Browse the repository at this point in the history
* Adds routes for patron_transaction_events.
* Adds brief view for patron_transaction_events.
* Adds special facet-like components for events total amount.

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
  • Loading branch information
zannkukai committed Nov 30, 2022
1 parent 222fb40 commit 8e4f69d
Show file tree
Hide file tree
Showing 45 changed files with 1,558 additions and 59 deletions.
2 changes: 2 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"tsConfig": "projects/admin/tsconfig.app.json",
"assets": ["projects/admin/src/assets"],
"styles": [
"node_modules/primeng/resources/themes/lara-light-blue/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"projects/admin/src/app/scss/styles.scss",
"node_modules/ngx-bootstrap/datepicker/bs-datepicker.css"
],
Expand Down
456 changes: 438 additions & 18 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@ngx-loading-bar/router": "^6.0.0",
"@ngx-translate/core": "^14.0.0",
"@rero/ng-core": "^14.0.0",
"@swimlane/ngx-charts": "^20.1.0",
"bootstrap": "^4.6.2",
"crypto-js": "^4.1.1",
"easymde": "^2.18.0",
Expand All @@ -97,6 +98,7 @@
"ngx-build-plus": "^14.0.0",
"ngx-spinner": "^14.0.0",
"ngx-toastr": "^15.2.0",
"primeng": "^14.1.2",
"rxjs": "~6.6.7",
"simple-isbn": "^1.1.5",
"tslib": "^2.4.0",
Expand Down
25 changes: 22 additions & 3 deletions projects/admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* RERO ILS UI
* Copyright (C) 2019 RERO
* Copyright (C) 2019-2022 RERO
* Copyright (C) 2019-2022 UCLouvain
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -30,6 +31,7 @@ import {
TranslateLoader, TranslateService, TruncateTextPipe
} from '@rero/ng-core';
import { ItemHoldingsCallNumberPipe, MainTitlePipe, SharedModule, UserService } from '@rero/shared';
import { NgxChartsModule } from '@swimlane/ngx-charts';
import { AccordionModule } from 'ngx-bootstrap/accordion';
import { CollapseModule } from 'ngx-bootstrap/collapse';
import { BsDatepickerModule, BsLocaleService } from 'ngx-bootstrap/datepicker';
Expand All @@ -42,6 +44,7 @@ import {
SelectAccountEditorWidgetComponent
} from './acquisition/components/editor/widget/select-account-editor-widget/select-account-editor-widget.component';
import { ReceivedOrderPermissionValidator } from './acquisition/utils/permissions';
import { PaymentsDataComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/payments-data.component';
import { CurrentLibraryPermissionValidator } from './utils/permissions';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
Expand Down Expand Up @@ -144,7 +147,7 @@ import { PatronTypesDetailViewComponent } from './record/detail-view/patron-type
import { RecordMaskedComponent } from './record/detail-view/record-masked/record-masked.component';
import { TemplateDetailViewComponent } from './record/detail-view/template-detail-view/template-detail-view.component';
import { VendorDetailViewComponent } from './record/detail-view/vendor-detail-view/vendor-detail-view.component';
import { DocumentRecordSearchComponent } from './record/document-record-search/document-record-search.component';
import { DocumentRecordSearchComponent } from './record/search-view/document-record-search/document-record-search.component';
import { IdentifiedbyValueComponent } from './record/editor/wrappers/identifiedby-value.component';
import { UserIdComponent } from './record/editor/wrappers/user-id/user-id.component';
import { CipoPatronTypeItemTypeComponent } from './record/formly/type/cipo-patron-type-item-type/cipo-patron-type-item-type.component';
Expand All @@ -166,6 +169,13 @@ import { ExpectedIssueComponent } from './record/detail-view/holding-detail-view
import { ReceivedIssueComponent } from './record/detail-view/holding-detail-view/serial-holding-detail-view/received-issue/received-issue.component';
import { AppInitializerService } from './service/app-initializer.service';
import { LoansBriefViewComponent } from './record/brief-view/loans-brief-view/loans-brief-view.component';
import { PatronTransactionEventsBriefViewComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-events-brief-view.component';
import { PatronNamePipe } from './pipe/patron-name.pipe';
import { PatronTransactionEventOverdueComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-event-overdue.component';
import { PatronTransactionEventDefaultComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-event-default.component';
import { PatronTransactionEventSearchViewComponent } from './record/search-view/patron-transaction-event-search-view/patron-transaction-event-search-view.component';
import { PaymentsDataTableComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/table/payments-data-table.component';
import { PaymentDataPieComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/pie/payment-data-pie.component';

/** Init application factory */
export function appInitFactory(appInitializerService: AppInitializerService): () => Promise<any> {
Expand Down Expand Up @@ -272,7 +282,15 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
ItemAvailabilityPipe,
ExpectedIssueComponent,
ReceivedIssueComponent,
LoansBriefViewComponent
LoansBriefViewComponent,
PatronTransactionEventsBriefViewComponent,
PatronNamePipe,
PatronTransactionEventOverdueComponent,
PatronTransactionEventDefaultComponent,
PatronTransactionEventSearchViewComponent,
PaymentsDataComponent,
PaymentsDataTableComponent,
PaymentDataPieComponent
],
imports: [
AppRoutingModule,
Expand All @@ -281,6 +299,7 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
BrowserModule,
BsDatepickerModule.forRoot(),
BsDropdownModule.forRoot(),
NgxChartsModule,
CollapseModule.forRoot(),
FormsModule,
HttpClientModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Loan, LoanOverduePreview } from 'projects/admin/src/app/classes/loans';
import { OrganisationService } from 'projects/admin/src/app/service/organisation.service';
import { forkJoin } from 'rxjs';
import { Item } from 'projects/admin/src/app/classes/items';
import { PatronTransactionEvent, PatronTransactionEventType } from 'projects/admin/src/app/circulation/classes/patron-transaction';
import { PatronTransactionEvent, PatronTransactionEventType } from 'projects/admin/src/app/classes/patron-transaction';

@Component({
selector: 'admin-overdue-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { UntypedFormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { TranslateService } from '@ngx-translate/core';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { OrganisationService } from '../../../../service/organisation.service';
import { PatronTransaction } from '../../../classes/patron-transaction';
import { PatronTransactionService } from '../../../services/patron-transaction.service';
import { OrganisationService } from 'projects/admin/src/app/service/organisation.service';
import { PatronTransaction } from 'projects/admin/src/app/classes/patron-transaction';
import { PatronTransactionService } from 'projects/admin/src/app/circulation/services/patron-transaction.service';


@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { OrganisationService } from '../../../../service/organisation.service';
import { PatronTransactionEvent, PatronTransactionEventType } from '../../../classes/patron-transaction';
import { OrganisationService } from 'projects/admin/src/app/service/organisation.service';
import { PatronTransactionEvent, PatronTransactionEventType } from 'projects/admin/src/app/classes/patron-transaction';

@Component({
selector: 'admin-patron-transaction-event',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Input } from '@angular/core';
import { PatronTransaction } from '../../../../classes/patron-transaction';
import { PatronTransaction } from '../../../../../classes/patron-transaction';

@Component({
selector: 'admin-default-transaction-detail',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { map, mergeMap } from 'rxjs/operators';
import { Item } from 'projects/admin/src/app/classes/items';
import { PatronTransaction } from 'projects/admin/src/app/circulation/classes/patron-transaction';
import { PatronTransaction } from 'projects/admin/src/app/classes/patron-transaction';

@Component({
selector: 'admin-overdue-transaction-detail',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import { Component, Input, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { OrganisationService } from '../../../../service/organisation.service';
import { PatronTransaction, PatronTransactionEventType, PatronTransactionStatus } from '../../../classes/patron-transaction';
import { PatronTransactionService } from '../../../services/patron-transaction.service';
import { OrganisationService } from 'projects/admin/src/app/service/organisation.service';
import { PatronTransaction, PatronTransactionEventType, PatronTransactionStatus } from 'projects/admin/src/app/classes/patron-transaction';
import { PatronTransactionService } from 'projects/admin/src/app/circulation/services/patron-transaction.service';
import {
PatronTransactionEventFormComponent
} from '../patron-transaction-event-form/patron-transaction-event-form.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import { UserService } from '@rero/shared';
import { BsModalService } from 'ngx-bootstrap/modal';
import { Subscription } from 'rxjs';
import { Loan, LoanOverduePreview } from '../../../classes/loans';
import { OrganisationService } from '../../../service/organisation.service';
import { PatronService } from '../../../service/patron.service';
import { PatronTransaction, PatronTransactionStatus } from '../../classes/patron-transaction';
import { Loan, LoanOverduePreview } from 'projects/admin/src/app/classes/loans';
import { OrganisationService } from 'projects/admin/src/app/service/organisation.service';
import { PatronService } from 'projects/admin/src/app/service/patron.service';
import { PatronTransaction, PatronTransactionStatus } from 'projects/admin/src/app/classes/patron-transaction';
import { PatronTransactionService } from '../../services/patron-transaction.service';
import { PatronTransactionEventFormComponent } from './patron-transaction-event-form/patron-transaction-event-form.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import { ToastrService } from 'ngx-toastr';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { map } from 'rxjs/operators';
import { UserService } from '@rero/shared';
import { RouteToolService } from '../../routes/route-tool.service';
import { RouteToolService } from 'projects/admin/src/app/routes/route-tool.service';
import {
PatronTransaction,
PatronTransactionEvent,
PatronTransactionEventType,
PatronTransactionStatus
} from '../classes/patron-transaction';
} from 'projects/admin/src/app/classes/patron-transaction';

@Injectable({
providedIn: 'root'
Expand Down
28 changes: 16 additions & 12 deletions projects/admin/src/app/menu/service/menu-user-services.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class MenuUserServicesService extends MenuBase {
/** Inventory menu */
private _inventoryMenu: MenuItemInterface;

/** Fees menu */
private _feeMenu: MenuItemInterface;

/** Current loans */
private _currentLoansMenu: MenuItemInterface;

Expand Down Expand Up @@ -264,6 +267,14 @@ export class MenuUserServicesService extends MenuBase {
.setAttribute('id', 'inventory-list-menu')
.setExtra('iconClass', 'fa fa-list');
this._translatedName(this._inventoryMenu, 'Inventory list');

// ----- FEES LIST
this._feeMenu = reportMenu.addChild('Fees')
.setRouterLink(['/', 'records', 'patron_transaction_events'])
.setQueryParam('transaction_library', this._userService.user.currentLibrary)
.setAttribute('id', 'fees-list-menu')
.setExtra('iconClass', 'fa fa-money');
this._translatedName(this._inventoryMenu, 'Fees');
}

/**
Expand Down Expand Up @@ -343,19 +354,12 @@ export class MenuUserServicesService extends MenuBase {
// ACQUISITION:
this._ordersMenu.setQueryParam('library', user.currentLibrary);
this._lateIssuesMenu.setQueryParam('library', user.currentLibrary);
// REPORT: INVENTORY LIST
// REPORT:
this._inventoryMenu.setQueryParam('library', user.currentLibrary);
// ADMIN: MY ORGANISATION
this._myOrganisationMenu
.setRouterLink([
'/', 'records', 'organisations',
'detail', user.currentOrganisation
]);
// ADMIN: MY LIBRARY
this._myLibraryMenu.setRouterLink([
'/', 'records', 'libraries',
'detail', user.currentLibrary
]);
this._feeMenu.setQueryParam('transaction_library', user.currentLibrary);
// ADMIN:
this._myOrganisationMenu.setRouterLink(['/', 'records', 'organisations', 'detail', user.currentOrganisation]);
this._myLibraryMenu.setRouterLink(['/', 'records', 'libraries', 'detail', user.currentLibrary]);
});
}
}
48 changes: 48 additions & 0 deletions projects/admin/src/app/pipe/patron-name.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* RERO ILS UI
* Copyright (C) 2019-2022 RERO
* Copyright (C) 2019-2022 UCLouvain
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Pipe, PipeTransform } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Pipe({
name: 'patronName'
})
export class PatronNamePipe implements PipeTransform {

/**
* Constructor
* @param _recordService: RecordService
*/
constructor(
private _recordService: RecordService
) {}

/**
* Build the usage name for a patron based on its PID
* @param patronPid - string: the patron pid
* @returns an observable returning the patron name as string if patron exists.
*/
transform(patronPid: string): Observable<undefined | string> {
return this._recordService.getRecord('patrons', patronPid).pipe(
map((data: any) => data.metadata),
map((metadata: any) => [metadata?.last_name, metadata?.first_name].join(', '))
)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
RERO ILS UI
Copyright (C) 2019-2022 RERO
Copyright (C) 2019-2022 UCLouvain
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<div class="description container pl-0">
<h5 class="mb-0">{{ parent.note }}</h5>
<dl class="row ml-3 mb-0">
<dt class="label-title col-3" translate>Patron</dt>
<dd class="col-9">
<a [routerLink]="['/records', 'patrons', 'detail', parent.patron.pid]">{{ parent.patron.pid | patronName | async }}</a>
</dd>
</dl>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* RERO ILS UI
* Copyright (C) 2019-2022 RERO
* Copyright (C) 2019-2022 UCLouvain
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { Component, Input } from '@angular/core';
import { PatronTransaction, PatronTransactionEvent } from '../../../classes/patron-transaction';

@Component({
selector: 'admin-patron-transaction-event-default',
templateUrl: './patron-transaction-event-default.component.html',
styleUrls: ['./patron-transaction-events-brief-view.component.scss']
})
export class PatronTransactionEventDefaultComponent {

@Input() event: PatronTransactionEvent;
@Input() parent: PatronTransaction;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--
RERO ILS UI
Copyright (C) 2019-2022 RERO
Copyright (C) 2019-2022 UCLouvain
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<div class="description container pl-0">
<h5 class="mb-0">{{ parent.document.title | mainTitle }}</h5>
<dl class="row ml-3 mb-0">
<dt class="label-title col-3" translate>Call-number</dt>
<dd class="col-9">
<shared-inherited-call-number [item]="parent.loan.item"></shared-inherited-call-number>
(<a [routerLink]="['/records', 'items', 'detail', parent.loan.item.pid]">{{ parent.loan.item.barcode }}</a>)
</dd>
<dt class="label-title col-3" translate>Patron</dt>
<dd class="col-9">
<a [routerLink]="['/records', 'patrons', 'detail', parent.patron.pid]">{{ parent.patron.pid | patronName | async }}</a>
</dd>
</dl>
</div>
Loading

0 comments on commit 8e4f69d

Please sign in to comment.