Commit 795a3ca1 authored by Gijs Hendriksen's avatar Gijs Hendriksen Committed by Sébastiaan Versteeg
Browse files

Added check for late cancellation in the event detail

parent 4906698e
...@@ -58,6 +58,7 @@ Object { ...@@ -58,6 +58,7 @@ Object {
"Queue position {{pos}}": "Wachtlijst positie {{pos}}", "Queue position {{pos}}": "Wachtlijst positie {{pos}}",
"Register": "Aanmelden", "Register": "Aanmelden",
"Registration deadline": "Registratiedeadline", "Registration deadline": "Registratiedeadline",
"Registration is not allowed anymore, as you cancelled your registration after the deadline.": "Aanmelden is niet meer toegestaan omdat je bent afgemeld na de afmelddeadline.",
"Registration is not possible anymore.": "Aanmelden is niet meer mogelijk.", "Registration is not possible anymore.": "Aanmelden is niet meer mogelijk.",
"Registration status": "Aanmeldstatus", "Registration status": "Aanmeldstatus",
"Registration will open {{start}}": "Aanmelden opent {{start}}", "Registration will open {{start}}": "Aanmelden opent {{start}}",
......
...@@ -30,5 +30,6 @@ ...@@ -30,5 +30,6 @@
"Update registration": "Aanmelding bijwerken", "Update registration": "Aanmelding bijwerken",
"Cancel registration": "Afmelden", "Cancel registration": "Afmelden",
"Registrations": "Aanmeldingen", "Registrations": "Aanmeldingen",
"Could not load the event...": "Kan het evenement niet laden..." "Could not load the event...": "Kan het evenement niet laden...",
"Registration is not allowed anymore, as you cancelled your registration after the deadline.": "Aanmelden is niet meer toegestaan omdat je bent afgemeld na de afmelddeadline."
} }
...@@ -209,6 +209,8 @@ Pizza: ...@@ -209,6 +209,8 @@ Pizza:
const regStarted = startRegDate <= nowDate; const regStarted = startRegDate <= nowDate;
const regAllowed = regRequired && endRegDate > nowDate && regStarted; const regAllowed = regRequired && endRegDate > nowDate && regStarted;
const afterCancelDeadline = data.cancel_deadline !== null && cancelDeadlineDate <= nowDate; const afterCancelDeadline = data.cancel_deadline !== null && cancelDeadlineDate <= nowDate;
const isLateCancellation = data.user_registration
&& data.user_registration.is_late_cancellation;
if (!regRequired) { if (!regRequired) {
text = t('No registration required.'); text = t('No registration required.');
...@@ -220,9 +222,11 @@ Pizza: ...@@ -220,9 +222,11 @@ Pizza:
text = t('Registration will open {{start}}', { start: registrationStart }); text = t('Registration will open {{start}}', { start: registrationStart });
} else if (!regAllowed) { } else if (!regAllowed) {
text = t('Registration is not possible anymore.'); text = t('Registration is not possible anymore.');
} else if (isLateCancellation) {
text = t('Registration is not allowed anymore, as you cancelled your registration after the deadline.');
} }
if (afterCancelDeadline) { if (afterCancelDeadline && !isLateCancellation) {
if (text.length > 0) { if (text.length > 0) {
text += ' '; text += ' ';
} }
...@@ -253,8 +257,12 @@ Pizza: ...@@ -253,8 +257,12 @@ Pizza:
const regRequired = data.registration_start !== null || data.registration_end !== null; const regRequired = data.registration_start !== null || data.registration_end !== null;
const regStarted = startRegDate <= nowDate; const regStarted = startRegDate <= nowDate;
const isLateCancellation = data.user_registration
&& data.user_registration.is_late_cancellation;
const regAllowed = regRequired && endRegDate > nowDate const regAllowed = regRequired && endRegDate > nowDate
&& regStarted && data.registration_allowed; && regStarted && data.registration_allowed
&& !isLateCancellation;
if (regAllowed) { if (regAllowed) {
if (data.user_registration === null || data.user_registration.is_cancelled) { if (data.user_registration === null || data.user_registration.is_cancelled) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment