diff --git a/src/app/modules/colors/components/mix-editor/mix-editor.component.html b/src/app/modules/colors/components/mix-editor/mix-editor.component.html index 0378e9d..3c5f35e 100644 --- a/src/app/modules/colors/components/mix-editor/mix-editor.component.html +++ b/src/app/modules/colors/components/mix-editor/mix-editor.component.html @@ -46,8 +46,8 @@ Produit - - + {{material.name}} @@ -99,7 +99,7 @@ diff --git a/src/app/modules/colors/components/mix-editor/mix-editor.component.ts b/src/app/modules/colors/components/mix-editor/mix-editor.component.ts index e3e212d..6420169 100644 --- a/src/app/modules/colors/components/mix-editor/mix-editor.component.ts +++ b/src/app/modules/colors/components/mix-editor/mix-editor.component.ts @@ -16,6 +16,7 @@ import {ConfirmBoxComponent} from '../../../shared/components/confirm-box/confir import {AccountService} from '../../../accounts/services/account.service' import {EmployeePermission} from '../../../shared/model/employee' import {ErrorService} from '../../../shared/service/error.service' +import {MatSelect} from '@angular/material/select' @Component({ selector: 'cre-mix-editor', @@ -131,6 +132,10 @@ export class MixEditorComponent extends SubscribingComponent { return id ? this.materials.filter(m => m.id === id)[0] : null } + getAvailableMaterials(selector: MatSelect): Material[] { + return this.materials.filter(m => selector.value === m.id || this.mixMaterials.filter(mm => mm.materialId === m.id).length === 0) + } + get canDeleteMix() { return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPE) } diff --git a/src/app/modules/employees/pages/edit/edit.component.ts b/src/app/modules/employees/pages/edit/edit.component.ts index ad45c80..27d8478 100644 --- a/src/app/modules/employees/pages/edit/edit.component.ts +++ b/src/app/modules/employees/pages/edit/edit.component.ts @@ -97,7 +97,7 @@ export class EditComponent extends ErrorHandlingComponent { } get idControl(): FormControl { - this._idControl = this.lazyControl(this._idControl, () => new FormControl(this.employee.id, Validators.compose([Validators.required, Validators.pattern(new RegExp('^[0-9]+$')), Validators.min(0)]))) + this._idControl = this.lazyControl(this._idControl, () => new FormControl({value: this.employee.id, disabled: true}, Validators.compose([Validators.required, Validators.pattern(new RegExp('^[0-9]+$')), Validators.min(0)]))) return this._idControl }