diff --git a/interfaces/product.ts b/interfaces/product.ts index 12f44e2..10245de 100644 --- a/interfaces/product.ts +++ b/interfaces/product.ts @@ -13,4 +13,7 @@ export interface IProduct extends IProductDefinition { filters: IProductFilter[]; subproducts: IProductDefinition[]; cardTemplate: string; + external: { + rules: string; + }; } diff --git a/src/app/card/card.page.html b/src/app/card/card.page.html index 0d1b214..87c7b7e 100644 --- a/src/app/card/card.page.html +++ b/src/app/card/card.page.html @@ -44,6 +44,11 @@ } + + + + Rules + diff --git a/src/app/meta.service.ts b/src/app/meta.service.ts index b9950e7..ad8f942 100644 --- a/src/app/meta.service.ts +++ b/src/app/meta.service.ts @@ -9,6 +9,7 @@ import { environment } from '../environments/environment'; export class MetaService { private allProducts: IProduct[] = []; private templatesByProductId: Record = {}; + private rulesByProductId: Record = {}; public get products() { return this.allProducts; @@ -20,16 +21,21 @@ export class MetaService { this.allProducts = realData; - this.loadTemplates(); + this.loadExternals(); } - private loadTemplates() { + private loadExternals() { this.allProducts.forEach((product) => { this.templatesByProductId[product.id] = product.cardTemplate; + this.rulesByProductId[product.id] = product.external.rules; }); } public getTemplateByProductId(productId: string): string { return this.templatesByProductId[productId]; } + + public getRulesByProductId(productId: string): string { + return this.rulesByProductId[productId]; + } }