-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patron: add 'blocked' functionnality
* Displays on patron detail view if it is blocked. Displays the blocked reason. * Adds 2 fields on patron detail view: * blocked (if patron is blocked) * blocked reason (why this patron was blocked) * Patron loan detailed view: add a blocked banner if patron is blocked. * Adds different notification to librarian if a patron is blocked while asking for new request Co-Authored-by: Olivier DOSSMANN <git@dossmann.net>
- Loading branch information
1 parent
8bbb03a
commit a48d0a5
Showing
18 changed files
with
192 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
projects/admin/src/app/pipe/patron-blocked-message.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2020 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { PatronBlockedMessagePipe } from './patron-blocked-message.pipe'; | ||
import { TranslateService } from '@ngx-translate/core'; | ||
|
||
class TranslateServiceMock { | ||
currentLang = 'en'; | ||
} | ||
|
||
describe('PatronBlockedMessagePipe', () => { | ||
it('create an instance', () => { | ||
const pipe = new PatronBlockedMessagePipe(new TranslateServiceMock() as TranslateService); | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
projects/admin/src/app/pipe/patron-blocked-message.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2020 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { TranslateService } from '@ngx-translate/core'; | ||
|
||
|
||
@Pipe({ | ||
name: 'patronBlockedMessage' | ||
}) | ||
export class PatronBlockedMessagePipe implements PipeTransform { | ||
|
||
/** | ||
* Constructor | ||
* @param translate - TranslateService | ||
*/ | ||
constructor(private translate: TranslateService) {} | ||
|
||
/** | ||
* Display a message if patron is blocked | ||
* @param patron - Patron object | ||
*/ | ||
transform(patron: any, ...args: any[]): any { | ||
if (patron == null || patron.blocked !== true) { | ||
return null; | ||
} | ||
return `${this.translate.instant('This patron is currently blocked.')} ${this.translate.instant('Reason')}: ${patron.blocked_note}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.