Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cfb4651af | |||
| 2d141b529c | |||
| b418ca7d58 | |||
| 9eea804f71 | |||
| f3ebb0a925 | |||
| 6421eb5b3e | |||
| 971624a358 |
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
@@ -1,16 +1,22 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { Outlet, useLocation } from 'react-router-dom';
|
||||||
import UserMenu from "./layoutcom/UserMenu";
|
import UserMenu from "./layoutcom/UserMenu";
|
||||||
import UserHeader from "./layoutcom/UserHeader";
|
import UserHeader from "./layoutcom/UserHeader";
|
||||||
import UserFooter from "./layoutcom/UserFooter";
|
import UserFooter from "./layoutcom/UserFooter";
|
||||||
import { Outlet } from 'react-router-dom';
|
import siteLinks from '../../links/siteLinks';
|
||||||
|
|
||||||
|
|
||||||
export default function Layout() {
|
export default function Layout() {
|
||||||
|
|
||||||
|
const {pathname} = useLocation()
|
||||||
|
// const isProfileComplete = pathname == siteLinks.profile_complete
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="app">
|
<div className="app">
|
||||||
<div className="app-wrap">
|
<div className="app-wrap">
|
||||||
<UserHeader />
|
<UserHeader />
|
||||||
<div className="app-container">
|
<div className="app-container">
|
||||||
|
|
||||||
<aside className="app-navbar">
|
<aside className="app-navbar">
|
||||||
<UserMenu />
|
<UserMenu />
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default function UserFooter(){
|
|||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<footer className="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>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default function UserHeader(){
|
|||||||
|
|
||||||
<ul className="navbar-nav nav-right ml-auto">
|
<ul className="navbar-nav nav-right ml-auto">
|
||||||
<li className="nav-item user-profile">
|
<li className="nav-item user-profile">
|
||||||
<a onClick={toggleMenu} href="#" className="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdow">
|
<a onClick={toggleMenu} className="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdow">
|
||||||
<img src={getImage('profile-pic-circle.png')} alt="avtar-img" />
|
<img src={getImage('profile-pic-circle.png')} alt="avtar-img" />
|
||||||
<span className="bg-success user-status"></span>
|
<span className="bg-success user-status"></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,27 +1,36 @@
|
|||||||
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 { IoMdArrowDropdown } from "react-icons/io";
|
||||||
|
import { completeProfile, getCommonPractice } from '../../services/services';
|
||||||
|
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
username: Yup.string().min(3, "Minimum 3 characters").max(50, "Maximum 50 characters").required("Email is required"),
|
practice: Yup.string().required("Required"),
|
||||||
|
specialization: Yup.string().required("Required"),
|
||||||
|
introduction: Yup.string().min(1, "Minimum 10 characters").max(50, "Maximum 50 characters").required("Required"),
|
||||||
})
|
})
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
username: '',
|
practice: '',
|
||||||
|
specialization: '',
|
||||||
|
introduction: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function HomeSections(){
|
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({
|
||||||
mutationFn: (fields) => {
|
mutationFn: (fields) => {
|
||||||
return ()=>{}
|
return completeProfile(fields)
|
||||||
},
|
},
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
console.log('res', res)
|
console.log('res', res)
|
||||||
@@ -30,70 +39,139 @@ export default function HomeSections(){
|
|||||||
|
|
||||||
const handleCompleteProfile = (values, helpers) => {
|
const handleCompleteProfile = (values, helpers) => {
|
||||||
// helpers.resetForm()
|
// helpers.resetForm()
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
|
// ...values
|
||||||
|
}
|
||||||
console.log('values', values, helpers)
|
console.log('values', values, helpers)
|
||||||
// mutation.mutate(values)
|
// 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 <>
|
||||||
|
|
||||||
<BreadcrumbComBS title='Update Profile' paths={['Dashboard', 'Profile']} />
|
<BreadcrumbComBS title='Update Profile' paths={['Dashboard', 'Profile']} />
|
||||||
|
|
||||||
<div className="row">
|
{commonPractices?.isFetching ?
|
||||||
<div className="col-xxl-6 m-b-30">
|
<>
|
||||||
<div className="card card-statistics h-100 mb-0" style={{minHeight: '100px'}}>
|
<div className="row">
|
||||||
{/* <div className="card-header d-flex align-items-center justify-content-between">
|
<div className="col-12">
|
||||||
<div className="card-heading">
|
<p className='text-mute'>Loading...</p>
|
||||||
<h4 className="card-title">My Product URLs</h4>
|
</div>
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</>
|
||||||
<div className="col-xxl-6 m-b-30">
|
: commonPractices?.isError ?
|
||||||
<div className="card card-statistics h-100 mb-0">
|
<div className="row">
|
||||||
{/* <div className="card-header d-flex align-items-center justify-content-between">
|
<div className="col-12">
|
||||||
<div className="card-heading">
|
<p className='text-danger'>{commonPractices?.error?.message}</p>
|
||||||
<h4 className="card-title">My Product URLs</h4>
|
</div>
|
||||||
|
</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=''>
|
|
||||||
<div className="row">
|
|
||||||
<>
|
|
||||||
<div className="col-12">
|
|
||||||
<div className="form-group">
|
|
||||||
<label className={`text-black fw-bold control-label ${(props.errors.username && props.touched.username) && 'text-danger'}`}>Username*</label>
|
|
||||||
<input type="username" name='username' className="form-control" placeholder="Username" value={props.values.username} onChange={props.handleChange} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* {cSignup.error &&
|
|
||||||
<>
|
|
||||||
<div className="col-12">
|
|
||||||
<p className='text-danger'>{cSignup.error.message}</p>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
} */}
|
|
||||||
|
|
||||||
<div className="col-12 mt-3 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>
|
}
|
||||||
</>;
|
</>;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ const siteLinks = {
|
|||||||
help: '/help',
|
help: '/help',
|
||||||
home: '/',
|
home: '/',
|
||||||
dash: '/dash',
|
dash: '/dash',
|
||||||
profile_complete: '/profile_complete',
|
profile_complete: '/profile-complete',
|
||||||
product: '/product/*',
|
product: '/product/*',
|
||||||
contacts: '/contacts',
|
contacts: '/contacts',
|
||||||
comments: '/comments',
|
comments: '/comments',
|
||||||
|
|||||||
@@ -167,6 +167,14 @@ export const getSettingsData = (reqData) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET PRODUCT SUBSCRIPTIONS
|
// FUNCTION TO GET PRODUCT SUBSCRIPTIONS
|
||||||
|
export const completeProfile = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/account/startprofile`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO COMPLETE PROFILE
|
||||||
export const getSubscriptions = (reqData) => {
|
export const getSubscriptions = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
...reqData,
|
...reqData,
|
||||||
@@ -174,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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import ProfileCompleteCom from '../component/profile_complete/ProfileCompleteCom';
|
import ProfileCompleteCom from '../component/profile_complete/ProfileCompleteCom';
|
||||||
|
|
||||||
|
|
||||||
export default function ProfileCompletePage(){
|
export default function ProfileCompletePage(){
|
||||||
return <ProfileCompleteCom />
|
return <ProfileCompleteCom />
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user