Browse Source

admin part

Mila-Zagrevskaya 5 years ago
parent
commit
7e65e9c644

+ 25 - 56
package-lock.json

@@ -2932,8 +2932,7 @@
             },
             "ansi-regex": {
               "version": "2.1.1",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "aproba": {
               "version": "1.2.0",
@@ -2951,13 +2950,11 @@
             },
             "balanced-match": {
               "version": "1.0.0",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "brace-expansion": {
               "version": "1.1.11",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "balanced-match": "^1.0.0",
                 "concat-map": "0.0.1"
@@ -2970,18 +2967,15 @@
             },
             "code-point-at": {
               "version": "1.1.0",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "concat-map": {
               "version": "0.0.1",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "console-control-strings": {
               "version": "1.1.0",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "core-util-is": {
               "version": "1.0.2",
@@ -3084,8 +3078,7 @@
             },
             "inherits": {
               "version": "2.0.3",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "ini": {
               "version": "1.3.5",
@@ -3095,7 +3088,6 @@
             "is-fullwidth-code-point": {
               "version": "1.0.0",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "number-is-nan": "^1.0.0"
               }
@@ -3108,20 +3100,17 @@
             "minimatch": {
               "version": "3.0.4",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "brace-expansion": "^1.1.7"
               }
             },
             "minimist": {
               "version": "0.0.8",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "minipass": {
               "version": "2.3.5",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "safe-buffer": "^5.1.2",
                 "yallist": "^3.0.0"
@@ -3138,7 +3127,6 @@
             "mkdirp": {
               "version": "0.5.1",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "minimist": "0.0.8"
               }
@@ -3211,8 +3199,7 @@
             },
             "number-is-nan": {
               "version": "1.0.1",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "object-assign": {
               "version": "4.1.1",
@@ -3222,7 +3209,6 @@
             "once": {
               "version": "1.4.0",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "wrappy": "1"
               }
@@ -3298,8 +3284,7 @@
             },
             "safe-buffer": {
               "version": "5.1.2",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "safer-buffer": {
               "version": "2.1.2",
@@ -3329,7 +3314,6 @@
             "string-width": {
               "version": "1.0.2",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "code-point-at": "^1.0.0",
                 "is-fullwidth-code-point": "^1.0.0",
@@ -3347,7 +3331,6 @@
             "strip-ansi": {
               "version": "3.0.1",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "ansi-regex": "^2.0.0"
               }
@@ -3386,13 +3369,11 @@
             },
             "wrappy": {
               "version": "1.0.2",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "yallist": {
               "version": "3.0.3",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             }
           }
         },
@@ -6986,8 +6967,7 @@
             },
             "ansi-regex": {
               "version": "2.1.1",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "aproba": {
               "version": "1.2.0",
@@ -7011,7 +6991,6 @@
             "brace-expansion": {
               "version": "1.1.11",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "balanced-match": "^1.0.0",
                 "concat-map": "0.0.1"
@@ -7024,8 +7003,7 @@
             },
             "code-point-at": {
               "version": "1.1.0",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "concat-map": {
               "version": "0.0.1",
@@ -7034,8 +7012,7 @@
             },
             "console-control-strings": {
               "version": "1.1.0",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "core-util-is": {
               "version": "1.0.2",
@@ -7138,8 +7115,7 @@
             },
             "inherits": {
               "version": "2.0.3",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "ini": {
               "version": "1.3.5",
@@ -7149,7 +7125,6 @@
             "is-fullwidth-code-point": {
               "version": "1.0.0",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "number-is-nan": "^1.0.0"
               }
@@ -7162,20 +7137,17 @@
             "minimatch": {
               "version": "3.0.4",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "brace-expansion": "^1.1.7"
               }
             },
             "minimist": {
               "version": "0.0.8",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "minipass": {
               "version": "2.3.5",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "safe-buffer": "^5.1.2",
                 "yallist": "^3.0.0"
@@ -7192,7 +7164,6 @@
             "mkdirp": {
               "version": "0.5.1",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "minimist": "0.0.8"
               }
@@ -7265,8 +7236,7 @@
             },
             "number-is-nan": {
               "version": "1.0.1",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "object-assign": {
               "version": "4.1.1",
@@ -7276,7 +7246,6 @@
             "once": {
               "version": "1.4.0",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "wrappy": "1"
               }
@@ -7352,8 +7321,7 @@
             },
             "safe-buffer": {
               "version": "5.1.2",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "safer-buffer": {
               "version": "2.1.2",
@@ -7383,7 +7351,6 @@
             "string-width": {
               "version": "1.0.2",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "code-point-at": "^1.0.0",
                 "is-fullwidth-code-point": "^1.0.0",
@@ -7401,7 +7368,6 @@
             "strip-ansi": {
               "version": "3.0.1",
               "bundled": true,
-              "optional": true,
               "requires": {
                 "ansi-regex": "^2.0.0"
               }
@@ -7440,13 +7406,11 @@
             },
             "wrappy": {
               "version": "1.0.2",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             },
             "yallist": {
               "version": "3.0.3",
-              "bundled": true,
-              "optional": true
+              "bundled": true
             }
           }
         }
@@ -10595,6 +10559,11 @@
         "scheduler": "^0.13.6"
       }
     },
+    "react-accessible-accordion": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/react-accessible-accordion/-/react-accessible-accordion-3.0.0.tgz",
+      "integrity": "sha512-pRfqyPFdCZlYuICYerLznzve/+Jmcah1RFFLDF4kOyWJijoa1Eo9bLYea/+4yJwAdTLj69xzcS8j4L704zMuAQ=="
+    },
     "react-app-polyfill": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-1.0.1.tgz",

+ 1 - 0
package.json

@@ -9,6 +9,7 @@
     "moment": "^2.24.0",
     "node-sass": "^4.12.0",
     "react": "^16.8.6",
+    "react-accessible-accordion": "^3.0.0",
     "react-dom": "^16.8.6",
     "react-escape-outside": "^0.1.1",
     "react-full-page": "^0.1.7",

+ 61 - 54
src/components/Admin/ChangeServices-Doctors.js

@@ -17,74 +17,81 @@ export default class ChangeServicesDoctors extends React.Component {
             changeInputValues,
         } = this.props;
         return (
-            
-            <div style={{display:'flex',flexDirection:'column', width:'400px', margin:'10px 20px'}}>
-                <form style={{display:"flex",flexDirection:"column"}} onSubmit={(e)=>{
-                    e.preventDefault();
-                    // eslint-disable-next-line array-callback-return
-                    form.map(el => {
-                        obj[el.name] = el.value
-                    });
-                    postItem(obj)
-                }}
-                >
-                    {
-                        form.map(el => (
-                            <Input
-                                key={el.id}
-                                id={el.id}
-                                el={el}
-                                changeInputValues={changeInputValues}
-                            />
-                        ))
-                    }
-                    <input
-                        type='submit'
-                        value='Post New Item'
-                    />
-                </form>
 
-                <select  onChange={(e)=>changeId(e.target.value)} defaultValue='choose item'>
-                    <option disabled >choose item</option>
-                    {
-                        data.map(el=> (
-                            <option key={el._id}>{el.name}</option>
-                        ))
-                    }
-                </select>
-                {itemId &&
-                <button onClick={()=>deleteItem(itemId)} style={{backgroundColor:"red"}}>DELETE Item</button>
-                }
-                {
-                    <form style={{display:"flex",flexDirection:"column",margin:"20px 0"}} onSubmit={(e)=>{
+            <div className = "change-services-doctors">
+                <div className="admin-item">
+                    <form className ="form-doctors"   onSubmit={(e)=>{
                         e.preventDefault();
                         // eslint-disable-next-line array-callback-return
                         form.map(el => {
-                            if (el.value !== '')
-                                obj[el.name] = el.value
+                            obj[el.name] = el.value
                         });
-                        putItem({data:obj,id:itemId})
-
-                    }}>
-                        {itemId &&
-                        form.map(el => {
-                            el.required = false;
-                            return (
-                                <Input
+                        postItem(obj)
+                    }}
+                    >
+                        {
+                            form.map(el => (
+                                <Input 
                                     key={el.id}
                                     id={el.id}
                                     el={el}
                                     changeInputValues={changeInputValues}
                                 />
-                            )
-                        })
+                            ))
                         }
-                        <input
+                        <input className = "btn link" 
                             type='submit'
-                            value='Change Selected Item'
+                            value='Добавить '
                         />
                     </form>
-                }
+                </div>
+
+                <div className="admin-item">
+                    <select  className = "appointment admin-form"  onChange={(e)=>changeId(e.target.value)} defaultValue='choose item'>
+                        <option disabled >Выбрать</option>
+                        {
+                            data.map(el=> (
+                                <option key={el._id}>{el.name}</option>
+                            ))
+                        }
+                    </select>
+                    {itemId &&
+                    <button className = "btn link" onClick={()=>deleteItem(itemId)} style={{backgroundColor:"#ff9774"}}>Удалить карточку сотрудника</button>
+                    }
+
+                    {
+                        <form  onSubmit={(e)=>{
+                            e.preventDefault();
+                            // eslint-disable-next-line array-callback-return
+                            form.map(el => {
+                                if (el.value !== '')
+                                    obj[el.name] = el.value
+                            });
+                            putItem({data:obj,id:itemId})
+
+                        }}>
+
+                            {itemId &&
+                            form.map(el => {
+                                el.required = false;
+                                return (
+                                    <Input
+                                        key={el.id}
+                                        id={el.id}
+                                        el={el}
+                                        changeInputValues={changeInputValues}
+                                    />
+                                )
+                            })
+                            }
+                            <input
+                                className = "btn link"
+                                type='submit'
+                                value='Change Selected Item'
+                            />
+                        </form>
+                    }
+               </div>
             </div>
         );
     }

+ 1 - 0
src/components/Admin/Input.js

@@ -4,6 +4,7 @@ export default class Input extends React.Component {
     render(){
         return (
             <input
+                className = "appointment admin-form"
                 id={this.props.el.id}
                 type={this.props.el.type}
                 name={this.props.el.name}

+ 6 - 10
src/components/Admin/Shedule.js

@@ -25,12 +25,8 @@ export default class Shedule extends React.Component {
     };
 
     render() {
-<<<<<<< HEAD
+        console.log ( this.props )
         const { doctors, postNewShedule, sheduleMonthArray, setSheduleDoctor } = this.props;
-=======
-        console.log(this.props)
-        const {doctors,postNewShedule,sheduleMonthArray,setSheduleDoctor} = this.props;
->>>>>>> 904bc8a7a3d95efb0629ac4c7827faaae6a2ebf4
         return (
             <div  className = "shedule-container" >
               
@@ -38,9 +34,9 @@ export default class Shedule extends React.Component {
                     <select className = "appointment admin-appointment"  onChange={(e) => setSheduleDoctor(e.target.value)} defaultValue='Выберите доктора'>
                     <option disabled >Выберите доктора</option>
                         {
-                            doctors.map(el=> (
-                                <option key={el._id} id={el._id}>{el.name}</option>
-                            ))
+                            doctors.map ( el=> (
+                                <option key={el._id} id={el._id}> {el.name} </option>
+                            ) )
                         }
                     </select>
 
@@ -52,13 +48,13 @@ export default class Shedule extends React.Component {
                     }
 
 
-                { ( this.state.startDate && this.state.endDate ) && <button className = "btn admin" onClick = { this.post }>Отправить </button>}
+                { ( this.state.startDate && this.state.endDate ) && <button className = "btn admin" onClick = { this.post }> Отправить </button>}
 
                 </div>
                 
 
                 {postNewShedule.doctor &&
-                <Calendar doctor={doctors.find(el=> el._id === postNewShedule.doctor)} setAppointmentShedule={console.log}/>
+                <Calendar doctor={doctors.find (el => el._id === postNewShedule.doctor)} setAppointmentShedule = {console.log}/>
                 }
             </div>
         );

+ 24 - 16
src/components/Services.js

@@ -4,26 +4,32 @@ import {connect} from 'react-redux'
 
 export class Services extends React.Component {
     render() {
-        const {data} = this.props;
-        // console.log ("data:", {data})
+        const {data, categories} = this.props;
+
+        console.log ("data:", data);
+        console.log ("categories:", Object.values (categories))
+        // console.log ("this.props:", this.props.app)
 
         return (
             <div className="main">
                 <div className="wrapper">
                     <div className = "doctors-wrap">
-                        {
-                            data.map ( el => (
-                                <div key={el._id} className = "item">
-                                    <p>{el.name}</p>
-                                    <p>Длительность: {el.duration} ч.</p> 
-                                    <p>{el.description}</p>
-                                    <p>Цена: {el.price} грн.</p>
-                                    <div>
-                                        <Link to= {`/services/${el._id}`} className = "btn more "> Подробнее ... </Link>
-                                        <button className = "btn link"> Записаться на приём </button>
-                                    </div>
-                             </div>
-                            ) )
+                        { categories[0] &&
+                           categories.map ( el => 
+                                // el.map ( item => (
+                                //     <div key={item._id} className = "item">
+                                //         <p>{item.name}</p>
+                                //         <p>Длительность: {item.duration} ч.</p> 
+                                //         <p>{item.description}</p>
+                                //         <p>Цена: {item.price} грн.</p>
+                                //         <div>
+                                //         <Link to= {`/services/${item._id}`} className = "btn more "> Подробнее ... </Link>
+                                //         <button className = "btn link"> Записаться на приём </button>
+                                //     </div>
+                                // </div>
+                                // ))
+                                <p>{el}</p>
+                            )  
                         }
                     </div>
                 </div>
@@ -34,7 +40,9 @@ export class Services extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        data:state.app.services
+        app:state.app,
+        data:state.app.services,
+        categories:Object.keys (state.app.servicesArray)
     }
 };
 

+ 2 - 2
src/components/appointment/Calendar.js

@@ -29,9 +29,9 @@ export default class Calendar extends Component {
         return (
             <div className = "calendar-container">
                 <div className = "calendar-title-box" >
-                    <button className= "btn angle" onClick={() => this.setState({current:current.subtract(1,"month")})}><span class="icon-angle-left"></span></button>
+                    <button className= "btn angle" onClick={() => this.setState({current:current.subtract(1,"month")})}><span className="icon-angle-left"></span></button>
                     <h4>{current.format('MMMM-YYYY')}</h4>
-                    <button  className= "btn angle"  onClick={() => this.setState({current:current.add(1,"month")})}><span class="icon-angle-right"></span></button>
+                    <button  className= "btn angle"  onClick={() => this.setState({current:current.add(1,"month")})}><span className="icon-angle-right"></span></button>
                 </div>
                 <div className = "weekdays">
                     {moment.weekdaysShort(true).map(el => (

+ 21 - 10
src/reducers/reducers.js

@@ -6,7 +6,7 @@ const postNewDoctorForm =[
         type:'text',
         value:"",
         name:'name',
-        placeholder:'Enter doctor Name and Last Name',
+        placeholder:'Введите ФИО сотрудника',
         required:true
     },
     {
@@ -14,7 +14,7 @@ const postNewDoctorForm =[
         type:'text',
         value:"",
         name:'experience',
-        placeholder:'Enter practice start date',
+        placeholder:'Введите дату начала практики',
         required:true
     },
     {
@@ -22,7 +22,7 @@ const postNewDoctorForm =[
         type:'text',
         value:"",
         name:'photo',
-        placeholder:'Enter path to photo here',
+        placeholder:'Добавьте фотографию',
         required:true
     },
     {
@@ -30,7 +30,7 @@ const postNewDoctorForm =[
         type:'text',
         value:"",
         name:'profession',
-        placeholder:'Enter profession here',
+        placeholder:'Добавьте специализацию',
         required:true
     },
     {
@@ -38,7 +38,7 @@ const postNewDoctorForm =[
         type:'text',
         value:"",
         name:'skillsDescription',
-        placeholder:'Enter skills description here',
+        placeholder:'Введите описание навыков здесь',
         required:true
     },
     {
@@ -46,7 +46,7 @@ const postNewDoctorForm =[
         type:'text',
         value:"",
         name:'speciality',
-        placeholder:'Enter array of service speciality description here',
+        placeholder:'Введите массив представляемых услуг',
         required:true
     }
 ];
@@ -57,7 +57,7 @@ const postNewServiceForm =[
         type:'text',
         value:"",
         name:'name',
-        placeholder:'Enter service Name',
+        placeholder:'Введите название сервиса',
         required:true
     },
     {
@@ -65,7 +65,7 @@ const postNewServiceForm =[
         type:'text',
         value:"",
         name:'description',
-        placeholder:'Enter service description',
+        placeholder:'Введите описание сервиса',
         required:true
     },
     {
@@ -73,7 +73,7 @@ const postNewServiceForm =[
         type:'number',
         value:"",
         name:'duration',
-        placeholder:'Enter duration',
+        placeholder:'Введите длительность (часы)',
         required:true
     },
     {
@@ -81,7 +81,7 @@ const postNewServiceForm =[
         type:'number',
         value:"",
         name:'price',
-        placeholder:'Enter price',
+        placeholder:'Введите стоимость сервиса',
         required:true
     }
 ];
@@ -98,7 +98,18 @@ const defaultState = {
         therapist:[],
         implantologist: [],
         endodontics:[],
+    //     [
+    //         [
+    //             "surg",
+    //             [{},{}]
+    //         ],
+    //         [
+    //             "kids",
+    //             [{},{}]
+    //         ]
+    //     ]
     },
+
     orders:[],
     users:[],
     reviews: [],

+ 22 - 4
src/style/all.scss

@@ -498,7 +498,8 @@ aside {
 	display: flex;
 	justify-content: space-between;
 }
-.option {
+.option,
+.change-services-doctors {
 	width: 40%;
 	margin: 0 auto;
 }
@@ -512,11 +513,8 @@ aside {
 		display: flex;
 		flex-direction: row;
 		justify-content: space-between;
-
 	}
-	
 	.shedule-input {
-		// width: calc(20% - 20px);
 		margin: 20px 10px 0 0;
 		border: 1px solid $hover-color;
 		border-radius: 3px;
@@ -556,3 +554,23 @@ aside {
 
 }
 
+// ___ change-services-doctors____
+.change-services-doctors {
+	display: flex;
+	// flex-direction: column;
+	justify-content: center;
+	width: 100%;
+	margin-top: 50px;
+	.form-doctors {
+		display: flex;
+		flex-direction: column;
+	}
+	.admin-form {
+		margin: 2px 0;
+
+	}
+	.admin-item {
+		width: 35%;
+		margin: 0 50px;
+	}
+}