introduce new shift signup state for not arrived angels
This commit is contained in:
parent
7a3bdda483
commit
2c04e35bed
|
@ -191,6 +191,8 @@ function shift_entry_error_message(ShiftSignupState $shift_signup_state) {
|
|||
error(_('This shift is already occupied.'));
|
||||
} elseif ($shift_signup_state->getState() == ShiftSignupState::SHIFT_ENDED) {
|
||||
error(_('This shift ended already.'));
|
||||
} elseif ($shift_signup_state->getState() == ShiftSignupState::NOT_ARRIVED) {
|
||||
error(_('You are not marked as arrived.'));
|
||||
} elseif ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
|
||||
error(_('You are signed up for this shift.'));
|
||||
}
|
||||
|
|
|
@ -43,6 +43,11 @@ class ShiftSignupState
|
|||
*/
|
||||
const SIGNED_UP = 'SIGNED_UP';
|
||||
|
||||
/**
|
||||
* User has to be arrived
|
||||
*/
|
||||
const NOT_ARRIVED = 'NOT_ARRIVED';
|
||||
|
||||
/** @var string */
|
||||
private $state;
|
||||
|
||||
|
@ -83,6 +88,7 @@ class ShiftSignupState
|
|||
private function valueForState($state)
|
||||
{
|
||||
switch ($state) {
|
||||
case ShiftSignupState::NOT_ARRIVED:
|
||||
case ShiftSignupState::SHIFT_ENDED:
|
||||
return 100;
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ function Shift_signup_allowed_angel(
|
|||
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
|
||||
|
||||
if (config('signup_requires_arrival') && !$user['Gekommen']) {
|
||||
return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries);
|
||||
return new ShiftSignupState(ShiftSignupState::NOT_ARRIVED, $free_entries);
|
||||
}
|
||||
|
||||
if ($user_shifts == null) {
|
||||
|
|
|
@ -67,6 +67,7 @@ class ShiftCalendarShiftRenderer
|
|||
case ShiftSignupState::SIGNED_UP:
|
||||
return 'primary';
|
||||
|
||||
case ShiftSignupState::NOT_ARRIVED:
|
||||
case ShiftSignupState::SHIFT_ENDED:
|
||||
return 'default';
|
||||
|
||||
|
@ -186,6 +187,11 @@ class ShiftCalendarShiftRenderer
|
|||
$entry_list[] = $inner_text . ' (' . _('ended') . ')';
|
||||
break;
|
||||
|
||||
case ShiftSignupState::NOT_ARRIVED:
|
||||
// No link and add a text hint, when the shift ended
|
||||
$entry_list[] = $inner_text . ' (' . _('not arrived') . ')';
|
||||
break;
|
||||
|
||||
case ShiftSignupState::ANGELTYPE:
|
||||
if ($angeltype['restricted'] == 1) {
|
||||
// User has to be confirmed on the angeltype first
|
||||
|
|
Loading…
Reference in New Issue