From 90aaf780c861ec735f591b08b6148b0593d65180 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 6 Sep 2021 22:19:57 +0200 Subject: [PATCH] Add filters, payment options and halal to the food theme --- Models/ThemeConfig/FilterConfig.ts | 7 ++ assets/layers/food/food.json | 121 +++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/Models/ThemeConfig/FilterConfig.ts b/Models/ThemeConfig/FilterConfig.ts index 977d6b1ef4..d5992d370e 100644 --- a/Models/ThemeConfig/FilterConfig.ts +++ b/Models/ThemeConfig/FilterConfig.ts @@ -11,6 +11,13 @@ export default class FilterConfig { }[]; constructor(json: FilterConfigJson, context: string) { + if(json.options === undefined){ + throw `A filter without options was given at ${context}` + } + + if(json.options.map === undefined){ + throw `A filter was given where the options aren't a list at ${context}` + } this.options = json.options.map((option, i) => { const question = Translations.T( option.question, diff --git a/assets/layers/food/food.json b/assets/layers/food/food.json index 374211a9f9..31b8fefd18 100644 --- a/assets/layers/food/food.json +++ b/assets/layers/food/food.json @@ -388,6 +388,39 @@ ], "condition": "cuisine!=friture" }, + { + "#": "halal (no friture)", + "question": { + "nl": "Heeft deze eetgelegenheid een halal optie?" + }, + "mappings": [ + { + "if": "diet:halal=no", + "then": { + "nl": "Geen halal opties beschikbaar" + } + }, + { + "if": "diet:halal=limited", + "then": { + "nl": "Beperkte halal opties zijn beschikbaar" + } + }, + { + "if": "diet:halal=yes", + "then": { + "nl": "halal opties zijn beschikbaar" + } + }, + { + "if": "diet:halal=only", + "then": { + "nl": "Enkel halal opties zijn beschikbaar" + } + } + ], + "condition": "cuisine!=friture" + }, { "question": { "nl": "Heeft deze frituur vegetarische snacks?", @@ -541,6 +574,94 @@ } ], "condition": "cuisine=friture" + }, + { + "question": { + "en": "Which methods of payment are accepted here?", + "nl": "Welke betaalmiddelen worden hier geaccepteerd?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "payment:cash=yes", + "ifnot": "payment:cash=no", + "then": { + "en": "Cash is accepted here", + "nl": "Cash geld wordt hier aanvaard" + } + }, + { + "if": "payment:cards=yes", + "ifnot": "payment:cards=no", + "then": { + "en": "Payment cards are accepted here", + "nl": "Betalen met bankkaarten kan hier" + } + } + ] + } + ], + "filter": [ + { + "options": [ + { + "question": { + "en": "Opened now", + "nl": "Nu geopened" + }, + "osmTags": "_isOpen=yes" + } + ] + }, + { + "options": [ + { + "question": { + "en": "Has a vegetarian menu", + "nl": "Heeft een vegetarisch menu" + }, + "osmTags": { + "or": [ + "diet:vegetarian=yes", + "diet:vegetarian=only", + "diet:vegan=yes", + "diet:vegan=only" + ] + } + } + ] + }, + { + "options": [ + { + "question": { + "en": "Has a vegan menu", + "nl": "Heeft een veganistisch menu" + }, + "osmTags": { + "or": [ + "diet:vegan=yes", + "diet:vegan=only" + ] + } + } + ] + }, + { + "options": [ + { + "question": { + "en": "Has a halal menu", + "nl": "Heeft een halal menu" + }, + "osmTags": { + "or": [ + "diet:halal=yes", + "diet:halal=only" + ] + } + } + ] } ] } \ No newline at end of file