Skip to content

Commit

Permalink
Merge pull request #165 from nhsengland/develop
Browse files Browse the repository at this point in the history
Merging into master for deployment
  • Loading branch information
ShaliniNHS authored Apr 25, 2022
2 parents 88335f0 + 960ce2f commit d2d6f3d
Show file tree
Hide file tree
Showing 54 changed files with 2,886 additions and 161 deletions.
18 changes: 18 additions & 0 deletions src/app/config/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ export const locale = {
lastAccessorUserOnOrganisationUnit: {
label: 'User cannot be the last Qualifying Accessor on the organisation unit'
}
},
change_organisation_user_unit: {
lastAccessorUserOnOrganisation: {
label: 'User is not the only {{ role }} within their organisation',
description: '{{ organisation.name }}'
},
lastAccessorUserOnOrganisationUnit: {
label: 'User is not the only {{ role }} within their organisation unit',
description: '{{ unit.name }}'
},
lastAccessorFromUnitProvidingSupport: {
label: 'User is not the person in their organisation or unit who is supporting an innovator',
description: {
none: 'No innovation is being supported',
singular: '{{ supports.innovations.length }} innovation being supported',
plural: '{{ supports.innovations.length }} innovations being supported',
}
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('FeatureModules/Accessor/AccessorLayoutComponent', () => {

const expected = [
{ title: 'Your details', link: `/accessor/account/manage-details` },
// { title: 'Email notifications', link: `/accessor/account/email-notifications` }
{ title: 'Email notifications', link: `/accessor/account/email-notifications` }
];

fixture = TestBed.createComponent(AccessorLayoutComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class AccessorLayoutComponent extends CoreComponent {
case 'userAccountMenu':
this.leftSideBar = [
{ title: 'Your details', link: `/accessor/account/manage-details` },
// { title: 'Email notifications', link: `/accessor/account/email-notifications` }
{ title: 'Email notifications', link: `/accessor/account/email-notifications` }
];
break;

Expand Down
86 changes: 79 additions & 7 deletions src/modules/feature-modules/admin/admin-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ import { PageServiceUsersLockComponent } from './pages/service-users/service-use
import { PageServiceUsersNewComponent } from './pages/service-users/service-users-new/service-users-new.component';
import { PageServiceUsersUnlockComponent } from './pages/service-users/service-users-unlock.component';
import { PageAdminUsersNewComponent } from './pages/admin-users/admin-users-new/admin-users-new.component';

import { PageAdminDeleteComponent } from './pages/admin-users/admin-users-delete/admin-users-delete.component';
// Resolvers.
import { ServiceUserDataResolver } from './resolvers/service-user-data.resolver';
import { PageListOrganisationsAndUnitsComponent } from './pages/list-organisations-and-units/list-organisations-and-units.component';
import { PageListOrganisationsAndUnitsComponent } from './pages/organisations/organisations-list/organisations-list.component';
import { PageAdminOrganisationInfoComponent } from './pages/organisations/organisations-info/organisation-info.component';
import { PageAdminOrganisationEditComponent } from './pages/organisations/organisations-edit/organisations-edit.component';
import { OrganisationDataResolver } from './resolvers/organisation-data.resolver';
import { PageServiceChangeOrganisationUserUnitComponent } from './pages/change-organisation-user-unit/change-organisation-user-unit.component';
import { PageAdminAccountManageAccountInfoComponent } from './pages/account/manage-account/manage-account-info.component';

const routes: Routes = [

Expand All @@ -38,8 +43,42 @@ const routes: Routes = [
},
{
path: 'organisations',
pathMatch: 'full',
component: PageListOrganisationsAndUnitsComponent
data: { breadcrumb: 'Organisations' },
children: [
{
path: '',
pathMatch: 'full',
component: PageListOrganisationsAndUnitsComponent,
data: { breadcrumb: null },
},
{
path: ':orgId',
runGuardsAndResolvers: 'pathParamsOrQueryParamsChange',
resolve: { organisation: OrganisationDataResolver },
data: { breadcrumb: (data: { organisation: { id: string, name: string } }) => `${data.organisation.name}` },
children: [
{
path: '',
pathMatch: 'full',
component: PageAdminOrganisationInfoComponent,
data: { breadcrumb: null }
},
{
path: 'edit',
pathMatch: 'full',
component: PageAdminOrganisationEditComponent,
data: { module: 'Organisation' }
},
{
path: 'unit/:unitId/edit',
pathMatch: 'full',
component: PageAdminOrganisationEditComponent,
data: { module: 'Unit' }
}
]
},

]
},

// NOTE: When creating the future admin-users routes, a guard should be created to protect those routes!
Expand All @@ -60,12 +99,24 @@ const routes: Routes = [
},
{
path: ':userId',
pathMatch: 'full',
// pathMatch: 'full',
resolve: { user: ServiceUserDataResolver },
data: {
breadcrumb: (data: { user: { id: string, displayName: string } }) => `${data.user.displayName}`
},
component: PageAdminUsersInfoComponent
children: [
{
path: '',
pathMatch: 'full',
data: { breadcrumb: null },
component: PageAdminUsersInfoComponent
},
{
path: 'delete',
pathMatch: 'full',
component: PageAdminDeleteComponent
}
]
}
]
},
Expand Down Expand Up @@ -121,13 +172,34 @@ const routes: Routes = [
path: 'change-role',
pathMatch: 'full',
component: PageServiceChangeUserRoleComponent
},
{
path: 'change-unit',
pathMatch: 'full',
component: PageServiceChangeOrganisationUserUnitComponent
}
]
}

]
},
{
path: 'account',
data: { breadcrumb: 'Account' },
children: [
{ path: '', pathMatch: 'full', redirectTo: 'manage-account', data: { breadcrumb: null } },
{
path: 'manage-account',
data: { breadcrumb: 'Manage account' },
children: [
{
path: '', pathMatch: 'full', component: PageAdminAccountManageAccountInfoComponent,
data: { layoutOptions: { type: 'userAccountMenu' } }
}
]
}
]
}

]
}
];
Expand Down
16 changes: 14 additions & 2 deletions src/modules/feature-modules/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ import { PageServiceUsersUnlockComponent } from './pages/service-users/service-u
import { PageAdminUsersFindComponent } from './pages/admin-users/admin-users-find/admin-users-find.component';
import { PageServiceChangeUserRoleComponent } from './pages/change-user-role/change-user-role.component';
import { PageAdminUsersNewComponent } from './pages/admin-users/admin-users-new/admin-users-new.component';
import { PageAdminDeleteComponent } from './pages/admin-users/admin-users-delete/admin-users-delete.component';

