Browse Source

Merge branch 'master' of http://gitlab.a-level.com.ua/Entony/FEA_12_CLINIC

Alex 5 years ago
parent
commit
286dc95bb0

+ 2 - 6
.idea/workspace.xml

@@ -3,11 +3,7 @@
   <component name="ChangeListManager">
     <list default="true" id="a8a32a88-c432-4104-a927-0d3d1c1c21be" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/appointment/Appointment.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/appointment/Appointment.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/main/Main.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/main/Main.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/services/Services.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/services/Services.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/specialists/Doctors.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/specialists/Doctors.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/utils/formFields.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/formFields.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/components/main/team.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/main/team.js" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -76,7 +72,7 @@
       <option name="presentableId" value="Default" />
       <updated>1562445740358</updated>
       <workItem from="1562445741612" duration="45849000" />
-      <workItem from="1566302661790" duration="666000" />
+      <workItem from="1566302661790" duration="4410000" />
     </task>
     <servers />
   </component>

+ 9 - 16
src/App.js

@@ -24,28 +24,15 @@ export class App extends React.Component {
         this.props.getDoctors();
         this.props.getServices();
         this.props.getCategories();
-        // this.props.getOrders();
 
        if(localStorage.getItem('userId')) this.props.getUser()
 
-       window.addEventListener = ( "hashchange", makeHashchange) 
+       window.addEventListener = ( "hashchange", makeHashchange)
 
-        // fetch ("https://api-clinics.herokuapp.com/api/v1/auth/login", {
-        //     method : "POST",
-        //     credentials: "include",
-        //     headers: {
-        //         "Content-Type": "application/json"
-        //     },
-        //     body: JSON.stringify ({
-        //         email: "test@test.com",
-        //         password: "qwerty"
-        //     })
-        // })
-        //     .then (res => res.json ())
-        //     .then (res => console.log (res))
     }
 
     render() {
+
         return (
               <Loader flag={this.props.app.isFetching}>
                   <Header/>
@@ -68,7 +55,13 @@ export class App extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        app:state.app
+        app:state.app,
+        appoinLoad:state.appointment.isFetching,
+        ordersLoad:state.orders.isFetching,
+        appLoad:state.app.isFetching,
+        servicesLoad:state.services.isFetching,
+        userLoad:state.user.isFetching,
+        sheduleLoad:state.shedule.isFetching,
     }
 };
 

+ 1 - 1
src/components/Footer.js

@@ -9,7 +9,7 @@ const Footer = () => {
                     <p>пл. Конституции, 26</p>
            </div>
            <div className="footer-part logo-box">
-               <img src="../images/logo.png" alt="logo"/>
+               <img src="../../images/logo.png" alt="logo"/>
                </div>
            <div className="footer-part contacts">
               <h4 className  = "icon-phone"> Контакты</h4>

+ 8 - 5
src/components/appointment/Appointment.js

@@ -22,10 +22,12 @@ export class Appoint extends React.Component {
 
     componentDidMount() {
         this.props.setAppointmentDoctor(this.props.match.params.doctorId);
-        this.props.setAppointmentSpec({
-            data:this.props.match.params.serviceId,
-            services:this.props.services
-        })
+        if(this.props.match.params.serviceId !== 'false'){
+            this.props.setAppointmentSpec({
+                data:this.props.match.params.serviceId,
+                services:this.props.services
+            })
+        }
     }
 
     componentWillUnmount() {
@@ -75,6 +77,7 @@ export class Appoint extends React.Component {
         if (appointment.specId) {
             spec = services.find(el => el._id === appointment.specId)
         }
+        console.log(this.props)
         return (
             <>
                 <div className="main">
@@ -83,7 +86,7 @@ export class Appoint extends React.Component {
                             <div className="card">
                                 <div className="card-item present">
                                     <div className="photo">
-                                        <img src={`.${doctor.photo}`} alt={doctor.name}/>
+                                        <img src={`../../${doctor.photo}`} alt={doctor.name}/>
                                     </div>
                                     <div className="order">
                                         <h3>{doctor.name}</h3>

+ 1 - 1
src/components/main/team.js

@@ -16,7 +16,7 @@ export default class Team extends React.Component {
                          <div className="item"  key = {el._id} >
                              <div className="photo">
                                 <img src= {el.photo} alt= {el.name}/>
-                                <Link to = {`/doctors/${el._id}`}>
+                                <Link to = {`/doctors/${el._id}/true`}>
                                     <div className="desc">
                                         <h3>{el.name}</h3>
                                         <p className="experience">Опыт работы {new Date().toISOString().split('T')[0].split('-')[0] - el.experience.split('T')[0].split('-')[0]} лет</p>

+ 6 - 9
src/reducers/user.js

@@ -1,6 +1,6 @@
 import * as types from '../actionsTypes/actionsTypes'
 
-import {adminChangeUserForm, changeUserForm} from "../utils/formFields"
+import {adminChangeUserForm} from "../utils/formFields"
 
 const defaultState = {
     user: null,
@@ -81,7 +81,6 @@ export const userReducer = (state = defaultState, action) => {
 
         case types.FIND_USER_REQUEST_SUCCESS : {
             const data = state.findUserInput.includes('@') ? action.payload.users[0] : action.payload.user;
-            console.log(data)
             return {
                 ...state,
                 user: data,
@@ -99,17 +98,15 @@ export const userReducer = (state = defaultState, action) => {
                         }
                         : el.id === 'user' && data.doctor === false && data.role === false
                         ? {
-                                ...el,
+                            ...el,
                             defaultChecked: true,
-                            }
+                        }
                         : el
                 ),
                 error: action.payload.message,
-                access:data.role ? 'role' : data.doctor ? 'doctor' : 'user',
-                isFetching:
-                    false
-            }
-                ;
+                access: data.role ? 'role' : data.doctor ? 'doctor' : 'user',
+                isFetching: false
+            };
         }
 
         case types.FIND_USER_REQUEST_FAIL : {

+ 1 - 1
src/utils/formFields.js

@@ -418,7 +418,7 @@ export const route = [
   },
   {
     id: 7,
-    exact: false,
+    exact: true,
     path: "/appointment/:doctorId/:serviceId",
     protected: true,
     component: Appointment