Alan Lam 7 лет назад
Родитель
Сommit
ec37de42c8

+ 4 - 0
controllers/projects.php

@@ -16,6 +16,10 @@ $id = http::value("id", "int");
 $name = http::value("name", "trim");
 $year = http::value("year", "int");
 
+if($year === false) {
+	$year = date("Y");
+}
+
 if($id) $nvp["id"] = $id;
 if($name) $nvp["name"] = (new Constraint("CONTAINS"))->setValues($name);
 if($year) {

+ 16 - 0
engine/util.php

@@ -1,6 +1,22 @@
 <?php
 class Util {
 
+	public static function getGenderText($gender) {
+		switch($gender) {
+			case "M": return MALE;
+			case "F": return FEMALE;
+			default: return "";
+		}
+	}
+
+	public static function getBooleanText($boolean) {
+		switch($boolean) {
+			case "Y": return YES;
+			case "N": return NO;
+			default: return "";
+		}
+	}
+
 	public static function convertUTF8($string, $target_encoding = "CP1252") {
 		return mb_convert_encoding($string, $target_encoding, "UTF-8");
 	}

+ 252 - 0
json/age_verification_mitchells_and_butlers.json

@@ -0,0 +1,252 @@
+{
+	"beforeTest": [
+		{
+			"type": "header",
+			"content": "Before the Test"
+		},
+		{
+			"type": "text",
+			"name": "shop_left",
+			"label": "Shop Name (Left)",
+			"maxLength": 32,
+			"required": true,
+			"customerExport": false
+		},
+		{
+			"type": "text",
+			"name": "shop_right",
+			"label": "Shop Name (Right)",
+			"maxLength": 32,
+			"required": true,
+			"customerExport": false
+		},
+		{
+			"type": "text",
+			"name": "attire",
+			"label": "Tester Clothing",
+			"maxLength": 50,
+			"required": true,
+			"customerExport": false
+		},
+		{
+			"type": "file",
+			"label": "Selfie",
+			"name": "selfie",
+			"required": true
+		},
+		{
+			"type": "file",
+			"label": "Location Photo",
+			"name": "location_photo",
+			"required": true
+		}
+	],
+	"duringTest": [
+		{
+			"type": "header",
+			"content": "Challenge Details"
+		},
+		{
+			"type": "dropdown",
+			"name": "challenge_stage",
+			"label": "Stage",
+			"values": ["", 1, 2, 3, 4, 5],
+			"displayStrings": ["Select stage", "Challenge on bar or entry", "Challenge during browsing", "Challenge during play", "Challenge on exit", "No challenge"],
+			"required": true
+		},
+		{
+			"type": "textarea",
+			"name": "challenge_description",
+			"label": "Description",
+			"maxLength": 250,
+			"helpText": "Describe how the challenge took place. For example: \"While entering I was approached politely and asked for ID.\""
+		},
+
+		{
+			"type": "header",
+			"content": "Challenger Details (if challenged)"
+		},
+		{
+			"type": "text",
+			"name": "challenger_name",
+			"label": "Name",
+			"maxLength": 32,
+			"customerExport": false
+		},
+		{
+			"type": "textarea",
+			"name": "challenger_description",
+			"label": "Description",
+			"maxLength": 250,
+			"helpText": "Describe the person who challenged you and any comments you feel that are relevant. For example: \"She was about 150cm tall and had long red hair and glasses. She approached me and asked me if I wanted some water and then asked if I had any ID.\"",
+			"customerExport": false
+		},
+		{
+			"type": "dropdown",
+			"name": "challenger_gender",
+			"label": "Gender",
+			"values": ["", "M", "F"],
+			"displayStrings": ["No challenge/Don't know", "M", "F"],
+			"customerExport": false
+		},
+		{
+			"type": "dropdown",
+			"name": "challenger_eye_contact",
+			"label": "Eye Contact",
+			"values": ["", "0", "1"],
+			"displayStrings": ["No challenge/Don't know", "No", "Yes"],
+			"customerExport": false
+		},
+
+		{
+			"type": "header",
+			"content": "Bar Details"
+		},
+		{
+			"type": "dropdown",
+			"name": "bar_purchase",
+			"label": "Bar Purchase",
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"helpText": "Did you buy anything at the bar?"
+		},
+		{
+			"type": "number",
+			"name": "bar_expenditure",
+			"label": "Bar Expenditure",
+			"maxLength": 10,
+			"min": 0,
+			"max": 20,
+			"step": 0.01,
+			"prependText": "£",
+			"helpText": "For example: Enter 1.50 if you have spent £1.50."
+		},
+		{
+			"type": "dropdown",
+			"name": "alcohol_purchased",
+			"label": "Alcohol Purchased",
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"]
+		},
+		{
+			"type": "text",
+			"name": "bar_purchase_item",
+			"label": "Name of Item Purchased",
+			"maxLength": 20
+		},
+
+
+		{
+			"type": "header",
+			"content": "Play Details"
+		},
+		{
+			"type": "text",
+			"name": "play_machine",
+			"label": "Machine Played",
+			"maxLength": 20,
+			"customerExport": false
+		},
+		{
+			"type": "text",
+			"name": "play_machine_position",
+			"label": "Machine Position",
+			"maxLength": 100,
+			"customerExport": false,
+			"helpText": "Where the machine was located in the venue? (e.g. Opposite the bar.)"
+		},
+		{
+			"type": "dropdown",
+			"name": "play_machine_line_of_sight",
+			"label": "Machine Line of Sight of Bar",
+			"values": ["", "0", "1"],
+			"displayStrings": ["Don't know", "No", "Yes"],
+			"helpText": "Was the machine in line of sight of the bar?"
+		},
+		{
+			"type": "dropdown",
+			"name": "play_jackpot",
+			"label": "Jackpot Value",
+			"values": ["", 5, 10, 15, 20, 25, 35, 50, 100, 500],
+			"displayStrings": ["Did not play/Don't know", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
+			"customerExport": false
+		},
+		{
+			"type": "dropdown",
+			"name": "play_machine_stake",
+			"label": "Stake Played",
+			"values": ["", 0.1, 0.2, 0.25, 0.3, 0.5, 1, 2],
+			"displayStrings": ["Did not play/Don't know", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
+			"helpText": "This is how much the machine charges you per spin."
+		},
+		{
+			"type": "dropdown",
+			"name": "play_minutes",
+			"label": "Time Played (Minutes)",
+			"values": ["", "1", "2", "3", "4", "5"],
+			"displayStrings": ["Did not play/Don't know", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
+		},
+		{
+			"type": "number",
+			"name": "play_spent",
+			"label": "Total Spent",
+			"maxLength": 10,
+			"min": 0,
+			"max": 20,
+			"step": 0.01,
+			"prependText": "£",
+			"helpText": "For example: Enter 1.50 if you have spent £1.50."
+		},
+
+		{
+			"type": "header",
+			"content": "Signage Details"
+		},
+		{
+			"type": "dropdown",
+			"name": "citizen_card_brochure_displayed",
+			"label": "Citizen Card Brochure Displayed",
+			"values": ["", "0", "1"],
+			"displayStrings": ["Don't know", "No", "Yes"]
+		},
+		{
+			"type": "dropdown",
+			"name": "think_21_25",
+			"label": "Think 21 or Think 25",
+			"values": ["", "Think 21", "Think 25"],
+			"displayStrings": ["Don't know", "Think 21", "Think 25"]
+		},
+		{
+			"type": "dropdown",
+			"name": "think_21_badge",
+			"label": "Think 21/25 Badge Worn by Staff",
+			"values": ["", "0", "1"],
+			"displayStrings": ["Don't know", "No", "Yes"]
+		},
+		{
+			"type": "dropdown",
+			"name": "think_21_poster",
+			"label": "Think 21/25 Poster Displayed",
+			"values": ["", "0", "1"],
+			"displayStrings": ["Don't know", "No", "Yes"]
+		},
+		{
+			"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."
+		},
+
+		{
+			"type": "header",
+			"content": "Notes"
+		},
+		{
+			"type": "textarea",
+			"name": "additional_notes",
+			"label": "Additional Notes",
+			"maxLength": 600
+		}
+	]
+}

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
public/css/bootstrap.min.css


+ 6 - 0
scss/_main.scss

@@ -127,4 +127,10 @@ input[required], select[required], textarea[required] {
 
 .grecaptcha-badge {
 	display: none;
+}
+
+.table-sm-text {
+	td, th {
+		font-size: 0.875rem;
+	}
 }

+ 5 - 5
template_processing/age_verification/test_pdf.php

@@ -105,7 +105,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 	<div class="bl">
 		<div class="field">Gender:</div>
-		<div class="value"><?=TestPDF::getValueHtml($test->challenger_gender)?></div>
+		<div class="value"><?=TestPDF::getValueHtml(Util::getGenderText($test->challenger_gender))?></div>
 	</div>
 
 	<strong>Description:</strong><br />
@@ -165,7 +165,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 	<div class="bl">
 		<div class="field">Eye Contact:</div>
-		<div class="value"><?=($test->challenger_eye_contact ? "Y" : "N")?></div>
+		<div class="value"><?=($test->challenger_eye_contact ? "Yes" : "No")?></div>
 	</div>
 
 	<div>
@@ -191,7 +191,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 		<?php
 		$play_jackpot = $values["play_jackpot"] ?? "";
 		if(!empty($play_jackpot)) {
-			$play_jackpot = "£{$play_jackpot}";
+			$play_jackpot = "£" . number_format($play_jackpot, 2);
 		}
 		?>
 
@@ -203,7 +203,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 		<?php
 		$play_machine_stake = $values["play_machine_stake"] ?? "";
 		if(!empty($play_machine_stake)) {
-			$play_machine_stake = "£{$play_machine_stake}";
+			$play_machine_stake = "£" . number_format($play_machine_stake, 2);
 		}
 		?>
 
@@ -219,7 +219,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 		<?php
 		$play_spent = $values["play_spent"] ?? "";
-		if(!empty($play_spent)) $play_spent = "£{$play_spent}";
+		if(!empty($play_spent)) $play_spent = "£" . number_format($play_spent, 2);
 		?>
 
 		<div>

+ 79 - 45
template_processing/age_verification_mitchells_butlers/test_pdf.php

@@ -110,6 +110,10 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 	<div style="clear: both;"></div><br />
 
+	<?php
+
+	?>
+
 	<div class="subheader">
 		<strong>Staff</strong>
 	</div>
@@ -121,12 +125,81 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 	<div class="bl">
 		<div class="field">Gender:</div>
-		<div class="value"><?=TestPDF::getValueHtml($test->challenger_gender)?></div>
+		<div class="value"><?=TestPDF::getValueHtml(Util::getGenderText($test->challenger_gender))?></div>
 	</div>
 
 	<strong>Description:</strong><br />
 	<?=TestPDF::getValueHtml($test->challenger_description)?><br />
 
+	<br />
+
+	<div class="subheader">
+		<strong>Signage</strong>
+	</div>
+
+	<div class="wide-field-names">
+		<div class="bl">
+			<div class="field">Think 21/25:</div>
+			<div class="value"><?=TestPDF::getValueHtml($values["think_21_25"] ?? "")?></div>
+		</div>
+
+		<?php
+		$value = $values["citizen_card_brochure_displayed"] ?? "";
+		if(strlen($value)) $value = $value ? "Yes" : "No";
+		?>
+
+		<div class="bl">
+			<div class="field">Citizen Card Brochure Displayed:</div>
+			<div class="value"><?=TestPDF::getValueHtml($value)?></div>
+		</div>
+
+		<?php
+		$value = $values["think_21_poster"] ?? "";
+		if(strlen($value)) $value = $value ? "Yes" : "No";
+		?>
+
+		<div class="bl">
+			<div class="field">Think 21/25 Posters Displayed:</div>
+			<div class="value"><?=TestPDF::getValueHtml($value)?></div>
+		</div>
+
+		<strong>Think 21/25 Poster Notes:</strong><br />
+		<?=TestPDF::getValueHtml($values["think_21_poster_notes"] ?? "")?>
+	</div>
+
+	<br />
+
+	<?php
+	$bar_purchase = ($values["bar_purchase"] ?? "") ? "Yes" : "No";
+	$bar_expenditure = ($values["bar_expenditure"] ?? "") ?: 0;
+	$alcohol_purchased = ($values["alcohol_purchased"] ?? "") ? "Yes" : "No";
+	$bar_purchase_item = ($values["bar_purchase_item"] ?? "");
+	?>
+
+	<div class="subheader">
+		<strong>Bar Details</strong>
+	</div>
+
+	<div class="wide-field-names">
+		<div class="bl">
+			<div class="field">Bar Purchase:</div>
+			<div class="value"><?=TestPDF::getValueHtml($bar_purchase)?></div>
+		</div>
+		<div class="bl">
+			<div class="field">Bar Expenditure:</div>
+			<div class="value">£<?=number_format($bar_expenditure, 2)?></div>
+		</div>
+		<div class="bl">
+			<div class="field">Alcohol Purchased:</div>
+			<div class="value"><?=$alcohol_purchased?></div>
+		</div>
+		<div>
+			<div class="field">Name of Item Purchased:</div>
+			<div class="value"><?=TestPDF::getValueHtml($bar_purchase_item)?></div>
+		</div>
+	</div>
+
+
 </div>
 
 <div style="float: right; width: 49.5%">
@@ -181,20 +254,16 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 	<div class="bl">
 		<div class="field">Eye Contact:</div>
-		<div class="value"><?=($test->challenger_eye_contact ? "Y" : "N")?></div>
+		<div class="value"><?=($test->challenger_eye_contact ? "Yes" : "No")?></div>
 	</div>
 
 	<div>
 		<strong>Description:</strong><br />
 		<?=TestPDF::getValueHtml($test->challenge_description)?>
 	</div>
-</div>
 
-<div class="clear"></div>
-
-<br />
+	<br />
 
-<div style="float: left; width: 49.5%">
 	<div class="subheader">
 		<strong>Play Details</strong>
 	</div>
@@ -222,7 +291,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 		<?php
 		$play_jackpot = $values["play_jackpot"] ?? "";
 		if(!empty($play_jackpot)) {
-			$play_jackpot = "£{$play_jackpot}";
+			$play_jackpot = "£" . number_format($play_jackpot, 2);
 		}
 		?>
 
@@ -234,7 +303,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 		<?php
 		$play_machine_stake = $values["play_machine_stake"] ?? "";
 		if(!empty($play_machine_stake)) {
-			$play_machine_stake = "£{$play_machine_stake}";
+			$play_machine_stake = "£" . number_format($play_machine_stake, 2);
 		}
 		?>
 
@@ -250,7 +319,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 		<?php
 		$play_spent = $values["play_spent"] ?? "";
-		if(!empty($play_spent)) $play_spent = "£{$play_spent}";
+		if(!empty($play_spent)) $play_spent = "£" . number_format($play_spent, 2);
 		?>
 
 		<div>
@@ -258,42 +327,7 @@ $pass_image = $test->pass ? "pass.png" : "fail.png";
 			<div class="value"><?=TestPDF::getValueHtml($play_spent)?></div>
 		</div>
 	</div>
-</div>
-
-<div style="float: right; width: 49.5%">
-	<div class="subheader">
-		<strong>Signage</strong>
-	</div>
-
-	<div class="wide-field-names">
-		<div class="bl">
-			<div class="field">Think 21/25:</div>
-			<div class="value"><?=TestPDF::getValueHtml($values["think_21_25"] ?? "")?></div>
-		</div>
-
-		<?php
-		$value = $values["citizen_card_brochure_displayed"] ?? "";
-		if(strlen($value)) $value = $value ? "Yes" : "No";
-		?>
 
-		<div class="bl">
-			<div class="field">Citizen Card Brochure Displayed:</div>
-			<div class="value"><?=TestPDF::getValueHtml($value)?></div>
-		</div>
-
-		<?php
-		$value = $values["think_21_poster"] ?? "";
-		if(strlen($value)) $value = $value ? "Yes" : "No";
-		?>
-
-		<div class="bl">
-			<div class="field">Think 21/25 Posters Displayed:</div>
-			<div class="value"><?=TestPDF::getValueHtml($value)?></div>
-		</div>
-
-		<strong>Think 21/25 Poster Notes:</strong><br />
-		<?=TestPDF::getValueHtml($values["think_21_poster_notes"] ?? "")?>
-	</div>
 </div>
 
 <div class="clear"></div>

+ 6 - 9
views/location_list.php

@@ -1,9 +1,10 @@
 <div class="table-responsive limit-height-2">
-	<table class="table table-sm table-hover">
+	<table class="table table-sm table-sm-text table-hover">
 		<thead>
 			<tr>
 				<th class="text-right pr-3">ID</th>
 				<th>Name / Address</th>
+				<th>Internal ID</th>
 				<th></th>
 			</tr>
 		</thead>
@@ -25,17 +26,13 @@
 					}
 					?>
 					<br />
-					<?php
-					if($location->internal_id) {
-						?>
-						<small class="text-info">Internal ID: <?=htmlspecialchars($location->internal_id)?></small><br />
-						<?php
-					}
-					?>
 					<small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]))?></small>
 				</td>
+				<td>
+					<?=htmlspecialchars($location->internal_id)?>
+				</td>
 				<td class="text-right align-middle">
-					<a class="btn btn-outline-primary" href="/account/locations/<?=$location->id?>/edit">Edit</a>
+					<a class="btn btn-sm btn-outline-primary" href="/account/locations/<?=$location->id?>/edit">Edit</a>
 				</td>
 			</tr>
 			<?php

+ 13 - 0
views/map_overview.php

@@ -66,6 +66,12 @@
 				$customer = $project->getCustomer();
 				$unix_deadline = strtotime($project->dts_deadline . " UTC");
 				$deadline = date("d/m/Y", $unix_deadline);
+
+				$icon = null;
+				if($project->time_of_day != "A") {
+					$icon = $project->getTimeOfDayIcon();
+				}
+
 				?>
 				<a class="list-group-item list-group-item-action d-flex justify-content-between" data-project-id="<?=$project->id?>" data-selected="false">
 					<div class="w-100">
@@ -74,6 +80,13 @@
 							<small><strong>DEADLINE: <?=$deadline?></strong></small>
 						</div>
 						<?=htmlspecialchars($project->name)?>
+						<?php
+						if($icon) {
+							?>
+							<i class="fal fa-<?=$icon?>"></i>
+							<?php
+						}
+						?>
 					</div>
 					<span class="badge badge-pill badge-lg align-self-center"></span>
 				</a>

+ 23 - 10
views/project_list.php

@@ -1,17 +1,19 @@
-<table class="table table-sm table-hover">
+<table class="table table-sm table-sm-text table-hover">
 	<thead>
 		<tr>
 			<th class="text-right pr-3">ID</th>
 			<th>Name</th>
-			<th>Template</th>
+			<th>Tests</th>
 			<th>Period</th>
-			<th>Year</th>
 			<th>Report Month</th>
 			<th></th>
 		</tr>
 	</thead>
 	<tbody>
 	<?php
+	$project_ids = array_column($projects, "id");
+	$tests = Test::query(["project_id" => $project_ids]);
+
 	foreach($projects as $project) {
 
 		$year = date("Y", strtotime($project->dts_start));
@@ -25,35 +27,46 @@
 			$report_month = $dt_report->format("M Y");
 		}
 
-		$time_of_day_icon = $project->getTimeOfDayIcon();
+		$time_of_day_icon = $project->time_of_day != "A" ? $project->getTimeOfDayIcon() : null;
 		$time_of_day_text = $project->getTimeOfDayText();
 
 		$template = $project->getTemplate();
 
+		$completed_tests = array_filter($tests, function($test) use ($project) {
+			return ($project->id == $test->project_id) && ($test->status == Test::STATUS_COMPLETED);
+		});
+		$completed_test_count = count($completed_tests);
+
 		?>
 		<tr>
 			<td class="text-right pr-3 align-middle">
 				<?=$project->id?>
 			</td>
 			<td class="align-middle">
+				<small><strong><a href="<?=htmlspecialchars($template->getURL())?>"><?=htmlspecialchars($template->name)?></a></strong></small><br />
 				<a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
-				<i class="fal fa-<?=$time_of_day_icon?>" data-toggle="tooltip" data-title="<?=$time_of_day_text?> Tests"></i>
+				<?php
+				if($time_of_day_icon) {
+					?>
+					<i class="fal fa-<?=$time_of_day_icon?>" data-toggle="tooltip" data-title="<?=$time_of_day_text?> Tests"></i>
+					<?php
+				}
+				?>
 			</td>
 			<td class="align-middle">
-				<a href="<?=htmlspecialchars($template->getURL())?>"><?=htmlspecialchars($template->name)?></a>
+				<small><strong>Completed</strong></small><br />
+				<?=$completed_test_count?> / <?=$project->test_count?>
 			</td>
 			<td class="align-middle">
+				<small><strong><?=$year?></strong></small><br />
 				<?=$date_start?> -
 				<?=$date_deadline?>
 			</td>
-			<td class="align-middle">
-				<?=$year?>
-			</td>
 			<td class="align-middle">
 				<?=$report_month?>
 			</td>
 			<td class="text-right align-middle">
-				<a class="btn btn-outline-primary" href="/account/projects/<?=$project->id?>/edit">Edit</a>
+				<a class="btn btn-sm btn-outline-primary" href="/account/projects/<?=$project->id?>/edit">Edit</a>
 			</td>
 		</tr>
 		<?php

+ 6 - 0
webpack.mix.js

@@ -1,5 +1,11 @@
 let mix = require('laravel-mix');
 
+if(process.env.NODE_ENV === "development") {
+    mix.webpackConfig({devtool: "inline-source-map"});
+    mix.sourceMaps();
+}
+
+
 mix.setResourceRoot('/');
 mix
     .sass('scss/bootstrap.scss', 'public/css/bootstrap.min.css')

Некоторые файлы не были показаны из-за большого количества измененных файлов