updated profile layout #66
@@ -1,16 +1,31 @@
|
||||
import React from 'react'
|
||||
import { Outlet, useLocation } from 'react-router-dom';
|
||||
import UserMenu from "./layoutcom/UserMenu";
|
||||
import UserHeader from "./layoutcom/UserHeader";
|
||||
import UserFooter from "./layoutcom/UserFooter";
|
||||
import { Outlet } from 'react-router-dom';
|
||||
import siteLinks from '../../links/siteLinks';
|
||||
|
||||
|
||||
export default function Layout() {
|
||||
|
||||
const {pathname} = useLocation()
|
||||
const isProfileComplete = pathname == siteLinks.profile_complete
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
{isProfileComplete ?
|
||||
<div className="app-wrap">
|
||||
<UserHeader />
|
||||
<div className="container-fluid">
|
||||
<Outlet />
|
||||
</div>
|
||||
<UserFooter isProfileComplete={isProfileComplete} />
|
||||
</div>
|
||||
:
|
||||
<div className="app-wrap">
|
||||
<UserHeader />
|
||||
<div className="app-container">
|
||||
|
||||
<aside className="app-navbar">
|
||||
<UserMenu />
|
||||
</aside>
|
||||
@@ -22,6 +37,7 @@ export default function Layout() {
|
||||
</div>
|
||||
<UserFooter />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from "react";
|
||||
|
||||
export default function UserFooter(){
|
||||
export default function UserFooter({isProfileComplete=false}){
|
||||
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
return <>
|
||||
<footer className="footer">
|
||||
<footer className={`${isProfileComplete && 'w-100'} footer`}>
|
||||
<div className="row">
|
||||
<div className="col-12 col-sm-6 text-center text-sm-left">
|
||||
<p>© Copyright {year}. All rights reserved.</p>
|
||||
|
||||
@@ -73,7 +73,7 @@ export default function UserHeader(){
|
||||
|
||||
<ul className="navbar-nav nav-right ml-auto">
|
||||
<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" />
|
||||
<span className="bg-success user-status"></span>
|
||||
</a>
|
||||
|
||||
@@ -5,24 +5,30 @@ import { Form, Formik } from "formik";
|
||||
import * as Yup from "yup";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import getImage from "../../utils/getImage";
|
||||
import { IoMdArrowDropdown } from "react-icons/io";
|
||||
import { completeProfile } from '../../services/services';
|
||||
|
||||
|
||||
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"),
|
||||
information: Yup.string().min(1, "Minimum 10 characters").max(50, "Maximum 50 characters").required("Required"),
|
||||
})
|
||||
|
||||
const initialValues = {
|
||||
username: '',
|
||||
practice: '',
|
||||
specialization: '',
|
||||
information: '',
|
||||
};
|
||||
|
||||
|
||||
export default function HomeSections(){
|
||||
export default function ProfileCompleteCom(){
|
||||
|
||||
const {state:{profile_completed}} = useLocation()
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return ()=>{}
|
||||
return completeProfile(fields)
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
console.log('res', res)
|
||||
@@ -31,14 +37,21 @@ export default function HomeSections(){
|
||||
|
||||
const handleCompleteProfile = (values, helpers) => {
|
||||
// helpers.resetForm()
|
||||
let reqData = {
|
||||
token: localStorage.getItem('token'), // USER TOKEN
|
||||
uid: localStorage.getItem('uid'), // USER UID
|
||||
// ...values
|
||||
}
|
||||
console.log('values', values, helpers)
|
||||
// mutation.mutate(values)
|
||||
// mutation.mutate(reqData)
|
||||
}
|
||||
|
||||
return <>
|
||||
<BreadcrumbComBS title='Update Profile' paths={['Dashboard', 'Profile']} />
|
||||
<div style={{marginTop: '90px'}}>
|
||||
<BreadcrumbComBS title='Update Profile' paths={['Dashboard', 'Profile']} />
|
||||
</div>
|
||||
|
||||
<div className="row">
|
||||
<div className="row pt-1">
|
||||
|
||||
{/*<div className="col-xxl-6 m-b-30">*/}
|
||||
{/* <div className="card card-statistics h-100 mb-0" style={{minHeight: '100px'}}>*/}
|
||||
@@ -49,7 +62,7 @@ export default function HomeSections(){
|
||||
{/* </div> *!/*/}
|
||||
{/* </div>*/}
|
||||
{/*</div>*/}
|
||||
<div className="col-xxl-6 m-b-30">
|
||||
<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">
|
||||
@@ -65,29 +78,56 @@ export default function HomeSections(){
|
||||
>
|
||||
{(props) => {
|
||||
return (
|
||||
<Form className=''>
|
||||
<div className="row">
|
||||
<Form className='h-100 row flex-column'>
|
||||
{/* <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 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>
|
||||
|
||||
{/* {cSignup.error &&
|
||||
<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='text-danger'>{cSignup.error.message}</p>
|
||||
<p className={`${mutation.isSuccess ? 'text-success' : 'text-danger'}`}>{mutation.isSuccess ? 'Completed successfully' : mutation.error.message}</p>
|
||||
</div>
|
||||
</>
|
||||
} */}
|
||||
|
||||
<div className="col-12 mt-3 text-end">
|
||||
<div className="mt-auto text-end">
|
||||
<button type='submit' className="btn btn-primary text-uppercase">{false ? 'loading...' : 'Continue'}</button>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
{/* </div> */}
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
@@ -95,9 +135,9 @@ export default function HomeSections(){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-xxl-6 m-b-30">
|
||||
<div class="img-block left-column wow fadeInRight">
|
||||
<img className="img-fluid" src={getImage('img-07.png')} alt="content-image" />
|
||||
<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>
|
||||
|
||||
@@ -167,6 +167,14 @@ export const getSettingsData = (reqData) => {
|
||||
}
|
||||
|
||||
// FUNCTION TO GET PRODUCT SUBSCRIPTIONS
|
||||
export const completeProfile = (reqData) => {
|
||||
let postData = {
|
||||
...reqData,
|
||||
}
|
||||
return postAuxEnd(`/panel/`, postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO COMPLETE PROFILE
|
||||
export const getSubscriptions = (reqData) => {
|
||||
let postData = {
|
||||
...reqData,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import ProfileCompleteCom from '../component/profile_complete/ProfileCompleteCom';
|
||||
|
||||
|
||||
export default function ProfileCompletePage(){
|
||||
return <ProfileCompleteCom />
|
||||
}
|
||||
Reference in New Issue
Block a user