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.'));
|
error(_('This shift is already occupied.'));
|
||||||
} elseif ($shift_signup_state->getState() == ShiftSignupState::SHIFT_ENDED) {
|
} elseif ($shift_signup_state->getState() == ShiftSignupState::SHIFT_ENDED) {
|
||||||
error(_('This shift ended already.'));
|
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) {
|
} elseif ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
|
||||||
error(_('You are signed up for this shift.'));
|
error(_('You are signed up for this shift.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,11 @@ class ShiftSignupState
|
||||||
*/
|
*/
|
||||||
const SIGNED_UP = 'SIGNED_UP';
|
const SIGNED_UP = 'SIGNED_UP';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User has to be arrived
|
||||||
|
*/
|
||||||
|
const NOT_ARRIVED = 'NOT_ARRIVED';
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $state;
|
private $state;
|
||||||
|
|
||||||
|
@ -83,6 +88,7 @@ class ShiftSignupState
|
||||||
private function valueForState($state)
|
private function valueForState($state)
|
||||||
{
|
{
|
||||||
switch ($state) {
|
switch ($state) {
|
||||||
|
case ShiftSignupState::NOT_ARRIVED:
|
||||||
case ShiftSignupState::SHIFT_ENDED:
|
case ShiftSignupState::SHIFT_ENDED:
|
||||||
return 100;
|
return 100;
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ function Shift_signup_allowed_angel(
|
||||||
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
|
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
|
||||||
|
|
||||||
if (config('signup_requires_arrival') && !$user['Gekommen']) {
|
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) {
|
if ($user_shifts == null) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ class ShiftCalendarShiftRenderer
|
||||||
case ShiftSignupState::SIGNED_UP:
|
case ShiftSignupState::SIGNED_UP:
|
||||||
return 'primary';
|
return 'primary';
|
||||||
|
|
||||||
|
case ShiftSignupState::NOT_ARRIVED:
|
||||||
case ShiftSignupState::SHIFT_ENDED:
|
case ShiftSignupState::SHIFT_ENDED:
|
||||||
return 'default';
|
return 'default';
|
||||||
|
|
||||||
|
@ -186,6 +187,11 @@ class ShiftCalendarShiftRenderer
|
||||||
$entry_list[] = $inner_text . ' (' . _('ended') . ')';
|
$entry_list[] = $inner_text . ' (' . _('ended') . ')';
|
||||||
break;
|
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:
|
case ShiftSignupState::ANGELTYPE:
|
||||||
if ($angeltype['restricted'] == 1) {
|
if ($angeltype['restricted'] == 1) {
|
||||||
// User has to be confirmed on the angeltype first
|
// User has to be confirmed on the angeltype first
|
||||||
|
|
Loading…
Reference in New Issue