Add day/evening attendance option

This commit is contained in:
2017-02-16 20:43:42 +00:00
parent c939c09991
commit e69d04f199
9 changed files with 46 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ class RsvpCard extends React.Component {
password: PropTypes.string,
completed: PropTypes.boolean,
attending: PropTypes.boolean,
ceremony: PropTypes.boolean,
dietary: PropTypes.string,
starter: PropTypes.string,
main: PropTypes.string,
@@ -47,6 +48,8 @@ class RsvpCard extends React.Component {
if (prop === 'attending' && value === 'false') { return true; }
if (!this.props.person.ceremony) { return true; }
return (isOK(this.state.saveAttending) &&
isOK(this.state.saveStarter) &&
isOK(this.state.saveMain));
@@ -186,7 +189,12 @@ class RsvpCard extends React.Component {
{this.state.saveAttending === 'error' ? <MdError size={30} color="red" /> : null}
</div>
</div>
<div className={[s.rsvpDetails, this.state.detailsVisible ? s.rsvpDetailsVisible : null].join(' ')}>
<div
className={[
s.rsvpDetails,
this.state.detailsVisible && this.props.person.ceremony ? s.rsvpDetailsVisible : null,
].join(' ')}
>
<div className={s.formGroup}>
<label className={s.label} htmlFor="starter">
Starter:

View File

@@ -48,6 +48,10 @@ const Person = Model.define('Person', {
type: DataType.BOOLEAN,
},
ceremony: {
type: DataType.BOOLEAN,
},
dietary: {
type: DataType.STRING(255),
},

View File

@@ -16,6 +16,7 @@ const PersonItemType = new ObjectType({
email: { type: StringType },
completed: { type: BooleanType },
attending: { type: BooleanType },
ceremony: { type: BooleanType },
dietary: { type: StringType },
starter: { type: StringType },
main: { type: StringType },

View File

@@ -87,6 +87,19 @@ class AdminPeople extends React.Component {
name="email"
/>
</div>
<div className={s.formGroup}>
<label className={s.label} htmlFor="ceremony">
Invite type:
</label>
<select
className={s.input}
id="cermony"
name="ceremony"
>
<option value="true">Full day</option>
<option value="false">Evening only</option>
</select>
</div>
<div className={s.formGroup}>
<label className={s.label} htmlFor="password">
Password (blank will autogenerate):

View File

@@ -14,6 +14,7 @@ class AdminPerson extends React.Component {
email: PropTypes.string,
password: PropTypes.string,
attending: PropTypes.boolean,
ceremony: PropTypes.boolean,
}).isRequired,
};
@@ -74,6 +75,20 @@ class AdminPerson extends React.Component {
defaultValue={this.props.person.email}
/>
</div>
<div className={s.formGroup}>
<label className={s.label} htmlFor="ceremony">
Invite type:
</label>
<select
className={s.input}
id="cermony"
name="ceremony"
defaultValue={this.props.person.ceremony ? 'true' : 'false'}
>
<option value="true">Full day</option>
<option value="false">Evening only</option>
</select>
</div>
<div className={s.formGroup}>
<label className={s.label} htmlFor="password">
Password:

View File

@@ -11,7 +11,7 @@ export default {
return { redirect: '/admin' };
}
const resp = await fetchQL('{getPersonByKey{key,firstname,lastname,email,completed,password,starter,main,dietary}}', {
const resp = await fetchQL('{getPersonByKey{key,firstname,lastname,email,completed,password,ceremony,starter,main,dietary}}', {
key: params.key,
});

View File

@@ -10,6 +10,7 @@ class Rsvp extends React.Component {
firstname: PropTypes.string,
lastname: PropTypes.string,
email: PropTypes.string,
ceremony: PropTypes.boolean,
dietary: PropTypes.string,
starter: PropTypes.string,
main: PropTypes.string,

View File

@@ -46,7 +46,7 @@ export default {
return { redirect: '/' };
}
const resp = await fetchQL('{getPersonsByPassword{key,firstname,lastname,attending,dietary,starter,main}}', {
const resp = await fetchQL('{getPersonsByPassword{key,firstname,lastname,attending,ceremony,dietary,starter,main}}', {
password: params.password,
});

View File

@@ -236,6 +236,7 @@ app.post('/admin/person', (req, res, next) => {
firstname: req.body.firstname,
lastname: req.body.lastname,
email: req.body.email,
ceremony: req.body.ceremony,
};
if (req.body.password && req.body.password !== '') {