From bf59298564722d75beed5ddac66db0e99caac451 Mon Sep 17 00:00:00 2001 From: Qaseem Wakeel Lodhi Date: Sat, 13 Oct 2018 15:57:51 +0500 Subject: [PATCH] WIP: integrate event registration form with mock data. https://github.com/recurship/event-manager/issues/170 --- .../containers/CurrentEvent/CurrentEvent.css | 6 ++ .../containers/CurrentEvent/CurrentEvent.js | 30 ++++++- .../src/containers/FormsModal/FormsModal.css | 0 .../src/containers/FormsModal/FormsModal.js | 87 +++++++++++++++++++ client/src/mocks/mockForms.js | 38 ++++++++ 5 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 client/src/containers/FormsModal/FormsModal.css create mode 100644 client/src/containers/FormsModal/FormsModal.js create mode 100644 client/src/mocks/mockForms.js diff --git a/client/src/containers/CurrentEvent/CurrentEvent.css b/client/src/containers/CurrentEvent/CurrentEvent.css index f96a08a..15d1e51 100644 --- a/client/src/containers/CurrentEvent/CurrentEvent.css +++ b/client/src/containers/CurrentEvent/CurrentEvent.css @@ -6,6 +6,12 @@ bottom: 0; padding: 5px 30px; } + +#summary-container .subscribe { + justify-content: flex-end; + display: flex; + width: 100%; +} .row .col #edit-user { position: absolute; top: 5px; diff --git a/client/src/containers/CurrentEvent/CurrentEvent.js b/client/src/containers/CurrentEvent/CurrentEvent.js index acddb69..96ae7ec 100644 --- a/client/src/containers/CurrentEvent/CurrentEvent.js +++ b/client/src/containers/CurrentEvent/CurrentEvent.js @@ -8,6 +8,7 @@ import { CardTitle, CardSubtitle, Col, + Button, Row, } from 'reactstrap'; import MetaTagsComponent from '../../components/SocialShare/MetaTagsComponent'; @@ -17,15 +18,22 @@ import { fetchCurrentEvent } from '../../actions'; import ContentHeader from '../../components/ContentHeader/ContentHeader'; import moment from 'moment'; import DescriptionContainer from '../../components/DescriptionContainer/DescriptionContainer'; +import FormsModal from '../FormsModal/FormsModal'; import { Link } from 'react-router-dom'; import { AttendeeType } from '../../types/attendee-types'; import './CurrentEvent.css'; import GoogleMap from '../../components/GoogleMap/GoogleMap'; +import { eventRegisteration } from '../../mocks/mockForms'; const DATE_FORMAT = 'LLLL'; class CurrentEvent extends Component { eventId; + + constructor(props) { + super(props); + } + componentDidMount() { this.getCurrentEvent(); } @@ -37,6 +45,12 @@ class CurrentEvent extends Component { dispatch(fetchCurrentEvent(eventId)); }; + eventSubscribe = (e, user) => { + e.preventDefault(); + this.registrationModal.toggle(); + // this.editModal.receiveUserDetails(user) + }; + getAttendeesProfiles = (attendees: Array) => { return ( @@ -68,11 +82,14 @@ class CurrentEvent extends Component { render() { let { event } = this.props.currentEvent; - return (
{event ? ( + (this.registrationModal = ref)} + /> { /> - + { iconName="fa fa-users fa-2x" content={event.organisation.name} /> + +
+ +
diff --git a/client/src/containers/FormsModal/FormsModal.css b/client/src/containers/FormsModal/FormsModal.css new file mode 100644 index 0000000..e69de29 diff --git a/client/src/containers/FormsModal/FormsModal.js b/client/src/containers/FormsModal/FormsModal.js new file mode 100644 index 0000000..02ddb20 --- /dev/null +++ b/client/src/containers/FormsModal/FormsModal.js @@ -0,0 +1,87 @@ +import React from 'react'; +import { + Button, + Modal, + ModalHeader, + ModalBody, + ModalFooter, + Input, + Label, +} from 'reactstrap'; +import './FormsModal.css'; + +class FormsModal extends React.Component { + constructor(props) { + super(props); + this.state = { + modal: false, + backdrop: true, + }; + // this.submit = this.submit.bind(this); + // this.toggle = this.toggle.bind(this); + } + toggle = () => { + this.setState({ + modal: !this.state.modal, + }); + }; + + submit = e => { + //TODO, update user via id; + this.toggle(); + }; + + render() { + return ( +
+ + Forms + +
+ {this.props.registrationForm.map((field, index) => ( +
+ {field.type !== 'dropdown' && ( +
+ + +
+ )} + + {field.type === 'dropdown' && ( +
+ + +
+ )} +
+ ))} +
+
+ + {' '} + + +
+
+ ); + } +} +export default FormsModal; diff --git a/client/src/mocks/mockForms.js b/client/src/mocks/mockForms.js new file mode 100644 index 0000000..a83e12d --- /dev/null +++ b/client/src/mocks/mockForms.js @@ -0,0 +1,38 @@ +export const eventRegisteration = [ + { + name: 'firstName', + type: 'text', + value: '', + label: 'First Name', + }, + { + name: 'lastName', + type: 'text', + value: '', + label: 'Last Name', + }, + { + name: 'email', + type: 'email', + value: '', + label: 'Email', + }, + { + name: 'phone-number', + type: 'number', + value: '', + label: 'Phone Number', + }, + { + name: 'organisation', + type: 'text', + value: '', + label: 'Organisation', + }, + { + name: 'experience', + type: 'dropdown', + label: 'Experience', + value: ['Fresh', '1 to 2 years', '2 to 3 years', '3 to onward'], + }, +];