Skip to content

Commit

Permalink
Merge pull request #128 from GSG-G8/119-people-number-client
Browse files Browse the repository at this point in the history
people number in client
close #119
  • Loading branch information
LinaYahya authored Aug 25, 2020
2 parents 7337404 + 3d257d8 commit 1acdbd0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
7 changes: 6 additions & 1 deletion client/src/components/DayView/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Calendar extends React.Component {
readOnly: false,
title: '',
description: '',
noOfPeople: null,
},
hiddenDays: [0],
minTime: '00:00',
Expand All @@ -49,6 +50,7 @@ class Calendar extends React.Component {
readOnly: false,
title: '',
description: '',
noOfPeople: null,
},
});
this.showModal();
Expand Down Expand Up @@ -95,6 +97,7 @@ class Calendar extends React.Component {
resourceId: event.room_id,
userid: event.user_id,
userName: event.name,
noOfPeople: event.noofpeople,
})),
});
})
Expand All @@ -120,6 +123,7 @@ class Calendar extends React.Component {
title: '',
description: '',
readOnly: false,
noOfPeople: null,
},
});
this.showModal();
Expand All @@ -131,7 +135,7 @@ class Calendar extends React.Component {
start,
end,
title,
extendedProps: { description, userName, userid },
extendedProps: { description, userName, userid, noOfPeople },
} = event;
this.setState({
modalData: {
Expand All @@ -144,6 +148,7 @@ class Calendar extends React.Component {
userName,
userid,
readOnly: true,
noOfPeople,
},
});
this.showModal();
Expand Down
21 changes: 19 additions & 2 deletions client/src/components/Form/Reservation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,15 @@ class BookingForm extends React.Component {
hiddenDays.includes(Number(current.format('e')));

const { repeat, confirmLoading } = this.state;
const { start, end, roomId, title, description, readOnly } = modalData;
const {
start,
end,
roomId,
title,
description,
readOnly,
noOfPeople,
} = modalData;
const disabled = confirmLoading || readOnly;
const { admin, userID } = this.context;
const couldCancel = readOnly && (modalData.userid === userID || admin);
Expand All @@ -196,7 +204,7 @@ class BookingForm extends React.Component {
>
<Form
labelCol={{
span: 5,
span: 8,
}}
labelAlign="left"
initialValues={{
Expand All @@ -207,6 +215,7 @@ class BookingForm extends React.Component {
description,
repeat: 'once',
remind: true,
noOfPeople,
}}
ref={this.formRef}
onFinish={(values) => {
Expand Down Expand Up @@ -248,6 +257,13 @@ class BookingForm extends React.Component {
<Input disabled={disabled} />
</Form.Item>

<Form.Item
name="noOfPeople"
label="Number of attendees:"
rules={[{ required: true, message: 'Add People Number' }]}
>
<Input disabled={disabled} />
</Form.Item>
<Form.Item name="description" label="Description">
<Input.TextArea disabled={disabled} />
</Form.Item>
Expand Down Expand Up @@ -353,6 +369,7 @@ BookingForm.propTypes = {
userName: PropTypes.string,
userid: PropTypes.number,
readOnly: PropTypes.bool,
noOfPeople: PropTypes.number,
}).isRequired,
fetchEvents: PropTypes.func.isRequired,
minTime: PropTypes.string.isRequired,
Expand Down

0 comments on commit 1acdbd0

Please sign in to comment.