83635: Item request - processed message

This commit is contained in:
Kristof De Langhe
2021-10-14 15:45:05 +02:00
parent a745468b0c
commit 478c95f6d4
3 changed files with 46 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
<div class="container" *ngVar="(itemRequestRD$ | async) as itemRequestRD"> <div class="container" *ngVar="(itemRequestRD$ | async) as itemRequestRD">
<h3 class="mb-4">{{'grant-deny-request-copy.header' | translate}}</h3> <h3 class="mb-4">{{'grant-deny-request-copy.header' | translate}}</h3>
<div *ngIf="itemRequestRD && itemRequestRD.hasSucceeded"> <div *ngIf="itemRequestRD && itemRequestRD.hasSucceeded">
<div *ngIf="!itemRequestRD.payload.decisionDate">
<p [innerHTML]="'grant-deny-request-copy.intro1' | translate:{ url: (itemUrl$ | async), name: (itemName$ | async) }"></p> <p [innerHTML]="'grant-deny-request-copy.intro1' | translate:{ url: (itemUrl$ | async), name: (itemName$ | async) }"></p>
<p>{{'grant-deny-request-copy.intro2' | translate}}</p> <p>{{'grant-deny-request-copy.intro2' | translate}}</p>
@@ -18,5 +19,12 @@
</a> </a>
</div> </div>
</div> </div>
<div *ngIf="itemRequestRD.payload.decisionDate" class="processed-message">
<p>{{'grant-deny-request-copy.processed' | translate}}</p>
<p class="text-center">
<a routerLink="/home" class="btn btn-primary">{{'grant-deny-request-copy.home-page' | translate}}</a>
</p>
</div>
</div>
<ds-loading *ngIf="!itemRequestRD || itemRequestRD?.isLoading"></ds-loading> <ds-loading *ngIf="!itemRequestRD || itemRequestRD?.isLoading"></ds-loading>
</div> </div>

View File

@@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { AuthService } from '../../core/auth/auth.service'; import { AuthService } from '../../core/auth/auth.service';
import { ItemDataService } from '../../core/data/item-data.service'; import { ItemDataService } from '../../core/data/item-data.service';
import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
import { of as observableOf } from 'rxjs'; import { BehaviorSubject, of as observableOf } from 'rxjs';
import { import {
createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject,
createSuccessfulRemoteDataObject$ createSuccessfulRemoteDataObject$
@@ -17,8 +17,10 @@ import { Item } from '../../core/shared/item.model';
import { GrantDenyRequestCopyComponent } from './grant-deny-request-copy.component'; import { GrantDenyRequestCopyComponent } from './grant-deny-request-copy.component';
import { getItemPageRoute } from '../../item-page/item-page-routing-paths'; import { getItemPageRoute } from '../../item-page/item-page-routing-paths';
import { getRequestCopyDenyRoute, getRequestCopyGrantRoute } from '../request-copy-routing-paths'; import { getRequestCopyDenyRoute, getRequestCopyGrantRoute } from '../request-copy-routing-paths';
import { By } from '@angular/platform-browser';
import { RemoteData } from '../../core/data/remote-data';
describe('GrantDenyRequestCopyComponent', () => { fdescribe('GrantDenyRequestCopyComponent', () => {
let component: GrantDenyRequestCopyComponent; let component: GrantDenyRequestCopyComponent;
let fixture: ComponentFixture<GrantDenyRequestCopyComponent>; let fixture: ComponentFixture<GrantDenyRequestCopyComponent>;
@@ -120,4 +122,21 @@ describe('GrantDenyRequestCopyComponent', () => {
done(); done();
}); });
}); });
describe('processed message', () => {
it('should not be displayed when decisionDate is undefined', () => {
const message = fixture.debugElement.query(By.css('.processed-message'));
expect(message).toBeNull();
});
it('should be displayed when decisionDate is defined', () => {
component.itemRequestRD$ = createSuccessfulRemoteDataObject$(Object.assign(new ItemRequest(), itemRequest, {
decisionDate: 'defined-date'
}));
fixture.detectChanges();
const message = fixture.debugElement.query(By.css('.processed-message'));
expect(message).not.toBeNull();
});
});
}); });

View File

@@ -1467,10 +1467,14 @@
"grant-deny-request-copy.header": "Document copy request", "grant-deny-request-copy.header": "Document copy request",
"grant-deny-request-copy.home-page": "Take me to the home page",
"grant-deny-request-copy.intro1": "If you are one of the authors of the document <a href='{{ url }}'>{{ name }}</a>, then please use one of the options below to respond to the user's request.", "grant-deny-request-copy.intro1": "If you are one of the authors of the document <a href='{{ url }}'>{{ name }}</a>, then please use one of the options below to respond to the user's request.",
"grant-deny-request-copy.intro2": "After choosing an option, you will be presented with a suggested email reply which you may edit.", "grant-deny-request-copy.intro2": "After choosing an option, you will be presented with a suggested email reply which you may edit.",
"grant-deny-request-copy.processed": "This request has already been processed. You can use the button below to get back to the home page.",
"grant-request-copy.email.message": "Dear {{ recipientName }},\nIn response to your request I have the pleasure to send you in attachment a copy of the file(s) concerning the document: \"{{ itemUrl }}\" ({{ itemName }}), of which I am an author.\n\nBest regards,\n{{ authorName }} <{{ authorEmail }}>", "grant-request-copy.email.message": "Dear {{ recipientName }},\nIn response to your request I have the pleasure to send you in attachment a copy of the file(s) concerning the document: \"{{ itemUrl }}\" ({{ itemName }}), of which I am an author.\n\nBest regards,\n{{ authorName }} <{{ authorEmail }}>",