|
@@ -1,64 +1,103 @@
|
|
import React, { Component } from "react";
|
|
import React, { Component } from "react";
|
|
import { connect } from "react-redux";
|
|
import { connect } from "react-redux";
|
|
-import { reduxForm, Field } from "redux-form";
|
|
|
|
|
|
+// import { reduxForm, Field } from "redux-form";
|
|
import "./adminMyEventsPage.scss";
|
|
import "./adminMyEventsPage.scss";
|
|
import * as actions from "../../actions/adminMainPageActions";
|
|
import * as actions from "../../actions/adminMainPageActions";
|
|
import AdminHeader from "../../components/adminHeader/adminHeader";
|
|
import AdminHeader from "../../components/adminHeader/adminHeader";
|
|
import Form from "../../components/eventForm/eventReduxForm";
|
|
import Form from "../../components/eventForm/eventReduxForm";
|
|
-import AdminEventElement from "../../components/adminEventElement/adminEventElement";
|
|
|
|
|
|
+// import AdminEventElement from "../../components/adminEventElement/adminEventElement";
|
|
import ConfirmationMessage from "../../components/confirmationMessage/confirmationMessage";
|
|
import ConfirmationMessage from "../../components/confirmationMessage/confirmationMessage";
|
|
-import {customSelect} from "../../components/customFields/customSelect/customSelect";
|
|
|
|
|
|
+// import {customSelect} from "../../components/customFields/customSelect/customSelect";
|
|
|
|
+import EventInfoShort from "../../components/eventInfoShort/EventInfoShort";
|
|
|
|
|
|
class AdminAddEventPage extends Component {
|
|
class AdminAddEventPage extends Component {
|
|
- state = {
|
|
|
|
- confirmationMessageFlag: false
|
|
|
|
- };
|
|
|
|
|
|
+
|
|
|
|
+ state = {
|
|
|
|
+ confirmationMessageFlag: false,
|
|
|
|
+ // initialValues: this.props.eventFormInitialValue,
|
|
|
|
+ // eventList: this.props.eventList,
|
|
|
|
+ showFormFlag: false
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
- this.props.getEvents();
|
|
|
|
|
|
+ this.props.getEvents();
|
|
}
|
|
}
|
|
-
|
|
|
|
- resetInitValue = () => this.setState({ eventFormInitialValue: {} });
|
|
|
|
|
|
|
|
- showConfirmationMessage = () => this.setState({confirmationMessageFlag: true });
|
|
|
|
- closeConfirmationMessage = () => this.setState({confirmationMessageFlag: false });
|
|
|
|
|
|
+ // resetInitValue = () => this.setState({ eventFormInitialValue: {} });
|
|
|
|
+
|
|
|
|
+ // showConfirmationMessage = () => this.setState({confirmationMessageFlag: true });
|
|
|
|
+ // closeConfirmationMessage = () => this.setState({confirmationMessageFlag: false });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // editItem = item =>
|
|
|
|
+ // this.setState(prevState => ({
|
|
|
|
+ // ...prevState,
|
|
|
|
+ // showFormFlag: true,
|
|
|
|
+ // eventList: prevState.eventList.map(el => (el.id === item.id ? item : el))
|
|
|
|
+ // }));
|
|
|
|
+
|
|
|
|
+ // setInitialValues = id =>
|
|
|
|
+ // this.setState(prevState => {
|
|
|
|
+ // console.log('prevState', prevState)
|
|
|
|
+ // return {
|
|
|
|
+ // ...prevState,
|
|
|
|
+ // eventFormInitialValue: prevState.eventList.find(el => el._id === id)
|
|
|
|
+ // }});
|
|
|
|
|
|
render() {
|
|
render() {
|
|
const {
|
|
const {
|
|
postNewEvent,
|
|
postNewEvent,
|
|
eventList,
|
|
eventList,
|
|
- eventFormInitialValue,
|
|
|
|
- eventTypes
|
|
|
|
|
|
+ // eventFormInitialValue,
|
|
|
|
+ // eventTypes
|
|
} = this.props
|
|
} = this.props
|
|
|
|
|
|
console.log('eventList', eventList)
|
|
console.log('eventList', eventList)
|
|
- console.log('confirmationMessageFlag', this.state.confirmationMessageFlag)
|
|
|
|
|
|
+ // console.log('confirmationMessageFlag', this.state.confirmationMessageFlag)
|
|
|
|
|
|
- console.log("eventFormInitialValue", eventFormInitialValue);
|
|
|
|
|
|
+ // console.log("eventFormInitialValue", eventFormInitialValue);
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
<AdminHeader />
|
|
<AdminHeader />
|
|
<div className="event-page">
|
|
<div className="event-page">
|
|
<div className="event-page__content">
|
|
<div className="event-page__content">
|
|
<h2 className="event-page__title">MY EVENTS</h2>
|
|
<h2 className="event-page__title">MY EVENTS</h2>
|
|
-
|
|
|
|
|
|
+
|
|
<div className="event-page__container">
|
|
<div className="event-page__container">
|
|
- {eventList && eventList.map(elem =>
|
|
|
|
- <AdminEventElement
|
|
|
|
- key={elem._id}
|
|
|
|
- img={elem.mainBannerPicture}
|
|
|
|
- title={elem.title}
|
|
|
|
- id={elem._id}
|
|
|
|
- // onClick={showCarElement.bind(null, elem.id)}
|
|
|
|
- />
|
|
|
|
- )}
|
|
|
|
|
|
+ {eventList && eventList.map(el =>
|
|
|
|
+ <div key={el._id}>
|
|
|
|
+ <EventInfoShort
|
|
|
|
+ key={el._id}
|
|
|
|
+ title={el.title}
|
|
|
|
+ country={el.country}
|
|
|
|
+ city={el.city}
|
|
|
|
+ id={el._id}
|
|
|
|
+ eventDate={el.eventDate}
|
|
|
|
+ imgSrc={el.mainBannerPicture}
|
|
|
|
+ />
|
|
|
|
+ <div className="event-buttons-conteiner">
|
|
|
|
+ <button className="event-button" >Edit Event</button>
|
|
|
|
+ <button className="event-button" >Delete Event</button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ // <AdminEventElement
|
|
|
|
+ // key={elem._id}
|
|
|
|
+ // img={elem.mainBannerPicture}
|
|
|
|
+ // title={elem.title}
|
|
|
|
+ // id={elem._id}
|
|
|
|
+ // // onClick={showCarElement.bind(null, elem.id)}
|
|
|
|
+ // />
|
|
|
|
+ )}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- {/* <Form
|
|
|
|
- postNewEvent = {postNewEvent}
|
|
|
|
- resetInitValue = {this.resetInitValue}
|
|
|
|
- showConfirmationMessage = {this.showConfirmationMessage}
|
|
|
|
- /> */}
|
|
|
|
|
|
+ {this.showFormFlag && <Form
|
|
|
|
+ initialValues={this.state.initialValues}
|
|
|
|
+ postNewEvent={postNewEvent}
|
|
|
|
+ editItem={this.editItem}
|
|
|
|
+ resetInitValue={this.resetInitValue}
|
|
|
|
+ showConfirmationMessage={this.showConfirmationMessage}
|
|
|
|
+ />}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|