Alan Lam 3 лет назад
Родитель
Сommit
20918b260a

+ 3 - 3
engine/chart_generator.php

@@ -489,7 +489,7 @@ class ChartGenerator {
 	 * @return Chart[]
 	 * @throws Exception
 	 */
-	public function getPointOfChallengeCharts(): array {
+	public function getPointOfChallengeCharts(string $title_format, array $labels = []): array {
 		$charts = [];
 
 		foreach($this->periodKeys as $index => $key) {
@@ -501,8 +501,8 @@ class ChartGenerator {
 
 			$chart = new Chart;
 			$chart->setType("pie");
-			$chart->setTitle("$key_label Point of Challenge");
-			$chart->setLabels(["On Entry", "While Browsing", "During Play", "On Exit", "No Challenge"]);
+			$chart->setTitle(sprintf($title_format, $key_label));
+			$chart->setLabels($labels);
 			$chart->addDataset("Counts", [
 				$period_data->stage1Count,
 				$period_data->stage2Count,

+ 1 - 1
engine/form.php

@@ -350,7 +350,7 @@ class Form {
 	 */
 	private static function renderTextareaField(object $options): void {
 		$id = str_replace("_", "-", $options->name);
-		$placeholder = "Enter " . strtolower($options->label);
+		$placeholder = $options->placeholder ?? "Enter " . strtolower($options->label);
 		$value = $options->value ?? http::value($options->name);
 		$required = ($options->required ?? false) ? "required" : "";
 		$help_text = $options->helpText ?? false;

+ 40 - 24
json/age_verification_hilton.json

@@ -102,9 +102,9 @@
 		{
 			"type": "dropdown",
 			"name": "challenge_stage",
-			"label": "Stage",
+			"label": "When were you challenged for ID?",
 			"values": ["", 1, 2, 3, 4, 5],
-			"displayStrings": ["Select stage", "Challenge on entry", "Challenge on ordering", "Challenge at service", "Challenge at payment", "No challenge"],
+			"displayStrings": ["Select stage", "Challenged on entry", "Challenged on ordering", "Challenged at service", "Challenged at payment", "Not challenged at all"],
 			"required": true
 		},
 		{
@@ -141,7 +141,7 @@
 		{
 			"type": "inline-radio",
 			"name": "challenger_gender",
-			"label": "Gender",
+			"label": "What was the gender of the Team Member serving you?",
 			"values": ["", "M", "F"],
 			"displayStrings": ["No challenge", "Male", "Female"],
 			"customerExport": false
@@ -164,6 +164,28 @@
 			"type": "header",
 			"content": "Bar Details"
 		},
+		{
+			"type": "inline-radio",
+			"name": "bar_allergies_questioned",
+			"label": "Were you asked if you had any allergies?",
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"]
+		},
+		{
+			"type": "radio",
+			"name": "bar_atmosphere",
+			"label": "What was the bar like?",
+			"values": ["busy_quiet", "welcoming", "friendly", "staff_engaged_distracted"],
+			"displayStrings": ["Busy or quiet", "Welcoming", "Friendly atmosphere", "Team Members engaged with guests or distracted"]
+		},
+		{
+			"type": "textarea",
+			"name": "bar_atmosphere_description",
+			"label": "Description of what was the bar like",
+			"maxLength": 200,
+			"placeholder": "Enter description in 200 characters or less",
+			"required": true
+		},
 		{
 			"type": "inline-radio",
 			"name": "bar_purchase",
@@ -181,7 +203,7 @@
 			"max": 20,
 			"step": 0.01,
 			"prependText": "£",
-			"helpText": "For example: Enter 1.50 if you have spent £1.50."
+			"helpText": "For example: Enter 4.50 if you have spent £4.50."
 		},
 		{
 			"type": "inline-radio",
@@ -207,41 +229,35 @@
 		},
 		{
 			"type": "inline-radio",
-			"name": "citizen_card_brochure_displayed",
-			"label": "Citizen Card Brochure Displayed",
+			"name": "weight_and_measures_act_1985",
+			"label": "Weight & Measures Act 1985",
 			"values": ["0", "1"],
 			"displayStrings": ["No", "Yes"],
-			"defaultValue": "1"
+			"defaultValue": "0"
 		},
 		{
 			"type": "inline-radio",
-			"name": "think_21_25",
-			"label": "Think 21 or Think 25",
-			"values": ["Think 21", "Think 25"],
-			"displayStrings": ["Think 21", "Think 25"]
+			"name": "licensing_act_2003",
+			"label": "Licensing Act 2003",
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "0"
 		},
 		{
 			"type": "inline-radio",
-			"name": "think_21_badge",
-			"label": "Think 21/25 Badge Worn by Staff",
+			"name": "double_measures",
+			"label": "Drinks served in Double measures as standard",
 			"values": ["0", "1"],
 			"displayStrings": ["No", "Yes"],
-			"defaultValue": "1"
+			"defaultValue": "0"
 		},
 		{
 			"type": "inline-radio",
-			"name": "think_21_poster",
-			"label": "Think 21/25 Poster Displayed",
+			"name": "drinks_list",
+			"label": "Drinks list with prices displayed",
 			"values": ["0", "1"],
 			"displayStrings": ["No", "Yes"],
-			"defaultValue": "1"
-		},
-		{
-			"type": "textarea",
-			"name": "think_21_poster_notes",
-			"label": "Think 21/25 Poster Details",
-			"maxLength": 200,
-			"helpText": "Describe the location of the poster that was displayed."
+			"defaultValue": "0"
 		},
 
 		{

+ 1 - 1
template_processing/age_verification/reports_build_charts.php

@@ -25,7 +25,7 @@ $charts[] = $generator->getPeriodicEyeContactChart();
 $charts[] = $generator->getPeriodicDoorSensorAlertPassRateChart();
 $charts[] = $generator->getPeriodicEyeContactPassRateChart();
 $charts[] = $generator->getPeriodicTotalsChart();
-$charts = array_merge($charts, $generator->getPointOfChallengeCharts());
+$charts = array_merge($charts, $generator->getPointOfChallengeCharts("%s Point of Challenge", ["On Entry", "While Browsing", "During Play", "On Exit", "No Challenge"]));
 $charts[] = $generator->getPeriodicTesterGenderChart();
 $charts[] = $generator->getPeriodicTestCountChart();
 $charts = array_merge($charts, $generator->getGenderComparisonCharts());

+ 17 - 2
template_processing/age_verification_hilton/reports_build_charts.php

@@ -1,10 +1,12 @@
-<?php
+<?php /** @noinspection PhpUnhandledExceptionInspection */
 
 /**
  * @var ChartGenerator $generator
  * @var Template $template
  */
 
+$challenge_stage_field = $template->getChallengeStageField();
+
 $charts[] = $generator->getTestsByStageChart();
 $charts[] = $generator->getChallengerGenderChart();
 $charts[] = $generator->getTesterGenderChart();
@@ -27,7 +29,20 @@ $charts[] = $generator->getPeriodicEyeContactPassRateChart();
 $charts[] = $generator->getPeriodicLineOfSightPassRateChart();
 $charts[] = $generator->getPeriodicBarPurchasePassRateChart();
 $charts[] = $generator->getPeriodicTotalsChart();
-$charts = array_merge($charts, $generator->getPointOfChallengeCharts());
+
+if($challenge_stage_field) {
+	$title_format = "%s Point of Challenge";
+	$labels = [];
+	foreach($challenge_stage_field->values as $index => $value) {
+		if(!$value) {
+			continue;
+		}
+		$labels[] = $challenge_stage_field->displayStrings[$index];
+	}
+
+	$charts = array_merge($charts, $generator->getPointOfChallengeCharts("%s Point of Challenge", $labels));
+}
+
 $charts[] = $generator->getPeriodicTesterGenderChart();
 $charts[] = $generator->getPeriodicTestCountChart();
 $charts = array_merge($charts, $generator->getGenderComparisonCharts());

+ 1 - 1
template_processing/age_verification_mitchells_butlers/reports_build_charts.php

@@ -27,7 +27,7 @@ $charts[] = $generator->getPeriodicEyeContactPassRateChart();
 $charts[] = $generator->getPeriodicLineOfSightPassRateChart();
 $charts[] = $generator->getPeriodicBarPurchasePassRateChart();
 $charts[] = $generator->getPeriodicTotalsChart();
-$charts = array_merge($charts, $generator->getPointOfChallengeCharts());
+$charts = array_merge($charts, $generator->getPointOfChallengeCharts("%s Point of Challenge", ["On Entry", "While Browsing", "During Play", "On Exit", "No Challenge"]));
 $charts[] = $generator->getPeriodicTesterGenderChart();
 $charts[] = $generator->getPeriodicTestCountChart();
 $charts = array_merge($charts, $generator->getGenderComparisonCharts());

+ 1 - 1
template_processing/age_verification_stonegate/reports_build_charts.php

@@ -32,7 +32,7 @@ $charts[] = $generator->getPeriodicEyeContactPassRateChart();
 $charts[] = $generator->getPeriodicLineOfSightPassRateChart();
 $charts[] = $generator->getPeriodicBarPurchasePassRateChart();
 $charts[] = $generator->getPeriodicTotalsChart();
-$charts = array_merge($charts, $generator->getPointOfChallengeCharts());
+$charts = array_merge($charts, $generator->getPointOfChallengeCharts("%s Point of Challenge", ["On Entry", "While Browsing", "During Play", "On Exit", "No Challenge"]));
 $charts[] = $generator->getPeriodicTesterGenderChart();
 $charts[] = $generator->getPeriodicTestCountChart();
 $charts = array_merge($charts, $generator->getGenderComparisonCharts());