|  | @@ -1,7 +1,7 @@
 | 
	
		
			
				|  |  |  import React, { Component } from "react";
 | 
	
		
			
				|  |  |  import ContentWrapper from "@/components/Layout/ContentWrapper";
 | 
	
		
			
				|  |  | -import { Card, CardBody, CardHeader, CardTitle, Button, Row, Col } from "reactstrap";
 | 
	
		
			
				|  |  | -import { getPelaporan, addStatus, removeLaporan, activeLaporan, changeRoleData } from "@/actions/pelaporan";
 | 
	
		
			
				|  |  | +import { Card, CardBody, CardHeader, CardTitle, Button, Row, Col, FormGroup, Input } from "reactstrap";
 | 
	
		
			
				|  |  | +import { getPelaporan, getOneLaporan, addStatus, removeLaporan, activeLaporan, changeRoleData } from "@/actions/pelaporan";
 | 
	
		
			
				|  |  |  import { updateJadwal } from "@/actions/penjadwalan";
 | 
	
		
			
				|  |  |  import DetailLaporan from "@/components/Main/DetailLaporan";
 | 
	
		
			
				|  |  |  import Link from "next/link";
 | 
	
	
		
			
				|  | @@ -18,6 +18,9 @@ import { connect } from "react-redux";
 | 
	
		
			
				|  |  |  import Loader from "@/components/Common/Loader";
 | 
	
		
			
				|  |  |  import Router from "next/router";
 | 
	
		
			
				|  |  |  import { ToastContainer, toast } from "react-toastify";
 | 
	
		
			
				|  |  | +import { Formik, Form, Field, ErrorMessage } from "formik";
 | 
	
		
			
				|  |  | +import * as Yup from "yup";
 | 
	
		
			
				|  |  | +import Datetime from "react-datetime";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const status = [
 | 
	
		
			
				|  |  |  	{ value: "Ditindaklanjuti DIKTI", label: "Ditindaklanjuti DIKTI", className: "State-ACT" },
 | 
	
	
		
			
				|  | @@ -30,9 +33,13 @@ const statusLLDIKTI = [
 | 
	
		
			
				|  |  |  	{ value: "Delegasi ke DIKTI", label: "Delegasi ke DIKTI", className: "State-ACT" },
 | 
	
		
			
				|  |  |  	{ value: "Ditutup", label: "Ditutup", className: "State-ACT" },
 | 
	
		
			
				|  |  |  ];
 | 
	
		
			
				|  |  | -class Calendar extends Component {
 | 
	
		
			
				|  |  | -	calendarEvents = events;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const jadwalSchema = Yup.object().shape({
 | 
	
		
			
				|  |  | +	judul: Yup.string().required("Required"),
 | 
	
		
			
				|  |  | +	dari_tanggal: Yup.date().required("Required"),
 | 
	
		
			
				|  |  | +	sampai_tanggal: Yup.date().required("Required"),
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +class Calendar extends Component {
 | 
	
		
			
				|  |  |  	calendarPlugins = [interactionPlugin, dayGridPlugin, timeGridPlugin, listPlugin, bootstrapPlugin];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	calendarHeader = {
 | 
	
	
		
			
				|  | @@ -58,49 +65,34 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  	static getInitialProps = ({ query }) => ({ query });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	async componentDidMount() {
 | 
	
		
			
				|  |  | -		/* initialize the external events */
 | 
	
		
			
				|  |  | -		new Draggable(this.refs.externalEventsList, {
 | 
	
		
			
				|  |  | -			itemSelector: ".fce-event",
 | 
	
		
			
				|  |  | -			eventData: function (eventEl) {
 | 
	
		
			
				|  |  | -				return {
 | 
	
		
			
				|  |  | -					title: eventEl.innerText.trim(),
 | 
	
		
			
				|  |  | -				};
 | 
	
		
			
				|  |  | -			},
 | 
	
		
			
				|  |  | -		});
 | 
	
		
			
				|  |  | +		const { token, query } = this.props;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		const { organisasi, peran } = this.props.user.peran[0];
 | 
	
		
			
				|  |  | +		const dataLaporan = await getPelaporan(token, { jadwal: true });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		const queryDataLaporan = { role: peran.id === 2021 ? "lldikti" : "dikti", penjadwalan: true, active: true };
 | 
	
		
			
				|  |  | -		if (peran.id === 2021) queryDataLaporan.orgId = organisasi.id;
 | 
	
		
			
				|  |  | -		const dataLaporan = await getPelaporan(queryDataLaporan);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		const laporan = await getPelaporan({ number: this.props.query.number, ptId: this.props.query.ptId });
 | 
	
		
			
				|  |  | +		const laporan = await getOneLaporan(token, query.id);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		this.setState({ dataLaporan });
 | 
	
		
			
				|  |  |  		this.getDataEvent();
 | 
	
		
			
				|  |  | -		await this.defaultStatus(laporan.data[0]);
 | 
	
		
			
				|  |  | -		// const cek = this.state.dataLaporan.data.filter((e) => e._number === this.props.query.number && e.pt_id == this.props.query.ptId)[0];
 | 
	
		
			
				|  |  | +		this.defaultStatus();
 | 
	
		
			
				|  |  |  		this.setState({ laporan });
 | 
	
		
			
				|  |  |  		let color = "#" + Math.floor(Math.random() * 16777215).toString(16);
 | 
	
		
			
				|  |  | -		if (laporan.data[0].penjadwalan) {
 | 
	
		
			
				|  |  | -			color = laporan.data[0].penjadwalan.background_color;
 | 
	
		
			
				|  |  | +		if (laporan.data.jadwal) {
 | 
	
		
			
				|  |  | +			color = laporan.data.jadwal.warna;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		this.setState({ externalEvents: [{ id: this.props.query.number, color, name: `Jadwal Pemeriksaan - No.Laporan : ${this.props.query.number} - ${laporan.data[0].pt.nama}`, allDay: true }] });
 | 
	
		
			
				|  |  | +		this.setState({ externalEvents: [{ id: query.id, color, name: `Jadwal Pemeriksaan - No.Laporan : ${laporan.data.no_laporan} - ${laporan.data.pt.nama}`, allDay: true }] });
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	getStatus = () => (this.props.user.peran[0].peran.id === 2021 ? statusLLDIKTI : status);
 | 
	
		
			
				|  |  | +	getStatus = () => (this.props.user.role.id === 2021 ? statusLLDIKTI : status);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	getDataEvent = () => {
 | 
	
		
			
				|  |  | -		const dataEvent = this.state.dataLaporan.data
 | 
	
		
			
				|  |  | -			.filter((e) => e.penjadwalan)
 | 
	
		
			
				|  |  | -			.map((e) => ({
 | 
	
		
			
				|  |  | -				id: e._id,
 | 
	
		
			
				|  |  | -				title: e.penjadwalan.title,
 | 
	
		
			
				|  |  | -				start: new Date(e.penjadwalan.from_date),
 | 
	
		
			
				|  |  | -				end: new Date(e.penjadwalan.to_date),
 | 
	
		
			
				|  |  | -				backgroundColor: e.penjadwalan.background_color, //red
 | 
	
		
			
				|  |  | -				borderColor: e.penjadwalan.background_color,
 | 
	
		
			
				|  |  | -			}));
 | 
	
		
			
				|  |  | +		const dataEvent = this.state.dataLaporan.data.map((e) => ({
 | 
	
		
			
				|  |  | +			id: e._id,
 | 
	
		
			
				|  |  | +			title: e.jadwal.judul,
 | 
	
		
			
				|  |  | +			start: new Date(e.jadwal.dari_tanggal),
 | 
	
		
			
				|  |  | +			end: new Date(e.jadwal.sampai_tanggal),
 | 
	
		
			
				|  |  | +			backgroundColor: e.jadwal.warna,
 | 
	
		
			
				|  |  | +			borderColor: e.jadwal.warna,
 | 
	
		
			
				|  |  | +		}));
 | 
	
		
			
				|  |  |  		this.setState({ dataEvent });
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -113,10 +105,6 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  		this.setState({ selectedEvent: data });
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	addEvent(event) {
 | 
	
		
			
				|  |  | -		this.calendarEvents.push(event);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  	handleEventReceive = (info) => {
 | 
	
		
			
				|  |  |  		var styles = getComputedStyle(info.draggedEl);
 | 
	
		
			
				|  |  |  		info.event.setProp("backgroundColor", styles.backgroundColor);
 | 
	
	
		
			
				|  | @@ -124,30 +112,37 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  		this.handleEventCalendar(info);
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	handleEventCalendar = ({ event }) => {
 | 
	
		
			
				|  |  | -		const number = this.props.query.number;
 | 
	
		
			
				|  |  | -		const ptId = this.props.query.ptId;
 | 
	
		
			
				|  |  | -		const data = {
 | 
	
		
			
				|  |  | -			title: event.title,
 | 
	
		
			
				|  |  | -			from_date: event.start,
 | 
	
		
			
				|  |  | -			to_date: event.end || event.start,
 | 
	
		
			
				|  |  | -			background_color: event.backgroundColor,
 | 
	
		
			
				|  |  | +	handleEventCalendar = async (data) => {
 | 
	
		
			
				|  |  | +		const { token, query } = this.props;
 | 
	
		
			
				|  |  | +		const { id } = query;
 | 
	
		
			
				|  |  | +		const { laporan } = this.state;
 | 
	
		
			
				|  |  | +		const warna = "#" + Math.floor(Math.random() * 16777215).toString(16);
 | 
	
		
			
				|  |  | +		const d = {
 | 
	
		
			
				|  |  | +			judul: data.judul,
 | 
	
		
			
				|  |  | +			dari_tanggal: data.dari_tanggal,
 | 
	
		
			
				|  |  | +			sampai_tanggal: data.sampai_tanggal,
 | 
	
		
			
				|  |  | +			warna,
 | 
	
		
			
				|  |  |  		};
 | 
	
		
			
				|  |  | -		toast.promise(updateJadwal({ number, ptId }, data), {
 | 
	
		
			
				|  |  | +		if (laporan.data.jadwal) {
 | 
	
		
			
				|  |  | +			d.warna = laporan.data.jadwal.warna;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		await toast.promise(updateJadwal(token, id, d), {
 | 
	
		
			
				|  |  |  			pending: "Loading",
 | 
	
		
			
				|  |  |  			success: "Success",
 | 
	
		
			
				|  |  |  			error: "Error",
 | 
	
		
			
				|  |  |  		});
 | 
	
		
			
				|  |  | +		// this.state.dataEvent.push({
 | 
	
		
			
				|  |  | +		// 	title: data.judul,
 | 
	
		
			
				|  |  | +		// 	start: new Date(data.dari_tanggal),
 | 
	
		
			
				|  |  | +		// 	end: new Date(data.sampai_tanggal),
 | 
	
		
			
				|  |  | +		// 	backgroundColor: warna,
 | 
	
		
			
				|  |  | +		// 	borderColor: warna,
 | 
	
		
			
				|  |  | +		// });
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	defaultStatus = async (data) => {
 | 
	
		
			
				|  |  | -		const { ptId, number } = this.props.query;
 | 
	
		
			
				|  |  | +	defaultStatus = async () => {
 | 
	
		
			
				|  |  |  		const status = this.getStatus();
 | 
	
		
			
				|  |  | -		if (!data.status) {
 | 
	
		
			
				|  |  | -			await addStatus({ number, ptId }, { status: status[0].value });
 | 
	
		
			
				|  |  | -			return this.setState({ selectedOption: status[0] });
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		return this.setState({ selectedOption: status.filter((e) => e.value === data.status)[0] });
 | 
	
		
			
				|  |  | +		return this.setState({ selectedOption: status[0] });
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	handleChangeSelect = (selectedOption) => this.setState({ selectedOption });
 | 
	
	
		
			
				|  | @@ -177,6 +172,7 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	render() {
 | 
	
		
			
				|  |  |  		const { externalEvents, laporan, selectedOption, selectedEvent } = this.state;
 | 
	
		
			
				|  |  | +		console.log(this.state.dataLaporan);
 | 
	
		
			
				|  |  |  		return (
 | 
	
		
			
				|  |  |  			<ContentWrapper>
 | 
	
		
			
				|  |  |  				<div className="content-heading">
 | 
	
	
		
			
				|  | @@ -193,7 +189,7 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  							<Col>
 | 
	
		
			
				|  |  |  								<Card className="card-default">
 | 
	
		
			
				|  |  |  									<CardBody>
 | 
	
		
			
				|  |  | -										<DetailLaporan noStatus query={this.props.query} data={laporan.data[0]} handleChangeSelect={this.handleChangeSelect} />
 | 
	
		
			
				|  |  | +										<DetailLaporan noStatus data={laporan.data} />
 | 
	
		
			
				|  |  |  									</CardBody>
 | 
	
		
			
				|  |  |  								</Card>
 | 
	
		
			
				|  |  |  							</Col>
 | 
	
	
		
			
				|  | @@ -226,50 +222,70 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  										<>
 | 
	
		
			
				|  |  |  											<Card className="card-default" title="">
 | 
	
		
			
				|  |  |  												<CardHeader>
 | 
	
		
			
				|  |  | -													<CardTitle tag="h4">Daftar Pemeriksaan</CardTitle>
 | 
	
		
			
				|  |  | +													<CardTitle tag="h4">Input Jadwal</CardTitle>
 | 
	
		
			
				|  |  |  												</CardHeader>
 | 
	
		
			
				|  |  |  												<CardBody>
 | 
	
		
			
				|  |  | -													<div className="external-events" ref="externalEventsList">
 | 
	
		
			
				|  |  | -														{externalEvents.map((ev) => (
 | 
	
		
			
				|  |  | -															<div
 | 
	
		
			
				|  |  | -																className="fce-event"
 | 
	
		
			
				|  |  | -																style={{
 | 
	
		
			
				|  |  | -																	backgroundColor: ev.color,
 | 
	
		
			
				|  |  | -																}}
 | 
	
		
			
				|  |  | -																key={ev.name + ev.color}
 | 
	
		
			
				|  |  | -																data-id={ev.id}
 | 
	
		
			
				|  |  | -															>
 | 
	
		
			
				|  |  | -																{ev.name}
 | 
	
		
			
				|  |  | -															</div>
 | 
	
		
			
				|  |  | -														))}
 | 
	
		
			
				|  |  | -													</div>
 | 
	
		
			
				|  |  | +													<Formik
 | 
	
		
			
				|  |  | +														enableReinitialize={true}
 | 
	
		
			
				|  |  | +														initialValues={{
 | 
	
		
			
				|  |  | +															judul: laporan.data?.jadwal.judul || "",
 | 
	
		
			
				|  |  | +															dari_tanggal: moment(laporan.data?.jadwal.dari_tanggal) || new Date(),
 | 
	
		
			
				|  |  | +															sampai_tanggal: moment(laporan.data?.jadwal.sampai_tanggal) || new Date(),
 | 
	
		
			
				|  |  | +														}}
 | 
	
		
			
				|  |  | +														validationSchema={jadwalSchema}
 | 
	
		
			
				|  |  | +														onSubmit={this.handleEventCalendar}
 | 
	
		
			
				|  |  | +													>
 | 
	
		
			
				|  |  | +														{({ isSubmitting }) => (
 | 
	
		
			
				|  |  | +															<Form>
 | 
	
		
			
				|  |  | +																<FormGroup>
 | 
	
		
			
				|  |  | +																	<label className="col-form-label">Judul</label>
 | 
	
		
			
				|  |  | +																	<Field name="judul">{({ field, form }) => <Input type="text" placeholder="judul" {...field} />}</Field>
 | 
	
		
			
				|  |  | +																	<ErrorMessage name="judul" component="div" className="form-text text-danger" />
 | 
	
		
			
				|  |  | +																</FormGroup>
 | 
	
		
			
				|  |  | +																<FormGroup>
 | 
	
		
			
				|  |  | +																	<label className="col-form-label">Dari Tanggal</label>
 | 
	
		
			
				|  |  | +																	<Field name="dari_tanggal">
 | 
	
		
			
				|  |  | +																		{({ field, form }) => (
 | 
	
		
			
				|  |  | +																			<Datetime
 | 
	
		
			
				|  |  | +																				timeFormat={false}
 | 
	
		
			
				|  |  | +																				inputProps={{ className: "form-control" }}
 | 
	
		
			
				|  |  | +																				value={field.value}
 | 
	
		
			
				|  |  | +																				onChange={(e) => {
 | 
	
		
			
				|  |  | +																					form.setFieldValue(field.name, e);
 | 
	
		
			
				|  |  | +																				}}
 | 
	
		
			
				|  |  | +																			/>
 | 
	
		
			
				|  |  | +																		)}
 | 
	
		
			
				|  |  | +																	</Field>
 | 
	
		
			
				|  |  | +																	<ErrorMessage name="dari_tanggal" component="div" className="form-text text-danger" />
 | 
	
		
			
				|  |  | +																</FormGroup>
 | 
	
		
			
				|  |  | +																<FormGroup>
 | 
	
		
			
				|  |  | +																	<label className="col-form-label">Sampai Tanggal</label>
 | 
	
		
			
				|  |  | +																	<Field name="sampai_tanggal">
 | 
	
		
			
				|  |  | +																		{({ field, form }) => (
 | 
	
		
			
				|  |  | +																			<Datetime
 | 
	
		
			
				|  |  | +																				timeFormat={false}
 | 
	
		
			
				|  |  | +																				inputProps={{ className: "form-control" }}
 | 
	
		
			
				|  |  | +																				value={field.value}
 | 
	
		
			
				|  |  | +																				onChange={(e) => {
 | 
	
		
			
				|  |  | +																					form.setFieldValue(field.name, e);
 | 
	
		
			
				|  |  | +																				}}
 | 
	
		
			
				|  |  | +																			/>
 | 
	
		
			
				|  |  | +																		)}
 | 
	
		
			
				|  |  | +																	</Field>
 | 
	
		
			
				|  |  | +																	<ErrorMessage name="sampai_tanggal" component="div" className="form-text text-danger" />
 | 
	
		
			
				|  |  | +																</FormGroup>
 | 
	
		
			
				|  |  | +																<FormGroup row>
 | 
	
		
			
				|  |  | +																	<div className="col-xl-12">
 | 
	
		
			
				|  |  | +																		<Button color="primary" block type="submit" disabled={isSubmitting}>
 | 
	
		
			
				|  |  | +																			Simpan Jadwal
 | 
	
		
			
				|  |  | +																		</Button>
 | 
	
		
			
				|  |  | +																	</div>
 | 
	
		
			
				|  |  | +																</FormGroup>
 | 
	
		
			
				|  |  | +															</Form>
 | 
	
		
			
				|  |  | +														)}
 | 
	
		
			
				|  |  | +													</Formik>
 | 
	
		
			
				|  |  |  												</CardBody>
 | 
	
		
			
				|  |  |  											</Card>
 | 
	
		
			
				|  |  | -											{laporan.data && laporan.data[0].penjadwalan && (
 | 
	
		
			
				|  |  | -												<Card className="card-default">
 | 
	
		
			
				|  |  | -													<CardHeader>
 | 
	
		
			
				|  |  | -														<CardTitle tag="h4">Jadwal Pemeriksaan</CardTitle>
 | 
	
		
			
				|  |  | -													</CardHeader>
 | 
	
		
			
				|  |  | -													<CardBody>
 | 
	
		
			
				|  |  | -														<table className="table">
 | 
	
		
			
				|  |  | -															<tbody>
 | 
	
		
			
				|  |  | -																<tr>
 | 
	
		
			
				|  |  | -																	<td>Judul</td>
 | 
	
		
			
				|  |  | -																	<td>{laporan.data[0].penjadwalan.title}</td>
 | 
	
		
			
				|  |  | -																</tr>
 | 
	
		
			
				|  |  | -																<tr>
 | 
	
		
			
				|  |  | -																	<td>Waktu</td>
 | 
	
		
			
				|  |  | -																	<td>{`${moment(laporan.data[0].penjadwalan.from_date).format("DD MMMM YYYY")} ${
 | 
	
		
			
				|  |  | -																		moment(laporan.data[0].penjadwalan.from_date).format("DD MMMM YYYY") === moment(laporan.data[0].penjadwalan.to_date).format("DD MMMM YYYY")
 | 
	
		
			
				|  |  | -																			? ""
 | 
	
		
			
				|  |  | -																			: `- ${moment(laporan.data[0].penjadwalan.to_date).add(-1, "d").format("DD MMMM YYYY")}`
 | 
	
		
			
				|  |  | -																	}`}</td>
 | 
	
		
			
				|  |  | -																</tr>
 | 
	
		
			
				|  |  | -															</tbody>
 | 
	
		
			
				|  |  | -														</table>
 | 
	
		
			
				|  |  | -													</CardBody>
 | 
	
		
			
				|  |  | -												</Card>
 | 
	
		
			
				|  |  | -											)}
 | 
	
		
			
				|  |  |  										</>
 | 
	
		
			
				|  |  |  									)}
 | 
	
		
			
				|  |  |  									<div className="mb-3">
 | 
	
	
		
			
				|  | @@ -298,13 +314,8 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  										events={this.state.dataEvent}
 | 
	
		
			
				|  |  |  										themeSystem={"bootstrap"}
 | 
	
		
			
				|  |  |  										header={this.calendarHeader}
 | 
	
		
			
				|  |  | -										editable={true}
 | 
	
		
			
				|  |  | -										droppable={true}
 | 
	
		
			
				|  |  |  										deepChangeDetection={true}
 | 
	
		
			
				|  |  |  										eventClick={this.eventClick}
 | 
	
		
			
				|  |  | -										eventReceive={this.handleEventReceive}
 | 
	
		
			
				|  |  | -										eventDrop={this.handleEventCalendar}
 | 
	
		
			
				|  |  | -										eventResize={this.handleEventCalendar}
 | 
	
		
			
				|  |  |  									></FullCalendar>
 | 
	
		
			
				|  |  |  								</CardBody>
 | 
	
		
			
				|  |  |  							</Card>
 | 
	
	
		
			
				|  | @@ -316,5 +327,5 @@ class Calendar extends Component {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const mapStateToProps = (state) => ({ user: state.user });
 | 
	
		
			
				|  |  | +const mapStateToProps = (state) => ({ user: state.user, token: state.token });
 | 
	
		
			
				|  |  |  export default connect(mapStateToProps)(Calendar);
 |