Ajout de l'onglet d'administration

This commit is contained in:
FyloZ 2021-05-01 16:01:23 -04:00
parent b7f50fca38
commit 86747f729f
39 changed files with 192 additions and 227 deletions

View File

@ -1,6 +1,7 @@
import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {CatalogComponent} from "./pages/catalog/catalog.component";
import {NgModule} from '@angular/core'
import {Routes, RouterModule} from '@angular/router'
import {CatalogComponent} from './pages/catalog/catalog.component'
import {AdministrationComponent} from './pages/administration/administration.component'
const routes: Routes = [{
@ -9,39 +10,46 @@ const routes: Routes = [{
}, {
path: 'account',
loadChildren: () => import('./modules/accounts/accounts.module').then(m => m.AccountsModule)
}, {
path: 'employee',
loadChildren: () => import('./modules/employees/employees.module').then(m => m.EmployeesModule)
}, {
path: 'group',
loadChildren: () => import('./modules/groups/groups.module').then(m => m.GroupsModule)
}, {
path: 'catalog',
component: CatalogComponent,
children: [{
path: 'materialtype',
loadChildren: () => import('./modules/material-type/material-type.module').then(m => m.MaterialTypeModule),
}, {
path: 'material',
loadChildren: () => import('./modules/material/material.module').then(m => m.MaterialModule)
}, {
path: 'company',
loadChildren: () => import('./modules/company/company.module').then(m => m.CompanyModule)
}, {
path: '',
pathMatch: 'full',
redirectTo: 'materialtype'
}]
}, {
path: 'admin',
component: AdministrationComponent,
children: [
{
path: 'materialtype',
loadChildren: () => import('./modules/material-type/material-type.module').then(m => m.MaterialTypeModule),
},
{
path: 'material',
loadChildren: () => import('./modules/material/material.module').then(m => m.MaterialModule)
},
{
path: 'company',
loadChildren: () => import('./modules/company/company.module').then(m => m.CompanyModule)
},
{
path: 'user',
loadChildren: () => import('./modules/users/user.module').then(m => m.UserModule)
}, {
path: 'group',
loadChildren: () => import('./modules/groups/group.module').then(m => m.GroupModule)
}, {
path: '',
pathMatch: 'full',
redirectTo: 'materialtype'
redirectTo: 'user'
}
]
},
{path: 'material', loadChildren: () => import('./modules/material/material.module').then(m => m.MaterialModule)}];
}, {
path: 'material',
loadChildren: () => import('./modules/material/material.module').then(m => m.MaterialModule)
}]
@NgModule({
imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })],
imports: [RouterModule.forRoot(routes, {relativeLinkResolution: 'legacy'})],
exports: [RouterModule]
})
export class AppRoutingModule {

View File

@ -8,11 +8,13 @@ import {SharedModule} from "./modules/shared/shared.module";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {CatalogComponent} from './pages/catalog/catalog.component';
import {CompanyModule} from './modules/company/company.module';
import { AdministrationComponent } from './pages/administration/administration.component';
@NgModule({
declarations: [
AppComponent,
CatalogComponent
CatalogComponent,
AdministrationComponent
],
imports: [
AppRoutingModule,

View File

@ -5,12 +5,12 @@
</mat-card-header>
<mat-card-content>
<mat-form-field>
<mat-label>Numéro d'employé</mat-label>
<mat-label>Numéro d'utilisateur</mat-label>
<input matInput [formControl]="idFormControl" type="text"/>
<mat-icon matSuffix>person</mat-icon>
<mat-error *ngIf="idFormControl.invalid">
<span *ngIf="idFormControl.errors.required">Un numéro d'employé est requis</span>
<span *ngIf="idFormControl.errors.pattern">Le numéro d'employé doit être un nombre</span>
<span *ngIf="idFormControl.errors.required">Un numéro d'utilisateur est requis</span>
<span *ngIf="idFormControl.errors.pattern">Le numéro d'utilisateur doit être un nombre</span>
</mat-error>
</mat-form-field>
<mat-form-field>

View File

@ -83,7 +83,7 @@
*ngIf="isRecipeApprobationExpired(recipe)"
svgIcon="clock-alert"
class="color-warning"
title="L'approbation de cette recette est expirée (il y a plus de 4 ans)">
title="L'approbation de l'échantillon est expirée (il y a plus de 4 ans)">
</mat-icon>
</td>
</ng-container>

View File

@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ListComponent } from './pages/list/list.component';
import {AddComponent} from "./pages/add/add.component";
import {EditComponent} from "./pages/edit/edit.component";
import {PasswordEditComponent} from "./pages/password-edit/password-edit.component";
const routes: Routes = [{ path: 'list', component: ListComponent }, {path: 'add', component: AddComponent}, {path: 'edit/:id', component: EditComponent}, {path: 'password/edit/:id', component: PasswordEditComponent}, {path: '', redirectTo: 'list'}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class EmployeesRoutingModule { }

View File

@ -1,34 +0,0 @@
<ng-container *ngIf="employees$ | async as employees">
<table class="my-3 mx-auto mat-elevation-z1" *ngIf="employees.length > 0" mat-table [dataSource]="employees">
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>Numéro d'employé</th>
<td mat-cell *matCellDef="let employee">{{employee.id}}</td>
</ng-container>
<ng-container matColumnDef="firstName">
<th mat-header-cell *matHeaderCellDef>Prénom</th>
<td mat-cell *matCellDef="let employee">{{employee.firstName}}</td>
</ng-container>
<ng-container matColumnDef="lastName">
<th mat-header-cell *matHeaderCellDef>Nom</th>
<td mat-cell *matCellDef="let employee">{{employee.lastName}}</td>
</ng-container>
<ng-container matColumnDef="edit">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell [class.disabled]="!canEditEmployee" *matCellDef="let employee">
<button mat-raised-button color="accent">Modifier</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="columns"></tr>
<tr mat-row *matRowDef="let employee; columns: columns"></tr>
<tr>
<td>test</td>
</tr>
</table>
<ng-container *ngIf="employees.length <= 0">
<div class="w-100 mt-2 text-center empty">
<p>Il n'y a aucun employé dans ce groupe</p>
</div>
</ng-container>
</ng-container>

View File

@ -1,31 +0,0 @@
import {Component, Input, OnInit} from '@angular/core'
import {Employee, EmployeeGroup, EmployeePermission} from '../../../shared/model/employee'
import {GroupService} from '../../services/group.service'
import {AccountService} from '../../../accounts/services/account.service'
import {Observable} from 'rxjs'
@Component({
selector: 'cre-employees-list',
templateUrl: './employees-list.component.html',
styleUrls: ['./employees-list.component.sass']
})
export class EmployeesListComponent implements OnInit {
@Input() group: EmployeeGroup
employees$: Observable<Employee[]> | null
columns = ['id', 'firstName', 'lastName', 'edit']
constructor(
private accountService: AccountService,
private groupService: GroupService
) {
}
ngOnInit(): void {
this.employees$ = this.groupService.getEmployeesForGroup(this.group.id)
}
get canEditEmployee(): boolean {
return this.accountService.hasPermission(EmployeePermission.EDIT_USERS)
}
}

View File

@ -0,0 +1,23 @@
import {NgModule} from '@angular/core'
import {RouterModule, Routes} from '@angular/router'
import {ListComponent} from './pages/list/list.component'
import {AddComponent} from './pages/add/add.component'
import {EditComponent} from './pages/edit/edit.component'
const routes: Routes = [{
path: 'list', component: ListComponent
}, {
path: 'add', component: AddComponent
}, {
path: 'edit/:id', component: EditComponent
}, {
path: '', redirectTo: 'list'
}]
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class GroupRoutingModule {
}

View File

@ -1,18 +1,17 @@
import {NgModule} from '@angular/core';
import {GroupsRoutingModule} from './groups-routing.module';
import {GroupRoutingModule} from './group-routing.module';
import {ListComponent} from './pages/list/list.component';
import {SharedModule} from "../shared/shared.module";
import {AddComponent} from './pages/add/add.component';
import {EditComponent} from './pages/edit/edit.component';
import {EmployeesListComponent} from './components/employees-list/employees-list.component';
@NgModule({
declarations: [ListComponent, AddComponent, EditComponent, EmployeesListComponent],
declarations: [ListComponent, AddComponent, EditComponent],
imports: [
GroupsRoutingModule,
GroupRoutingModule,
SharedModule
]
})
export class GroupsModule { }
export class GroupModule { }

View File

@ -1,15 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {ListComponent} from './pages/list/list.component';
import {AddComponent} from "./pages/add/add.component";
import {EditComponent} from "./pages/edit/edit.component";
const routes: Routes = [{path: 'list', component: ListComponent}, {path: 'add', component: AddComponent}, {path: 'edit/:id', component: EditComponent}, {path: '', redirectTo: 'list'}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class GroupsRoutingModule {
}

View File

@ -1,6 +1,6 @@
<cre-entity-add
title="Création d'un groupe"
backButtonLink="/group/list"
backButtonLink="/admin/group/list"
[formFields]="formFields"
(submit)="submit($event)">
</cre-entity-add>

View File

@ -57,7 +57,7 @@ export class AddComponent extends ErrorHandlingComponent {
if (permissionsField.valid()) {
this.subscribeAndNavigate(
this.groupService.save(values.name, permissionsField.allEnabledPermissions),
'/group/list'
'/admin/group/list'
)
}
}

View File

@ -1,7 +1,7 @@
<cre-entity-edit
*ngIf="group"
title="Modifier le groupe {{group.name}}"
backButtonLink="/group/list"
backButtonLink="/admin/group/list"
deletePermission="REMOVE_USERS"
deleteConfirmMessage="Voulez-vous vraiment supprimer le groupe {{group.name}}?"
[entity]="group"

View File

@ -37,7 +37,7 @@ export class EditComponent extends ErrorHandlingComponent {
errorHandlers: ErrorHandler[] = [{
filter: error => error.type === 'notfound-employeegroup-id',
consumer: error => this.urlUtils.navigateTo('/group/list')
consumer: error => this.urlUtils.navigateTo('/admin/group/list')
}, {
filter: error => error.type === 'exists-employeegroup-name',
messageProducer: error => `Un groupe avec le nom '${error.name}' existe déjà`
@ -69,7 +69,7 @@ export class EditComponent extends ErrorHandlingComponent {
if (permissionsField.valid()) {
this.subscribeAndNavigate(
this.groupService.update(this.group.id, values.name, permissionsField.allEnabledPermissions),
'/group/list'
'/admin/group/list'
)
}
}
@ -77,7 +77,7 @@ export class EditComponent extends ErrorHandlingComponent {
delete() {
this.subscribeAndNavigate(
this.groupService.delete(this.group.id),
'/group/list'
'/admin/group/list'
)
}
}

View File

@ -1,5 +1,5 @@
<cre-entity-list
addLink="/group/add"
addLink="/admin/group/add"
addPermission="EDIT_USERS"
[entities$]="groups$"
[columns]="columns"

View File

@ -25,7 +25,7 @@ export class ListComponent extends ErrorHandlingComponent {
disabledFn: group => this.isDefaultGroup(group)
}, {
text: 'Modifier',
linkFn: group => `/group/edit/${group.id}`,
linkFn: group => `/admin/group/edit/${group.id}`,
permission: EmployeePermission.EDIT_USERS
}]

View File

@ -1,28 +1,23 @@
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {ListComponent} from "./pages/list/list.component";
import {AddComponent} from "./pages/add/add.component";
import {EditComponent} from "./pages/edit/edit.component";
import {NgModule} from '@angular/core'
import {RouterModule, Routes} from '@angular/router'
import {ListComponent} from './pages/list/list.component'
import {AddComponent} from './pages/add/add.component'
import {EditComponent} from './pages/edit/edit.component'
const routes: Routes = [
{
path: 'list',
component: ListComponent
},
{
path: 'add',
component: AddComponent
},
{
path: 'edit/:id',
component: EditComponent
},
{
path: '',
redirectTo: 'list'
}
];
const routes: Routes = [{
path: 'list',
component: ListComponent
}, {
path: 'add',
component: AddComponent
}, {
path: 'edit/:id',
component: EditComponent
}, {
path: '',
redirectTo: 'list'
}]
@NgModule({
imports: [RouterModule.forChild(routes)],

View File

@ -14,9 +14,8 @@ import {ErrorService} from '../../service/error.service'
export class HeaderComponent extends SubscribingComponent {
links: HeaderLink[] = [
{route: '/color', title: 'Couleurs', requiredPermission: EmployeePermission.VIEW_RECIPES},
{route: '/catalog', title: 'Catalogue', enabled: true, requiredPermission: EmployeePermission.VIEW_CATALOG},
{route: '/employee', title: 'Utilisateurs', requiredPermission: EmployeePermission.VIEW_USERS},
{route: '/group', title: 'Groupes', requiredPermission: EmployeePermission.VIEW_USERS},
{route: '/catalog', title: 'Catalogue', requiredPermission: EmployeePermission.VIEW_CATALOG},
{route: '/admin', title: 'Administration', requiredPermission: EmployeePermission.VIEW_USERS},
{route: '/account/login', title: 'Connexion', enabled: true},
{route: '/account/logout', title: 'Déconnexion', enabled: false},
]

View File

@ -0,0 +1,16 @@
import {Injectable, OnDestroy, OnInit} from '@angular/core'
import {GlobalAlertHandlerComponent} from '../global-alert-handler/global-alert-handler.component'
import {NavLink} from '../nav/nav.component'
@Injectable()
export abstract class SubMenuComponent implements OnInit, OnDestroy {
abstract links: NavLink[]
ngOnInit(): void {
GlobalAlertHandlerComponent.extraTopMarginMultiplier = 1
}
ngOnDestroy(): void {
GlobalAlertHandlerComponent.extraTopMarginMultiplier = 0
}
}

View File

@ -1,11 +1,8 @@
import {Component, ContentChildren, ViewChild, ViewContainerRef} from '@angular/core'
import {Component, ViewChild} from '@angular/core'
import {Validators} from '@angular/forms'
import {
currentPermissionsFieldComponent,
PermissionsFieldComponent
} from '../../../shared/components/permissions-field/permissions-field.component'
import {currentPermissionsFieldComponent} from '../../../shared/components/permissions-field/permissions-field.component'
import {GroupService} from '../../../groups/services/group.service'
import {EmployeeService} from '../../services/employee.service'
import {UserService} from '../../services/user.service'
import {ActivatedRoute, Router} from '@angular/router'
import {ErrorHandlingComponent} from '../../../shared/components/subscribing.component'
import {ErrorHandler, ErrorService} from '../../../shared/service/error.service'
@ -22,14 +19,14 @@ export class AddComponent extends ErrorHandlingComponent {
formFields: FormField[] = [{
name: 'id',
label: 'Numéro d\'employé',
label: 'Numéro d\'utilisateur',
icon: 'pound',
type: 'number',
required: true,
validator: Validators.compose([Validators.pattern(new RegExp('^[0-9]+$')), Validators.min(0)]),
errorMessages: [
{conditionFn: errors => errors.required, message: 'Un numéro d\'employé est requis'},
{conditionFn: errors => errors.pattern, message: 'Le numéro d\'employé doit être un nombre'}
{conditionFn: errors => errors.required, message: 'Un numéro d\'utilisateur est requis'},
{conditionFn: errors => errors.pattern, message: 'Le numéro d\'utilisateur doit être un nombre'}
]
}, {
name: 'firstName',
@ -84,7 +81,7 @@ export class AddComponent extends ErrorHandlingComponent {
}]
constructor(
private employeeService: EmployeeService,
private employeeService: UserService,
private groupService: GroupService,
errorService: ErrorService,
router: Router,
@ -112,7 +109,7 @@ export class AddComponent extends ErrorHandlingComponent {
groupId,
permissionsField.allEnabledPermissions
),
'/employee/list'
'/admin/user/list'
)
}
}

View File

@ -1,6 +1,6 @@
import {Component, ViewChild} from '@angular/core'
import {currentPermissionsFieldComponent} from '../../../shared/components/permissions-field/permissions-field.component'
import {EmployeeService} from '../../services/employee.service'
import {UserService} from '../../services/user.service'
import {GroupService} from '../../../groups/services/group.service'
import {ActivatedRoute, Router} from '@angular/router'
import {Employee} from '../../../shared/model/employee'
@ -21,7 +21,7 @@ export class EditComponent extends ErrorHandlingComponent {
employee: Employee | null
formFields: FormField[] = [{
name: 'id',
label: 'Numéro d\'employé',
label: 'Numéro d\'utilisateur',
icon: 'pound',
type: 'number',
readonly: true
@ -44,7 +44,7 @@ export class EditComponent extends ErrorHandlingComponent {
{conditionFn: errors => errors.required, message: 'Un nom est requis'}
]
}, {
name: 'groupId',
name: 'group',
label: 'Groupe',
icon: 'account-multiple',
type: 'select',
@ -60,7 +60,7 @@ export class EditComponent extends ErrorHandlingComponent {
errorHandlers: ErrorHandler[] = [{
filter: error => error.type === 'notfound-employee-id',
consumer: error => this.urlUtils.navigateTo('/employee/list')
consumer: error => this.urlUtils.navigateTo('/admin/user/list')
}, {
filter: error => error.type === 'exists-employee-fullName',
messageProducer: error => `Un utilisateur nommé '${error.fullName}' existe déjà`
@ -68,7 +68,7 @@ export class EditComponent extends ErrorHandlingComponent {
constructor(
private accountService: AccountService,
private employeeService: EmployeeService,
private employeeService: UserService,
private groupService: GroupService,
errorService: ErrorService,
router: Router,
@ -96,26 +96,11 @@ export class EditComponent extends ErrorHandlingComponent {
parseInt(values.id),
values.firstName,
values.lastName,
values.group,
permissionsField.allEnabledPermissions
),
() => {
// TODO de-comment when backend will be ready
// const group = values.groupId
// if (group >= 0) {
// this.subscribeAndNavigate(
// this.groupService.addEmployeeToGroup(group, this.employee),
// '/employee/list'
// )
// } else {
// if (this.employee.group) {
// this.subscribeAndNavigate(
// this.groupService.removeEmployeeFromGroup(this.employee),
// '/employee/list'
// )
// } else {
this.urlUtils.navigateTo('/employee/list')
// }
// }
this.urlUtils.navigateTo('/admin/user/list')
}
)
}
@ -124,7 +109,7 @@ export class EditComponent extends ErrorHandlingComponent {
delete() {
this.subscribeAndNavigate(
this.employeeService.delete(this.employee.id),
'/employee/list'
'/admin/user/list'
)
}
}

View File

@ -1,5 +1,5 @@
<cre-entity-list
addLink="/employee/add"
addLink="/admin/user/add"
addPermission="EDIT_USERS"
[entities$]="employees$"
[columns]="columns"

View File

@ -1,6 +1,6 @@
import {Component} from '@angular/core'
import {Observable} from 'rxjs'
import {EmployeeService} from '../../services/employee.service'
import {UserService} from '../../services/user.service'
import {Employee, EmployeePermission} from '../../../shared/model/employee'
import {takeUntil} from 'rxjs/operators'
import {AccountService} from '../../../accounts/services/account.service'
@ -24,7 +24,7 @@ import {ErrorService} from '../../../shared/service/error.service'
export class ListComponent extends ErrorHandlingComponent {
employees$: Observable<Employee[]>
columns = [
{def: 'id', title: 'Numéro d\'employé', valueFn: e => e.id},
{def: 'id', title: 'Numéro d\'utilisateur', valueFn: e => e.id},
{def: 'name', title: 'Nom', valueFn: e => `${e.firstName} ${e.lastName}`},
{def: 'group', title: 'Groupe', valueFn: e => e.group ? e.group.name : 'Aucun'},
{def: 'permissionCount', title: 'Nombre de permissions', valueFn: e => e.permissions.length},
@ -32,16 +32,16 @@ export class ListComponent extends ErrorHandlingComponent {
]
buttons = [{
text: 'Modifier',
linkFn: employee => `/employee/edit/${employee.id}`,
linkFn: employee => `/admin/user/edit/${employee.id}`,
permission: EmployeePermission.EDIT_USERS
}, {
text: 'Modifier mot de passe',
linkFn: employee => `/employee/password/edit/${employee.id}`,
linkFn: employee => `/admin/user/password/edit/${employee.id}`,
permission: EmployeePermission.EDIT_USERS
}]
constructor(
private employeeService: EmployeeService,
private employeeService: UserService,
private accountService: AccountService,
errorService: ErrorService,
router: Router,

View File

@ -1,6 +1,6 @@
import {Component} from '@angular/core'
import {ErrorHandlingComponent} from '../../../shared/components/subscribing.component'
import {EmployeeService} from '../../services/employee.service'
import {UserService} from '../../services/user.service'
import {Employee} from '../../../shared/model/employee'
import {ActivatedRoute, Router} from '@angular/router'
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'
@ -19,11 +19,11 @@ export class PasswordEditComponent extends ErrorHandlingComponent {
errorHandlers: ErrorHandler[] = [{
filter: error => error.type === 'notfound-employee-id',
consumer: error => this.urlUtils.navigateTo('/employee/list')
consumer: error => this.urlUtils.navigateTo('/admin/user/list')
}]
constructor(
private employeeService: EmployeeService,
private employeeService: UserService,
private formBuilder: FormBuilder,
errorService: ErrorService,
router: Router,
@ -49,7 +49,7 @@ export class PasswordEditComponent extends ErrorHandlingComponent {
if (this.form.valid) {
this.subscribeAndNavigate(
this.employeeService.updatePassword(this.employee.id, this.passwordControl.value),
'/employee/list'
'/admin/user/list'
)
}
}

View File

@ -6,7 +6,7 @@ import {Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class EmployeeService {
export class UserService {
constructor(
private api: ApiService
) {
@ -25,8 +25,8 @@ export class EmployeeService {
return this.api.post<Employee>('/employee', employee)
}
update(id: number, firstName: string, lastName: string, permissions: EmployeePermission[]): Observable<void> {
const employee = {id, firstName, lastName, permissions}
update(id: number, firstName: string, lastName: string, group: number, permissions: EmployeePermission[]): Observable<void> {
const employee = {id, firstName, lastName, groupId: group, permissions}
return this.api.put<void>('/employee', employee)
}

View File

@ -0,0 +1,28 @@
import {NgModule} from '@angular/core'
import {Routes, RouterModule} from '@angular/router'
import {ListComponent} from './pages/list/list.component'
import {AddComponent} from './pages/add/add.component'
import {EditComponent} from './pages/edit/edit.component'
import {PasswordEditComponent} from './pages/password-edit/password-edit.component'
const routes: Routes = [{
path: 'list',
component: ListComponent
}, {
path: 'add', component: AddComponent
}, {
path: 'edit/:id',
component: EditComponent
}, {
path: 'password/edit/:id', component: PasswordEditComponent
}, {
path: '', redirectTo: 'list'
}]
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class UserRoutingModule {
}

View File

@ -1,6 +1,6 @@
import {NgModule} from '@angular/core';
import {EmployeesRoutingModule} from './employees-routing.module';
import {UserRoutingModule} from './user-routing.module';
import {ListComponent} from './pages/list/list.component';
import {SharedModule} from "../shared/shared.module";
import { AddComponent } from './pages/add/add.component';
@ -12,9 +12,9 @@ import { PasswordEditComponent } from './pages/password-edit/password-edit.compo
@NgModule({
declarations: [ListComponent, AddComponent, EditComponent, PasswordEditComponent],
imports: [
EmployeesRoutingModule,
UserRoutingModule,
SharedModule,
MatSelectModule
]
})
export class EmployeesModule { }
export class UserModule { }

View File

@ -0,0 +1,2 @@
<cre-nav [links]="links"></cre-nav>
<router-outlet></router-outlet>

View File

@ -0,0 +1,16 @@
import {Component} from '@angular/core'
import {SubMenuComponent} from '../../modules/shared/components/sub-menu/sub-menu.component'
import {NavLink} from '../../modules/shared/components/nav/nav.component'
import {EmployeePermission} from '../../modules/shared/model/employee'
@Component({
selector: 'cre-administration',
templateUrl: './administration.component.html',
styleUrls: ['./administration.component.sass']
})
export class AdministrationComponent extends SubMenuComponent {
links: NavLink[] = [
{route: '/admin/user', title: 'Utilisateurs', permission: EmployeePermission.VIEW_USERS},
{route: '/admin/group', title: 'Groupes', permission: EmployeePermission.VIEW_USERS},
]
}

View File

@ -1,25 +1,17 @@
import {Component, OnDestroy, OnInit} from '@angular/core'
import {Component} from '@angular/core'
import {NavLink} from '../../modules/shared/components/nav/nav.component'
import {EmployeePermission} from '../../modules/shared/model/employee'
import {GlobalAlertHandlerComponent} from '../../modules/shared/components/global-alert-handler/global-alert-handler.component'
import {SubMenuComponent} from '../../modules/shared/components/sub-menu/sub-menu.component'
@Component({
selector: 'cre-inventory-page',
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.sass']
})
export class CatalogComponent implements OnInit, OnDestroy {
export class CatalogComponent extends SubMenuComponent {
links: NavLink[] = [
{route: '/catalog/materialtype', title: 'Types de produit', permission: EmployeePermission.VIEW_CATALOG},
{route: '/catalog/material', title: 'Inventaire', permission: EmployeePermission.VIEW_CATALOG},
{route: '/catalog/company', title: 'Bannières', permission: EmployeePermission.VIEW_CATALOG}
]
ngOnInit(): void {
GlobalAlertHandlerComponent.extraTopMarginMultiplier = 1
}
ngOnDestroy(): void {
GlobalAlertHandlerComponent.extraTopMarginMultiplier = 0
}
}