Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cfb4651af | |||
| 2d141b529c | |||
| b418ca7d58 | |||
| 9eea804f71 |
@@ -9,19 +9,10 @@ import siteLinks from '../../links/siteLinks';
|
|||||||
export default function Layout() {
|
export default function Layout() {
|
||||||
|
|
||||||
const {pathname} = useLocation()
|
const {pathname} = useLocation()
|
||||||
const isProfileComplete = pathname == siteLinks.profile_complete
|
// const isProfileComplete = pathname == siteLinks.profile_complete
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="app">
|
<div className="app">
|
||||||
{isProfileComplete ?
|
|
||||||
<div className="app-wrap">
|
|
||||||
<UserHeader />
|
|
||||||
<div className="container-fluid">
|
|
||||||
<Outlet />
|
|
||||||
</div>
|
|
||||||
<UserFooter isProfileComplete={isProfileComplete} />
|
|
||||||
</div>
|
|
||||||
:
|
|
||||||
<div className="app-wrap">
|
<div className="app-wrap">
|
||||||
<UserHeader />
|
<UserHeader />
|
||||||
<div className="app-container">
|
<div className="app-container">
|
||||||
@@ -37,7 +28,6 @@ export default function Layout() {
|
|||||||
</div>
|
</div>
|
||||||
<UserFooter />
|
<UserFooter />
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default function UserFooter({isProfileComplete=false}){
|
export default function UserFooter(){
|
||||||
|
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<footer className={`${isProfileComplete && 'w-100'} footer`}>
|
<footer className={`footer`}>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12 col-sm-6 text-center text-sm-left">
|
<div className="col-12 col-sm-6 text-center text-sm-left">
|
||||||
<p>© Copyright {year}. All rights reserved.</p>
|
<p>© Copyright {year}. All rights reserved.</p>
|
||||||
|
|||||||
@@ -1,29 +1,31 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
|
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import { Form, Formik } from "formik";
|
import { Form, Formik } from "formik";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import getImage from "../../utils/getImage";
|
import getImage from "../../utils/getImage";
|
||||||
import { IoMdArrowDropdown } from "react-icons/io";
|
import { IoMdArrowDropdown } from "react-icons/io";
|
||||||
import { completeProfile } from '../../services/services';
|
import { completeProfile, getCommonPractice } from '../../services/services';
|
||||||
|
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
practice: Yup.string().required("Required"),
|
practice: Yup.string().required("Required"),
|
||||||
specialization: Yup.string().required("Required"),
|
specialization: Yup.string().required("Required"),
|
||||||
information: Yup.string().min(1, "Minimum 10 characters").max(50, "Maximum 50 characters").required("Required"),
|
introduction: Yup.string().min(1, "Minimum 10 characters").max(50, "Maximum 50 characters").required("Required"),
|
||||||
})
|
})
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
practice: '',
|
practice: '',
|
||||||
specialization: '',
|
specialization: '',
|
||||||
information: '',
|
introduction: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function ProfileCompleteCom(){
|
export default function ProfileCompleteCom(){
|
||||||
|
|
||||||
|
const [practices, setPractices] = useState({practice: [], specialization: []})
|
||||||
|
|
||||||
const {state:{profile_completed}} = useLocation()
|
const {state:{profile_completed}} = useLocation()
|
||||||
|
|
||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
@@ -46,101 +48,130 @@ export default function ProfileCompleteCom(){
|
|||||||
// mutation.mutate(reqData)
|
// mutation.mutate(reqData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commonPractices = useMutation({ // FUNCTION TO GET COMMON PRACTICES
|
||||||
|
mutationFn: (fields) => {
|
||||||
|
return getCommonPractice(fields)
|
||||||
|
},
|
||||||
|
onError: ()=> {
|
||||||
|
setPractices({practice: [], specialization: []})
|
||||||
|
},
|
||||||
|
onSuccess: (res) => {
|
||||||
|
let returnPractices = []
|
||||||
|
let returnSpecialization = []
|
||||||
|
setPractices(res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
|
}
|
||||||
|
commonPractices.mutate(reqData)
|
||||||
|
},[])
|
||||||
|
|
||||||
|
console.log('practices', practices)
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<div style={{marginTop: '90px'}}>
|
|
||||||
<BreadcrumbComBS title='Update Profile' paths={['Dashboard', 'Profile']} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="row pt-1">
|
<BreadcrumbComBS title='Update Profile' paths={['Dashboard', 'Profile']} />
|
||||||
|
|
||||||
{/*<div className="col-xxl-6 m-b-30">*/}
|
{commonPractices?.isFetching ?
|
||||||
{/* <div className="card card-statistics h-100 mb-0" style={{minHeight: '100px'}}>*/}
|
<>
|
||||||
{/* /!* <div className="card-header d-flex align-items-center justify-content-between">*/}
|
<div className="row">
|
||||||
{/* <div className="card-heading">*/}
|
<div className="col-12">
|
||||||
{/* <h4 className="card-title">My Product URLs</h4>*/}
|
<p className='text-mute'>Loading...</p>
|
||||||
{/* </div>*/}
|
</div>
|
||||||
{/* </div> *!/*/}
|
</div>
|
||||||
{/* </div>*/}
|
</>
|
||||||
{/*</div>*/}
|
: commonPractices?.isError ?
|
||||||
<div className="col-md-6 m-b-30">
|
<div className="row">
|
||||||
<div className="card card-statistics h-100 mb-0">
|
<div className="col-12">
|
||||||
{/* <div className="card-header d-flex align-items-center justify-content-between">
|
<p className='text-danger'>{commonPractices?.error?.message}</p>
|
||||||
<div className="card-heading">
|
</div>
|
||||||
<h4 className="card-title">My Product URLs</h4>
|
</div>
|
||||||
|
:
|
||||||
|
<div className="row pt-1">
|
||||||
|
<div className="col-md-6 m-b-30">
|
||||||
|
<div className="card card-statistics h-100 mb-0">
|
||||||
|
{/* <div className="card-header d-flex align-items-center justify-content-between">
|
||||||
|
<div className="card-heading">
|
||||||
|
<h4 className="card-title">My Product URLs</h4>
|
||||||
|
</div>
|
||||||
|
</div> */}
|
||||||
|
{/* <div style={{minHeight: '400px'}}></div> */}
|
||||||
|
<div className="card-body">
|
||||||
|
<Formik
|
||||||
|
initialValues={initialValues}
|
||||||
|
validationSchema={validationSchema}
|
||||||
|
onSubmit={handleCompleteProfile}
|
||||||
|
>
|
||||||
|
{(props) => {
|
||||||
|
return (
|
||||||
|
<Form className='h-100 row flex-column'>
|
||||||
|
{/* <div className="row"> */}
|
||||||
|
<>
|
||||||
|
<div className="">
|
||||||
|
<div className="form-group position-relative">
|
||||||
|
<label className={`text-black fw-bold control-label ${(props.errors.practice && props.touched.practice) && 'text-danger'}`}>Practice :</label>
|
||||||
|
<div className="position-relative">
|
||||||
|
<select onChange={props.handleChange} name='practice' value={props.values.practice} className="form-control">
|
||||||
|
<option value=''>Select</option>
|
||||||
|
<option value='engineering'>Engineering</option>
|
||||||
|
</select>
|
||||||
|
<IoMdArrowDropdown className='position-absolute w-auto' style={{top: '50%', right: '2px', transform: 'translateY(-50%)'}} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="">
|
||||||
|
<div className="form-group">
|
||||||
|
<label className={`text-black fw-bold control-label ${(props.errors.specialization && props.touched.specialization) && 'text-danger'}`}>Specialization :</label>
|
||||||
|
<div className="position-relative">
|
||||||
|
<select onChange={props.handleChange} name='specialization' value={props.values.specialization} className="form-control">
|
||||||
|
<option value=''>Select</option>
|
||||||
|
<option value='construction'>Construction</option>
|
||||||
|
</select>
|
||||||
|
<IoMdArrowDropdown className='position-absolute w-auto' style={{top: '50%', right: '2px', transform: 'translateY(-50%)'}} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="">
|
||||||
|
<div className="form-group position-relative">
|
||||||
|
<label className={`text-black fw-bold control-label ${(props.errors.introduction && props.touched.introduction) && 'text-danger'}`}>General Information :</label>
|
||||||
|
<textarea name='introduction' rows={10} style={{resize: 'none'}} className="form-control" value={props.values.introduction} onChange={props.handleChange} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{/* {(mutation.isError || mutation.isSuccess) &&
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className={`${mutation.isSuccess ? 'text-success' : 'text-danger'}`}>{mutation.isSuccess ? 'Completed successfully' : mutation.error.message}</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
} */}
|
||||||
|
|
||||||
|
<div className="mt-auto text-end">
|
||||||
|
<button type='submit' className="btn btn-primary text-uppercase">{false ? 'loading...' : 'Continue'}</button>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
{/* </div> */}
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Formik>
|
||||||
</div>
|
</div>
|
||||||
</div> */}
|
</div>
|
||||||
{/* <div style={{minHeight: '400px'}}></div> */}
|
</div>
|
||||||
<div className="card-body">
|
<div className="col-md-6 m-b-30">
|
||||||
<Formik
|
<div className="text-center img-block left-column wow fadeInRight">
|
||||||
initialValues={initialValues}
|
<img className="img-fluid" src={getImage('img-07.png')} alt="content-image" />
|
||||||
validationSchema={validationSchema}
|
|
||||||
onSubmit={handleCompleteProfile}
|
|
||||||
>
|
|
||||||
{(props) => {
|
|
||||||
return (
|
|
||||||
<Form className='h-100 row flex-column'>
|
|
||||||
{/* <div className="row"> */}
|
|
||||||
<>
|
|
||||||
<div className="">
|
|
||||||
<div className="form-group position-relative">
|
|
||||||
<label className={`text-black fw-bold control-label ${(props.errors.practice && props.touched.practice) && 'text-danger'}`}>Practice :</label>
|
|
||||||
<div className="position-relative">
|
|
||||||
<select onChange={props.handleChange} name='practice' value={props.values.practice} className="form-control">
|
|
||||||
<option value=''>Select</option>
|
|
||||||
<option value='engineering'>Engineering</option>
|
|
||||||
</select>
|
|
||||||
<IoMdArrowDropdown className='position-absolute w-auto' style={{top: '50%', right: '2px', transform: 'translateY(-50%)'}} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="">
|
|
||||||
<div className="form-group">
|
|
||||||
<label className={`text-black fw-bold control-label ${(props.errors.specialization && props.touched.specialization) && 'text-danger'}`}>Specialization :</label>
|
|
||||||
<div className="position-relative">
|
|
||||||
<select onChange={props.handleChange} name='specialization' value={props.values.specialization} className="form-control">
|
|
||||||
<option value=''>Select</option>
|
|
||||||
<option value='construction'>Construction</option>
|
|
||||||
</select>
|
|
||||||
<IoMdArrowDropdown className='position-absolute w-auto' style={{top: '50%', right: '2px', transform: 'translateY(-50%)'}} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="">
|
|
||||||
<div className="form-group position-relative">
|
|
||||||
<label className={`text-black fw-bold control-label ${(props.errors.information && props.touched.information) && 'text-danger'}`}>General Information :</label>
|
|
||||||
<textarea name='information' rows={10} style={{resize: 'none'}} className="form-control" value={props.values.information} onChange={props.handleChange} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{/* {(mutation.isErrorrror || mutation.isSuccess) &&
|
|
||||||
<>
|
|
||||||
<div className="col-12">
|
|
||||||
<p className={`${mutation.isSuccess ? 'text-success' : 'text-danger'}`}>{mutation.isSuccess ? 'Completed successfully' : mutation.error.message}</p>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
} */}
|
|
||||||
|
|
||||||
<div className="mt-auto text-end">
|
|
||||||
<button type='submit' className="btn btn-primary text-uppercase">{false ? 'loading...' : 'Continue'}</button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
{/* </div> */}
|
|
||||||
</Form>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Formik>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-6 m-b-30">
|
}
|
||||||
<div class="text-center img-block left-column wow fadeInRight">
|
|
||||||
<img className="img-fluid" src={getImage('img-07.png')} alt="content-image" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>;
|
</>;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ export const completeProfile = (reqData) => {
|
|||||||
let postData = {
|
let postData = {
|
||||||
...reqData,
|
...reqData,
|
||||||
}
|
}
|
||||||
return postAuxEnd(`/panel/`, postData, false)
|
return postAuxEnd(`/panel/account/startprofile`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION TO COMPLETE PROFILE
|
// FUNCTION TO COMPLETE PROFILE
|
||||||
@@ -182,6 +182,14 @@ export const getSubscriptions = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/subscription/products`, postData, false)
|
return postAuxEnd(`/panel/subscription/products`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET COMMON PRACTICE
|
||||||
|
export const getCommonPractice = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/common/practice`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user