Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
ThaliApp
Commits
fceda41c
Commit
fceda41c
authored
Sep 26, 2017
by
Gijs Hendriksen
Browse files
Merge branch 'fix/event-stati' into 'master'
Get rid of status property of events Closes #27 and #26 See merge request
!60
parents
729c974a
6ac48c9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/components/Event.js
View file @
fceda41c
...
...
@@ -10,14 +10,6 @@ import MemberView from './MemberView';
import
LoadingScreen
from
'
./LoadingScreen
'
;
import
{
colors
}
from
'
../style
'
;
const
REGISTRATION_NOT_NEEDED
=
-
1
;
const
REGISTRATION_NOT_YET_OPEN
=
0
;
// eslint-disable-next-line no-unused-vars
const
REGISTRATION_OPEN
=
1
;
const
REGISTRATION_OPEN_NO_CANCEL
=
2
;
const
REGISTRATION_CLOSED
=
3
;
const
REGISTRATION_CLOSED_CANCEL_ONLY
=
4
;
class
Event
extends
Component
{
eventDesc
=
(
data
)
=>
{
const
startDate
=
Moment
(
data
.
start
).
format
(
'
D MMM YYYY, HH:mm
'
);
...
...
@@ -50,7 +42,7 @@ class Event extends Component {
<
/View>
,
);
if
(
data
.
stat
us
>
REGISTRATION_NOT_NEEDED
)
{
if
(
data
.
regi
st
r
at
ion_start
!==
null
||
data
.
registration_end
!==
null
)
{
const
registrationDeadline
=
Moment
(
data
.
registration_end
).
format
(
'
D MMM YYYY, HH:mm
'
);
const
cancelDeadline
=
Moment
(
data
.
cancel_deadline
).
format
(
'
D MMM YYYY, HH:mm
'
);
...
...
@@ -110,23 +102,33 @@ class Event extends Component {
eventInfo
=
(
event
)
=>
{
let
text
=
''
;
if
(
event
.
status
===
REGISTRATION_NOT_YET_OPEN
)
{
const
registrationStart
=
Moment
(
event
.
registration_start
).
format
(
'
D MMM YYYY, HH:m
'
);
text
=
`Aanmelden opent
${
registrationStart
}
`
;
}
else
if
(
event
.
status
===
REGISTRATION_CLOSED
||
event
.
status
===
REGISTRATION_CLOSED_CANCEL_ONLY
)
{
text
=
'
Aanmelden is niet meer mogelijk
'
;
}
else
if
(
event
.
status
===
REGISTRATION_NOT_NEEDED
)
{
text
=
'
Geen aanmelding vereist
'
;
const
nowDate
=
new
Date
();
const
startRegDate
=
new
Date
(
event
.
registration_start
);
const
endRegDate
=
new
Date
(
event
.
registration_end
);
const
cancelDeadlineDate
=
new
Date
(
event
.
cancel_deadline
);
const
regRequired
=
event
.
registration_start
!==
null
||
event
.
registration_end
!==
null
;
const
regStarted
=
startRegDate
<=
nowDate
;
const
regAllowed
=
regRequired
&&
endRegDate
>
nowDate
&&
regStarted
;
const
afterCancelDeadline
=
event
.
cancel_deadline
!==
null
&&
cancelDeadlineDate
<=
nowDate
;
if
(
!
regRequired
)
{
text
=
'
Geen aanmelding vereist.
'
;
if
(
event
.
no_registration_message
)
{
text
=
event
.
no_registration_message
;
}
}
else
if
(
!
regStarted
)
{
const
registrationStart
=
Moment
(
event
.
registration_start
).
format
(
'
D MMM YYYY, HH:m
'
);
text
=
`Aanmelden opent
${
registrationStart
}
.`
;
}
else
if
(
!
regAllowed
)
{
text
=
'
Aanmelden is niet meer mogelijk.
'
;
}
if
(
(
event
.
status
===
REGISTRATION_OPEN_NO_CANCEL
||
event
.
status
===
REGISTRATION_CLOSED
)
&&
event
.
user_registration
!==
null
&&
!
event
.
user_registration
.
is_cancelled
&&
event
.
fine
>
0
&&
event
.
user_registration
.
queue_position
===
null
)
{
if
(
afterCancelDeadline
)
{
if
(
text
.
length
>
0
)
{
text
+=
'
'
;
}
text
+=
`Afmelden is niet meer mogelijk zonder de volledige kosten van €
${
event
.
fine
}
te `
+
'
betalen. Let op: je kunt je hierna niet meer aanmelden.
'
;
}
...
...
@@ -267,7 +269,6 @@ Event.propTypes = {
organiser
:
PropTypes
.
number
.
isRequired
,
location
:
PropTypes
.
string
.
isRequired
,
map_location
:
PropTypes
.
string
.
isRequired
,
status
:
PropTypes
.
number
.
isRequired
,
registration_allowed
:
PropTypes
.
bool
.
isRequired
,
has_fields
:
PropTypes
.
bool
.
isRequired
,
registration_start
:
PropTypes
.
string
,
...
...
app/reducers/event.js
View file @
fceda41c
...
...
@@ -10,8 +10,9 @@ const initialState = {
organiser
:
-
1
,
category
:
''
,
location
:
''
,
status
:
-
1
,
registered
:
false
,
map_location
:
''
,
registration_allowed
:
false
,
has_fields
:
false
,
},
registrations
:
[],
success
:
false
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment