Done
This commit is contained in:
parent
f7d8d64d7b
commit
b6fb78d9dc
|
|
@ -10,6 +10,7 @@ import useAuthState from '../../lib/state mangment/AuthState';
|
||||||
import { GiHamburgerMenu } from 'react-icons/gi';
|
import { GiHamburgerMenu } from 'react-icons/gi';
|
||||||
import WithDrawer from './WithDrawer';
|
import WithDrawer from './WithDrawer';
|
||||||
import Sidebar from './SideBar';
|
import Sidebar from './SideBar';
|
||||||
|
import { Dropdown, type MenuProps } from 'antd';
|
||||||
|
|
||||||
type TUserData =
|
type TUserData =
|
||||||
{
|
{
|
||||||
|
|
@ -29,6 +30,14 @@ const Header = () => {
|
||||||
logout()
|
logout()
|
||||||
navigate('/auth')
|
navigate('/auth')
|
||||||
}
|
}
|
||||||
|
const items: MenuProps['items'] = [
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
label: (
|
||||||
|
<div onClick={handelClick}>{t("Log Out")}</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,22 +56,14 @@ const Header = () => {
|
||||||
</WithDrawer>
|
</WithDrawer>
|
||||||
</div>
|
</div>
|
||||||
<div className='Header_Right'>
|
<div className='Header_Right'>
|
||||||
{/* <Theme /> */}
|
|
||||||
{/* <Translate /> */}
|
|
||||||
<Menu menuButton={<MenuButton>
|
|
||||||
|
|
||||||
<div className='User_Pro'>
|
|
||||||
<div className='User_info'>
|
<Dropdown menu={{ items }} placement="bottomLeft">
|
||||||
{/* <h6>{user?.full_name}</h6> */}
|
<div className='User_Pro'>
|
||||||
{/* <p> {user?.role_type} </p> */}
|
|
||||||
</div>
|
|
||||||
<img className='UNK_User' src={UserImageURL} alt='' width={40} height={40} />
|
<img className='UNK_User' src={UserImageURL} alt='' width={40} height={40} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</MenuButton>} transition>
|
</Dropdown>
|
||||||
<MenuItem onClick={handelClick}>{t("Log Out")}</MenuItem>
|
|
||||||
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,35 @@ import { QueryStatusEnum } from '../../config/QueryStatus'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
||||||
import { useGetProject } from '../../api/Project'
|
import { useGetProject } from '../../api/Project'
|
||||||
|
import SelectField from '../../Layout/Dashboard/SelectField'
|
||||||
|
|
||||||
function Page() {
|
function Page() {
|
||||||
|
|
||||||
const column =useTableColumns()
|
const column =useTableColumns()
|
||||||
const {data ,status } = useGetProject()
|
const {data ,status } = useGetProject()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const ExpandedComponent = ({ data }:any) => {
|
||||||
|
console.log(data,"data");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='p-2'>
|
||||||
|
<p >description : {data?.description}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const typeselect = [
|
||||||
|
{label : "website" , value : "website"},
|
||||||
|
{label : "mobile" , value : "mobile"},
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
return (
|
return (
|
||||||
// Pass Status to Layout
|
// Pass Status to Layout
|
||||||
<DashBody status={status as QueryStatusEnum} >
|
<DashBody status={status as QueryStatusEnum} >
|
||||||
|
|
||||||
<DashHeader showAddButton={false} title={'Project'}>
|
<DashHeader showAddButton={false} title={'Project'}>
|
||||||
<div className='RightSide d-flex gap-2 align-center '>
|
<div className='RightSide d-flex gap-2 align-center '>
|
||||||
|
<SelectField selectBy="type" lebel="type" option={typeselect} />
|
||||||
<AddButton onClick={()=>navigate('/project/add')}></AddButton>
|
<AddButton onClick={()=>navigate('/project/add')}></AddButton>
|
||||||
</div>
|
</div>
|
||||||
</DashHeader>
|
</DashHeader>
|
||||||
|
|
@ -32,6 +47,8 @@ function Page() {
|
||||||
isLoading={false}
|
isLoading={false}
|
||||||
columns={column}
|
columns={column}
|
||||||
is_pagination={false}
|
is_pagination={false}
|
||||||
|
expandableRows
|
||||||
|
expandableRowsComponent={ExpandedComponent}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ export const getInitialValues = (objectToEdit: any | null = null): any => {
|
||||||
return {
|
return {
|
||||||
id: objectToEdit?.id ?? null,
|
id: objectToEdit?.id ?? null,
|
||||||
image: objectToEdit?.image ,
|
image: objectToEdit?.image ,
|
||||||
type: objectToEdit?.type ,
|
|
||||||
is_active: objectToEdit?.is_active ,
|
is_active: objectToEdit?.is_active ,
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,7 +28,6 @@ export const getValidationSchema = (editMode: boolean = false): Yup.Schema<any>
|
||||||
// Validate input
|
// Validate input
|
||||||
return Yup.object().shape({
|
return Yup.object().shape({
|
||||||
image: Yup.string().required('Required'),
|
image: Yup.string().required('Required'),
|
||||||
type: Yup.string().required('Required'),
|
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,13 @@ const useTableColumns :any = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: t("type"),
|
|
||||||
sortable: false,
|
|
||||||
center: "true",
|
|
||||||
cell: (row:any) => row?.type
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name: t("is_active"),
|
name: t("is_active"),
|
||||||
sortable: false,
|
sortable: false,
|
||||||
center: "true",
|
center: "true",
|
||||||
cell: (row:any) => row?.is_active
|
cell: (row:any) => row?.is_active === 1 ? "true" : "false"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "#",
|
name: "#",
|
||||||
|
|
@ -59,7 +54,7 @@ const useTableColumns :any = () => {
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
[deleteMutation, navigate, t]
|
[deleteMutation, t]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,8 @@ function Form() {
|
||||||
setFieldValue("is_active", checked ? 1 : 0)
|
setFieldValue("is_active", checked ? 1 : 0)
|
||||||
|
|
||||||
};
|
};
|
||||||
const typeselect = [
|
|
||||||
{label : "website" , value : "website"},
|
|
||||||
{label : "mobile" , value : "mobile"},
|
|
||||||
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
||||||
<Col>
|
<Col>
|
||||||
|
|
@ -29,7 +24,6 @@ function Form() {
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="type" type='Select' option={typeselect} />
|
|
||||||
<div className="ValidationField w-100" >
|
<div className="ValidationField w-100" >
|
||||||
<label className="text">
|
<label className="text">
|
||||||
{t(`is_active`)}
|
{t(`is_active`)}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,12 @@ import ValidationField from '../../../Components/ValidationField/ValidationField
|
||||||
|
|
||||||
function Form() {
|
function Form() {
|
||||||
|
|
||||||
|
const typeselect = [
|
||||||
|
{label : "website" , value : "website"},
|
||||||
|
{label : "mobile" , value : "mobile"},
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
return (
|
return (
|
||||||
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
||||||
<Col>
|
<Col>
|
||||||
|
|
@ -14,6 +20,7 @@ function Form() {
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="logo" type='File' />
|
<ValidationField name="logo" type='File' />
|
||||||
|
<ValidationField name="type" type='Select' option={typeselect} />
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,12 @@ import ValidationField from '../../../Components/ValidationField/ValidationField
|
||||||
|
|
||||||
function Form() {
|
function Form() {
|
||||||
|
|
||||||
|
const typeselect = [
|
||||||
|
{label : "website" , value : "website"},
|
||||||
|
{label : "mobile" , value : "mobile"},
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
return (
|
return (
|
||||||
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
||||||
<Col>
|
<Col>
|
||||||
|
|
@ -14,6 +20,7 @@ function Form() {
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="logo" type='File' />
|
<ValidationField name="logo" type='File' />
|
||||||
|
<ValidationField name="type" type='Select' option={typeselect} />
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export const getInitialValues = (objectToEdit: any | null = null): any => {
|
||||||
title: objectToEdit?.title ,
|
title: objectToEdit?.title ,
|
||||||
logo: objectToEdit?.logo ,
|
logo: objectToEdit?.logo ,
|
||||||
description: objectToEdit?.description ,
|
description: objectToEdit?.description ,
|
||||||
|
type: objectToEdit?.type ,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -21,6 +22,8 @@ export const getInitialValuesForAdd = (objectToEdit: any | null = null): any =>
|
||||||
title: null ,
|
title: null ,
|
||||||
logo: null ,
|
logo: null ,
|
||||||
description: null ,
|
description: null ,
|
||||||
|
type: null ,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,6 +36,7 @@ export const getValidationSchema = (editMode: boolean = false): Yup.Schema<any>
|
||||||
title: Yup.string().required('Required'),
|
title: Yup.string().required('Required'),
|
||||||
logo: Yup.string().required('Required'),
|
logo: Yup.string().required('Required'),
|
||||||
description: Yup.string().required('Required'),
|
description: Yup.string().required('Required'),
|
||||||
|
type: Yup.string().required('Required'),
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@ const useTableColumns :any = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: t("type"),
|
||||||
|
sortable: false,
|
||||||
|
center: "true",
|
||||||
|
cell: (row:any) => row?.type
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: t("title"),
|
name: t("title"),
|
||||||
sortable: false,
|
sortable: false,
|
||||||
|
|
@ -41,7 +47,7 @@ const useTableColumns :any = () => {
|
||||||
name: t("description"),
|
name: t("description"),
|
||||||
sortable: false,
|
sortable: false,
|
||||||
center: "true",
|
center: "true",
|
||||||
cell: (row:any) => row?.description
|
cell: (row:any) => <div className="single-line-div">{row?.description} </div>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "#",
|
name: "#",
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,10 @@ function Form() {
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="title" />
|
<ValidationField name="title" />
|
||||||
|
|
||||||
<ValidationField name="description" />
|
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="image" type='File' />
|
<ValidationField name="description" />
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,10 @@ function Form() {
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="title" />
|
<ValidationField name="title" />
|
||||||
|
|
||||||
<ValidationField name="description" />
|
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="image" type='File' />
|
<ValidationField name="description" />
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@ const EditPage = () => {
|
||||||
const { data,isLoading:IsloadingButton,isRefetching } = useGetOneService()
|
const { data,isLoading:IsloadingButton,isRefetching } = useGetOneService()
|
||||||
const { mutate, isSuccess } = useUpdateService()
|
const { mutate, isSuccess } = useUpdateService()
|
||||||
const handleSubmit = (values: any) => {
|
const handleSubmit = (values: any) => {
|
||||||
if(typeof values?.image === "string"){
|
|
||||||
delete values["image"]
|
|
||||||
}
|
|
||||||
mutate(values);
|
mutate(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ export const getInitialValues = (objectToEdit: any | null = null): any => {
|
||||||
return {
|
return {
|
||||||
id: objectToEdit?.id ?? null,
|
id: objectToEdit?.id ?? null,
|
||||||
title: objectToEdit?.title ,
|
title: objectToEdit?.title ,
|
||||||
image: objectToEdit?.image ,
|
|
||||||
description: objectToEdit?.description ,
|
description: objectToEdit?.description ,
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,7 +19,6 @@ export const getInitialValues = (objectToEdit: any | null = null): any => {
|
||||||
export const getInitialValuesForAdd = (objectToEdit: any | null = null): any => {
|
export const getInitialValuesForAdd = (objectToEdit: any | null = null): any => {
|
||||||
return {
|
return {
|
||||||
title: null ,
|
title: null ,
|
||||||
image: null ,
|
|
||||||
description: null ,
|
description: null ,
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -32,7 +30,6 @@ export const getValidationSchema = (editMode: boolean = false): Yup.Schema<any>
|
||||||
// Validate input
|
// Validate input
|
||||||
return Yup.object().shape({
|
return Yup.object().shape({
|
||||||
title: Yup.string().required('Required'),
|
title: Yup.string().required('Required'),
|
||||||
image: Yup.string().required('Required'),
|
|
||||||
description: Yup.string().required('Required'),
|
description: Yup.string().required('Required'),
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,16 +20,6 @@ const useTableColumns :any = () => {
|
||||||
center: true,
|
center: true,
|
||||||
selector: (row: any) => row.id,
|
selector: (row: any) => row.id,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: t("image"),
|
|
||||||
sortable: false,
|
|
||||||
center: "true",
|
|
||||||
cell: (row:any) => {
|
|
||||||
let src = row?.image;
|
|
||||||
return <ColumnsImage src={src} />
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: t("title"),
|
name: t("title"),
|
||||||
sortable: false,
|
sortable: false,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user