diff --git a/src/app/modules/colors/components/recipe-info/recipe-info.component.html b/src/app/modules/colors/components/recipe-info/recipe-info.component.html
index cf8819f..5e4831a 100644
--- a/src/app/modules/colors/components/recipe-info/recipe-info.component.html
+++ b/src/app/modules/colors/components/recipe-info/recipe-info.component.html
@@ -16,6 +16,10 @@
Non approuvée
+
+
Approbation expirée
+
+
{{recipe.remark}}
diff --git a/src/app/modules/colors/components/recipe-info/recipe-info.component.ts b/src/app/modules/colors/components/recipe-info/recipe-info.component.ts
index 6ff2509..35145bc 100644
--- a/src/app/modules/colors/components/recipe-info/recipe-info.component.ts
+++ b/src/app/modules/colors/components/recipe-info/recipe-info.component.ts
@@ -1,5 +1,5 @@
import {AfterViewInit, Component, Input} from '@angular/core'
-import {getRecipeLuma, Recipe} from '../../../shared/model/recipe.model'
+import {getRecipeLuma, recipeApprobationExpired, Recipe} from '../../../shared/model/recipe.model'
@Component({
selector: 'cre-recipe-info',
@@ -17,6 +17,10 @@ export class RecipeInfoComponent implements AfterViewInit {
this.isBPacExtensionInstalled = document.querySelectorAll('.bpac-extension-installed').length > 0
}
+ get isApprobationExpired(): boolean {
+ return recipeApprobationExpired(this.recipe)
+ }
+
get isDarkColor(): boolean {
return getRecipeLuma(this.recipe) < 100
}
diff --git a/src/app/modules/colors/pages/explore/explore.component.ts b/src/app/modules/colors/pages/explore/explore.component.ts
index f868b9c..21e3807 100644
--- a/src/app/modules/colors/pages/explore/explore.component.ts
+++ b/src/app/modules/colors/pages/explore/explore.component.ts
@@ -2,7 +2,7 @@ import {Component} from '@angular/core'
import {RecipeService} from '../../services/recipe.service'
import {ActivatedRoute, Router} from '@angular/router'
import {ErrorHandlingComponent} from '../../../shared/components/subscribing.component'
-import {MixMaterialDto, Recipe, recipeMixCount, recipeNoteForGroupId, recipeStepCount} from '../../../shared/model/recipe.model'
+import {MixMaterialDto, Recipe, recipeMixCount, recipeNoteForGroupId, recipeStepCount, recipeApprobationExpired} from '../../../shared/model/recipe.model'
import {Observable, Subject} from 'rxjs'
import {ErrorModel, ErrorService} from '../../../shared/service/error.service'
import {AlertService} from '../../../shared/service/alert.service'
diff --git a/src/app/modules/colors/pages/list/list.component.ts b/src/app/modules/colors/pages/list/list.component.ts
index 95cd14f..3bc4f20 100644
--- a/src/app/modules/colors/pages/list/list.component.ts
+++ b/src/app/modules/colors/pages/list/list.component.ts
@@ -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, isRecipeApprobationExpired, Recipe} from '../../../shared/model/recipe.model'
+import {getRecipeLuma, recipeApprobationExpired, Recipe} from '../../../shared/model/recipe.model'
import {ActivatedRoute, Router} from '@angular/router'
import {ErrorModel, ErrorService} from '../../../shared/service/error.service'
@@ -53,7 +53,7 @@ export class ListComponent extends ErrorHandlingComponent {
}
isRecipeApprobationExpired(recipe: Recipe): boolean {
- return isRecipeApprobationExpired(recipe)
+ return recipeApprobationExpired(recipe)
}
isCompanyHidden(companyRecipes: Recipe[]): boolean {
diff --git a/src/app/modules/shared/model/recipe.model.ts b/src/app/modules/shared/model/recipe.model.ts
index 9e9c13c..54ed1d8 100644
--- a/src/app/modules/shared/model/recipe.model.ts
+++ b/src/app/modules/shared/model/recipe.model.ts
@@ -124,3 +124,9 @@ export function getRecipeLuma(recipe: Recipe): number {
return 0.2126 * r + 0.7152 * g + 0.0722 * b // per ITU-R BT.709
}
+// TODO hard-coded for prototype
+export function recipeApprobationExpired(recipe: Recipe): boolean {
+ // @ts-ignore
+ return recipe.approbationDate && LocalDate.parse(recipe.approbationDate).year() < new Date().getFullYear() - 4
+}
+