From 95bc3a078d0c61f1353be80bddf7912fea186a30 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 8 Apr 2025 04:41:08 +0200 Subject: [PATCH] Themes(toilets): add questions about the changing tables --- assets/layers/toilet/toilet.json | 209 +++++++++++++++++-- src/UI/Popup/TagRendering/Questionbox.svelte | 5 +- 2 files changed, 194 insertions(+), 20 deletions(-) diff --git a/assets/layers/toilet/toilet.json b/assets/layers/toilet/toilet.json index cf6ed429e..65d3271b0 100644 --- a/assets/layers/toilet/toilet.json +++ b/assets/layers/toilet/toilet.json @@ -1121,7 +1121,7 @@ "special": { "type": "group", "header": "wheelchair-title", - "labels": "wheelchair" + "labels": "wheelchair;adult-changing-table" } } }, @@ -1292,7 +1292,6 @@ "condition": { "and": [ { - "#": "NOT on designated", "or": [ "wheelchair=yes", "toilets:wheelchair=yes" @@ -1302,7 +1301,8 @@ "or": [ "access=yes", "access=public", - "access=customers" + "access=customers", + "access=" ] } ] @@ -1352,7 +1352,7 @@ { "if": "centralkey=nks", "alsoShowIf": "centralkey~i~nks", - "hideInAnswer": "_country!=uk", + "hideInAnswer": "_country!=gb", "addExtraTags": [ "toilets:wheelchair:access=centralkey" ], @@ -1364,8 +1364,11 @@ { "if": "centralkey=eurokey", "alsoShowIf": "centralkey~i~eurokey", - "icon": "./assets/layers/toilet/eurokey.svg", - "hideInAnswer": "_country!=uk", + "icon": { + "class": "medium", + "path": "./assets/layers/toilet/eurokey.svg" + }, + "hideInAnswer": "_country!~(be)|(bg)|(cy)|(dk)|(de)|(ee)|(fi)|(fr)|(gr)|(hu)|(ie)|(it)|(hr)|(lv)|(lt)|(lu)|(mt)|(nl)|(at)|(pl)|(pt)|(ro)|(si)|(sk)|(es)|(cz)|(se)|(ch)|(tr)", "addExtraTags": [ "toilets:wheelchair:access=centralkey" ], @@ -1421,12 +1424,26 @@ "type": "pfloat" } }, + { + "id": "questions-wheelchair", + "labels": [ + "wheelchair", + "hidden", + "relevant-questions" + ], + "render": { + "special": { + "type": "questions", + "labels": "wheelchair" + } + } + }, { "id": "adult-changing-table-title", "labels": [ "hidden", "prefixed", - "wheelchair" + "adult-changing-table" ], "render": { "en": "

Adult changing table

", @@ -1437,10 +1454,10 @@ { "id": "adult-changing-table", "labels": [ - "wheelchair", "prefixed", "hidden", - "relevant-questions" + "relevant-questions", + "adult-changing-table" ], "question": { "en": "Does this toilet have an adult changing table?", @@ -1469,7 +1486,7 @@ "labels": [ "hidden", "prefixed", - "wheelchair" + "adult-changing-table" ], "question": { "en": "What is the height of the adult changing table?", @@ -1490,28 +1507,159 @@ ], "freeform": { "key": "changing_table:adult:height", - "type": "distance" + "type": "pfloat" }, "render": { "en": "The changing table is {canonical(changing_table:adult:height)} high", "nl": "De verzorgingstafel is {canonical(changing_table:adult:height)} hoog" }, - "condition": "changing_table:adult=yes" + "condition": { + "and": [ + "changing_table:adult=yes" + ] + } }, { - "id": "questions-wheelchair", + "id": "adult-changing-table-min_height", "labels": [ - "wheelchair", "hidden", - "relevant-questions" + "prefixed", + "adult-changing-table" + ], + "question": { + "en": "What is the lowest height the adult changing table can be moved to?", + "nl": "Wat is de laagste stand waarop de verzorgingstafel voor volwassenen gezet kan worden?" + }, + "questionHint": { + "en": "This is measured between the floor and the top of the changing table", + "nl": "Dit wordt gemeten van de vloer tot de bovenkant van de verzorgingstafel" + }, + "freeform": { + "key": "changing_table:adult:min_height", + "type": "pfloat" + }, + "render": { + "en": "The lowest height of the adult changing table is {canonical(changing_table:adult:min_height)}", + "nl": "De laagste stand van de verzorgingstafel is {canonical(changing_table:adult:min_height)} hoog" + }, + "condition": { + "and": [ + "changing_table:adult:height=adjustable" + ] + } + }, + { + "id": "adult-changing-table-max_height", + "labels": [ + "hidden", + "prefixed", + "adult-changing-table" + ], + "question": { + "en": "What is the highest height the adult changing table can be moved to?", + "nl": "Wat is de hoogste stand waarop de verzorgingstafel voor volwassenen gezet kan worden?" + }, + "questionHint": { + "en": "This is measured between the floor and the top of the changing table", + "nl": "Dit wordt gemeten van de vloer tot de bovenkant van de verzorgingstafel" + }, + "freeform": { + "key": "changing_table:adult:max_height", + "type": "pfloat" + }, + "render": { + "en": "The highest height of the adult changing table is {canonical(changing_table:adult:max_height)}", + "nl": "De hoogste stand van de verzorgingstafel is {canonical(changing_table:adult:max_height)} hoog" + }, + "condition": { + "and": [ + "changing_table:adult:height=adjustable" + ] + } + }, + { + "id": "adult-changing-table-mechanism", + "labels": [ + "hidden", + "relevant-questions", + "adult-changing-table" + ], + "question": { + "en": "How is the height of the changing table adjusted?", + "nl": "Hoe wordt de hoogte van de verzorgingstafel aangepast?" + }, + "mappings": [ + { + "if": "changing_table:adult:height:mechanism=manual", + "then": { + "nl": "De hoogte van de verzorgingstafel wordt met de hand aangepast", + "en": "The height of the adult changing table is adjusted manually" + } + }, + { + "if": "changing_table:adult:height:mechanism=electric", + "then": { + "nl": "De verzorgingstafel wordt door een electrische motor in hoogte versteld", + "en": "The height of the adult changing table is adjusted electrically" + } + } + ], + "condition": { + "and": [ + "changing_table:adult:height=adjustable" + ] + } + }, + { + "id": "adult-changing-table-support", + "labels": [ + "hidden", + "prefixed", + "adult-changing-table" + ], + "question": { + "en": "How is the adult changing table supported?", + "nl": "Hoe is de verschoningstafel in de ruimte geplaatst?" + }, + "mappings": [ + { + "if": "changing_table:adult:support=wall_mounted", + "then": { + "en": "The changing table is mounted to the wall", + "nl": "De verschoningstafel voor volwassenen hangt vast aan de muur" + } + }, + { + "if": "changing_table:adult:support=legs", + "then": { + "en": "The changing table stands on table legs", + "nl": "De verschoningstafel voor volwassenen staat op tafelpoten" + } + }, + { + "if": "changing_table:adult:support=wheels", + "then": { + "en": "The changing table stands on table legs with wheels and can be moved", + "nl": "De verschoningstafel voor volwassenen staat op tafelpoten met wielen en kan verplaatst worden" + } + } + ] + }, + { + "id": "questions-adult-changing-table", + "labels": [ + "hidden", + "relevant-questions", + "adult-changing-table" ], "render": { "special": { "type": "questions", "show_all": "yes", - "labels": "wheelchair" + "labels": "adult-changing-table" } - } + }, + "classes": "pt-6 mt-6 border-dashed border-t-2 border-gray-500" }, { "builtin": "phone", @@ -1605,6 +1753,33 @@ "cm" ] } + }, + { + "changing_table:adult:height": { + "quantity": "distance", + "denominations": [ + "m", + "cm" + ] + } + }, + { + "changing_table:adult:min_height": { + "quantity": "distance", + "denominations": [ + "m", + "cm" + ] + } + }, + { + "changing_table:adult:max_height": { + "quantity": "distance", + "denominations": [ + "m", + "cm" + ] + } } ] } diff --git a/src/UI/Popup/TagRendering/Questionbox.svelte b/src/UI/Popup/TagRendering/Questionbox.svelte index 53c787274..23ce5ed38 100644 --- a/src/UI/Popup/TagRendering/Questionbox.svelte +++ b/src/UI/Popup/TagRendering/Questionbox.svelte @@ -27,7 +27,7 @@ const _onlyForLabels = new Set(onlyForLabels) /** * If set, only questions _not_ having these labels will be shown. - * This is used for a partial questionbox + * This is used for a partial questionbox. If both 'onlyFor' and 'notFor' are set, questions must accept both */ export let notForLabels: string[] | undefined = undefined const _notForLabels = new Set(notForLabels) @@ -44,7 +44,7 @@ return true } - const baseQuestions = (layer?.tagRenderings ?? [])?.filter( + let baseQuestions = (layer?.tagRenderings ?? [])?.filter( (tr) => allowed(tr.labels) && tr.question !== undefined ) @@ -119,7 +119,6 @@ }, 50) } - {#if $loginEnabled}