diff --git a/apps/mina-sidor-fa/src/app/app-routing.module.ts b/apps/mina-sidor-fa/src/app/app-routing.module.ts index 7a7e5a2..287d162 100644 --- a/apps/mina-sidor-fa/src/app/app-routing.module.ts +++ b/apps/mina-sidor-fa/src/app/app-routing.module.ts @@ -1,50 +1,35 @@ import { NgModule } from '@angular/core'; import { ExtraOptions, RouterModule, Routes } from '@angular/router'; +import { RoleEnum } from '@msfa-enums/role.enum'; import { environment } from '@msfa-environment'; import { AuthGuard } from '@msfa-guards/auth.guard'; +import { OrganizationGuard } from '@msfa-guards/organization.guard'; +import { RoleGuard } from '@msfa-guards/role.guard'; const routes: Routes = [ { path: '', data: { title: '' }, loadChildren: () => import('./pages/start/start.module').then(m => m.StartModule), - canActivate: [AuthGuard], + canActivate: [AuthGuard, OrganizationGuard], }, { path: 'administration', - data: { title: 'Administration' }, + data: { title: 'Administration', expectedRole: RoleEnum.MSFA_AuthAdmin }, loadChildren: () => import('./pages/administration/administration.module').then(m => m.AdministrationModule), - canActivate: [AuthGuard], + canActivate: [AuthGuard, OrganizationGuard, RoleGuard], }, { path: 'deltagare', - data: { title: 'Deltagare' }, + data: { title: 'Deltagare', expectedRole: RoleEnum.MSFA_ReportAndPlanning }, loadChildren: () => import('./pages/deltagare/deltagare.module').then(m => m.DeltagareModule), - canActivate: [AuthGuard], + canActivate: [AuthGuard, OrganizationGuard, RoleGuard], }, { path: 'nya-deltagare', - data: { title: 'Nya deltagare' }, + data: { title: 'Nya deltagare', expectedRole: RoleEnum.MSFA_ReceiveDeltagare }, loadChildren: () => import('./pages/avrop/avrop.module').then(m => m.AvropModule), - canActivate: [AuthGuard], - }, - { - path: 'meddelanden', - data: { title: 'Meddelanden' }, - loadChildren: () => import('./pages/messages/messages.module').then(m => m.MessagesModule), - canActivate: [AuthGuard], - }, - { - path: 'statistik', - data: { title: 'Statistik' }, - loadChildren: () => import('./pages/statistics/statistics.module').then(m => m.StatisticsModule), - canActivate: [AuthGuard], - }, - { - path: 'installningar', - data: { title: 'Inställningar' }, - loadChildren: () => import('./pages/settings/settings.module').then(m => m.SettingsModule), - canActivate: [AuthGuard], + canActivate: [AuthGuard, OrganizationGuard, RoleGuard], }, { path: 'logga-ut', @@ -57,18 +42,19 @@ const routes: Routes = [ data: { title: 'Välj organisation' }, loadChildren: () => import('./pages/organization-picker/organization-picker.module').then(m => m.OrganizationPickerModule), + canActivate: [AuthGuard], }, { path: 'mitt-konto', data: { title: 'Mitt konto' }, loadChildren: () => import('./pages/my-account/my-account.module').then(m => m.MyAccountModule), - canActivate: [AuthGuard], + canActivate: [AuthGuard, OrganizationGuard], }, { path: 'obehorig', data: { title: 'Saknar behörighet' }, loadChildren: () => import('./pages/unauthorized/unauthorized.module').then(m => m.UnauthorizedModule), - canActivate: [], + canActivate: [AuthGuard], }, ]; diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.scss b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.scss index fbaa19b..f92e2b0 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.scss +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-card/employee-card.component.scss @@ -71,7 +71,7 @@ } &__edit-button { - @include msfa-button('secondary'); + @include msfa__button('secondary'); } &__authorization-icon { diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html index 515a166..47428ae 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.html @@ -140,7 +140,7 @@ (afOnPrimaryClick)="onFormSubmitted(true)" (afOnSecondaryClick)="abortFormSubmit()" (afOnInactive)="abortFormSubmit()" - afHeading="Är du säker" + afHeading="Är du säker?" afHeadingLevel="h2" afPrimaryButtonText="Ja, spara ändå" afSecondaryButtonText="Nej, gå tillbaka" diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.scss b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.scss index 540edf9..e6ad658 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.scss +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employee-form/edit-employee-form/edit-employee-form.component.scss @@ -47,7 +47,7 @@ } &__link-btn { - @include msfa-button('secondary'); + @include msfa__button('secondary'); } &__choose-all-utforande-verksamheter { diff --git a/apps/mina-sidor-fa/src/app/pages/administration/pages/employees/employees.component.html b/apps/mina-sidor-fa/src/app/pages/administration/pages/employees/employees.component.html index 72aa113..44a1bcd 100644 --- a/apps/mina-sidor-fa/src/app/pages/administration/pages/employees/employees.component.html +++ b/apps/mina-sidor-fa/src/app/pages/administration/pages/employees/employees.component.html @@ -20,11 +20,11 @@

Personallista

- + > + -
Meddelanden funkar!
- diff --git a/apps/mina-sidor-fa/src/app/pages/messages/messages.component.scss b/apps/mina-sidor-fa/src/app/pages/messages/messages.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/apps/mina-sidor-fa/src/app/pages/messages/messages.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/messages/messages.component.spec.ts deleted file mode 100644 index 19dba45..0000000 --- a/apps/mina-sidor-fa/src/app/pages/messages/messages.component.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { LayoutComponent } from '@msfa-shared/components/layout/layout.component'; -import { MessagesComponent } from './messages.component'; - -describe('MessagesComponent', () => { - let component: MessagesComponent; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - void TestBed.configureTestingModule({ - declarations: [MessagesComponent, LayoutComponent], - imports: [RouterTestingModule, HttpClientTestingModule], - }).compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(MessagesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/apps/mina-sidor-fa/src/app/pages/messages/messages.component.ts b/apps/mina-sidor-fa/src/app/pages/messages/messages.component.ts deleted file mode 100644 index 4c02bc3..0000000 --- a/apps/mina-sidor-fa/src/app/pages/messages/messages.component.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; - -@Component({ - selector: 'msfa-messages', - templateUrl: './messages.component.html', - styleUrls: ['./messages.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class MessagesComponent {} diff --git a/apps/mina-sidor-fa/src/app/pages/messages/messages.module.ts b/apps/mina-sidor-fa/src/app/pages/messages/messages.module.ts deleted file mode 100644 index bac60e0..0000000 --- a/apps/mina-sidor-fa/src/app/pages/messages/messages.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; -import { MessagesComponent } from './messages.component'; - -@NgModule({ - declarations: [MessagesComponent], - imports: [CommonModule, RouterModule.forChild([{ path: '', component: MessagesComponent }]), LayoutModule], -}) -export class MessagesModule {} diff --git a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.html b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.html index f6ba78c..d381966 100644 --- a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.html +++ b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.html @@ -1,9 +1,29 @@ + + + + diff --git a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.scss b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.scss index e69de29..d6f9321 100644 --- a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.scss +++ b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.scss @@ -0,0 +1,32 @@ +@import 'mixins/buttons'; +@import 'mixins/list'; +@import 'variables/gutters'; + +.my-account { + &__header { + display: flex; + justify-content: space-between; + align-items: center; + } + + &__logout { + @include msfa__button('secondary'); + } + + &__roles { + @include msfa__reset-list; + display: flex; + flex-direction: column; + gap: $digi--layout--gutter--s; + } + + &__role { + display: flex; + align-items: center; + gap: $digi--layout--gutter--s; + } + + &__authorization-icon { + color: var(--digi--ui--color--border--success); + } +} diff --git a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.spec.ts index 888b027..02c7c85 100644 --- a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.spec.ts +++ b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.spec.ts @@ -1,5 +1,7 @@ -import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; import { MyAccountComponent } from './my-account.component'; describe('MyAccountComponent', () => { @@ -9,8 +11,9 @@ describe('MyAccountComponent', () => { beforeEach( waitForAsync(() => { void TestBed.configureTestingModule({ - schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], + schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [MyAccountComponent], + imports: [HttpClientTestingModule, RouterTestingModule], }).compileComponents(); }) ); diff --git a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.ts b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.ts index bfd88e3..c7d59b0 100644 --- a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.ts +++ b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.component.ts @@ -1,4 +1,8 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { IconType } from '@msfa-enums/icon-type.enum'; +import { User } from '@msfa-models/user.model'; +import { UserService } from '@msfa-services/api/user.service'; +import { Observable } from 'rxjs'; @Component({ selector: 'msfa-my-account', @@ -6,4 +10,9 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; styleUrls: ['./my-account.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class MyAccountComponent {} +export class MyAccountComponent { + user$: Observable = this.userService.user$; + readonly IconType = IconType; + + constructor(private userService: UserService) {} +} diff --git a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.module.ts b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.module.ts index 36a2357..f7525f6 100644 --- a/apps/mina-sidor-fa/src/app/pages/my-account/my-account.module.ts +++ b/apps/mina-sidor-fa/src/app/pages/my-account/my-account.module.ts @@ -1,7 +1,8 @@ -import { DigiNgLinkInternalModule } from '@af/digi-ng/_link/link-internal'; +import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base'; import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; +import { IconModule } from '@msfa-shared/components/icon/icon.module'; import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; import { MyAccountComponent } from './my-account.component'; @@ -12,7 +13,8 @@ import { MyAccountComponent } from './my-account.component'; CommonModule, RouterModule.forChild([{ path: '', component: MyAccountComponent }]), LayoutModule, - DigiNgLinkInternalModule, + IconModule, + DigiNgSkeletonBaseModule, ], }) export class MyAccountModule {} diff --git a/apps/mina-sidor-fa/src/app/pages/organization-picker/organization-picker.component.ts b/apps/mina-sidor-fa/src/app/pages/organization-picker/organization-picker.component.ts index 3a744fc..1710a17 100644 --- a/apps/mina-sidor-fa/src/app/pages/organization-picker/organization-picker.component.ts +++ b/apps/mina-sidor-fa/src/app/pages/organization-picker/organization-picker.component.ts @@ -5,7 +5,7 @@ import { UnsubscribeDirective } from '@msfa-directives/unsubscribe.directive'; import { Organization } from '@msfa-models/organization.model'; import { UserService } from '@msfa-services/api/user.service'; import { Observable } from 'rxjs'; -import { filter, map } from 'rxjs/operators'; +import { filter } from 'rxjs/operators'; @Component({ selector: 'msfa-organization-picker', @@ -14,9 +14,8 @@ import { filter, map } from 'rxjs/operators'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class OrganizationPickerComponent extends UnsubscribeDirective { - organizations$: Observable = this.userService.user$.pipe( - filter(user => !!(user && user.organizations?.length)), - map(({ organizations }) => organizations) + organizations$: Observable = this.userService.organizations$.pipe( + filter(organizations => !!organizations?.length) ); constructor( diff --git a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.html b/apps/mina-sidor-fa/src/app/pages/settings/settings.component.html deleted file mode 100644 index 4588aeb..0000000 --- a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.html +++ /dev/null @@ -1,3 +0,0 @@ - -
Inställningar funkar!
-
diff --git a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.scss b/apps/mina-sidor-fa/src/app/pages/settings/settings.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/settings/settings.component.spec.ts deleted file mode 100644 index effd860..0000000 --- a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { LayoutComponent } from '@msfa-shared/components/layout/layout.component'; -import { SettingsComponent } from './settings.component'; - -describe('SettingsComponent', () => { - let component: SettingsComponent; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - void TestBed.configureTestingModule({ - declarations: [SettingsComponent, LayoutComponent], - imports: [RouterTestingModule, HttpClientTestingModule], - }).compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(SettingsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.ts b/apps/mina-sidor-fa/src/app/pages/settings/settings.component.ts deleted file mode 100644 index cd395c6..0000000 --- a/apps/mina-sidor-fa/src/app/pages/settings/settings.component.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; - -@Component({ - selector: 'msfa-settings', - templateUrl: './settings.component.html', - styleUrls: ['./settings.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class SettingsComponent {} diff --git a/apps/mina-sidor-fa/src/app/pages/settings/settings.module.ts b/apps/mina-sidor-fa/src/app/pages/settings/settings.module.ts deleted file mode 100644 index 4d15766..0000000 --- a/apps/mina-sidor-fa/src/app/pages/settings/settings.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; -import { SettingsComponent } from './settings.component'; - -@NgModule({ - declarations: [SettingsComponent], - imports: [CommonModule, RouterModule.forChild([{ path: '', component: SettingsComponent }]), LayoutModule], -}) -export class SettingsModule {} diff --git a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.html b/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.html deleted file mode 100644 index 3ed6879..0000000 --- a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.html +++ /dev/null @@ -1,3 +0,0 @@ - -
Statistik funkar!
-
diff --git a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.scss b/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.spec.ts b/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.spec.ts deleted file mode 100644 index 8b1a62a..0000000 --- a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { LayoutComponent } from '@msfa-shared/components/layout/layout.component'; -import { StatisticsComponent } from './statistics.component'; - -describe('StatisticsComponent', () => { - let component: StatisticsComponent; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - void TestBed.configureTestingModule({ - declarations: [StatisticsComponent, LayoutComponent], - imports: [RouterTestingModule, HttpClientTestingModule], - }).compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(StatisticsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.ts b/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.ts deleted file mode 100644 index c3ae0b6..0000000 --- a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.component.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; - -@Component({ - selector: 'msfa-statistics', - templateUrl: './statistics.component.html', - styleUrls: ['./statistics.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class StatisticsComponent {} diff --git a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.module.ts b/apps/mina-sidor-fa/src/app/pages/statistics/statistics.module.ts deleted file mode 100644 index 1bca8a8..0000000 --- a/apps/mina-sidor-fa/src/app/pages/statistics/statistics.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; -import { StatisticsComponent } from './statistics.component'; - -@NgModule({ - declarations: [StatisticsComponent], - imports: [CommonModule, RouterModule.forChild([{ path: '', component: StatisticsComponent }]), LayoutModule], -}) -export class StatisticsModule {} diff --git a/apps/mina-sidor-fa/src/app/shared/components/back-link/back-link.component.scss b/apps/mina-sidor-fa/src/app/shared/components/back-link/back-link.component.scss index bd35a07..de25bd1 100644 --- a/apps/mina-sidor-fa/src/app/shared/components/back-link/back-link.component.scss +++ b/apps/mina-sidor-fa/src/app/shared/components/back-link/back-link.component.scss @@ -1,5 +1,5 @@ @import 'mixins/link'; .back-link { - @include msfa-link(true); + @include msfa__link(true); } diff --git a/apps/mina-sidor-fa/src/app/shared/components/icon/icon.component.html b/apps/mina-sidor-fa/src/app/shared/components/icon/icon.component.html index ce3824e..a4117ae 100644 --- a/apps/mina-sidor-fa/src/app/shared/components/icon/icon.component.html +++ b/apps/mina-sidor-fa/src/app/shared/components/icon/icon.component.html @@ -25,6 +25,26 @@ > + + + + + + + + -