Ajout du préfixe du type de produit dans l'affichage des produits dans l'éditeur de mélange

This commit is contained in:
FyloZ 2021-04-06 09:26:59 -04:00
parent 84c4cb9179
commit 08dfd83b66
2 changed files with 8 additions and 3 deletions

View File

@ -72,13 +72,12 @@
<td mat-cell *matCellDef="let mixMaterial">
<mat-form-field *ngIf="materials">
<mat-select
#select
[value]="mixMaterial.materialId"
(valueChange)="setMixMaterialMaterial(mixMaterial, $event)">
<mat-option
*ngFor="let material of getAvailableMaterials(mixMaterial)"
[value]="material.id">
{{material.name}}
{{materialDisplayName(material)}}
</mat-option>
</mat-select>
</mat-form-field>

View File

@ -21,7 +21,6 @@ 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',
@ -156,6 +155,13 @@ export class MixEditorComponent extends ErrorHandlingComponent {
return this.materials.filter(m => mixMaterial.materialId === m.id || this.mixMaterials.filter(mm => mm.materialId === m.id).length === 0)
}
materialDisplayName(material: Material): string {
if (material.materialType.prefix) {
return `[${material.materialType.prefix}] ${material.name}`
}
return material.name
}
get canDeleteMix() {
return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPES)
}