vit9 5 سال پیش
والد
کامیت
e5d77ba46b

+ 19 - 0
package-lock.json

@@ -2667,6 +2667,11 @@
       "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
       "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
     },
+    "bootstrap-slider": {
+      "version": "9.9.0",
+      "resolved": "https://registry.npmjs.org/bootstrap-slider/-/bootstrap-slider-9.9.0.tgz",
+      "integrity": "sha1-ThTsxkAZAdod33aBqiTjOwDa3Og="
+    },
     "bowser": {
       "version": "1.9.4",
       "resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.4.tgz",
@@ -4658,6 +4663,11 @@
       "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
       "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg=="
     },
+    "es6bindall": {
+      "version": "0.0.9",
+      "resolved": "https://registry.npmjs.org/es6bindall/-/es6bindall-0.0.9.tgz",
+      "integrity": "sha1-ceAK+mn43VmsWsiYoNMcl434F9U="
+    },
     "escape-html": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -14730,6 +14740,15 @@
         }
       }
     },
+    "react-bootstrap-slider": {
+      "version": "2.1.5",
+      "resolved": "https://registry.npmjs.org/react-bootstrap-slider/-/react-bootstrap-slider-2.1.5.tgz",
+      "integrity": "sha512-7rO3JlCVIpr+XtwiSfg8r+MPqyl9KdLI61pNuSMBYYQZ42IWBC+kk/UDyYevp76aGAMtd9SCW8erxOvq+VpekQ==",
+      "requires": {
+        "bootstrap-slider": "9.9.0",
+        "es6bindall": "^0.0.9"
+      }
+    },
     "react-dev-utils": {
       "version": "7.0.1",
       "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-7.0.1.tgz",

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
     "form-data": "^2.3.3",
     "node-sass": "^4.11.0",
     "react": "^16.6.3",
+    "react-bootstrap-slider": "^2.1.5",
     "react-dom": "^16.6.3",
     "react-dropzone": "^8.0.4",
     "react-loader-spinner": "^2.3.0",

+ 67 - 0
src/actions/addNewStaffAction.js

@@ -34,6 +34,23 @@ export const AddNewStaffAction = payload => {
     }
 }
 
+export const base64 = payload => ({
+    type: types.BASE_64_REQUEST,
+    payload
+})
+export const base641 = payload => ({
+    type: types.BASE1_64_REQUEST,
+    payload
+})
+export const base642 = payload => ({
+    type: types.BASE2_64_REQUEST,
+    payload
+})
+export const base643 = payload => ({
+    type: types.BASE3_64_REQUEST,
+    payload
+})
+
 const addPhotoRequest = payload => ({
     type: types.PUSH_NEW_PHOTO_REQUEST,
     payload
@@ -60,4 +77,54 @@ export const pushPhoto = payload => {
             .catch(err =>
                 dispatch(addNewPhotoRequestFail(err)))
     }
+}
+
+
+
+ export const inputchangeHandler = payload => ({
+    type: types.INPUT_CHANGE_VALUE,
+    payload
+})
+
+export const inputchangeHandler1 = payload => ({
+    type: types.INPUT_CHANGE_VALUE1,
+    payload
+})
+export const inputchangeHandler2 = payload => ({
+    type: types.INPUT_CHANGE_VALUE2,
+    payload
+})
+export const inputchangeHandler3 = payload => ({
+    type: types.INPUT_CHANGE_VALUE3,
+    payload
+})
+
+
+
+
+const editStaffRequest = payload => ({
+    type: types.ADD_NEW_STAFF_REQUEST,
+    payload
+})
+
+const editStaffRequestSuccess = payload => ({
+    type: types.ADD_NEW_STAFF_REQUEST_SUCCESS,
+    payload
+})
+
+const editStaffRequestFail = payload => ({
+    type: types.ADD_NEW_STAFF_REQUEST_FAIL,
+    payload
+})
+
+export const EditStaffAction = payload => {
+    console.log(payload)
+    return dispatch => {
+        dispatch(editStaffRequest())
+        axios.put(`http://127.0.0.1:2000/api/staffs`, payload)
+            .then(res =>
+                setTimeout(() => dispatch(editStaffRequestSuccess(res)), 1000))
+            .catch(err =>
+                dispatch(editStaffRequestFail(err)))
+    }
 }

+ 6 - 1
src/actions/getStaffByIdAction.js

@@ -31,4 +31,9 @@ export const getStaffsDataById = (payload) => {
 			})
 
 	};
