renaming ifsg
This commit is contained in:
parent
c93c241dc9
commit
21423ef305
|
@ -17,8 +17,8 @@ class AddIfsgCerificatesToUsersLicenses extends Migration
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
$this->schema->table('users_licenses', function (Blueprint $table): void {
|
$this->schema->table('users_licenses', function (Blueprint $table): void {
|
||||||
$table->boolean('ifsg_certificate')->default(false)->after('drive_12t');
|
$table->boolean('ifsg_certificate_light')->default(false)->after('drive_12t');
|
||||||
$table->boolean('ifsg_certificate_full')->default(false)->after('ifsg_certificate');
|
$table->boolean('ifsg_certificate')->default(false)->after('ifsg_certificate_light');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ class AddIfsgCerificatesToUsersLicenses extends Migration
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
$this->schema->table('users_licenses', function (Blueprint $table): void {
|
$this->schema->table('users_licenses', function (Blueprint $table): void {
|
||||||
|
$table->dropColumn('ifsg_certificate_light');
|
||||||
$table->dropColumn('ifsg_certificate');
|
$table->dropColumn('ifsg_certificate');
|
||||||
$table->dropColumn('ifsg_certificate_full');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ function user_ifsg_certificate_required_hint()
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
// User has already entered data, no hint needed.
|
// User has already entered data, no hint needed.
|
||||||
if ($user->license->ifsg) {
|
if (!config('ifsg_enabled') || $user->license->ifsg_light || $user->license->ifsg) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ function AngelType_view_buttons(
|
||||||
icon('person-vcard') . __('my driving license')
|
icon('person-vcard') . __('my driving license')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($angeltype->requires_ifsg_certificate) {
|
if (config('isfg_enabled') && $angeltype->requires_ifsg_certificate) {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
url('/settings/certificates'),
|
url('/settings/certificates'),
|
||||||
icon('card-checklist') . __('angeltype.ifsg.own')
|
icon('card-checklist') . __('angeltype.ifsg.own')
|
||||||
|
@ -191,7 +191,7 @@ function AngelType_view_buttons(
|
||||||
error(__('This angeltype requires a driver license. Please enter your driver license information!'));
|
error(__('This angeltype requires a driver license. Please enter your driver license information!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($angeltype->requires_ifsg_certificate && !$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'));
|
error(__('angeltype.ifsg.required.info'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,7 @@ function User_view(
|
||||||
user_driver_license_edit_link($user_source),
|
user_driver_license_edit_link($user_source),
|
||||||
icon('person-vcard') . __('driving license')
|
icon('person-vcard') . __('driving license')
|
||||||
) : '',
|
) : '',
|
||||||
config('ifsg_enabled') && ($admin_user_privilege || ($its_me && $needs_drivers_license)) ? button(
|
config('ifsg_enabled') && ($admin_user_privilege || ($its_me && $needs_ifsg_certificate)) ? button(
|
||||||
page_link_to('settings/certificates'),
|
page_link_to('settings/certificates'),
|
||||||
icon('card-checklist') . __('ifsg.certificate')
|
icon('card-checklist') . __('ifsg.certificate')
|
||||||
) : '',
|
) : '',
|
||||||
|
|
|
@ -2213,10 +2213,10 @@ msgstr "Zertifikate"
|
||||||
msgid "settings.certificates.info"
|
msgid "settings.certificates.info"
|
||||||
msgstr "Hier kannst du deine gemachte Gesundheitsbelehrung eintragen"
|
msgstr "Hier kannst du deine gemachte Gesundheitsbelehrung eintragen"
|
||||||
|
|
||||||
msgid "settings.ifsg"
|
msgid "settings.ifsg_light"
|
||||||
msgstr "Ich wurde vor Ort nach IfSG §43 (Frikadellendiplom light) belehrt."
|
msgstr "Ich wurde vor Ort nach IfSG §43 (Frikadellendiplom light) belehrt."
|
||||||
|
|
||||||
msgid "settings.ifsg_full"
|
msgid "settings.ifsg"
|
||||||
msgstr "Ich habe eine Belehrung nach §43 IfSG (Frikadellendiplom) bei meinem Gesundheitsamt "
|
msgstr "Ich habe eine Belehrung nach §43 IfSG (Frikadellendiplom) bei meinem Gesundheitsamt "
|
||||||
"erhalten und innerhalb von 3 Monaten die Zweitbelehrung durch uns oder meinen Arbeitgeber/Koch/Verein bekommen. "
|
"erhalten und innerhalb von 3 Monaten die Zweitbelehrung durch uns oder meinen Arbeitgeber/Koch/Verein bekommen. "
|
||||||
"Zusätzlich ist die Zweitbelehrung nicht älter als zwei Jahre."
|
"Zusätzlich ist die Zweitbelehrung nicht älter als zwei Jahre."
|
||||||
|
|
|
@ -314,10 +314,10 @@ msgstr "Certificates"
|
||||||
msgid "settings.certificates.info"
|
msgid "settings.certificates.info"
|
||||||
msgstr "Here you can enter your health instruction"
|
msgstr "Here you can enter your health instruction"
|
||||||
|
|
||||||
msgid "settings.ifsg"
|
msgid "settings.ifsg_light"
|
||||||
msgstr "I was instructed about IfSG §43 (aka Frikadellendiplom light) on site."
|
msgstr "I was instructed about IfSG §43 (aka Frikadellendiplom light) on site."
|
||||||
|
|
||||||
msgid "settings.ifsg_full"
|
msgid "settings.ifsg"
|
||||||
msgstr "I have gotten the instruction about §43 IfSG (aka Frikadellendiplom) from my Health Department "
|
msgstr "I have gotten the instruction about §43 IfSG (aka Frikadellendiplom) from my Health Department "
|
||||||
"and a second instruction from us or my employer/chef/assosiation within 3 months. "
|
"and a second instruction from us or my employer/chef/assosiation within 3 months. "
|
||||||
"Additionally my second instruction is not older than 2 years."
|
"Additionally my second instruction is not older than 2 years."
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{{ m.info(__('settings.certificates.info')) }}
|
{{ m.info(__('settings.certificates.info')) }}
|
||||||
|
{{ f.checkbox('ifsg_certificate_light', __('settings.ifsg_light'), {
|
||||||
|
'checked': ifsg_certificate_light,
|
||||||
|
}) }}
|
||||||
{{ f.checkbox('ifsg_certificate', __('settings.ifsg'), {
|
{{ f.checkbox('ifsg_certificate', __('settings.ifsg'), {
|
||||||
'checked': ifsg_certificate,
|
'checked': ifsg_certificate,
|
||||||
}) }}
|
}) }}
|
||||||
{{ f.checkbox('ifsg_certificate_full', __('settings.ifsg_full'), {
|
|
||||||
'checked': ifsg_certificate_full,
|
|
||||||
}) }}
|
|
||||||
{{ f.submit(__('form.save')) }}
|
{{ f.submit(__('form.save')) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -83,8 +83,8 @@ class Controller extends BaseController
|
||||||
['labels' => ['type' => '3.5t'], 'value' => $this->stats->licenses('3.5t')],
|
['labels' => ['type' => '3.5t'], 'value' => $this->stats->licenses('3.5t')],
|
||||||
['labels' => ['type' => '7.5t'], 'value' => $this->stats->licenses('7.5t')],
|
['labels' => ['type' => '7.5t'], 'value' => $this->stats->licenses('7.5t')],
|
||||||
['labels' => ['type' => '12t'], 'value' => $this->stats->licenses('12t')],
|
['labels' => ['type' => '12t'], 'value' => $this->stats->licenses('12t')],
|
||||||
|
['labels' => ['type' => 'ifsg_light'], 'value' => $this->stats->licenses('ifsg_light')],
|
||||||
['labels' => ['type' => 'ifsg'], 'value' => $this->stats->licenses('ifsg')],
|
['labels' => ['type' => 'ifsg'], 'value' => $this->stats->licenses('ifsg')],
|
||||||
['labels' => ['type' => 'ifsg_full'], 'value' => $this->stats->licenses('ifsg_full')],
|
|
||||||
],
|
],
|
||||||
'users_email' => [
|
'users_email' => [
|
||||||
'type' => 'gauge',
|
'type' => 'gauge',
|
||||||
|
|
|
@ -183,8 +183,8 @@ class Stats
|
||||||
'3.5t' => 'drive_3_5t',
|
'3.5t' => 'drive_3_5t',
|
||||||
'7.5t' => 'drive_7_5t',
|
'7.5t' => 'drive_7_5t',
|
||||||
'12t' => 'drive_12t',
|
'12t' => 'drive_12t',
|
||||||
'ifsg' => 'ifsg_certificate',
|
'ifsg_light' => 'ifsg_certificate_light',
|
||||||
'ifsg_full' => 'ifsg_certificate_full',
|
'ifsg' => 'ifsg_certificate',
|
||||||
];
|
];
|
||||||
|
|
||||||
$query = (new License())
|
$query = (new License())
|
||||||
|
|
|
@ -234,8 +234,8 @@ class SettingsController extends BaseController
|
||||||
'pages/settings/certificates',
|
'pages/settings/certificates',
|
||||||
[
|
[
|
||||||
'settings_menu' => $this->settingsMenu(),
|
'settings_menu' => $this->settingsMenu(),
|
||||||
|
'ifsg_certificate_light' => $user->license->ifsg_certificate_light,
|
||||||
'ifsg_certificate' => $user->license->ifsg_certificate,
|
'ifsg_certificate' => $user->license->ifsg_certificate,
|
||||||
'ifsg_certificate_full' => $user->license->ifsg_certificate_full,
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -244,16 +244,16 @@ class SettingsController extends BaseController
|
||||||
{
|
{
|
||||||
$user = $this->auth->user();
|
$user = $this->auth->user();
|
||||||
$data = $this->validate($request, [
|
$data = $this->validate($request, [
|
||||||
|
'ifsg_certificate_light' => 'optional|checked',
|
||||||
'ifsg_certificate' => 'optional|checked',
|
'ifsg_certificate' => 'optional|checked',
|
||||||
'ifsg_certificate_full' => 'optional|checked',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!config('ifsg_enabled')) {
|
if (!config('ifsg_enabled')) {
|
||||||
throw new HttpNotFound('ifsg.disabled');
|
throw new HttpNotFound('ifsg.disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->license->ifsg_certificate = $data['ifsg_certificate'] || $data['ifsg_certificate_full'];
|
$user->license->ifsg_certificate_light = !$data['ifsg_certificate'] && $data['ifsg_certificate_light'];
|
||||||
$user->license->ifsg_certificate_full = (bool) $data['ifsg_certificate_full'];
|
$user->license->ifsg_certificate = (bool) $data['ifsg_certificate'];
|
||||||
$user->license->save();
|
$user->license->save();
|
||||||
|
|
||||||
$this->addNotification('settings.certificates.success');
|
$this->addNotification('settings.certificates.success');
|
||||||
|
@ -292,7 +292,7 @@ class SettingsController extends BaseController
|
||||||
$menu[url('/settings/theme')] = 'settings.theme';
|
$menu[url('/settings/theme')] = 'settings.theme';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('ifsg_enable')) {
|
if (config('ifsg_enabled')) {
|
||||||
$menu[url('/settings/certificates')] = 'settings.certificates';
|
$menu[url('/settings/certificates')] = 'settings.certificates';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,14 @@ class License extends HasUserModel
|
||||||
|
|
||||||
/** @var array Default attributes */
|
/** @var array Default attributes */
|
||||||
protected $attributes = [ // phpcs:ignore
|
protected $attributes = [ // phpcs:ignore
|
||||||
'has_car' => false,
|
'has_car' => false,
|
||||||
'drive_forklift' => false,
|
'drive_forklift' => false,
|
||||||
'drive_car' => false,
|
'drive_car' => false,
|
||||||
'drive_3_5t' => false,
|
'drive_3_5t' => false,
|
||||||
'drive_7_5t' => false,
|
'drive_7_5t' => false,
|
||||||
'drive_12t' => false,
|
'drive_12t' => false,
|
||||||
'ifsg_certificate' => false,
|
'ifsg_certificate_light' => false,
|
||||||
'ifsg_certificate_full' => false,
|
'ifsg_certificate' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,20 +54,20 @@ class License extends HasUserModel
|
||||||
'drive_3_5t',
|
'drive_3_5t',
|
||||||
'drive_7_5t',
|
'drive_7_5t',
|
||||||
'drive_12t',
|
'drive_12t',
|
||||||
|
'ifsg_certificate_light',
|
||||||
'ifsg_certificate',
|
'ifsg_certificate',
|
||||||
'ifsg_certificate_full',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var array<string> */
|
/** @var array<string> */
|
||||||
protected $casts = [ // phpcs:ignore
|
protected $casts = [ // phpcs:ignore
|
||||||
'has_car' => 'boolean',
|
'has_car' => 'boolean',
|
||||||
'drive_forklift' => 'boolean',
|
'drive_forklift' => 'boolean',
|
||||||
'drive_car' => 'boolean',
|
'drive_car' => 'boolean',
|
||||||
'drive_3_5t' => 'boolean',
|
'drive_3_5t' => 'boolean',
|
||||||
'drive_7_5t' => 'boolean',
|
'drive_7_5t' => 'boolean',
|
||||||
'drive_12t' => 'boolean',
|
'drive_12t' => 'boolean',
|
||||||
'ifsg_certificate' => 'boolean',
|
'ifsg_certificate_light' => 'boolean',
|
||||||
'ifsg_certificate_full' => 'boolean',
|
'ifsg_certificate' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
$stats->expects($this->exactly(8))
|
$stats->expects($this->exactly(8))
|
||||||
->method('licenses')
|
->method('licenses')
|
||||||
->withConsecutive(['has_car'], ['forklift'], ['car'], ['3.5t'], ['7.5t'], ['12t'], ['ifsg'], ['ifsg_full'])
|
->withConsecutive(['has_car'], ['forklift'], ['car'], ['3.5t'], ['7.5t'], ['12t'], ['ifsg_light'], ['ifsg'])
|
||||||
->willReturnOnConsecutiveCalls(6, 3, 15, 9, 7, 1, 5, 4);
|
->willReturnOnConsecutiveCalls(6, 3, 15, 9, 7, 1, 5, 4);
|
||||||
$stats->expects($this->exactly(2))
|
$stats->expects($this->exactly(2))
|
||||||
->method('arrivedUsers')
|
->method('arrivedUsers')
|
||||||
|
|
|
@ -142,8 +142,8 @@ class StatsTest extends TestCase
|
||||||
$this->assertEquals(0, $stats->licenses('3.5t'));
|
$this->assertEquals(0, $stats->licenses('3.5t'));
|
||||||
$this->assertEquals(0, $stats->licenses('7.5t'));
|
$this->assertEquals(0, $stats->licenses('7.5t'));
|
||||||
$this->assertEquals(1, $stats->licenses('12t'));
|
$this->assertEquals(1, $stats->licenses('12t'));
|
||||||
|
$this->assertEquals(0, $stats->licenses('ifsg_light'));
|
||||||
$this->assertEquals(0, $stats->licenses('ifsg'));
|
$this->assertEquals(0, $stats->licenses('ifsg'));
|
||||||
$this->assertEquals(0, $stats->licenses('ifsg_full'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue