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