2015-12-19 23:31:08 +01:00
|
|
|
<?php
|
|
|
|
|
2021-12-19 18:38:42 +01:00
|
|
|
use Engelsystem\Models\User\License;
|
2018-10-10 03:10:28 +02:00
|
|
|
use Engelsystem\Models\User\User;
|
|
|
|
|
2015-12-19 23:31:08 +01:00
|
|
|
/**
|
|
|
|
* Edit a user's driving license information.
|
2016-11-17 14:35:04 +01:00
|
|
|
*
|
2018-10-10 03:10:28 +02:00
|
|
|
* @param User $user_source The user
|
2021-12-19 18:38:42 +01:00
|
|
|
* @param License $user_driver_license The user driver license
|
2016-11-17 14:35:04 +01:00
|
|
|
* @return string
|
2015-12-19 23:31:08 +01:00
|
|
|
*/
|
2021-12-19 18:38:42 +01:00
|
|
|
function UserDriverLicense_edit_view($user_source, $user_driver_license)
|
2017-01-02 03:57:23 +01:00
|
|
|
{
|
2018-08-29 21:55:32 +02:00
|
|
|
return page_with_title(sprintf(__('Edit %s driving license information'), User_Nick_render($user_source)), [
|
2017-01-02 15:43:36 +01:00
|
|
|
buttons([
|
2023-02-05 18:03:00 +01:00
|
|
|
button(user_link($user_source->id), __('Back to profile'), 'back'),
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
msg(),
|
|
|
|
form([
|
2018-08-29 21:55:32 +02:00
|
|
|
form_info(__('Privacy'), __('Your driving license information is only visible for supporters and admins.')),
|
2021-12-19 18:38:42 +01:00
|
|
|
form_checkbox('wants_to_drive', __('I am willing to drive a car for the event'), $user_driver_license->wantsToDrive()),
|
2021-07-24 20:31:40 +02:00
|
|
|
div('m-3', [
|
2017-01-02 15:43:36 +01:00
|
|
|
form_checkbox(
|
|
|
|
'has_car',
|
2018-08-29 21:55:32 +02:00
|
|
|
__('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'),
|
2021-12-19 18:38:42 +01:00
|
|
|
$user_driver_license->has_car
|
2017-01-02 15:43:36 +01:00
|
|
|
),
|
2018-08-29 21:55:32 +02:00
|
|
|
heading(__('Driver license'), 3),
|
2021-12-19 18:38:42 +01:00
|
|
|
form_checkbox('has_license_car', __('Car'), $user_driver_license->drive_car),
|
2017-01-02 15:43:36 +01:00
|
|
|
form_checkbox(
|
|
|
|
'has_license_3_5t_transporter',
|
2018-08-29 21:55:32 +02:00
|
|
|
__('Transporter 3,5t'),
|
2021-12-19 18:38:42 +01:00
|
|
|
$user_driver_license->drive_3_5t
|
2017-01-02 15:43:36 +01:00
|
|
|
),
|
|
|
|
form_checkbox(
|
|
|
|
'has_license_7_5t_truck',
|
2018-08-29 21:55:32 +02:00
|
|
|
__('Truck 7,5t'),
|
2021-12-19 18:38:42 +01:00
|
|
|
$user_driver_license->drive_7_5t
|
2017-01-02 15:43:36 +01:00
|
|
|
),
|
|
|
|
form_checkbox(
|
2021-12-19 18:38:42 +01:00
|
|
|
'has_license_12t_truck',
|
|
|
|
__('Truck 12t'),
|
|
|
|
$user_driver_license->drive_12t
|
2017-01-02 15:43:36 +01:00
|
|
|
),
|
2017-12-25 23:12:52 +01:00
|
|
|
form_checkbox(
|
|
|
|
'has_license_forklift',
|
2018-08-29 21:55:32 +02:00
|
|
|
__('Forklift'),
|
2021-12-19 18:38:42 +01:00
|
|
|
$user_driver_license->drive_forklift
|
2023-02-05 18:03:00 +01:00
|
|
|
),
|
2017-01-02 15:43:36 +01:00
|
|
|
], 'driving_license'),
|
2023-02-05 18:03:00 +01:00
|
|
|
form_submit('submit', __('Save')),
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
2020-05-13 18:26:32 +02:00
|
|
|
'
|
|
|
|
<script type="text/javascript">
|
2022-11-29 21:47:26 +01:00
|
|
|
const drivingLicenseElement = document.getElementById("driving_license");
|
2017-01-22 01:02:52 +01:00
|
|
|
|
2022-11-29 21:47:26 +01:00
|
|
|
if (drivingLicenseElement) {
|
|
|
|
const checkbox = document.getElementById("wants_to_drive");
|
|
|
|
drivingLicenseElement.style.display = checkbox?.checked
|
|
|
|
? ""
|
|
|
|
: "none";
|
|
|
|
|
|
|
|
checkbox.addEventListener("click", () => {
|
|
|
|
drivingLicenseElement.style.display = document.getElementById("wants_to_drive")?.checked
|
|
|
|
? ""
|
|
|
|
: "none";
|
2020-05-13 18:26:32 +02:00
|
|
|
});
|
2022-11-29 21:47:26 +01:00
|
|
|
}
|
2020-05-13 18:26:32 +02:00
|
|
|
</script>
|
2023-02-05 18:03:00 +01:00
|
|
|
',
|
2021-09-10 14:30:16 +02:00
|
|
|
], true);
|
2015-12-19 23:31:08 +01:00
|
|
|
}
|