-};
+};
+
+export const deleteStaffById = (payload) => {
+	console.log(payload)
+	axios.delete(`http://127.0.0.1:2000/api/staffs?id=${payload}`,).then(res => console.log(res))
+}

+ 18 - 9
src/components/AllStaffs/FullInfoAboutStaff.js

@@ -23,13 +23,20 @@ class FullInfoAboutStaff extends Component {
 
         str = InfoStaff.map(el => {
             console.log(el.img)
-           let str1  = el.img.substr(29)
-                for(var i = 0, b = 24; i < str1.length; i=i+25  ){
-
-                    arr.push(str1.substr(i,b))  
+             if(el.state){
+                let str1  = el.img.substr(29)  
+           
+                    for(var i = 0, b = 24; i < str1.length; i=i+25  ){
+                    
+                        arr.push({newStr:str1.substr(i,b),state:el.state,defaultStr:el.img})
+             }
+                }
+                else{
+                    arr.push({state:el.state,defaultStr:el.img})
                 }
                 
         })
+        console.log(InfoStaff)
         console.log(arr)
         let data1
         let data;
@@ -45,13 +52,15 @@ class FullInfoAboutStaff extends Component {
             else {
                 data = InfoStaff.map((el,key)=>(
                     <div className="staff" key={key}>
-                    {/* <img src={str+str1} width="325" height="190" className="imgStaff"  alt="lorem" />
-                    <img src={str+str2} width="325" height="190" className="imgStaff"  alt="lorem" /> */}
-                    
                         {el.title} {el.price} {el.description}  
                     </div>)
                 )
-                 data1 =  arr.map(el => <img src={`http://127.0.0.1:2000/static/${el}`} width="325" height="190" className="imgStaff"  alt="lorem" />)
+                data1 =  arr.map(el => 
+                    <div>
+                    {
+                    el.state ?  <img src={`http://127.0.0.1:2000/static/${el.newStr}`} width="325" height="190" className="imgStaff"  alt="lorem" />
+                : <img src={`${el.defaultStr}`} width="325" height="190" className="imgStaff"  alt="lorem" /> 
+                    }</div>)
             }
         return (
 
@@ -62,7 +71,7 @@ class FullInfoAboutStaff extends Component {
             </Fragment>
 
         );
-    }
+        }
 }
 
 export default FullInfoAboutStaff;

+ 2 - 2
src/components/AllStaffs/index.js

@@ -9,7 +9,7 @@ class AllStaffs extends Component {
     render() {
         const { inputStaffs, isFetching, isAdmin, getUser } = this.props
         let data;
-
+        console.log(this.props)
             if(isFetching===true){            
 
                 data = <div className="loader"> 
@@ -24,7 +24,7 @@ class AllStaffs extends Component {
                     {inputStaffs.map((el,key)=>(
                         <Link to={`/staff/${el.id}`} key={key}>
                             <div className="staff">
-                               <img src={el.img.substr(0,53)} width="325" height="190" className="imgStaff"  alt="lorem" />
+                             {el.state ?  <img src={el.img.substr(0,53)} width="325" height="190" className="imgStaff"  alt="lorem" /> : <img src={el.img} width="325" height="190" className="imgStaff"  alt="lorem" />}
                                 <div className="titlleAndPrice">
                                     <h4>{el.title}</h4>
                                     <h4>Цена: {el.price}</h4>

+ 18 - 12
src/components/CategoryStaffs/index.js

@@ -7,8 +7,8 @@ import AddNewStaff from '../../components/BtnAddNewStaff'
 class CategoryStaffs extends Component {
     
     render() {
-        const { infoCategory, isFetching } = this.props
-        console.log(infoCategory)
+        const { infoCategory, isFetching, getUser } = this.props
+        console.log(this.props)
 
         let data;
             if(isFetching===true){
@@ -23,26 +23,32 @@ class CategoryStaffs extends Component {
             }
             else{
                 data = <div className="staffs">
-                    {infoCategory.map((el,key)=>(
-                        <Link to={`/staff/${el.id}`} key={key}>
-                            <div className="staff">
-                                <img src={el.img} width="325" height="190" className="imgStaff"  alt="lorem" />
-                                {el.title} {el.price}
+                {infoCategory.map((el,key)=>(
+                    <Link to={`/staff/${el.id}`} key={key}>
+                        <div className="staff">
+                           <img src={el.img.substr(0,53)} width="325" height="190" className="imgStaff"  alt="lorem" />
+                            <div className="titlleAndPrice">
+                                <h4>{el.title}</h4>
+                                <h4>Цена: {el.price}</h4>
                             </div>
-                        </Link> 
-                    ))}    
-                </div>
+
+                        </div>
+                    </Link> 
+                ))}    
+            </div>
             }
         return (
 
            <div className="content">
 
                 {data}
-                <AddNewStaff/>
+                <AddNewStaff   getUser={ getUser }/>
            </div> 
             
         );
     }
 }
 
-export default CategoryStaffs;
+export default CategoryStaffs;
+
+

+ 79 - 41
src/components/FormsAdd/FormAddNewStaff/SendingStaffForm.js

@@ -7,59 +7,90 @@ class SendingForm extends  Component  {
 
     constructor(props){
         super(props)
-       this.state = { image: 'http://zabavnik.club/wp-content/uploads/vopros_2_14000037-939x1024.jpg' }
+       this.state = { trig:false }
        
     }
-    onChange3 = e =>{
-        const { pushPhoto,photo } = this.props
-        //this.setState({image: e.target.files[0]})
+    
+    
+
+    onChange = e =>{
+        const { pushPhoto, base64 } = this.props      
+        this.setState({trig:true})
         let data = new FormData();
-        data.append('image',e.target.files[0], e.target.files[0].name);
-          
-          pushPhoto(data)
+        data.append('image',e.target.files[0], e.target.files[0].name); 
+         pushPhoto(data)  
+            var file = e.target.files[0];
+            var reader = new FileReader();
+            reader.onloadend = function() {
+                base64(reader.result)         
+            }
+            reader.readAsDataURL(file);
     }
-    onChange2 = e =>{
-        const { pushPhoto,photo } = this.props
-        //this.setState({image: e.target.files[0]})
+    onChange1 = e =>{
+        const { pushPhoto, base641 } = this.props      
+        this.setState({trig:true})
         let data = new FormData();
-        data.append('image',e.target.files[0], e.target.files[0].name);
-          
-          pushPhoto(data)
+        data.append('image',e.target.files[0], e.target.files[0].name); 
+         pushPhoto(data)  
+            var file = e.target.files[0];
+            var reader = new FileReader();
+            reader.onloadend = function() {
+                base641(reader.result)         
+            }
+            reader.readAsDataURL(file);
     }
-    onChange1 = e =>{
-        const { pushPhoto,photo } = this.props
-        //this.setState({image: e.target.files[0]})
+    onChange2 = e =>{
+        const { pushPhoto, base642 } = this.props      
+        this.setState({trig:true})
         let data = new FormData();
-        data.append('image',e.target.files[0], e.target.files[0].name);
-          
-          pushPhoto(data)
+        data.append('image',e.target.files[0], e.target.files[0].name); 
+         pushPhoto(data)  
+            var file = e.target.files[0];
+            var reader = new FileReader();
+            reader.onloadend = function() {
+                base642(reader.result)         
+            }
+            reader.readAsDataURL(file);
     }
-    onChange = e =>{
-        const { pushPhoto,photo } = this.props
-        //this.setState({image: e.target.files[0]})
+    onChange3 = e =>{
+        const { pushPhoto, base643 } = this.props      
+        this.setState({trig:true})
         let data = new FormData();
-        data.append('image',e.target.files[0], e.target.files[0].name);
-          
-          pushPhoto(data)
+       if( e.target.files[0] == undefined ) {
+           return 
+       }
+        data.append('image',e.target.files[0], e.target.files[0].name); 
+         pushPhoto(data)  
+            var file = e.target.files[0];
+            var reader = new FileReader();
+            reader.onloadend = function() {
+                base643(reader.result)         
+            }
+            reader.readAsDataURL(file);
     }
     submit = values => {
         const { AddNewStaffAction,  getUser, photo } = this.props
         //const { image } = this.state
         
-       let massive = []
-      // massive = photo.map(el => el.data.fileName)
-      // console.log(photo)
-        values.img = `http://127.0.0.1:2000/static/${photo.map(el => el.data.fileName)}`   
+        if(!this.state.trig){
+            values.img = "http://rs.img.com.ua/crop?v2=1&w=600&h=0&url=%2F%2Fbm.img.com.ua%2Fberlin%2Fstorage%2Forig%2Fd224d3bd9bfe8bcb6b561da523d87364.jpg";
+            values.state = 0
+        }
+        else{
+            values.img = `http://127.0.0.1:2000/static/${photo.map(el => el.data.fileName)}`; 
+            values.state = 1 
+         }
+        //values.img = `http://127.0.0.1:2000/static/${photo.map(el => el.data.fileName)}`  
         values.staff = "Машина"
-        values.state = 1
+       
         values.userId = getUser.id
         console.log(values)
         AddNewStaffAction(values)
     };
     render(){
         
-         const { handleSubmit, pristine, reset, submitting, allCategory, photo } = this.props
-         console.log(photo)
+         const { handleSubmit, pristine, reset, submitting, allCategory, photo, base64Photo, addOrnot, base64Photo1, base64Photo2, base64Photo3, addOrnot1, addOrnot2, addOrnot3 } = this.props
+         
         
         
     return (
@@ -102,24 +133,24 @@ class SendingForm extends  Component  {
                     </Field>
 
                             
-                                <label className='upload-zone'>
-                                    <i>&nbsp;</i>
+                                <label className='upload-zone zone1'>
+                                {addOrnot ? <img src={base64Photo} style={{"width": "80px", "height": "80px"}}></img> : <i>&nbsp;</i>}
                                     <input type='file' className='files'  onChange={this.onChange}/>
                                     
                                 </label>
                                 <label className='upload-zone zone2'>
-                                    <i>&nbsp;</i>
-                                    <input type='file' className='files'  onChange={this.onChange}/>
+                                {addOrnot1 ? <img src={base64Photo1} style={{"width": "80px", "height": "80px"}}></img> : <i>&nbsp;</i>}
+                                    <input type='file' className='files'  onChange={this.onChange1}/>
                                     
                                 </label>
                                 <label className='upload-zone zone3'>
-                                    <i>&nbsp;</i>
-                                    <input type='file' className='files'  onChange={this.onChange}/>
+                                {addOrnot2 ? <img src={base64Photo2} style={{"width": "80px", "height": "80px"}}></img> : <i>&nbsp;</i>}
+                                    <input type='file' className='files'  onChange={this.onChange2}/>
                                     
                                 </label>
                                 <label className='upload-zone zone4'>
-                                    <i>&nbsp;</i>
-                                    <input type='file' className='files'  onChange={this.onChange}/>
+                                {addOrnot3 ? <img src={base64Photo3} style={{"width": "80px", "height": "80px"}}></img> : <i>&nbsp;</i>}
+                                    <input type='file' className='files'  onChange={this.onChange3}/>
                                     
                                 </label>
                                 
@@ -150,4 +181,11 @@ class SendingForm extends  Component  {
 
 export default reduxForm({
     form: 'SendingForm'
-})(SendingForm)
+})(SendingForm)
+// const mapStateToProps = (state, props) => ({
+//     form: props.formId
+//   });
+  
+//   const component = reduxForm({ enableReinitialize: true })(SendingForm);
+  
+//   export default connect(mapStateToProps)(component);

+ 2 - 2
src/components/FormsAdd/FormAddNewStaff/index.js

@@ -15,14 +15,14 @@ class FormAddNewStaff extends Component {
     }
     render() {
         
-        const { isFetching, AddNewStaffAction, allCategory, getUser, photo, pushPhoto } = this.props
+        const { isFetching, AddNewStaffAction, allCategory, getUser, photo, pushPhoto, base64Photo, base64, addOrnot } = this.props
         let data;
         if (allCategory.data===undefined){
             data = []
         }
         else{ 
             const category = allCategory.data.filter(el => el.parentId !== 0)
-            data = <Form AddNewStaffAction={AddNewStaffAction} allCategory={category}  getUser={ getUser } photo={ photo } pushPhoto={ pushPhoto } />
+            data = <Form {...this.props} allCategory={ category }/>
         }
         return (
             <Fragment>

+ 13 - 0
src/constants/actionTypes.js

@@ -34,6 +34,19 @@
     export const PUSH_NEW_PHOTO_REQUEST = "PUSH_NEW_PHOTO_REQUEST";
     export const PUSH_NEW_PHOTO_REQUEST_SUCCESS = "PUSH_NEW_PHOTO_REQUEST_SUCCESS";
     export const PUSH_NEW_PHOTO_REQUEST_FAIL = "PUSH_NEW_PHOTO_REQUEST_FAIL";
+    export const BASE_64_REQUEST = "BASE_64_REQUEST";
+    export const BASE1_64_REQUEST = "BASE1_64_REQUEST";
+    export const BASE2_64_REQUEST = "BASE2_64_REQUEST";
+    export const BASE3_64_REQUEST = "BASE3_64_REQUEST";
+    //addNewStaffAction(PUT)
+    export const INPUT_CHANGE_VALUE = "INPUT_CHANGE_VALUE";
+    export const INPUT_CHANGE_VALUE1 = "INPUT_CHANGE_VALUE1";
+    export const INPUT_CHANGE_VALUE2 = "INPUT_CHANGE_VALUE2";
+    export const INPUT_CHANGE_VALUE3 = "INPUT_CHANGE_VALUE3";
+    export const EDIT_STAFF_REQUEST = "EDIT_STAFF_REQUEST";
+    export const EDIT_STAFF_REQUEST_SUCCESS = "EDIT_STAFF_REQUEST_SUCCESS";
+    export const EDIT_STAFF_REQUEST_FAIL = "EDIT_STAFF_REQUEST_FAIL";
+
     //searchStaffAction
     export const CHANGE_INPUT_VALUE = "CHANGE_INPUT_VALUE";
     export const SEARCH_STAFF_REQUEST = "SEARCH_STAFF_REQUEST";

+ 13 - 9
src/container/AddNewStaff.js

@@ -1,7 +1,7 @@
 import React, { Component, Fragment } from 'react';
 
 import { connect } from 'react-redux';
-import { AddNewStaffAction, closeModal, pushPhoto } from "../actions/addNewStaffAction";
+import { AddNewStaffAction, closeModal, pushPhoto, base64, base641, base642, base643 } from "../actions/addNewStaffAction";
 
 import { getUsersDataById } from "../actions/getUserById"
 
@@ -27,17 +27,13 @@ class AddNewStaff extends Component {
         closeModal();
     }
     render() {
-        const { showModal, error, isFetching, AddNewStaffAction, getUser, photo, pushPhoto } = this.props
-
+        const { showModal, error, isFetching, AddNewStaffAction, getUser, photo, pushPhoto, base64, base64Photo, addOrnot } = this.props
+        console.log(base64Photo)
         return (
 
             <Fragment>
                 <Fragment>
-                    <FormAddNewStaff AddNewStaffAction={AddNewStaffAction} 
-                        isFetching={isFetching}
-                        getUser={ getUser }
-                        photo={ photo } 
-                        pushPhoto={ pushPhoto }
+                    <FormAddNewStaff {...this.props}
 
                     />
                 </Fragment>
@@ -60,9 +56,17 @@ const mapStateToProps = state => ({
     showModal: state.addStaff.showModal,
     error: state.addStaff.error,
     getUser: state.getUserById.getUser,
+    base64Photo: state.addStaff.base64Photo,
+    base64Photo1: state.addStaff.base64Photo1,
+    base64Photo2: state.addStaff.base64Photo2,
+    base64Photo3: state.addStaff.base64Photo3,
+    addOrnot: state.addStaff.addOrnot,
+    addOrnot1: state.addStaff.addOrnot1,
+    addOrnot2: state.addStaff.addOrnot2,
+    addOrnot3: state.addStaff.addOrnot3
 });
 
-const mapDispatchToProps = dispatch => bindActionCreators({ AddNewStaffAction, getUsersDataById, closeModal, pushPhoto }, dispatch);
+const mapDispatchToProps = dispatch => bindActionCreators({ AddNewStaffAction, getUsersDataById, closeModal, pushPhoto, base64, base641, base642,base643 }, dispatch);
 
 export default AddNewStaff = connect(
     mapStateToProps,

+ 20 - 8
src/container/CategoryStaffInfo.js

@@ -1,6 +1,7 @@
 import React, { Component } from 'react';
 import { connect} from 'react-redux';
-import * as actions from "../actions/getStaffByCategoryIdAction";
+import { getCategorysDataById } from "../actions/getStaffByCategoryIdAction";
+import { getUsersDataById } from "../actions/getUserById"
 import { bindActionCreators } from "redux";
 
 import CategoryStaffs from '../components/CategoryStaffs'
@@ -10,10 +11,18 @@ import Header from '../container/Header'
 class CategoryStaffInfo extends Component {
     
     componentDidMount(){
-        const { getCategorysDataById, match } = this.props
+        const { getCategorysDataById, match, getUsersDataById } = this.props
         getCategorysDataById(match.params.id)
+       
+        //getStaffsDataById(match.params.id)
+        let localS = JSON.parse(localStorage.getItem("login"));
+            if(localS===null){
+
+            }
+            else{
+                getUsersDataById(localS)
+            }
         
-        console.log(this.state)
     }
 
     componentDidUpdate(prevProps){
@@ -24,16 +33,17 @@ class CategoryStaffInfo extends Component {
     }
 
     render() {
+        const { getUser } = this.props
         const {  infoCategory, isFetching  } = this.props
         console.log(this.props)
         
        
         return (
             <div>
-                <Header />
-                <div className="contentDiv">
-                    <LeftMenu />
-                    <CategoryStaffs infoCategory={infoCategory} isFetching={isFetching}  />
+                <Header  getUser={ getUser }/>
+                <div className="menuAndContent">
+                    <LeftMenu  getUser={ getUser }/>
+                    <CategoryStaffs infoCategory={infoCategory} isFetching={isFetching}  getUser={ getUser }  />
                 </div>
             </div>
         );
@@ -45,9 +55,11 @@ const mapStateToProps = state => ({
     infoCategory: state.categoryById.infoCategory,
     isFetching: state.categoryById.isFetching,
     trigger: state.categoryById.trigger,
+    getUser: state.getUserById.getUser,
+
   });
   
-  const mapDispatchToProps = dispatch => bindActionCreators({ ...actions }, dispatch);
+  const mapDispatchToProps = dispatch => bindActionCreators({ getCategorysDataById, getUsersDataById }, dispatch);
   
   export default CategoryStaffInfo = connect(
         mapStateToProps,

+ 20 - 1
src/container/MainPage.js

@@ -29,7 +29,26 @@ class MainPage extends Component {
     }
 
     render() {
-
+        // const axios = require('axios')
+        // axios.post(
+        //             'http://127.0.0.1:2000/api/staffs',
+        //             {
+        //                 "title": "Авто",
+        //                 "description": "Током бахнет!",
+        //                 "staff": "Стаф. Не знаю, что вы хотите тут, но я сделал",
+        //                 "price": 4,
+        //                 "state": 1,
+        //                 "img": "http://site.com",
+        //                 "userId":  1,
+        //                 "categoryId": 4
+        //             }
+                    
+        //         )
+                
+        //         .then(function (response) { console.log(response) })
+        //         .catch((err)=>console.log(err))
+      
+        
         const { inputStaffs, isFetching, getUser } = this.props
         const {  name, isAdmin, id } = this.props
 

+ 7 - 5
src/container/MainPageStaffInfo.js

@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React, { Component, Fragment } from 'react';
 import { connect} from 'react-redux';
 import {getStaffsDataById} from "../actions/getStaffByIdAction";
 
@@ -25,13 +25,15 @@ class MainPageStaffInfo extends Component {
     render() {
             const { getUser } = this.props
         return (
-            <div>
+            <Fragment>
 
                 <Header getUser={ getUser } />
-                <LeftMenu getUser={ getUser }/>
-                <FullInfoAboutStaff {...this.props} />
+                
+                    <LeftMenu getUser={ getUser }/>
+                    <FullInfoAboutStaff {...this.props} />
 
-            </div>
+                
+            </Fragment>
         );
     }
 }

+ 9 - 7
src/container/SearchStaff.js

@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React, { Component, Fragment } from 'react';
 import { connect} from 'react-redux';
 import {searchStaff} from "../actions/searchStaffAction";
 
@@ -31,12 +31,14 @@ class SearchStaff extends Component {
         const {  getUser } = this.props
         
         console.log(this.props)
-        return (
-          <div>
-            <Header  getUser={ getUser } />
-            <LeftMenu    getUser={ getUser }/>
-            <SearchStaffsPage {...this.props} />
-          </div>       
+        return ( 
+          <Fragment>
+          <Header  getUser={ getUser } />
+          <div className="menuAndContent">
+              <LeftMenu    getUser={ getUser }/>
+              <SearchStaffsPage {...this.props} />
+          </div>
+          </Fragment>       
         );
       }
 }

+ 2 - 1
src/container/UserProfile.js

@@ -40,7 +40,8 @@ class UserProfile extends Component {
         return (
            <div>
                {staffs!==undefined && <div> {getUser.name}
-                 {staffs.map((el,key)=> <div key={key}> {el.title} </div> )}
+                 {/* {staffs.map((el,key)=> <div key={key}> {el.title} </div> )} */}
+                 <Link to="/activeStaffs">Активные Товары</Link>
                  <button onClick={this.singOut}><Link to="/">Выход</Link></button>
              </div>
                }

+ 104 - 1
src/reducer/addStaff.js

@@ -1,15 +1,28 @@
 import * as types from '../constants/actionTypes';
 
 const initState = {
+    addOrnot: false,
+    addOrnot1: false,
+    addOrnot2: false,
+    addOrnot3: false,
+    base64Photo: "",
+    base64Photo1: "",
+    base64Photo2: "",
+    base64Photo3: "",
+    inputData: '',
+    inputData1: '',
+    inputData2: null,
+    inputData3: null,
     staffData: [],
     photo: [],
+    editData: [],
     isFetching: false,
     error: null,
     showModal: false
 }
 
 export default ( state = initState, { type, payload } ) => {
-    console.log(payload)
+    
     switch (type){
         case types.ADD_NEW_STAFF_REQUEST: {
             return {
@@ -61,6 +74,96 @@ export default ( state = initState, { type, payload } ) => {
                 
             }
         }
+        case types.INPUT_CHANGE_VALUE: {
+            return {
+                ...state,
+                isFetching: false,
+                error: "error",
+                inputData: payload
+                
+            }
+        }
+        case types.INPUT_CHANGE_VALUE1: {
+            return {
+                ...state,
+                isFetching: false,
+                error: "error",
+                inputData1: payload
+                
+            }
+        }
+        case types.INPUT_CHANGE_VALUE2: {
+            return {
+                ...state,
+                isFetching: false,
+                error: "error",
+                inputData2: payload
+                
+            }
+        }
+        case types.INPUT_CHANGE_VALUE3: {
+            return {
+                ...state,
+                isFetching: false,
+                error: "error",
+                inputData3: payload
+                
+            }
+        }
+        case types.EDIT_STAFF_REQUEST: {
+            return {
+                ...state,
+                isFetching: true
+            }
+        }
+        case types.EDIT_STAFF_REQUEST_SUCCESS: {
+            return {
+                ...state,
+               
+                isFetching:false,
+                showModal: true
+            }
+        }
+        case types.EDIT_STAFF_REQUEST_FAIL: {
+            return {
+                ...state,
+                isFetching: false,
+                error: "error",
+                showModal: true
+            }
+        }
+        case types.BASE_64_REQUEST: {
+            return {
+            ...state,
+            isFetching: false,
+            base64Photo: payload,
+            addOrnot: true
+            }
+          }
+          case types.BASE1_64_REQUEST: {
+            return {
+            ...state,
+            isFetching: false,
+            base64Photo1: payload,
+            addOrnot1: true
+            }
+          }
+          case types.BASE2_64_REQUEST: {
+            return {
+            ...state,
+            isFetching: false,
+            base64Photo2: payload,
+            addOrnot2: true
+            }
+          }
+          case types.BASE3_64_REQUEST: {
+            return {
+            ...state,
+            isFetching: false,
+            base64Photo3: payload,
+            addOrnot3: true
+            }
+          }
          default: return state;
     }
 }

+ 5 - 1
src/router.js

@@ -18,7 +18,8 @@ import SearchStaffs from './container/SearchStaff'
 import SearchStaffsInfo from './container/SearchStaffsInfo'
 import AddNewStaff from './container/AddNewStaff'
 import AddNewCategory from './container/AddNewCategory'
-
+import ActiveStaffs from './container/activeStaffs'
+import redactorForm from './container/redactorForm'
 // import Form from './components/Auth/index'
 // import RegistrForm from './components/Auth/registration'
 // import UserProtect from './components/usersProtectPage/'
@@ -56,6 +57,9 @@ class Router extends Component {
                 <Route path="/search/Staff/:id" exact component={SearchStaffsInfo} />
             <Route path="/newStaff" exact component={AddNewStaff} />
             <Route path="/addCategory" exact component={AddNewCategory} />
+            <Route path="/activeStaffs" exact component={ ActiveStaffs } />
+            <Route path="/activeStaffs/:id" exact component={ redactorForm } />
+           
 	    </Switch>
     </div>
        )