add hint admin_shifts no location, shift type or angeltype (#1337)

This commit is contained in:
xuwhite 2024-01-28 20:57:59 +01:00 committed by GitHub
parent f387bc655d
commit 89d8a070d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 0 deletions

View File

@ -41,11 +41,13 @@ function admin_shifts()
// Locations laden // Locations laden
$locations = Location::orderBy('name')->get(); $locations = Location::orderBy('name')->get();
$no_locations = $locations->isEmpty();
$location_array = $locations->pluck('name', 'id')->toArray(); $location_array = $locations->pluck('name', 'id')->toArray();
// Load angeltypes // Load angeltypes
/** @var AngelType[] $types */ /** @var AngelType[] $types */
$types = AngelType::all(); $types = AngelType::all();
$no_angeltypes = $types->isEmpty();
$needed_angel_types = []; $needed_angel_types = [];
foreach ($types as $type) { foreach ($types as $type) {
$needed_angel_types[$type->id] = 0; $needed_angel_types[$type->id] = 0;
@ -54,6 +56,7 @@ function admin_shifts()
// Load shift types // Load shift types
/** @var ShiftType[]|Collection $shifttypes_source */ /** @var ShiftType[]|Collection $shifttypes_source */
$shifttypes_source = ShiftType::all(); $shifttypes_source = ShiftType::all();
$no_shifttypes = $shifttypes_source->isEmpty();
$shifttypes = []; $shifttypes = [];
foreach ($shifttypes_source as $shifttype) { foreach ($shifttypes_source as $shifttype) {
$shifttypes[$shifttype->id] = $shifttype->name; $shifttypes[$shifttype->id] = $shifttype->name;
@ -501,6 +504,9 @@ function admin_shifts()
icon('clock-history') icon('clock-history')
) . form([$reset], '', 'display:inline'), ) . form([$reset], '', 'display:inline'),
[ [
$no_locations ? warning(__('admin_shifts.no_locations')) : '',
$no_shifttypes ? warning(__('admin_shifts.no_shifttypes')) : '',
$no_angeltypes ? warning(__('admin_shifts.no_angeltypes')) : '',
msg(), msg(),
form([ form([
div('row', [ div('row', [

View File

@ -2074,3 +2074,12 @@ msgstr "Schicht Ort wurde von %s nach %s verschoben"
msgid "notification.shift.updated.shift" msgid "notification.shift.updated.shift"
msgstr "Die aktualisierte Schicht:" msgstr "Die aktualisierte Schicht:"
msgid "admin_shifts.no_locations"
msgstr "Es wurde noch kein Ort erstellt. Ohne können keine Schichten erstellt werden."
msgid "admin_shifts.no_shifttypes"
msgstr "Es wurde noch kein Schichttyp erstellt. Ohne können keine Schichten erstellt werden."
msgid "admin_shifts.no_angeltypes"
msgstr "Es wurde noch kein Engeltyp erstellt. Ohne können keine Schichten erstellt werden."

View File

@ -953,3 +953,12 @@ msgstr "Actions"
msgid "general.back" msgid "general.back"
msgstr "Back" msgstr "Back"
msgid "admin_shifts.no_locations"
msgstr "No location has been created yet. Shifts can't be created without one."
msgid "admin_shifts.no_shifttypes"
msgstr "No shift type has been created yet. Shifts can't be created without one."
msgid "admin_shifts.no_angeltypes"
msgstr "No angeltype has been created yet. Shifts can't be created without one."