// Services.
import { ServiceUsersService } from './services/service-users.service';

// Resolvers.
import { ServiceUserDataResolver } from './resolvers/service-user-data.resolver';
import { PageAdminUsersInfoComponent } from './pages/admin-users/admin-users-info/admin-users-info.component';
import { PageListOrganisationsAndUnitsComponent } from './pages/list-organisations-and-units/list-organisations-and-units.component';
import { PageListOrganisationsAndUnitsComponent } from './pages/organisations/organisations-list/organisations-list.component';
import { PageAdminOrganisationInfoComponent } from './pages/organisations/organisations-info/organisation-info.component';
import { PageAdminOrganisationEditComponent } from './pages/organisations/organisations-edit/organisations-edit.component';
import { OrganisationDataResolver } from './resolvers/organisation-data.resolver';
import { PageServiceChangeOrganisationUserUnitComponent } from './pages/change-organisation-user-unit/change-organisation-user-unit.component';
import { PageAdminAccountManageAccountInfoComponent } from './pages/account/manage-account/manage-account-info.component';

@NgModule({
imports: [
Expand All @@ -51,14 +57,20 @@ import { PageListOrganisationsAndUnitsComponent } from './pages/list-organisatio
PageServiceChangeUserRoleComponent,
PageAdminUsersInfoComponent,
PageListOrganisationsAndUnitsComponent,
PageAdminUsersNewComponent
PageAdminUsersNewComponent,
PageAdminOrganisationInfoComponent,
PageAdminOrganisationEditComponent,
PageServiceChangeOrganisationUserUnitComponent,
PageAdminDeleteComponent,
PageAdminAccountManageAccountInfoComponent
],
providers: [
// Services.
ServiceUsersService,

// Resolvers.
ServiceUserDataResolver,
OrganisationDataResolver
]
})
export class AdminModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AdminLayoutComponent extends CoreComponent {
title: 'Management',
description: 'This is the menu description',
children: [
{ title: 'Organisations', url: '/admin/organisations', description: 'Manage organisations and assotiated units' },
{ title: 'Organisations', url: '/admin/organisations', description: 'Manage organisations and associated units' },
{ title: 'Terms and conditions', url: '/admin/terms-conditions', description: 'Create a new version and trigger acceptance by the users' }
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="nhsuk-grid-row nhsuk-u-padding-top-3">
<div class="nhsuk-grid-column-full">

<theme-alert [type]="alert.type" [title]="alert.title" [setFocus]="alert.setFocus">
<p> {{ alert.message }} </p>
</theme-alert>

<h1 class="nhsuk-heading-xl"> {{ pageTitle }} </h1>

</div>
</div>
<div class="nhsuk-grid-row nhsuk-u-margin-bottom-5">
<div class="nhsuk-grid-column-full">
<h2 class="nhsuk-heading-l"> Change your Password </h2>
<p> You will need to enter your current password to change to a new one. </p>
<a [href]="changePassword"> Change your Password </a>
<h6> Last password update: {{ user.passwordResetOn | date:'dd/MM/yyyy' }} </h6>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';

import { Injector } from '@angular/core';
import { USER_INFO_ADMIN } from '@tests/data.mocks';

import { CoreModule, AppInjector } from '@modules/core';
import { StoresModule, AuthenticationStore } from '@modules/stores';

import { PageAdminAccountManageAccountInfoComponent } from './manage-account-info.component';
import { AdminModule } from '@modules/feature-modules/admin/admin.module';




describe('FeatureModules/Admin/Pages/Account?ManageAccount/PageAdminAccountManageAccountInfoComponent', () => {

let authenticationStore: AuthenticationStore;


let component: PageAdminAccountManageAccountInfoComponent;
let fixture: ComponentFixture<PageAdminAccountManageAccountInfoComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [
HttpClientTestingModule,
RouterTestingModule,
CoreModule,
StoresModule,
AdminModule
]
});

AppInjector.setInjector(TestBed.inject(Injector));

authenticationStore = TestBed.inject(AuthenticationStore);
authenticationStore.getUserInfo = () => USER_INFO_ADMIN;

});
it('should create the component', () => {
fixture = TestBed.createComponent(PageAdminAccountManageAccountInfoComponent);
component = fixture.componentInstance;
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Component, OnInit } from '@angular/core';
import { CoreComponent } from '@app/base';
import { AlertType } from '@app/base/models';

@Component({
selector: 'app-admin-pages-manage-account-info',
templateUrl: './manage-account-info.component.html'
})
export class PageAdminAccountManageAccountInfoComponent extends CoreComponent implements OnInit {

alert: AlertType = { type: null };
changePassword = `${this.stores.environment.APP_URL}/change-password`;

user: {
passwordResetOn: string
};
constructor(

) {

super();
this.setPageTitle('Manage account');

const user = this.stores.authentication.getUserInfo();
this.user = {
passwordResetOn: user.passwordResetOn
};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div class="nhsuk-grid-row nhsuk-u-padding-top-3">
<div class="nhsuk-grid-column-two-thirds">

<h1 class="nhsuk-heading-xl"> {{ pageTitle }} </h1>

<form [formGroup]="form">

<div class="nhsuk-warning-callout nhsuk-u-margin-top-0">
<div class="nhsuk-heading-m nhsuk-warning-callout__label">
<span role="text"> <span class="nhsuk-u-visually-hidden">Important: </span> Are you sure? </span>
</div>
<p> This action is irreversible once the admin user is deleted.</p>
</div>
<!-- <theme-form-input controlName="email" label="Enter your email" [pageUniqueField]="false"></theme-form-input> -->
<theme-form-input controlName="confirmation" label="Are you sure that you want to delete?" description="To confirm, please type the following: delete the administrator" [pageUniqueField]="false"></theme-form-input>
<ng-container *ngIf="pageStep === 'CODE_REQUEST'">
<theme-form-input controlName="code" label="Enter the confirmation code" [pageUniqueField]="false"></theme-form-input>
</ng-container>
<button class="nhsuk-button nhsuk-button--secondary nhsuk-u-margin-top-3" (click)="onSubmitForm()" [disabled]="submitBtnClicked"> Delete account </button>

<!-- </ng-container> -->

<div class="nhsuk-u-padding-bottom-5">
<a routerLink="/admin/administration-users/{{user.id}}"> Cancel </a>
</div>

</form>

</div>
</div>
Loading

0 comments on commit d2d6f3d

Please sign in to comment.