import React, { Component } from "react";
import { connect } from "react-redux";
import * as actions from "../../actions/photogalaryActions";
// import {getEvents} from "../../actions/adminMainPageActions";
// import {photogalaryOnchange} from "../../actions/photogalaryActions";
import AdminHeader from "../../components/adminHeader/adminHeader";
import PhotogalaryForm from "../../components/adminPhotogalary/adminPhotogalaryReduxForm";
// import {eventFormInitialValue} from "../../state/addEventInitialValue"

class AdminAddPhotogalarytPage extends Component {
    // state = { 
    //  };

    componentDidMount() {
        this.props.getEvents();
        this.props.getPhotogalary()
    }

    render() {
        const {
            eventTypes,
            eventList,
            // photogalaryOnchange,
            // addPhotogalaryInitialValue,
            // putPhotogalary,
            postPhotogalary,
            // eventFormInitialValue
        } = this.props

        console.log('page props', this.props)
        console.log('eventList', eventList)
        console.log('gallery', this.props.gallery)

		// console.log("eventTypes", this.state.eventTypes );
		return (
            <>
                <AdminHeader />
                <div className="photogalary-form">
                    <div className="photogalary-form__content">
                        <h2 className="photogalary-form__form-title">ADD PHOTOGALARY</h2>
                        <PhotogalaryForm 
                            eventTypes={eventTypes} 
                            eventList={eventList} 
                            submitHandler = {postPhotogalary}
                            // photogalaryOnchange = {photogalaryOnchange}
                            // initialValues = {addPhotogalaryInitialValue}
                        />
                    </div>
                </div>
            </>
		);
	}
}

const mapStateToProps = state => ({
    eventList: state.adminMainPageReducer.eventList,
    eventTypes: state.adminMainPageReducer.eventTypes,
    // eventFormInitialValue: state.adminMainPageReducer.eventFormInitialValue,
    addPhotogalaryInitialValue: state.photogalaryReducer.addPhotogalaryInitialValue,
    gallery: state.photogalaryReducer.gallery
});

export default connect(
    mapStateToProps,
    actions
    // {getEvents, photogalaryOnchange}
)(AdminAddPhotogalarytPage);