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,21 +1,29 @@
<div class="container" *ngVar="(itemRequestRD$ | async) as itemRequestRD">
<h3 class="mb-4">{{'grant-deny-request-copy.header' | translate}}</h3>
<div *ngIf="itemRequestRD && itemRequestRD.hasSucceeded">
<p [innerHTML]="'grant-deny-request-copy.intro1' | translate:{ url: (itemUrl$ | async), name: (itemName$ | async) }"></p>
<p>{{'grant-deny-request-copy.intro2' | translate}}</p>
<div *ngIf="!itemRequestRD.payload.decisionDate">
<p [innerHTML]="'grant-deny-request-copy.intro1' | translate:{ url: (itemUrl$ | async), name: (itemName$ | async) }"></p>
<p>{{'grant-deny-request-copy.intro2' | translate}}</p>
<div class="btn-group ">
<a [routerLink]="grantRoute$ | async"
class="btn btn-outline-primary"
title="{{'grant-deny-request-copy.grant' | translate }}">
{{'grant-deny-request-copy.grant' | translate }}
</a>
<div class="btn-group ">
<a [routerLink]="grantRoute$ | async"
class="btn btn-outline-primary"
title="{{'grant-deny-request-copy.grant' | translate }}">
{{'grant-deny-request-copy.grant' | translate }}
</a>
<a [routerLink]="denyRoute$ | async"
class="btn btn-outline-danger"
title="{{'grant-deny-request-copy.deny' | translate }}">
{{'grant-deny-request-copy.deny' | translate }}
</a>
<a [routerLink]="denyRoute$ | async"
class="btn btn-outline-danger"
title="{{'grant-deny-request-copy.deny' | translate }}">
{{'grant-deny-request-copy.deny' | translate }}
</a>
</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>

View File

@@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { AuthService } from '../../core/auth/auth.service';
import { ItemDataService } from '../../core/data/item-data.service';
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
import { of as observableOf } from 'rxjs';
import { BehaviorSubject, of as observableOf } from 'rxjs';
import {
createSuccessfulRemoteDataObject,
createSuccessfulRemoteDataObject$
@@ -17,8 +17,10 @@ import { Item } from '../../core/shared/item.model';
import { GrantDenyRequestCopyComponent } from './grant-deny-request-copy.component';
import { getItemPageRoute } from '../../item-page/item-page-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 fixture: ComponentFixture<GrantDenyRequestCopyComponent>;
@@ -120,4 +122,21 @@ describe('GrantDenyRequestCopyComponent', () => {
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.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.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 }}>",