engelsystem/includes/view/UserDriverLicenses_view.php

74 lines
2.9 KiB
PHP
Raw Normal View History

<?php
2018-10-10 03:10:28 +02:00
use Engelsystem\Models\User\User;
/**
* Edit a user's driving license information.
*
2018-10-10 03:10:28 +02:00
* @param User $user_source The user
2017-01-03 03:22:48 +01:00
* @param bool $wants_to_drive true, if the user wants to drive
* @param array $user_driver_license The user driver license
* @return string
*/
2017-01-02 03:57:23 +01:00
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
{
return page_with_title(sprintf(__('Edit %s driving license information'), User_Nick_render($user_source)), [
2017-01-02 15:43:36 +01:00
buttons([
2018-10-10 03:10:28 +02:00
button(user_link($user_source->id), __('Back to profile'), 'back')
2017-01-02 15:43:36 +01:00
]),
msg(),
form([
form_info(__('Privacy'), __('Your driving license information is only visible for supporters and admins.')),
form_checkbox('wants_to_drive', __('I am willing to drive a car for the event'), $wants_to_drive),
div('m-3', [
2017-01-02 15:43:36 +01:00
form_checkbox(
'has_car',
__('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'),
2017-01-02 15:43:36 +01:00
$user_driver_license['has_car']
),
heading(__('Driver license'), 3),
form_checkbox('has_license_car', __('Car'), $user_driver_license['has_license_car']),
2017-01-02 15:43:36 +01:00
form_checkbox(
'has_license_3_5t_transporter',
__('Transporter 3,5t'),
2017-01-02 15:43:36 +01:00
$user_driver_license['has_license_3_5t_transporter']
),
form_checkbox(
'has_license_7_5t_truck',
__('Truck 7,5t'),
2017-01-02 15:43:36 +01:00
$user_driver_license['has_license_7_5t_truck']
),
form_checkbox(
'has_license_12_5t_truck',
__('Truck 12,5t'),
2017-01-02 15:43:36 +01:00
$user_driver_license['has_license_12_5t_truck']
),
2017-12-25 23:12:52 +01:00
form_checkbox(
'has_license_forklift',
__('Forklift'),
2017-12-25 23:12:52 +01:00
$user_driver_license['has_license_forklift']
)
2017-01-02 15:43:36 +01:00
], 'driving_license'),
form_submit('submit', __('Save'))
2017-01-02 15:43:36 +01:00
]),
2020-05-13 18:26:32 +02:00
'
<script type="text/javascript">
$(function() {
var checkbox = $(\'#wants_to_drive\');
if(checkbox.is(\':checked\'))
$(\'#driving_license\').show();
else
$(\'#driving_license\').hide();
2017-01-22 01:02:52 +01:00
2020-05-13 18:26:32 +02:00
checkbox.click(function() {
if($(\'#wants_to_drive\').is(\':checked\'))
$(\'#driving_license\').show();
else
$(\'#driving_license\').hide();
});
});
</script>
'
2017-01-02 15:43:36 +01:00
]);
}