Add table for ifsg to angeltype

This commit is contained in:
Igor Scheller 2023-08-19 12:59:52 +02:00 committed by Michael Weimann
parent c63a671dc4
commit 80bec733bd
5 changed files with 38 additions and 11 deletions

View File

@ -41,7 +41,11 @@ function user_ifsg_certificate_required_hint()
$angeltypes = $user->userAngelTypes;
foreach ($angeltypes as $angeltype) {
if ($angeltype->requires_ifsg_certificate) {
if (
$angeltype->requires_ifsg_certificate && !(
$user->license->ifsg_certificate || $user->license->ifsg_certificate_light
)
) {
return sprintf(
__('angeltype.ifsg.required.info.here'),
'<a href="' . url('/settings/certificates') . '">' . __('ifsg.info') . '</a>'

View File

@ -191,7 +191,11 @@ function AngelType_view_buttons(
error(__('This angeltype requires a driver license. Please enter your driver license information!'));
}
if (config('ifsg_enabled') && $angeltype->requires_ifsg_certificate && (!$user->license->ifsg_certificate_light || !$user->license->ifsg_certificate)) {
if (
config('ifsg_enabled') && $angeltype->requires_ifsg_certificate && !(
$user->license->ifsg_certificate_light || $user->license->ifsg_certificate
)
) {
error(__('angeltype.ifsg.required.info'));
}
@ -251,6 +255,10 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
$member['has_license_12t_truck'] = icon_bool($member->license->drive_12t);
$member['has_license_forklift'] = icon_bool($member->license->drive_forklift);
}
if ($angeltype->requires_ifsg_certificate) {
$member['ifsg_certificate'] = icon_bool($member->license->ifsg_certificate);
$member['ifsg_certificate_light'] = icon_bool($member->license->ifsg_certificate_light);
}
if ($angeltype->restricted && empty($member->pivot->confirm_user_id)) {
$member['actions'] = table_buttons([
@ -336,13 +344,14 @@ function AngelType_view_table_headers(AngelType $angeltype, $supporter, $admin_a
{
$headers = [
'name' => __('Nick'),
'dect' => __('DECT'),
'actions' => '',
];
if (config('enable_dect')) {
$headers['dect'] = __('DECT');
}
if ($angeltype->requires_driver_license && ($supporter || $admin_angeltypes)) {
$headers = [
'name' => __('Nick'),
'dect' => __('DECT'),
$headers = array_merge($headers, [
'wants_to_drive' => __('Driver'),
'has_car' => __('Has car'),
'has_license_car' => __('Car'),
@ -350,12 +359,16 @@ function AngelType_view_table_headers(AngelType $angeltype, $supporter, $admin_a
'has_license_7_5t_truck' => __('7,5t Truck'),
'has_license_12t_truck' => __('12t Truck'),
'has_license_forklift' => __('Forklift'),
'actions' => '',
];
]);
}
if (!config('enable_dect')) {
unset($headers['dect']);
if (config('ifsg_enabled') && $angeltype->requires_ifsg_certificate && ($supporter || $admin_angeltypes)) {
$headers['ifsg_certificate_light'] = __('ifsg.certificate_light');
$headers['ifsg_certificate'] = __('ifsg.certificate');
}
$headers['actions'] = '';
return $headers;
}

View File

@ -2233,6 +2233,9 @@ msgstr "Benötigt eine Gesundheitsbelehrung"
msgid "ifsg.certificate"
msgstr "Gesundheitsbelehrung"
msgid "ifsg.certificate_light"
msgstr "Gesundheitsbelehrung vor Ort"
msgid "angeltype.ifsg.own"
msgstr "Meine Gesundheitsbelehrung"

View File

@ -331,6 +331,9 @@ msgstr "Requires health instruction"
msgid "ifsg.certificate"
msgstr "health instruction"
msgid "ifsg.certificate_light"
msgstr "health instruction on site"
msgid "angeltype.ifsg.own"
msgstr "my health instruction"

View File

@ -14,6 +14,8 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
* @property bool $drive_3_5t
* @property bool $drive_7_5t
* @property bool $drive_12t
* @property bool $ifsg_certificate_light
* @property bool $ifsg_certificate
*
* @method static QueryBuilder|License[] whereHasCar($value)
* @method static QueryBuilder|License[] whereDriveForklift($value)
@ -21,6 +23,8 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
* @method static QueryBuilder|License[] whereDrive35T($value)
* @method static QueryBuilder|License[] whereDrive75T($value)
* @method static QueryBuilder|License[] whereDrive12T($value)
* @method static QueryBuilder|License[] whereIfsgCertificateLight($value)
* @method static QueryBuilder|License[] whereIfsgCertificate($value)
*/
class License extends HasUserModel
{