From 83d8b30207c4122f354c61bf05fedafc3e2a6ca7 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Sat, 20 Mar 2021 13:47:57 -0400 Subject: [PATCH] Inventaire --- src/app/modules/colors/colors.module.ts | 17 +- .../mix-table/mix-table.component.html | 4 +- .../mix-table/mix-table.component.ts | 3 +- .../pages/explore/explore.component.html | 3 +- .../colors/pages/explore/explore.component.ts | 27 ++-- .../modules/colors/services/recipe.service.ts | 45 +----- .../employees/pages/add/add.component.ts | 3 +- .../employees/pages/edit/edit.component.ts | 31 ++-- .../groups/pages/list/list.component.ts | 3 +- .../modules/groups/services/group.service.ts | 3 +- .../material/material-routing.module.ts | 4 +- src/app/modules/material/material.module.ts | 12 +- .../pages/inventory/inventory.component.html | 148 ++++++++++++++++++ .../pages/inventory/inventory.component.sass | 8 + .../pages/inventory/inventory.component.ts | 128 +++++++++++++++ .../material/pages/list/list.component.html | 8 - .../material/pages/list/list.component.sass | 0 .../material/pages/list/list.component.ts | 69 -------- .../material/service/inventory.service.ts | 29 ++++ .../material/service/material.service.ts | 4 + src/app/modules/shared/model/employee.ts | 3 +- src/app/pages/catalog/catalog.component.ts | 2 +- 22 files changed, 387 insertions(+), 167 deletions(-) create mode 100644 src/app/modules/material/pages/inventory/inventory.component.html create mode 100644 src/app/modules/material/pages/inventory/inventory.component.sass create mode 100644 src/app/modules/material/pages/inventory/inventory.component.ts delete mode 100644 src/app/modules/material/pages/list/list.component.html delete mode 100644 src/app/modules/material/pages/list/list.component.sass delete mode 100644 src/app/modules/material/pages/list/list.component.ts create mode 100644 src/app/modules/material/service/inventory.service.ts diff --git a/src/app/modules/colors/colors.module.ts b/src/app/modules/colors/colors.module.ts index fec9c19..75a9ad1 100644 --- a/src/app/modules/colors/colors.module.ts +++ b/src/app/modules/colors/colors.module.ts @@ -21,13 +21,16 @@ import { MixesCardComponent } from './components/mixes-card/mixes-card.component @NgModule({ - declarations: [ListComponent, AddComponent, EditComponent, ExploreComponent, RecipeInfoComponent, MixTableComponent, StepListComponent, StepTableComponent, MixEditorComponent, UnitSelectorComponent, MixAddComponent, MixEditComponent, ImagesEditorComponent, MixesCardComponent], - imports: [ - ColorsRoutingModule, - SharedModule, - MatExpansionModule, - FormsModule - ] + declarations: [ListComponent, AddComponent, EditComponent, ExploreComponent, RecipeInfoComponent, MixTableComponent, StepListComponent, StepTableComponent, MixEditorComponent, UnitSelectorComponent, MixAddComponent, MixEditComponent, ImagesEditorComponent, MixesCardComponent], + exports: [ + UnitSelectorComponent + ], + imports: [ + ColorsRoutingModule, + SharedModule, + MatExpansionModule, + FormsModule + ] }) export class ColorsModule { } diff --git a/src/app/modules/colors/components/mix-table/mix-table.component.html b/src/app/modules/colors/components/mix-table/mix-table.component.html index a0e1034..7b0738c 100644 --- a/src/app/modules/colors/components/mix-table/mix-table.component.html +++ b/src/app/modules/colors/components/mix-table/mix-table.component.html @@ -15,7 +15,7 @@
- +
@@ -115,7 +115,7 @@ diff --git a/src/app/modules/colors/components/mix-table/mix-table.component.ts b/src/app/modules/colors/components/mix-table/mix-table.component.ts index 70baa00..bb67518 100644 --- a/src/app/modules/colors/components/mix-table/mix-table.component.ts +++ b/src/app/modules/colors/components/mix-table/mix-table.component.ts @@ -119,7 +119,8 @@ export class MixTableComponent extends SubscribingComponent { } isInLowQuantity(materialId: number): boolean { - return this.deductErrorBody[this.mix.id] && this.deductErrorBody[this.mix.id].indexOf(materialId) >= 0 + return this.deductErrorBody.mix === this.mix.id && + this.deductErrorBody.lowQuantities.filter(l => l.material === materialId).length > 0 } round(quantity: number): number { diff --git a/src/app/modules/colors/pages/explore/explore.component.html b/src/app/modules/colors/pages/explore/explore.component.html index 3cb2ce7..eadbe1e 100644 --- a/src/app/modules/colors/pages/explore/explore.component.html +++ b/src/app/modules/colors/pages/explore/explore.component.html @@ -9,7 +9,6 @@ - @@ -31,7 +30,7 @@ [units$]="units$" (quantityChange)="changeQuantity($event)" (locationChange)="changeMixLocation($event)" - (deduct)="deductMixQuantities($event)"> + (deduct)="deductMix($event)"> diff --git a/src/app/modules/colors/pages/explore/explore.component.ts b/src/app/modules/colors/pages/explore/explore.component.ts index a71ed01..e54310c 100644 --- a/src/app/modules/colors/pages/explore/explore.component.ts +++ b/src/app/modules/colors/pages/explore/explore.component.ts @@ -23,9 +23,10 @@ export class ExploreComponent extends ErrorHandlingComponent { quantitiesChanges = new Map>() mixesLocationChanges = new Map() + deductedMixId: number | null handledErrorModels: ErrorModel[] = [{ filter: error => error.status === 409, - consumer: error => this.deductErrorBody = error.error, + consumer: error => this.deductErrorBody = {mix: this.deductedMixId, lowQuantities: error.error.lowQuantities}, messageProducer: () => 'Certains produit ne sont pas en quantité suffisante dans l\'inventaire' }] @@ -52,7 +53,7 @@ export class ExploreComponent extends ErrorHandlingComponent { this.note = r.note if (this.recipe.mixes.length <= 0 || this.recipe.steps.length <= 0) { - this.alertService.pushWarning("Cette recette n'est pas complète") + this.alertService.pushWarning('Cette recette n\'est pas complète') } }, '/colors/list' @@ -60,7 +61,7 @@ export class ExploreComponent extends ErrorHandlingComponent { } ngOnDestroy() { - super.ngOnDestroy(); + super.ngOnDestroy() GlobalAlertHandlerComponent.extraTopMarginMultiplier = 0 } @@ -93,18 +94,22 @@ export class ExploreComponent extends ErrorHandlingComponent { ) } - deductQuantities() { - this.performDeductQuantities(this.recipeService.deductQuantities(this.recipe, this.quantitiesChanges)) + deductMix(mixId: number) { + this.deductedMixId = mixId + const firstMixMaterial = this.recipe.mixes.filter(m => m.id === mixId)[0].mixMaterials[0] + if (this.quantitiesChanges.has(mixId) && this.quantitiesChanges.get(mixId).has(firstMixMaterial.material.id)) { + const originalQuantity = firstMixMaterial.quantity + const currentQuantity = this.quantitiesChanges.get(mixId).get(firstMixMaterial.material.id) + this.subscribeDeductMix(this.recipeService.deductMixFromQuantities(mixId, originalQuantity, currentQuantity)) + } else { + this.subscribeDeductMix(this.recipeService.deductMix(mixId, 1)) + } } - deductMixQuantities(mixId: number) { - this.performDeductQuantities(this.recipeService.deductMixQuantities(this.recipe, mixId, this.quantitiesChanges.get(mixId))) - } - - performDeductQuantities(observable: Observable) { + subscribeDeductMix(observable: Observable) { this.subscribe( observable, - () => this.alertService.pushSuccess('Les quantités des produits utilisés ont été déduites de l\'inventaire'), + () => this.alertService.pushSuccess('Les quantités quantités ont été déduites de l\'inventaire'), true ) } diff --git a/src/app/modules/colors/services/recipe.service.ts b/src/app/modules/colors/services/recipe.service.ts index 17e74b7..bde2768 100644 --- a/src/app/modules/colors/services/recipe.service.ts +++ b/src/app/modules/colors/services/recipe.service.ts @@ -3,6 +3,7 @@ import {ApiService} from '../../shared/service/api.service' import {Observable} from 'rxjs' import {Recipe, RecipeStep} from '../../shared/model/recipe.model' import {map} from 'rxjs/operators' +import {MaterialQuantity} from '../../material/service/inventory.service' @Injectable({ providedIn: 'root' @@ -63,46 +64,12 @@ export class RecipeService { return this.api.put('/recipe/public', body) } - deductMixQuantities(recipe: Recipe, mixId: number, quantities: Map): Observable { - return this.sendDeductBody(this.buildDeductMixBody(recipe, mixId, quantities)) + deductMixFromQuantities(mixId: number, originalQuantity: number, currentQuantity: number): Observable { + return this.deductMix(mixId, currentQuantity / originalQuantity) } - deductQuantities(recipe: Recipe, quantities: Map>): Observable { - return this.sendDeductBody(this.buildDeductBody(recipe, quantities)) - } - - delete(id: number): Observable { - return this.api.delete(`/recipe/${id}`) - } - - private buildDeductMixBody(recipe: Recipe, mixId: number, quantities: Map): any { - const mix = recipe.mixes.filter(m => m.id === mixId)[0] - const body = {id: recipe.id, quantities: {}} - body.quantities[mixId] = {} - const firstMaterial = mix.mixMaterials[0].material.id - mix.mixMaterials.forEach(m => { - if (quantities && quantities.has(m.material.id)) { - body.quantities[mix.id][m.material.id] = quantities.get(m.material.id) - } else { - let quantity = m.quantity - if (m.material.materialType.usePercentages) { - quantity = body.quantities[mix.id][firstMaterial] * (quantity / 100) - } - body.quantities[mix.id][m.material.id] = quantity - } - }) - return body - } - - private buildDeductBody(recipe: Recipe, quantities: Map>): any { - const body = {id: recipe.id, quantities: {}} - recipe.mixes.forEach(mix => { - body.quantities[mix.id] = this.buildDeductMixBody(recipe, mix.id, quantities.get(mix.id)).quantities[mix.id] - }) - return body - } - - private sendDeductBody(body: any): Observable { - return this.api.put('/recipe/deduct', body) + deductMix(mixId: number, ratio: number): Observable { + const body = {id: mixId, ratio} + return this.api.put('/inventory/deduct/mix', body) } } diff --git a/src/app/modules/employees/pages/add/add.component.ts b/src/app/modules/employees/pages/add/add.component.ts index 97f5f13..dd6e404 100644 --- a/src/app/modules/employees/pages/add/add.component.ts +++ b/src/app/modules/employees/pages/add/add.component.ts @@ -94,13 +94,14 @@ export class AddComponent extends ErrorHandlingComponent { submit(values) { const permissionsField = currentPermissionsFieldComponent if (permissionsField.valid()) { + const groupId = values.groupId >= 0 ? values.groupId : null this.subscribeAndNavigate( this.employeeService.save( values.id, values.firstName, values.lastName, values.password, - values.groupId, + groupId, permissionsField.allEnabledPermissions ), '/employee/list' diff --git a/src/app/modules/employees/pages/edit/edit.component.ts b/src/app/modules/employees/pages/edit/edit.component.ts index 5ddd2f3..15b49a1 100644 --- a/src/app/modules/employees/pages/edit/edit.component.ts +++ b/src/app/modules/employees/pages/edit/edit.component.ts @@ -92,22 +92,23 @@ export class EditComponent extends ErrorHandlingComponent { permissionsField.allEnabledPermissions ), () => { - 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 { + // 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') - } - } + // } + // } } ) } diff --git a/src/app/modules/groups/pages/list/list.component.ts b/src/app/modules/groups/pages/list/list.component.ts index dc2e7a2..e1a917a 100644 --- a/src/app/modules/groups/pages/list/list.component.ts +++ b/src/app/modules/groups/pages/list/list.component.ts @@ -18,8 +18,7 @@ export class ListComponent extends ErrorHandlingComponent { defaultGroup: EmployeeGroup = null columns = [ {def: 'name', title: 'Nom', valueFn: g => g.name}, - {def: 'permissionCount', title: 'Nombre de permissions', valueFn: g => g.permissions.length}, - {def: 'employeeCount', title: 'Nombre d\'utilisateurs', valueFn: g => g.employeeCount} + {def: 'permissionCount', title: 'Nombre de permissions', valueFn: g => g.permissions.length} ] buttons = [{ text: 'Définir par défaut', diff --git a/src/app/modules/groups/services/group.service.ts b/src/app/modules/groups/services/group.service.ts index 49bc2ca..fe56c48 100644 --- a/src/app/modules/groups/services/group.service.ts +++ b/src/app/modules/groups/services/group.service.ts @@ -18,8 +18,7 @@ export class GroupService { .pipe(tap(groups => groups.unshift({ id: -1, name: 'Aucun', - permissions: [], - employeeCount: 0 + permissions: [] }))) } diff --git a/src/app/modules/material/material-routing.module.ts b/src/app/modules/material/material-routing.module.ts index fa245a6..53b4ba5 100644 --- a/src/app/modules/material/material-routing.module.ts +++ b/src/app/modules/material/material-routing.module.ts @@ -1,12 +1,12 @@ import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; -import {ListComponent} from "./pages/list/list.component"; +import {InventoryComponent} from "./pages/inventory/inventory.component"; import {AddComponent} from "./pages/add/add.component"; import {EditComponent} from "./pages/edit/edit.component"; const routes: Routes = [{ path: 'list', - component: ListComponent + component: InventoryComponent }, { path: 'add', component: AddComponent diff --git a/src/app/modules/material/material.module.ts b/src/app/modules/material/material.module.ts index f51cfcb..6ccb444 100644 --- a/src/app/modules/material/material.module.ts +++ b/src/app/modules/material/material.module.ts @@ -2,18 +2,24 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MaterialRoutingModule} from './material-routing.module'; -import {ListComponent} from './pages/list/list.component'; +import {InventoryComponent} from './pages/inventory/inventory.component'; import {SharedModule} from "../shared/shared.module"; import {AddComponent} from './pages/add/add.component'; import {EditComponent} from './pages/edit/edit.component'; +import {ColorsModule} from '../colors/colors.module' +import {MatSortModule} from '@angular/material/sort' +import {FormsModule} from '@angular/forms' @NgModule({ - declarations: [ListComponent, AddComponent, EditComponent], + declarations: [InventoryComponent, AddComponent, EditComponent], imports: [ CommonModule, MaterialRoutingModule, - SharedModule + SharedModule, + ColorsModule, + MatSortModule, + FormsModule ] }) export class MaterialModule { diff --git a/src/app/modules/material/pages/inventory/inventory.component.html b/src/app/modules/material/pages/inventory/inventory.component.html new file mode 100644 index 0000000..6b05a5a --- /dev/null +++ b/src/app/modules/material/pages/inventory/inventory.component.html @@ -0,0 +1,148 @@ +
+ +
+ + Recherche par code... + + + + Recherche par type de produit + + + {{materialType.name}} + + + +
+ + +
+ + Quantité faible + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Code{{material.name}}Type de produit{{material.materialType.name}}Quantité{{getQuantity(material)}} {{units}} +
+ +
+ +
+
+
+ + + + + + + + + + + + + +
diff --git a/src/app/modules/material/pages/inventory/inventory.component.sass b/src/app/modules/material/pages/inventory/inventory.component.sass new file mode 100644 index 0000000..20ded20 --- /dev/null +++ b/src/app/modules/material/pages/inventory/inventory.component.sass @@ -0,0 +1,8 @@ +.input-group-append button + border-radius: 0 4px 4px 0 + +mat-select + margin-top: 4px + +.form-control + width: 6rem diff --git a/src/app/modules/material/pages/inventory/inventory.component.ts b/src/app/modules/material/pages/inventory/inventory.component.ts new file mode 100644 index 0000000..3843e18 --- /dev/null +++ b/src/app/modules/material/pages/inventory/inventory.component.ts @@ -0,0 +1,128 @@ +import {Component, ViewChild} from '@angular/core' +import {ErrorHandlingComponent} from '../../../shared/components/subscribing.component' +import {MaterialService} from '../../service/material.service' +import {EmployeePermission} from '../../../shared/model/employee' +import {ActivatedRoute, Router} from '@angular/router' +import {ErrorService} from '../../../shared/service/error.service' +import {Material} from '../../../shared/model/material.model' +import {AccountService} from '../../../accounts/services/account.service' +import {convertQuantity, UNIT_MILLILITER} from '../../../shared/units' +import {MatSort} from '@angular/material/sort' +import {MatTableDataSource} from '@angular/material/table' +import {MaterialTypeService} from '../../../material-type/service/material-type.service' +import {InventoryService} from '../../service/inventory.service' +import {environment} from '../../../../../environments/environment' + +@Component({ + selector: 'cre-list', + templateUrl: './inventory.component.html', + styleUrls: ['./inventory.component.sass'] +}) +export class InventoryComponent extends ErrorHandlingComponent { + @ViewChild(MatSort) sort: MatSort + + materials: Material[] | null + materialTypes$ = this.materialTypeService.all + dataSource: MatTableDataSource + hasSimdut: any + + columns = ['name', 'materialType', 'quantity', 'addQuantity', 'lowQuantityIcon', 'simdutIcon', 'editButton', 'openSimdutButton'] + hoveredMaterial: Material | null + + units = UNIT_MILLILITER + lowQuantityThreshold = 100 // TEMPORARY will be in the application settings + materialTypeFilter = 1 + materialNameFilter = '' + + constructor( + private materialService: MaterialService, + private materialTypeService: MaterialTypeService, + private inventoryService: InventoryService, + private accountService: AccountService, + errorService: ErrorService, + router: Router, + activatedRoute: ActivatedRoute + ) { + super(errorService, activatedRoute, router) + } + + ngOnInit() { + super.ngOnInit() + + this.subscribe( + this.materialService.allNotMixType, + materials => { + this.materials = materials + this.dataSource = this.setupDataSource() + }, + true, + 1 + ) + + this.subscribe( + this.materialService.getSimduts(), + ids => this.hasSimdut = ids, + false, + 1 + ) + } + + setupDataSource(): MatTableDataSource { + this.dataSource = new MatTableDataSource(this.materials) + this.dataSource.sortingDataAccessor = (material, header) => { + switch (header) { + case 'materialType': + return material[header].name + case 'lowQuantityIcon': + return this.isLowQuantity(material) + default: + return material[header] + } + } + this.dataSource.filterPredicate = (material, filter) => { + return (!this.materialTypeFilter || this.materialTypeFilter === 1 || material.materialType.id === this.materialTypeFilter) && + (!this.materialNameFilter || material.name.toLowerCase().includes(this.materialNameFilter.toLowerCase())) + } + + this.dataSource.sort = this.sort + return this.dataSource + } + + filterDataSource() { + this.dataSource.filter = 'filter' + } + + isLowQuantity(material: Material) { + return this.getQuantity(material) < this.lowQuantityThreshold + } + + getQuantity(material: Material): number { + return Math.round(convertQuantity(material.inventoryQuantity, UNIT_MILLILITER, this.units) * 100) / 100 + } + + materialHasSimdut(material: Material): boolean { + return this.hasSimdut && this.hasSimdut.filter(i => i === material.id).length > 0 + } + + openSimdut(material: Material) { + window.open(`${environment.apiUrl}/material/${material.id}/simdut`, '_blank') + } + + addQuantity(material: Material, input: HTMLInputElement) { + const quantity = input.valueAsNumber + this.subscribe( + this.inventoryService.add(material.id, quantity), + materialQuantities => { + // Reset the input value + input.value = null + + material.inventoryQuantity = parseInt(materialQuantities.filter(mq => mq.material === material.id)[0].quantity) + }, + true + ) + } + + get canEditMaterial(): boolean { + return this.accountService.hasPermission(EmployeePermission.EDIT_MATERIAL) + } +} diff --git a/src/app/modules/material/pages/list/list.component.html b/src/app/modules/material/pages/list/list.component.html deleted file mode 100644 index f14e70a..0000000 --- a/src/app/modules/material/pages/list/list.component.html +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/src/app/modules/material/pages/list/list.component.sass b/src/app/modules/material/pages/list/list.component.sass deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/modules/material/pages/list/list.component.ts b/src/app/modules/material/pages/list/list.component.ts deleted file mode 100644 index 96686fa..0000000 --- a/src/app/modules/material/pages/list/list.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -import {Component} from '@angular/core' -import {ErrorHandlingComponent} from '../../../shared/components/subscribing.component' -import {MaterialService} from '../../service/material.service' -import {EmployeePermission} from '../../../shared/model/employee' -import {environment} from '../../../../../environments/environment' -import {ActivatedRoute, Router} from '@angular/router' -import {ErrorService} from '../../../shared/service/error.service' - -@Component({ - selector: 'cre-list', - templateUrl: './list.component.html', - styleUrls: ['./list.component.sass'] -}) -export class ListComponent extends ErrorHandlingComponent { - materials$ = this.materialService.allNotMixType - columns = [ - {def: 'name', title: 'Code', valueFn: t => t.name}, - {def: 'inventoryQuantity', title: 'Quantité', valueFn: t => t.inventoryQuantity}, - {def: 'materialType', title: 'Type de produit', valueFn: t => t.materialType.name} - ] - icons = [{ - icon: 'text-box-remove', - color: 'warn', - title: 'Ce produit n\'a pas de fiche signalitique', - disabledFn: t => this.hasSimdutMap[t.id] - }] - buttons = [{ - text: 'Modifier', - linkFn: t => `/catalog/material/edit/${t.id}`, - permission: EmployeePermission.EDIT_MATERIAL - }, { - text: 'Fiche signalitique', - linkFn: t => { - return { - externalLink: environment.apiUrl + `/material/${t.id}/simdut` - } - }, - disabledFn: t => !this.hasSimdutMap[t.id] - }] - - private hasSimdutMap: any = {} - - constructor( - private materialService: MaterialService, - errorService: ErrorService, - router: Router, - activatedRoute: ActivatedRoute - ) { - super(errorService, activatedRoute, router) - } - - ngOnInit() { - super.ngOnInit() - - this.subscribe( - this.materials$, - mArray => { - mArray.forEach(m => { - this.subscribe( - this.materialService.hasSimdut(m.id), - b => this.hasSimdutMap[m.id] = b - ) - }) - }, - false, - 1 - ) - } -} diff --git a/src/app/modules/material/service/inventory.service.ts b/src/app/modules/material/service/inventory.service.ts new file mode 100644 index 0000000..2429fce --- /dev/null +++ b/src/app/modules/material/service/inventory.service.ts @@ -0,0 +1,29 @@ +import {Injectable} from '@angular/core' +import {ApiService} from '../../shared/service/api.service' +import {Observable} from 'rxjs' + +@Injectable({ + providedIn: 'root' +}) +export class InventoryService { + constructor( + private api: ApiService + ) { + } + + add(material: number, quantity: number): Observable { + return this.api.put('/material/inventory/add', [{material, quantity}]) + } + + deduct(materialQuantities: [{material: number, quantity: number}]): Observable { + return this.api.put('/material/inventory/deduct', materialQuantities) + } +} + +export class MaterialQuantity { + constructor( + public material: number, + public quantity: number + ) { + } +} diff --git a/src/app/modules/material/service/material.service.ts b/src/app/modules/material/service/material.service.ts index c8ea1d8..ddf0ca4 100644 --- a/src/app/modules/material/service/material.service.ts +++ b/src/app/modules/material/service/material.service.ts @@ -37,6 +37,10 @@ export class MaterialService { return this.api.get(`/material/${id}/simdut/exists`) } + getSimduts(): Observable { + return this.api.get('/material/simdut') + } + save(name: string, inventoryQuantity: number, materialType: number, simdutFile: FileInput): Observable { const body = new FormData() body.append('name', name) diff --git a/src/app/modules/shared/model/employee.ts b/src/app/modules/shared/model/employee.ts index 3fbb75d..5472bb8 100644 --- a/src/app/modules/shared/model/employee.ts +++ b/src/app/modules/shared/model/employee.ts @@ -15,8 +15,7 @@ export class EmployeeGroup { constructor( public id: number, public name: string, - public permissions: EmployeePermission[], - public employeeCount: number + public permissions: EmployeePermission[] ) { } } diff --git a/src/app/pages/catalog/catalog.component.ts b/src/app/pages/catalog/catalog.component.ts index 60ca21b..79ec177 100644 --- a/src/app/pages/catalog/catalog.component.ts +++ b/src/app/pages/catalog/catalog.component.ts @@ -11,7 +11,7 @@ import {GlobalAlertHandlerComponent} from '../../modules/shared/components/globa export class CatalogComponent implements OnInit, OnDestroy { links: NavLink[] = [ {route: '/catalog/materialtype', title: 'Types de produit', permission: EmployeePermission.VIEW_MATERIAL_TYPE}, - {route: '/catalog/material', title: 'Produits', permission: EmployeePermission.VIEW_MATERIAL}, + {route: '/catalog/material', title: 'Inventaire', permission: EmployeePermission.VIEW_MATERIAL}, {route: '/catalog/company', title: 'Bannières', permission: EmployeePermission.VIEW_COMPANY} ]