Ajout d'une icône lorsque l'approbation d'une recette est expirée

This commit is contained in:
FyloZ 2021-04-12 08:58:51 -04:00
parent e3357f27b7
commit 257d337b39
2 changed files with 18 additions and 3 deletions

View File

@ -72,8 +72,19 @@
<!-- Icons -->
<ng-container matColumnDef="iconNotApproved">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let recipe" [class.disabled]="recipe.approbationDate">
<mat-icon svgIcon="alert" class="color-warning" title="Cette recette n'est pas approuvée"></mat-icon>
<td mat-cell *matCellDef="let recipe">
<mat-icon
*ngIf="!recipe.approbationDate"
svgIcon="alert"
class="color-warning"
title="Cette recette n'est pas approuvée">
</mat-icon>
<mat-icon
*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)">
</mat-icon>
</td>
</ng-container>

View File

@ -3,7 +3,7 @@ import {ErrorHandlingComponent} from '../../../shared/components/subscribing.com
import {RecipeService} from '../../services/recipe.service'
import {EmployeePermission} from '../../../shared/model/employee'
import {AccountService} from '../../../accounts/services/account.service'
import {getRecipeLuma, Recipe} from '../../../shared/model/recipe.model'
import {getRecipeLuma, isRecipeApprobationExpired, Recipe} from '../../../shared/model/recipe.model'
import {ActivatedRoute, Router} from '@angular/router'
import {ErrorModel, ErrorService} from '../../../shared/service/error.service'
@ -52,6 +52,10 @@ export class ListComponent extends ErrorHandlingComponent {
.forEach(r => this.recipeMatchesSearchQuery(r))
}
isRecipeApprobationExpired(recipe: Recipe): boolean {
return isRecipeApprobationExpired(recipe)
}
isCompanyHidden(companyRecipes: Recipe[]): boolean {
return (this.searchQuery && this.searchQuery.length > 0) && companyRecipes.map(r => this.hiddenRecipes[r.id]).filter(r => !r).length <= 0
}