From 08dfd83b66ca2a6eef2cd9d7e7def8675e7f5870 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Tue, 6 Apr 2021 09:26:59 -0400 Subject: [PATCH 1/3] =?UTF-8?q?Ajout=20du=20pr=C3=A9fixe=20du=20type=20de?= =?UTF-8?q?=20produit=20dans=20l'affichage=20des=20produits=20dans=20l'?= =?UTF-8?q?=C3=A9diteur=20de=20m=C3=A9lange?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mix-editor/mix-editor.component.html | 3 +-- .../colors/components/mix-editor/mix-editor.component.ts | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) 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 7a356dc..34a267b 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 @@ -72,13 +72,12 @@ - {{material.name}} + {{materialDisplayName(material)}} 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 41c9fd9..961e3dc 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 @@ -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) } From cb35f8e5952161753317f73970e73e407e182092 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Tue, 6 Apr 2021 10:51:41 -0400 Subject: [PATCH 2/3] =?UTF-8?q?Les=20produits=20dans=20l'=C3=A9diteur=20de?= =?UTF-8?q?=20m=C3=A9lange=20sont=20maintenant=20tri=C3=A9s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mix-editor/mix-editor.component.html | 2 +- .../mix-editor/mix-editor.component.ts | 26 ++++++++++++++++++- .../material/service/material.service.ts | 4 +-- 3 files changed, 28 insertions(+), 4 deletions(-) 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 34a267b..7417836 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 @@ -75,7 +75,7 @@ [value]="mixMaterial.materialId" (valueChange)="setMixMaterialMaterial(mixMaterial, $event)"> {{materialDisplayName(material)}} 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 961e3dc..a0bdfef 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 @@ -4,7 +4,7 @@ import { MixMaterial, MixMaterialDto, mixMaterialsAsMixMaterialsDto, - Recipe, RecipeStep, + Recipe, sortMixMaterialsDto } from '../../../shared/model/recipe.model' import {ErrorHandlingComponent} from '../../../shared/components/subscribing.component' @@ -162,6 +162,30 @@ export class MixEditorComponent extends ErrorHandlingComponent { return material.name } + sortedMaterials(materials: Material[]): Material[] { + return materials.sort((a, b) => { + const aPrefixName = a.materialType.prefix.toLowerCase() + const bPrefixName = b.materialType.prefix.toLowerCase() + + if (aPrefixName < bPrefixName) { + return -1 + } else if (aPrefixName > bPrefixName) { + return 1 + } else { + const aName = a.name.toLowerCase() + const bName = b.name.toLowerCase() + + if (aName < bName) { + return -1 + } else if (aName > bName) { + return 1 + } else { + return 0 + } + } + }) + } + get canDeleteMix() { return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPES) } diff --git a/src/app/modules/material/service/material.service.ts b/src/app/modules/material/service/material.service.ts index ddf0ca4..709f0f1 100644 --- a/src/app/modules/material/service/material.service.ts +++ b/src/app/modules/material/service/material.service.ts @@ -45,7 +45,7 @@ export class MaterialService { const body = new FormData() body.append('name', name) body.append('inventoryQuantity', inventoryQuantity.toString()) - body.append('materialType', materialType.toString()) + body.append('materialTypeId', materialType.toString()) if (simdutFile && simdutFile.files) { body.append('simdutFile', simdutFile.files[0]) } @@ -57,7 +57,7 @@ export class MaterialService { body.append('id', id.toString()) body.append('name', name) body.append('inventoryQuantity', inventoryQuantity.toString()) - body.append('materialType', materialType.toString()) + body.append('materialTypeId', materialType.toString()) if (simdutFile) { body.append('simdutFile', simdutFile) } From 75bbbfeac13d1113bef40112ea7dbc338604471a Mon Sep 17 00:00:00 2001 From: FyloZ Date: Tue, 6 Apr 2021 10:54:02 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Ajout=20du=20nom=20de=20la=20banni=C3=A8re?= =?UTF-8?q?=20dans=20les=20crit=C3=A8res=20de=20recherche=20des=20recettes?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/modules/colors/pages/list/list.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/modules/colors/pages/list/list.component.ts b/src/app/modules/colors/pages/list/list.component.ts index 84d98ac..21c3670 100644 --- a/src/app/modules/colors/pages/list/list.component.ts +++ b/src/app/modules/colors/pages/list/list.component.ts @@ -65,7 +65,8 @@ export class ListComponent extends ErrorHandlingComponent { } private recipeMatchesSearchQuery(recipe: Recipe) { - const matches = this.searchString(recipe.name) || + const matches = this.searchString(recipe.company.name) || + this.searchString(recipe.name) || this.searchString(recipe.description) || (recipe.sample && this.searchString(recipe.sample.toString())) this.hiddenRecipes[recipe.id] = !matches