add hide angeltype in shift view option for angeltypes (#1195)
This commit is contained in:
parent
8ebaffd71a
commit
adf00b2739
|
@ -27,6 +27,7 @@ class AngelTypeFactory extends Factory
|
|||
'shift_self_signup' => $this->faker->boolean(),
|
||||
'show_on_dashboard' => $this->faker->boolean(),
|
||||
'hide_register' => $this->faker->boolean(),
|
||||
'hide_on_shift_view' => $this->faker->boolean(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Engelsystem\Migrations;
|
||||
|
||||
use Engelsystem\Database\Migration\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddHideOnShiftViewToAngeltypes extends Migration
|
||||
{
|
||||
use Reference;
|
||||
|
||||
/**
|
||||
* Run the migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$this->schema->table('angel_types', function (Blueprint $table): void {
|
||||
$table->boolean('hide_on_shift_view')->default(false)->after('hide_register');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$this->schema->table('angel_types', function (Blueprint $table): void {
|
||||
$table->dropColumn('hide_on_shift_view');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -121,6 +121,7 @@ function angeltype_edit_controller()
|
|||
$angeltype->shift_self_signup = $request->has('shift_self_signup');
|
||||
$angeltype->show_on_dashboard = $request->has('show_on_dashboard');
|
||||
$angeltype->hide_register = $request->has('hide_register');
|
||||
$angeltype->hide_on_shift_view = $request->has('hide_on_shift_view');
|
||||
|
||||
$angeltype->requires_driver_license = $request->has('requires_driver_license');
|
||||
$angeltype->requires_ifsg_certificate = $request->has('requires_ifsg_certificate');
|
||||
|
@ -145,7 +146,8 @@ function angeltype_edit_controller()
|
|||
. $angeltype->contact_dect . ', '
|
||||
. $angeltype->contact_email . ', '
|
||||
. $angeltype->show_on_dashboard . ', '
|
||||
. $angeltype->hide_register
|
||||
. $angeltype->hide_register . ', '
|
||||
. $angeltype->hide_on_shift_view
|
||||
);
|
||||
throw_redirect(angeltype_link($angeltype->id));
|
||||
}
|
||||
|
|
|
@ -174,6 +174,7 @@ function load_days()
|
|||
function load_types()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$isShico = auth()->can('admin_shifts');
|
||||
|
||||
if (!AngelType::count()) {
|
||||
error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.'));
|
||||
|
@ -197,8 +198,11 @@ function load_types()
|
|||
ON (
|
||||
`user_angel_type`.`angel_type_id`=`angel_types`.`id`
|
||||
AND `user_angel_type`.`user_id`=?
|
||||
)
|
||||
ORDER BY `angel_types`.`name`
|
||||
)'
|
||||
. ($isShico ? '' :
|
||||
'WHERE angel_types.hide_on_shift_view = 0
|
||||
OR user_angel_type.user_id IS NOT NULL ') .
|
||||
'ORDER BY `angel_types`.`name`
|
||||
',
|
||||
[
|
||||
$user->id,
|
||||
|
|
|
@ -90,12 +90,14 @@ function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode)
|
|||
? form_info(__('Name'), $angeltype->name)
|
||||
: form_text('name', __('Name'), $angeltype->name),
|
||||
$supporter_mode
|
||||
? form_info(__('Requires introduction'), $angeltype->restricted ? __('Yes') : __('No'))
|
||||
: form_checkbox('restricted', __('Requires introduction'), $angeltype->restricted),
|
||||
form_info(
|
||||
'',
|
||||
__('Angel types which require introduction can only be used by an angel if enabled by a supporter (double opt-in).')
|
||||
),
|
||||
? form_info(__('angeltypes.restricted'), $angeltype->restricted ? __('Yes') : __('No'))
|
||||
: form_checkbox(
|
||||
'restricted',
|
||||
__('angeltypes.restricted') .
|
||||
' <span class="bi bi-info-circle-fill text-info" data-bs-toggle="tooltip" title="' .
|
||||
__('angeltypes.restricted.info') . '"></span>',
|
||||
$angeltype->restricted
|
||||
),
|
||||
$supporter_mode
|
||||
? form_info(__('shift.self_signup'), $angeltype->shift_self_signup ? __('Yes') : __('No'))
|
||||
: form_checkbox(
|
||||
|
@ -135,6 +137,15 @@ function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode)
|
|||
$supporter_mode
|
||||
? form_info(__('Hide at Registration'), $angeltype->hide_register ? __('Yes') : __('No'))
|
||||
: form_checkbox('hide_register', __('Hide at Registration'), $angeltype->hide_register),
|
||||
$supporter_mode
|
||||
? form_info(__('angeltypes.hide_on_shift_view'), $angeltype->hide_on_shift_view ? __('Yes') : __('No'))
|
||||
: form_checkbox(
|
||||
'hide_on_shift_view',
|
||||
__('angeltypes.hide_on_shift_view') .
|
||||
' <span class="bi bi-info-circle-fill text-info" data-bs-toggle="tooltip" title="' .
|
||||
__('angeltypes.hide_on_shift_view.info') . '"></span>',
|
||||
$angeltype->hide_on_shift_view
|
||||
),
|
||||
form_textarea('description', __('Description'), $angeltype->description),
|
||||
form_info('', __('Please use markdown for the description.')),
|
||||
heading(__('Contact'), 3),
|
||||
|
@ -578,7 +589,7 @@ function AngelTypes_list_view($angeltypes, bool $admin_angeltypes)
|
|||
]),
|
||||
table([
|
||||
'name' => __('Name'),
|
||||
'is_restricted' => icon('mortarboard-fill') . __('Requires introduction'),
|
||||
'is_restricted' => icon('mortarboard-fill') . __('angeltypes.restricted'),
|
||||
'shift_self_signup_allowed' => icon('pencil-square') . __('shift.self_signup.allowed'),
|
||||
'membership' => __('Membership'),
|
||||
'actions' => '',
|
||||
|
|
|
@ -1293,12 +1293,10 @@ msgstr "Möchtest Du den Engeltypen %s löschen?"
|
|||
msgid "cancel"
|
||||
msgstr "abbrechen"
|
||||
|
||||
msgid "Requires introduction"
|
||||
msgid "angeltypes.restricted"
|
||||
msgstr "Benötigt Einführung"
|
||||
|
||||
msgid ""
|
||||
"Angel types which require introduction can only be used by an angel if "
|
||||
"enabled by a supporter (double opt-in)."
|
||||
msgid "angeltypes.restricted.info"
|
||||
msgstr ""
|
||||
"Engeltypen, welche eine Einführung benötigen, müssen von einem Supporter freigeschaltet werden "
|
||||
"(double-opt-in)."
|
||||
|
@ -2415,6 +2413,13 @@ msgstr "DECT"
|
|||
msgid "angeltypes.email"
|
||||
msgstr "E-Mail"
|
||||
|
||||
msgid "angeltypes.hide_on_shift_view"
|
||||
msgstr "Auf Schicht-Ansicht ausblenden"
|
||||
|
||||
msgid "angeltypes.hide_on_shift_view.info"
|
||||
msgstr "Wenn ausgewählt, können nur Admins und Mitglieder des Engeltyps auf der "
|
||||
"Schicht Seite die Filteroption für diesen Engeltyp sehen."
|
||||
|
||||
msgid "registration.register"
|
||||
msgstr "Registrieren"
|
||||
|
||||
|
|
|
@ -515,6 +515,13 @@ msgstr "Teams-/Job description"
|
|||
msgid "angeltypes.about.text"
|
||||
msgstr "Here you can find the list of teams and their tasks. If you have further questions, have a look at the FAQ."
|
||||
|
||||
msgid "angeltypes.restricted"
|
||||
msgstr "Requires introduction"
|
||||
|
||||
msgid "angeltypes.restricted.info"
|
||||
msgstr "Angel types which require introduction can only be used by an angel "
|
||||
"if enabled by a supporter (double opt-in)."
|
||||
|
||||
msgid "angeltypes.restricted.hint"
|
||||
msgstr "This angeltype requires the attendance at an introduction meeting. "
|
||||
"You might find additional information in the description."
|
||||
|
@ -541,6 +548,13 @@ msgstr "Shift self signup"
|
|||
msgid "shift.self_signup.allowed"
|
||||
msgstr "Shift self signup allowed"
|
||||
|
||||
msgid "angeltypes.hide_on_shift_view"
|
||||
msgstr "Hide on shift view"
|
||||
|
||||
msgid "angeltypes.hide_on_shift_view.info"
|
||||
msgstr "If checked only admins and members of the angeltype "
|
||||
"can see the filter option for this angeltype on the shifts page"
|
||||
|
||||
msgid "registration.register"
|
||||
msgstr "Register"
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
|||
* @property boolean $shift_self_signup # Users can sign up for shifts
|
||||
* @property boolean $show_on_dashboard # Show on public dashboard
|
||||
* @property boolean $hide_register # Hide from registration page
|
||||
* @property boolean $hide_on_shift_view # Hide from shift page
|
||||
*
|
||||
* @property-read Collection|NeededAngelType[] $neededBy
|
||||
* @property-read UserAngelType $pivot
|
||||
|
@ -78,6 +79,7 @@ class AngelType extends BaseModel
|
|||
'shift_self_signup',
|
||||
'show_on_dashboard',
|
||||
'hide_register',
|
||||
'hide_on_shift_view',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
|
@ -88,6 +90,7 @@ class AngelType extends BaseModel
|
|||
'shift_self_signup' => 'boolean',
|
||||
'show_on_dashboard' => 'boolean',
|
||||
'hide_register' => 'boolean',
|
||||
'hide_on_shift_view' => 'boolean',
|
||||
];
|
||||
|
||||
public function neededBy(): HasMany
|
||||
|
|
Loading…
Reference in New Issue