renaming ifsg

This commit is contained in:
Xu 2023-08-12 10:18:10 +02:00 committed by msquare
parent c93c241dc9
commit 21423ef305
13 changed files with 41 additions and 41 deletions

View File

@ -17,8 +17,8 @@ class AddIfsgCerificatesToUsersLicenses extends Migration
public function up(): void
{
$this->schema->table('users_licenses', function (Blueprint $table): void {
$table->boolean('ifsg_certificate')->default(false)->after('drive_12t');
$table->boolean('ifsg_certificate_full')->default(false)->after('ifsg_certificate');
$table->boolean('ifsg_certificate_light')->default(false)->after('drive_12t');
$table->boolean('ifsg_certificate')->default(false)->after('ifsg_certificate_light');
});
}
@ -28,8 +28,8 @@ class AddIfsgCerificatesToUsersLicenses extends Migration
public function down(): void
{
$this->schema->table('users_licenses', function (Blueprint $table): void {
$table->dropColumn('ifsg_certificate_light');
$table->dropColumn('ifsg_certificate');
$table->dropColumn('ifsg_certificate_full');
});
}
}

View File

@ -35,7 +35,7 @@ function user_ifsg_certificate_required_hint()
$user = auth()->user();
// 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;
}

View File

@ -173,7 +173,7 @@ function AngelType_view_buttons(
icon('person-vcard') . __('my driving license')
);
}
if ($angeltype->requires_ifsg_certificate) {
if (config('isfg_enabled') && $angeltype->requires_ifsg_certificate) {
$buttons[] = button(
url('/settings/certificates'),
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!'));
}
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'));
}

View File

@ -565,7 +565,7 @@ function User_view(
user_driver_license_edit_link($user_source),
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'),
icon('card-checklist') . __('ifsg.certificate')
) : '',

View File

@ -2213,10 +2213,10 @@ msgstr "Zertifikate"
msgid "settings.certificates.info"
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."
msgid "settings.ifsg_full"
msgid "settings.ifsg"
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. "
"Zusätzlich ist die Zweitbelehrung nicht älter als zwei Jahre."

View File

@ -314,10 +314,10 @@ msgstr "Certificates"
msgid "settings.certificates.info"
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."
msgid "settings.ifsg_full"
msgid "settings.ifsg"
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. "
"Additionally my second instruction is not older than 2 years."

View File

@ -11,12 +11,12 @@
<div class="row">
<div class="col-md-12">
{{ m.info(__('settings.certificates.info')) }}
{{ f.checkbox('ifsg_certificate_light', __('settings.ifsg_light'), {
'checked': ifsg_certificate_light,
}) }}
{{ f.checkbox('ifsg_certificate', __('settings.ifsg'), {
'checked': ifsg_certificate,
}) }}
{{ f.checkbox('ifsg_certificate_full', __('settings.ifsg_full'), {
'checked': ifsg_certificate_full,
}) }}
{{ f.submit(__('form.save')) }}
</div>
</div>

View File

@ -83,8 +83,8 @@ class Controller extends BaseController
['labels' => ['type' => '3.5t'], 'value' => $this->stats->licenses('3.5t')],
['labels' => ['type' => '7.5t'], 'value' => $this->stats->licenses('7.5t')],
['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_full'], 'value' => $this->stats->licenses('ifsg_full')],
],
'users_email' => [
'type' => 'gauge',

View File

@ -183,8 +183,8 @@ class Stats
'3.5t' => 'drive_3_5t',
'7.5t' => 'drive_7_5t',
'12t' => 'drive_12t',
'ifsg_light' => 'ifsg_certificate_light',
'ifsg' => 'ifsg_certificate',
'ifsg_full' => 'ifsg_certificate_full',
];
$query = (new License())

View File

@ -234,8 +234,8 @@ class SettingsController extends BaseController
'pages/settings/certificates',
[
'settings_menu' => $this->settingsMenu(),
'ifsg_certificate_light' => $user->license->ifsg_certificate_light,
'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();
$data = $this->validate($request, [
'ifsg_certificate_light' => 'optional|checked',
'ifsg_certificate' => 'optional|checked',
'ifsg_certificate_full' => 'optional|checked',
]);
if (!config('ifsg_enabled')) {
throw new HttpNotFound('ifsg.disabled');
}
$user->license->ifsg_certificate = $data['ifsg_certificate'] || $data['ifsg_certificate_full'];
$user->license->ifsg_certificate_full = (bool) $data['ifsg_certificate_full'];
$user->license->ifsg_certificate_light = !$data['ifsg_certificate'] && $data['ifsg_certificate_light'];
$user->license->ifsg_certificate = (bool) $data['ifsg_certificate'];
$user->license->save();
$this->addNotification('settings.certificates.success');
@ -292,7 +292,7 @@ class SettingsController extends BaseController
$menu[url('/settings/theme')] = 'settings.theme';
}
if (config('ifsg_enable')) {
if (config('ifsg_enabled')) {
$menu[url('/settings/certificates')] = 'settings.certificates';
}

View File

@ -37,8 +37,8 @@ class License extends HasUserModel
'drive_3_5t' => false,
'drive_7_5t' => false,
'drive_12t' => false,
'ifsg_certificate_light' => false,
'ifsg_certificate' => false,
'ifsg_certificate_full' => false,
];
/**
@ -54,8 +54,8 @@ class License extends HasUserModel
'drive_3_5t',
'drive_7_5t',
'drive_12t',
'ifsg_certificate_light',
'ifsg_certificate',
'ifsg_certificate_full',
];
/** @var array<string> */
@ -66,8 +66,8 @@ class License extends HasUserModel
'drive_3_5t' => 'boolean',
'drive_7_5t' => 'boolean',
'drive_12t' => 'boolean',
'ifsg_certificate_light' => 'boolean',
'ifsg_certificate' => 'boolean',
'ifsg_certificate_full' => 'boolean',
];
/**

View File

@ -88,7 +88,7 @@ class ControllerTest extends TestCase
$stats->expects($this->exactly(8))
->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);
$stats->expects($this->exactly(2))
->method('arrivedUsers')

View File

@ -142,8 +142,8 @@ class StatsTest extends TestCase
$this->assertEquals(0, $stats->licenses('3.5t'));
$this->assertEquals(0, $stats->licenses('7.5t'));
$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_full'));
}
/**