|
|
@@ -1,6 +1,14 @@
|
|
|
-<?php
|
|
|
+<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
+
|
|
|
+/**
|
|
|
+ * @var Customer[] $customers
|
|
|
+ * @var User $user
|
|
|
+ * @var UserCustomer $user_customer_link
|
|
|
+ */
|
|
|
+
|
|
|
+$dt_dob = $user->getDateTimeDateOfBirth();
|
|
|
+$date_dob = $dt_dob ? $dt_dob->format("Y-m-d") : "";
|
|
|
|
|
|
-$date_of_birth_parts = explode("-", $user->date_of_birth);
|
|
|
$activated_checked = ($user->activated) ? "checked" : "";
|
|
|
$can_claim_checked = ($user->can_claim) ? "checked" : "";
|
|
|
|
|
|
@@ -25,7 +33,7 @@ var userId = <?=$user->id?>;
|
|
|
<?php
|
|
|
foreach(User::LEVELS as $value => $display) {
|
|
|
if($value > Core::$user->level) continue;
|
|
|
- $selected = ($user->level == $value) ? "selected" : "";
|
|
|
+ $selected = ((int) $user->level === $value) ? "selected" : "";
|
|
|
?>
|
|
|
<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
|
|
|
<?php
|
|
|
@@ -46,7 +54,7 @@ var userId = <?=$user->id?>;
|
|
|
<option value="">Unassigned</option>
|
|
|
<?php
|
|
|
foreach($customers as $customer) {
|
|
|
- $selected = ($customer->id == $user_customer_link->customer_id) ? "selected" : "";
|
|
|
+ $selected = (int) $customer->id === (int) $user_customer_link->customer_id ? "selected" : "";
|
|
|
?>
|
|
|
<option value="<?=htmlspecialchars($customer->id)?>" <?=$selected?>><?=htmlspecialchars($customer->name)?></option>
|
|
|
<?php
|
|
|
@@ -76,7 +84,7 @@ var userId = <?=$user->id?>;
|
|
|
<option value="">Select title</option>
|
|
|
<?php
|
|
|
foreach(User::titles() as $value => $display) {
|
|
|
- $selected = ($user->title == $value) ? "selected" : "";
|
|
|
+ $selected = $user->title === $value ? "selected" : "";
|
|
|
?>
|
|
|
<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
|
|
|
<?php
|
|
|
@@ -104,8 +112,8 @@ var userId = <?=$user->id?>;
|
|
|
<option value="">Select gender</option>
|
|
|
<?php
|
|
|
foreach(User::genders() as $value => $display) {
|
|
|
- $value = substr($value, 0, 1);
|
|
|
- $selected = ($user->gender == $value) ? "selected" : "";
|
|
|
+ $value = $value[0];
|
|
|
+ $selected = ($user->gender === $value) ? "selected" : "";
|
|
|
?>
|
|
|
<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
|
|
|
<?php
|
|
|
@@ -140,26 +148,9 @@ var userId = <?=$user->id?>;
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row mb-1">
|
|
|
- <label class="col-sm-4 col-form-label" for="date-of-birth">Date of Birth</label>
|
|
|
+ <label class="col-sm-4 col-form-label" for="date-of-birth">Date of Birth</label>
|
|
|
<div class="col-sm">
|
|
|
- <select class="form-control w-auto d-inline-block" name="date_of_birth_day" id="date-of-birth-day">
|
|
|
- <option value="">Day</option>
|
|
|
- <?php
|
|
|
- Form::renderDayOptions($date_of_birth_parts[2]);
|
|
|
- ?>
|
|
|
- </select>
|
|
|
- <select class="form-control w-auto d-inline-block" name="date_of_birth_month" id="date-of-birth-month">
|
|
|
- <option value="">Month</option>
|
|
|
- <?php
|
|
|
- Form::renderMonthOptions($date_of_birth_parts[1]);
|
|
|
- ?>
|
|
|
- </select>
|
|
|
- <select class="form-control w-auto d-inline-block" name="date_of_birth_year" id="date-of-birth-year">
|
|
|
- <option value="">Year</option>
|
|
|
- <?php
|
|
|
- Form::renderYearOptionsDescending(null, null, $date_of_birth_parts[0]);
|
|
|
- ?>
|
|
|
- </select>
|
|
|
+ <input class="form-control" type="date" name="date_of_birth" id="date-of-birth" value="<?=$date_dob?>" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row mb-1">
|
|
|
@@ -168,7 +159,7 @@ var userId = <?=$user->id?>;
|
|
|
<select class="form-control" name="reported" id="reported">
|
|
|
<?php
|
|
|
foreach(Form::BOOLEAN_OPTIONS as $value => $display) {
|
|
|
- $selected = ($user->reported == $value) ? "selected" : "";
|
|
|
+ $selected = ((int) $user->reported === $value) ? "selected" : "";
|
|
|
?>
|
|
|
<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
|
|
|
<?php
|
|
|
@@ -190,7 +181,7 @@ var userId = <?=$user->id?>;
|
|
|
<select class="form-control" name="can_claim" id="can-claim">
|
|
|
<?php
|
|
|
foreach(Form::BOOLEAN_OPTIONS as $value => $display) {
|
|
|
- $selected = ($user->can_claim == $value) ? "selected" : "";
|
|
|
+ $selected = (int) $user->can_claim === $value ? "selected" : "";
|
|
|
?>
|
|
|
<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
|
|
|
<?php
|