diff --git a/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html b/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html
index c85c79d6d..6a75c6584 100644
--- a/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html
+++ b/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html
@@ -16,9 +16,9 @@
along with this program. If not, see .
-->
@if (accountsToDisplay && organisation) {
-
diff --git a/projects/admin/src/app/circulation/main-request/main-request.component.ts b/projects/admin/src/app/circulation/main-request/main-request.component.ts
index bff8642f2..12893940c 100644
--- a/projects/admin/src/app/circulation/main-request/main-request.component.ts
+++ b/projects/admin/src/app/circulation/main-request/main-request.component.ts
@@ -17,6 +17,7 @@
import { Component, inject, OnDestroy, OnInit } from '@angular/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { TranslateService } from '@ngx-translate/core';
+import { CONFIG } from '@rero/ng-core';
import { UserService } from '@rero/shared';
import moment from 'moment';
import { MessageService } from 'primeng/api';
@@ -175,7 +176,8 @@ export class MainRequestComponent implements OnInit, OnDestroy {
this.messageService.add({
severity: 'warn',
summary: this.translateService.instant('request'),
- detail: this.translateService.instant('No request corresponding to the given item has been found.')
+ detail: this.translateService.instant('No request corresponding to the given item has been found.'),
+ life: CONFIG.MESSAGE_LIFE
});
this._resetSearchInput();
} else {
@@ -187,7 +189,8 @@ export class MainRequestComponent implements OnInit, OnDestroy {
this.messageService.add({
severity: 'warn',
summary: this.translateService.instant('request'),
- detail: this.translateService.instant('The item is ').concat(this.translateService.instant(newItem.status))
+ detail: this.translateService.instant('The item is ').concat(this.translateService.instant(newItem.status)),
+ life: CONFIG.MESSAGE_LIFE
});
this._resetSearchInput();
}
diff --git a/projects/admin/src/app/circulation/patron/cancel-request-button.component.ts b/projects/admin/src/app/circulation/patron/cancel-request-button.component.ts
index 944617b28..531a307ac 100644
--- a/projects/admin/src/app/circulation/patron/cancel-request-button.component.ts
+++ b/projects/admin/src/app/circulation/patron/cancel-request-button.component.ts
@@ -14,10 +14,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-
import { Component, EventEmitter, inject, Input, Output } from '@angular/core';
import { LoanService } from '@app/admin/service/loan.service';
import { TranslateService } from '@ngx-translate/core';
+import { CONFIG } from '@rero/ng-core';
import { UserService } from '@rero/shared';
import { MessageService } from 'primeng/api';
@@ -78,7 +78,8 @@ export class CancelRequestButtonComponent {
this.messageService.add({
severity: 'warn',
summary: this.translateService.instant('Request'),
- detail: message
+ detail: message,
+ life: CONFIG.MESSAGE_LIFE
});
this.cancelRequestEvent.emit(this.loan.id);
});
diff --git a/projects/admin/src/app/circulation/patron/card/card.component.ts b/projects/admin/src/app/circulation/patron/card/card.component.ts
index 99fe2abd1..f1bd94e0d 100644
--- a/projects/admin/src/app/circulation/patron/card/card.component.ts
+++ b/projects/admin/src/app/circulation/patron/card/card.component.ts
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
- * Copyright (C) 2019-2023 RERO
+ * Copyright (C) 2019-2024 RERO
*
* 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
@@ -15,9 +15,9 @@
* along with this program. If not, see .
*/
import { Component, EventEmitter, inject, Input, Output } from '@angular/core';
-import moment from 'moment';
import { getBootstrapLevel } from '../../../utils/utils';
import { CirculationService } from '../../services/circulation.service';
+import { DateTime } from 'luxon';
@Component({
selector: 'admin-circulation-patron-detailed',
@@ -55,25 +55,24 @@ export class CardComponent {
/** Get the patron age */
get patronAge(): number {
if (this.patron && this.patron.birth_date) {
- return moment().diff(this.patron.birth_date, 'years');
+ const birthDate = DateTime.fromISO(this.patron.birth_date);
+ return Math.floor(DateTime.now().diff(birthDate, 'years').years);
}
}
/** Defined if it's the birthday of the patron */
get isBirthday(): boolean {
if (this.patron && this.patron.birth_date) {
- const today = moment().format('YYYY-MM-DD');
- const age = moment(today).diff(this.patron.birth_date, 'years', true);
- return age % 1 === 0;
+ const today = DateTime.fromISO(DateTime.now().toFormat('yyyy-M-d'));
+ const birthDate = DateTime.fromISO(this.patron.birth_date);
+ return today.diff(birthDate, 'years').years % 1 === 0;
}
return false;
}
/** Get the circulation messages about the loaded patron if exists */
get circulationMessages(): Array<{type: string, content: string}> {
- return (this.circulationService.hasOwnProperty('circulationInformations'))
- ? this.circulationService.circulationInformations.messages
- : [];
+ return this.circulationService.messages();
}
// COMPONENT FUNCTIONS ======================================================
diff --git a/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.html b/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.html
index 3a2080068..8e105c0bf 100644
--- a/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.html
+++ b/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.html
@@ -15,24 +15,15 @@
along with this program. If not, see .
-->
@if (form) {
-
-
-
-
-
Update Patron Password
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
}
diff --git a/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.ts b/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.ts
index 45e7f0f1f..26fcabf94 100644
--- a/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.ts
+++ b/projects/admin/src/app/circulation/patron/change-password-form/change-password-form.component.ts
@@ -19,6 +19,7 @@ import { Component, inject, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { TranslateService } from '@ngx-translate/core';
+import { CONFIG } from '@rero/ng-core';
import { User, UserApiService } from '@rero/shared';
import { MessageService } from 'primeng/api';
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
@@ -66,7 +67,8 @@ export class ChangePasswordFormComponent implements OnInit {
this.messageService.add({
severity: 'success',
summary: this.translateService.instant('Patron'),
- detail: this.translateService.instant('The patron password has been changed.')
+ detail: this.translateService.instant('The patron password has been changed.'),
+ life: CONFIG.MESSAGE_LIFE
});
this.closeModal();
},
@@ -78,7 +80,7 @@ export class ChangePasswordFormComponent implements OnInit {
this.messageService.add({
severity: 'error',
summary: this.translateService.instant('Patron'),
- detail: this.translateService.instant('Update Patron Password'),
+ detail: `${this.translateService.instant('Update Patron Password')}. ${error}`,
sticky: true,
closable: true
});
diff --git a/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.html b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.html
new file mode 100644
index 000000000..46200504a
--- /dev/null
+++ b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.html
@@ -0,0 +1,18 @@
+
+
+
diff --git a/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.spec.ts b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.spec.ts
new file mode 100644
index 000000000..f0a910331
--- /dev/null
+++ b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.spec.ts
@@ -0,0 +1,38 @@
+/*
+ * RERO ILS UI
+ * Copyright (C) 2024 RERO
+ *
+ * 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 .
+ */
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { CirculationSettingsComponent } from './circulation-settings.component';
+
+describe('CirculationSettingsComponent', () => {
+ let component: CirculationSettingsComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [CirculationSettingsComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(CirculationSettingsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.ts b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.ts
new file mode 100644
index 000000000..a267a1731
--- /dev/null
+++ b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.component.ts
@@ -0,0 +1,108 @@
+/*
+ * RERO ILS UI
+ * Copyright (C) 2024 RERO
+ *
+ * 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 .
+ */
+import { Component, inject, OnInit } from '@angular/core';
+import { LoanFixedDateService } from '@app/admin/circulation/services/loan-fixed-date.service';
+import { TranslateService } from '@ngx-translate/core';
+import { DateTranslatePipe } from '@rero/ng-core';
+import { MenuItem } from 'primeng/api';
+import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
+import { FixedDateFormComponent } from '../fixed-date-form/fixed-date-form.component';
+import { CirculationSettingsService, ICirculationSetting } from './circulation-settings.service';
+
+@Component({
+ selector: 'admin-circulation-settings',
+ templateUrl: './circulation-settings.component.html'
+})
+export class CirculationSettingsComponent implements OnInit {
+
+ private translateService: TranslateService = inject(TranslateService);
+ private dialogService: DialogService = inject(DialogService);
+ private loanFixedDateService: LoanFixedDateService = inject(LoanFixedDateService);
+ private dateTranslatePipe: DateTranslatePipe = inject(DateTranslatePipe);
+ private circulationSettingsService: CirculationSettingsService = inject(CirculationSettingsService);
+
+ items: MenuItem[] = [];
+
+ dialogRef: DynamicDialogRef | undefined;
+
+ ngOnInit(): void {
+ this.items = [
+ {
+ label: this.translateService.instant('Check-out for a fix date'),
+ code: 'fix-date',
+ command: () => this.openFixedEndDateDialog()
+ },
+ {
+ label: this.translateService.instant('Override blockings'),
+ code: 'override',
+ command: () => this.overrideBlocking()
+ }
+ ];
+
+ // Assignment of end date if present in locale storage
+ const fixedDateValue = this.loanFixedDateService.get();
+ if (fixedDateValue) {
+ this.setCheckoutDateSetting(new Date(fixedDateValue), true);
+ }
+ }
+
+ private openFixedEndDateDialog(): void {
+ this.dialogRef = this.dialogService.open(FixedDateFormComponent, {
+ header: this.translateService.instant('Choose a due date'),
+ width: '30vw',
+ height: '600px'
+ });
+ this.dialogRef.onClose.subscribe((result?: any) => {
+ if (result && 'action' in result && result.action === 'submit') {
+ const date = this.setCheckoutDateSetting(result.content.endDate, result.content.remember);
+ if (result.content.remember) {
+ this.loanFixedDateService.set(date);
+ }
+ }
+ });
+ }
+
+ private overrideBlocking(): void {
+ this._setCheckoutSetting({
+ key: 'overrideBlocking',
+ label: this.translateService.instant('Override blockings'),
+ value: true
+ });
+ }
+
+ private setCheckoutDateSetting(endDate: Date, remember: boolean): string {
+ endDate.setHours(23,59);
+ const formattedDate = this.dateTranslatePipe.transform(endDate, 'shortDate');
+ const setting = {
+ key: 'endDate',
+ label: this.translateService.instant('Active chosen due date: {{ endDate }}', {endDate: formattedDate}),
+ value: endDate.toISOString(),
+ extra: {
+ remember,
+ severity: remember ? 'success' : 'warning'
+ }
+ };
+ this._setCheckoutSetting(setting);
+
+ return setting.value;
+ }
+
+ private _setCheckoutSetting(setting: ICirculationSetting) {
+ this.circulationSettingsService.remove(setting.key);
+ this.circulationSettingsService.add(setting);
+ }
+}
diff --git a/projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.scss b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.service.spec.ts
similarity index 58%
rename from projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.scss
rename to projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.service.spec.ts
index 62eb75ca6..f5b6ab80c 100644
--- a/projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.scss
+++ b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.service.spec.ts
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
- * Copyright (C) 2020 RERO
+ * Copyright (C) 2024 RERO
*
* 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
@@ -14,7 +14,18 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-.btn-duplicate {
- z-index: 2;
- position: relative;
-}
+import { TestBed } from '@angular/core/testing';
+import { CirculationSettingsService } from './circulation-settings.service';
+
+describe('CirculationSettingsServiceService', () => {
+ let service: CirculationSettingsService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(CirculationSettingsService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.service.ts b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.service.ts
new file mode 100644
index 000000000..48fa80adb
--- /dev/null
+++ b/projects/admin/src/app/circulation/patron/loan/circulation-settings/circulation-settings.service.ts
@@ -0,0 +1,53 @@
+/*
+ * RERO ILS UI
+ * Copyright (C) 2024 RERO
+ *
+ * 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 .
+ */
+import { inject, Injectable } from '@angular/core';
+import { LoanFixedDateService } from '@app/admin/circulation/services/loan-fixed-date.service';
+
+export interface ICirculationSetting {
+ key: string; /** the setting internal key */
+ label: string; /** the setting label to display to user */
+ value: any; /** the setting value */
+ extra?: any; /** extra element for customization */
+}
+
+@Injectable({
+ providedIn: 'root'
+})
+export class CirculationSettingsService {
+
+ private loanFixedDateService: LoanFixedDateService = inject(LoanFixedDateService);
+
+ private checkoutCirculationSettings: ICirculationSetting[] = [];
+
+ add(circulationSetting: ICirculationSetting): void {
+ this.checkoutCirculationSettings.push(circulationSetting);
+ }
+
+ getSettings(): ICirculationSetting[] {
+ return this.checkoutCirculationSettings;
+ }
+
+ remove(key: string): ICirculationSetting | ICirculationSetting[] | null {
+ const idx = this.checkoutCirculationSettings.findIndex(setting => setting.key === key);
+ if (idx >= 0) {
+ if (key === 'endDate' && this.checkoutCirculationSettings[idx].extra.remember) {
+ this.loanFixedDateService.remove();
+ }
+ return this.checkoutCirculationSettings.splice(idx, 1);
+ }
+ }
+}
diff --git a/projects/admin/src/app/circulation/patron/loan/fixed-date-form/fixed-date-form.component.html b/projects/admin/src/app/circulation/patron/loan/fixed-date-form/fixed-date-form.component.html
index bf2f97969..49c5a129c 100644
--- a/projects/admin/src/app/circulation/patron/loan/fixed-date-form/fixed-date-form.component.html
+++ b/projects/admin/src/app/circulation/patron/loan/fixed-date-form/fixed-date-form.component.html
@@ -1,5 +1,5 @@
-
diff --git a/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.spec.ts b/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.spec.ts
index c57f3db27..4a7444a99 100644
--- a/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.spec.ts
+++ b/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.spec.ts
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
- * Copyright (C) 2019 RERO
+ * Copyright (C) 2019-2024 RERO
*
* 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
@@ -14,13 +14,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { ActivatedRoute } from '@angular/router';
-import { RouterTestingModule } from '@angular/router/testing';
+import { ActivatedRoute, RouterModule } from '@angular/router';
import { FormlyModule } from '@ngx-formly/core';
import { TranslateModule } from '@ngx-translate/core';
import { RecordModule, RecordService, RecordUiService } from '@rero/ng-core';
@@ -28,7 +26,6 @@ import { of } from 'rxjs';
import { EditorService } from '../../../service/editor.service';
import { DocumentEditorComponent } from './document-editor.component';
-
const recordTestingUiService = jasmine.createSpyObj('RecordUiService', [
'getResourceConfig'
]);
@@ -75,7 +72,7 @@ describe('DocumentEditorComponent', () => {
],
imports: [
HttpClientTestingModule,
- RouterTestingModule,
+ RouterModule.forRoot([]),
TranslateModule.forRoot(),
FormsModule,
ReactiveFormsModule,
diff --git a/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.ts b/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.ts
index 63553941b..9e83510e7 100644
--- a/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.ts
+++ b/projects/admin/src/app/record/custom-editor/document-editor/document-editor.component.ts
@@ -18,7 +18,7 @@
import { Component, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
-import { AbstractCanDeactivateComponent, RecordService } from '@rero/ng-core';
+import { AbstractCanDeactivateComponent, CONFIG, RecordService } from '@rero/ng-core';
import { MessageService } from 'primeng/api';
import { combineLatest } from 'rxjs';
import { EditorService } from '../../../service/editor.service';
@@ -59,7 +59,8 @@ export class DocumentEditorComponent extends AbstractCanDeactivateComponent {
this.messageService.add({
severity: 'warn',
summary: this.translateService.instant('Import'),
- detail: this.translateService.instant('Does not exists on the remote server!')
+ detail: this.translateService.instant('Does not exists on the remote server!'),
+ life: CONFIG.MESSAGE_LIFE
});
}
}
@@ -81,13 +82,15 @@ export class DocumentEditorComponent extends AbstractCanDeactivateComponent {
this.messageService.add({
severity: 'success',
summary: this.translateService.instant('Duplicate'),
- detail: this.translateService.instant('Document duplicated')
+ detail: this.translateService.instant('Document duplicated'),
+ life: CONFIG.MESSAGE_LIFE
});
} else {
this.messageService.add({
severity: 'warn',
summary: this.translateService.instant('Duplicate'),
- detail: this.translateService.instant('This document does not exists!')
+ detail: this.translateService.instant('This document does not exists!'),
+ life: CONFIG.MESSAGE_LIFE
});
}
}
diff --git a/projects/admin/src/app/record/custom-editor/libraries/exception-dates-edit/exception-dates-edit.component.html b/projects/admin/src/app/record/custom-editor/libraries/exception-dates-edit/exception-dates-edit.component.html
index 290920604..e62d9c508 100644
--- a/projects/admin/src/app/record/custom-editor/libraries/exception-dates-edit/exception-dates-edit.component.html
+++ b/projects/admin/src/app/record/custom-editor/libraries/exception-dates-edit/exception-dates-edit.component.html
@@ -14,256 +14,224 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
-->
-
-