|
@@ -1,5 +1,6 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import {connect} from "react-redux";
|
|
import {connect} from "react-redux";
|
|
|
|
+import moment from "moment";
|
|
// import { CustomSelect } from "./select";
|
|
// import { CustomSelect } from "./select";
|
|
|
|
|
|
import {
|
|
import {
|
|
@@ -17,6 +18,9 @@ import {
|
|
import Calendar from "./Calendar";
|
|
import Calendar from "./Calendar";
|
|
|
|
|
|
export class Appoint extends React.Component {
|
|
export class Appoint extends React.Component {
|
|
|
|
+ state = {
|
|
|
|
+ pickedDate:null
|
|
|
|
+ };
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
this.props.setAppointmentDoctor(this.props.match.params.doctorId)
|
|
this.props.setAppointmentDoctor(this.props.match.params.doctorId)
|
|
@@ -30,6 +34,11 @@ export class Appoint extends React.Component {
|
|
this.props.setAppointmentSpec(e.target.value)
|
|
this.props.setAppointmentSpec(e.target.value)
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ setShedule = (e) => {
|
|
|
|
+ this.setState({pickedDate:e.target.id});
|
|
|
|
+ this.props.setAppointmentShedule(e.target.id)
|
|
|
|
+ };
|
|
|
|
+
|
|
setTime = (e) => {
|
|
setTime = (e) => {
|
|
this.props.setAppointmentTime(e.target.value)
|
|
this.props.setAppointmentTime(e.target.value)
|
|
};
|
|
};
|
|
@@ -45,7 +54,7 @@ export class Appoint extends React.Component {
|
|
|
|
|
|
render() {
|
|
render() {
|
|
const {doctors, appointment, timeArray,services} = this.props.app;
|
|
const {doctors, appointment, timeArray,services} = this.props.app;
|
|
- const {match, setAppointmentShedule} = this.props;
|
|
|
|
|
|
+ const {match} = this.props;
|
|
const doctor = doctors.find(el => el._id === match.params.doctorId);
|
|
const doctor = doctors.find(el => el._id === match.params.doctorId);
|
|
let spec;
|
|
let spec;
|
|
if (appointment.spec){
|
|
if (appointment.spec){
|
|
@@ -66,13 +75,7 @@ export class Appoint extends React.Component {
|
|
|
|
|
|
{/* <CustomSelect label="Выбор услуги" /> */}
|
|
{/* <CustomSelect label="Выбор услуги" /> */}
|
|
|
|
|
|
- {appointment.spec &&
|
|
|
|
- <div>
|
|
|
|
- <p>{spec.name}</p>
|
|
|
|
- <p>Длительность: {spec.duration} ч.</p>
|
|
|
|
- <p>Цена от {spec.price} грн.</p>
|
|
|
|
- </div>
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
<select className = "appointment " onChange={this.setSpec} defaultValue='Выбор услуги'>
|
|
<select className = "appointment " onChange={this.setSpec} defaultValue='Выбор услуги'>
|
|
<option disabled >Выбор услуги</option>
|
|
<option disabled >Выбор услуги</option>
|
|
@@ -84,41 +87,58 @@ export class Appoint extends React.Component {
|
|
</select>
|
|
</select>
|
|
|
|
|
|
{appointment.spec &&
|
|
{appointment.spec &&
|
|
- <Calendar
|
|
|
|
- doctor={doctor}
|
|
|
|
- action={setAppointmentShedule}
|
|
|
|
- />
|
|
|
|
|
|
+ <Calendar
|
|
|
|
+ doctor={doctor}
|
|
|
|
+ action={this.setShedule}
|
|
|
|
+ />
|
|
}
|
|
}
|
|
|
|
|
|
- {appointment.shedule &&
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ {appointment.shedule &&
|
|
<div className = "appointment-time" >
|
|
<div className = "appointment-time" >
|
|
<div className="btn-box" >
|
|
<div className="btn-box" >
|
|
- { timeArray.map ( (el, index)=> (
|
|
|
|
-
|
|
|
|
- <label key={Object.keys(el)} >
|
|
|
|
- <input
|
|
|
|
- type ="radio"
|
|
|
|
- name = "choise-time"
|
|
|
|
- id = {index} onChange={this.setTime}
|
|
|
|
- value = {Object.keys(el)}
|
|
|
|
- />
|
|
|
|
- {Object.keys(el)}
|
|
|
|
- </label>
|
|
|
|
- ))
|
|
|
|
|
|
+ {
|
|
|
|
+ timeArray.map ( (el, index) => (
|
|
|
|
+ <label key={Object.keys(el)} >
|
|
|
|
+ <input
|
|
|
|
+ type ="radio"
|
|
|
|
+ name = "choise-time"
|
|
|
|
+ id = {index} onChange={this.setTime}
|
|
|
|
+ value = {Object.keys(el)}
|
|
|
|
+ />
|
|
|
|
+ <span> {Object.keys(el)}</span>
|
|
|
|
+
|
|
|
|
+ </label>
|
|
|
|
+ ))
|
|
|
|
+ }
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ }
|
|
|
|
+ {appointment.spec &&
|
|
|
|
+ <div>
|
|
|
|
+ <p>{spec.name}</p>
|
|
|
|
+ <p>Длительность: {spec.duration} ч.</p>
|
|
|
|
+ <p>Цена от {spec.price} грн.</p>
|
|
|
|
+ {this.state.pickedDate &&
|
|
|
|
+ <p>{moment(this.state.pickedDate).format('DD-MMMM-YYYY')}</p>
|
|
|
|
+ }
|
|
|
|
+ {appointment.time &&
|
|
|
|
+ <p>{appointment.time}</p>
|
|
}
|
|
}
|
|
- </div>
|
|
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
|
|
|
|
{appointment.time &&
|
|
{appointment.time &&
|
|
<div style={{display:"flex",flexDirection:"column"}}>
|
|
<div style={{display:"flex",flexDirection:"column"}}>
|
|
- <input className = "appointment comment" type='text' placeholder='Добавить комментарий' onChange={this.setComment}/>
|
|
|
|
|
|
+ <input
|
|
|
|
+ className = "appointment comment"
|
|
|
|
+ type='text'
|
|
|
|
+ placeholder='Добавить комментарий'
|
|
|
|
+ onChange={this.setComment}/>
|
|
<button className = "btn link" onClick={this.postOrder}>Подтвердите запись</button>
|
|
<button className = "btn link" onClick={this.postOrder}>Подтвердите запись</button>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|