show reseller
This commit is contained in:
parent
36feda0b43
commit
9e35207841
22
src/Pages/Admin/Reseller/show/Model/FilterForm.tsx
Normal file
22
src/Pages/Admin/Reseller/show/Model/FilterForm.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import React from "react";
|
||||
import ValidationField from "../../../../../Components/ValidationField/ValidationField";
|
||||
import { Col, Row } from "reactstrap";
|
||||
import { userTypeOptions } from "../../../../../config/userTypeOptions";
|
||||
|
||||
const FilterForm = () => {
|
||||
return (
|
||||
<div>
|
||||
<Row>
|
||||
<Col>
|
||||
<ValidationField placeholder="username" label="username" name="username" />
|
||||
<ValidationField placeholder="phone_number" label="phone_number" name="phone_number" />
|
||||
</Col>
|
||||
<Col>
|
||||
<ValidationField type="Select" option={userTypeOptions} placeholder="type" label="type" name="type" />
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default FilterForm;
|
||||
44
src/Pages/Admin/Reseller/show/Page.tsx
Normal file
44
src/Pages/Admin/Reseller/show/Page.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { useTranslation } from "react-i18next";
|
||||
import { Suspense } from "react";
|
||||
import { Spin } from "antd";
|
||||
import useSetPageTitle from "../../../../Hooks/useSetPageTitle";
|
||||
import PageHeader from "../../../../Layout/Dashboard/PageHeader";
|
||||
import FilterLayout from "../../../../Layout/Dashboard/FilterLayout";
|
||||
import FilterForm from "./Model/FilterForm";
|
||||
import StudentInfoCard from "../../../../Components/student/StudentInfoCard";
|
||||
import StudentAddressCard from "../../../../Components/student/AddressCard";
|
||||
import { studentParamInfo } from "../../../../Components/student/StudentParam";
|
||||
import StudentTabs from "./StudentTabs";
|
||||
|
||||
const TableHeader = () => {
|
||||
const [t] = useTranslation();
|
||||
useSetPageTitle(
|
||||
t(`page_header.users`) +
|
||||
"/ " +
|
||||
t(`PageTitle.students`)
|
||||
+
|
||||
" / " +
|
||||
t(`PageTitle.students_details`),
|
||||
);
|
||||
return (
|
||||
<div className="TableWithHeader single_student">
|
||||
<Suspense fallback={<Spin />}>
|
||||
<PageHeader
|
||||
pageTitle="users"
|
||||
/>
|
||||
<div className="single_student_body">
|
||||
<div className="student_info">
|
||||
<StudentInfoCard data={studentParamInfo} name={"moaz dawalibi"} status={"subs"}/>
|
||||
<StudentAddressCard address={"adawi tjara dar alshfaa askn akan an aksn akn"} />
|
||||
</div>
|
||||
<div className="student_table">
|
||||
<StudentTabs/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableHeader;
|
||||
61
src/Pages/Admin/Reseller/show/StudentTabs.tsx
Normal file
61
src/Pages/Admin/Reseller/show/StudentTabs.tsx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { useTranslation } from 'react-i18next';
|
||||
import { Tabs } from 'antd';
|
||||
import type { TabsProps } from 'antd';
|
||||
import FilterLayout from '../../../../Layout/Dashboard/FilterLayout';
|
||||
import FilterForm from './Model/FilterForm';
|
||||
import { lazy } from 'react';
|
||||
import { BsQuestionSquare } from "react-icons/bs";
|
||||
import { IoStatsChartOutline } from "react-icons/io5";
|
||||
import { useGetAllUser } from '../../../../api/user';
|
||||
import useSearchQuery from '../../../../api/utils/useSearchQuery';
|
||||
import { useFilterState } from '../../../../Components/Utils/Filter/FilterState';
|
||||
|
||||
const Table = lazy(() => import("./Table"));
|
||||
|
||||
const StudentTabs = () => {
|
||||
const {t} = useTranslation();
|
||||
|
||||
const [searchQuery] = useSearchQuery("name");
|
||||
const { filterState } = useFilterState();
|
||||
const response = useGetAllUser({
|
||||
name: searchQuery,
|
||||
pagination: true,
|
||||
...filterState,
|
||||
});
|
||||
|
||||
const items: TabsProps['items'] = [
|
||||
{
|
||||
key: '1',
|
||||
label: t("practical.quiz"),
|
||||
icon:<BsQuestionSquare/>,
|
||||
children:
|
||||
<>
|
||||
<FilterLayout
|
||||
sub_children={<FilterForm />}
|
||||
filterTitle="sidebar.quiz"
|
||||
/>
|
||||
<Table response={response}/>
|
||||
</>,
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: t("practical.hightes_quiz"),
|
||||
icon:<IoStatsChartOutline/>,
|
||||
children:
|
||||
<>
|
||||
<FilterLayout
|
||||
sub_children={<FilterForm />}
|
||||
filterTitle="practical.hightes_quiz"
|
||||
/>
|
||||
<Table response={response}/>
|
||||
</>,
|
||||
},
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<Tabs defaultActiveKey="1" items={items} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default StudentTabs
|
||||
8
src/Pages/Admin/Reseller/show/Table.tsx
Normal file
8
src/Pages/Admin/Reseller/show/Table.tsx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import DataTable from "../../../../Layout/Dashboard/Table/DataTable";
|
||||
import { useColumns } from "./useTableColumns";
|
||||
const App = ({response}:{response:any}) => {
|
||||
|
||||
return <DataTable response={response} useColumns={useColumns} />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
9
src/Pages/Admin/Reseller/show/index.tsx
Normal file
9
src/Pages/Admin/Reseller/show/index.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { useColumns } from "./useTableColumns";
|
||||
import Table from "./Table";
|
||||
import { FaPlus } from "react-icons/fa";
|
||||
|
||||
export {
|
||||
Table,
|
||||
useColumns,
|
||||
FaPlus,
|
||||
};
|
||||
48
src/Pages/Admin/Reseller/show/useTableColumns.tsx
Normal file
48
src/Pages/Admin/Reseller/show/useTableColumns.tsx
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { TableColumnsType } from "antd";
|
||||
import { user } from "../../../../types/Item";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export const useColumns = () => {
|
||||
const [t] = useTranslation();
|
||||
|
||||
const columns: TableColumnsType<user> = [
|
||||
{
|
||||
title: t("columns.quiz_date"),
|
||||
dataIndex: "id",
|
||||
key: "id",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.subject"),
|
||||
dataIndex: "username",
|
||||
key: "username",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.quiz_address"),
|
||||
dataIndex: "phone_number",
|
||||
key: "phone_number",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.created_by"),
|
||||
dataIndex: "type",
|
||||
key: "type",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.creator_name"),
|
||||
dataIndex: "type",
|
||||
key: "type",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.quiz_status"),
|
||||
dataIndex: "type",
|
||||
key: "type",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
|
@ -11,6 +11,8 @@ import {
|
|||
canAddReSeller,
|
||||
canDeleteReSeller,
|
||||
canEditReSeller,
|
||||
canShowReSeller,
|
||||
canShowStudent,
|
||||
} from "../../../utils/hasAbilityFn";
|
||||
import ActionButtons from "../../../Components/Table/ActionButtons";
|
||||
import ColumnsImage from "../../../Components/Columns/ColumnsImage";
|
||||
|
|
@ -21,6 +23,10 @@ export const useColumns = () => {
|
|||
const { setObjectToEdit } = useObjectToEdit((state) => state);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handelShow = (record: ReSeller) => {
|
||||
navigate(`${record?.id}`);
|
||||
};
|
||||
|
||||
const handelDelete = (data: ReSeller) => {
|
||||
setObjectToEdit(data);
|
||||
handel_open_model(ModalEnum?.RE_SELLER_DELETE);
|
||||
|
|
@ -71,7 +77,9 @@ export const useColumns = () => {
|
|||
<ActionButtons
|
||||
canDelete={canDeleteReSeller}
|
||||
canEdit={canEditReSeller}
|
||||
canShow={canShowReSeller}
|
||||
index={index}
|
||||
onShow={() => handelShow(record)}
|
||||
onDelete={() => handelDelete(record)}
|
||||
onEdit={() => handleEdit(record)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const StudentTabs = () => {
|
|||
const items: TabsProps['items'] = [
|
||||
{
|
||||
key: '1',
|
||||
label: <span>{t("practical.quiz")} </span>,
|
||||
label: t("practical.quiz"),
|
||||
icon:<BsQuestionSquare/>,
|
||||
children:
|
||||
<>
|
||||
|
|
@ -39,7 +39,7 @@ const StudentTabs = () => {
|
|||
},
|
||||
{
|
||||
key: '2',
|
||||
label: <span>{t("practical.hightes_quiz")} </span>,
|
||||
label: t("practical.hightes_quiz"),
|
||||
icon:<IoStatsChartOutline/>,
|
||||
children:
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ const Student = React.lazy(() => import("./Pages/Admin/Student/Page"));
|
|||
const ShowStudent = React.lazy(() => import("./Pages/Admin/Student/show/Page"));
|
||||
|
||||
const ReSeller = React.lazy(() => import("./Pages/Admin/Reseller/Page"));
|
||||
const ShowReSeller = React.lazy(() => import("./Pages/Admin/Reseller/show/Page"));
|
||||
const AddReSeller = React.lazy(() => import("./Pages/Admin/Reseller/Add/Page"));
|
||||
const EditReSeller = React.lazy(
|
||||
() => import("./Pages/Admin/Reseller/Edit/Page"),
|
||||
|
|
@ -211,6 +212,14 @@ export const CrudRoute: TCrudRoute[] = [
|
|||
abilities_value: ABILITIES_VALUES_ENUM.INDEX,
|
||||
prevPath: 0,
|
||||
},
|
||||
{
|
||||
header: "page_header.reSeller",
|
||||
element: <ShowReSeller />,
|
||||
path: `/${ABILITIES_ENUM?.RE_SELLER}/:id`,
|
||||
abilities: ABILITIES_ENUM?.RE_SELLER,
|
||||
abilities_value: ABILITIES_VALUES_ENUM.INDEX,
|
||||
prevPath: 0,
|
||||
},
|
||||
{
|
||||
header: "page_header.student",
|
||||
element: <ShowStudent />,
|
||||
|
|
|
|||
|
|
@ -13,11 +13,18 @@
|
|||
}
|
||||
|
||||
|
||||
.student_info_card{
|
||||
|
||||
|
||||
|
||||
.student_info_card,
|
||||
.student_address_card{
|
||||
width: 24vw;
|
||||
box-shadow: 2px 2px 8px 3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px;
|
||||
padding: 20px 15px ;
|
||||
p{
|
||||
color: #6A7287;
|
||||
}
|
||||
.student_info_card_header{
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
|
@ -43,18 +50,12 @@
|
|||
color: #202C4B;
|
||||
font-size: 20px;
|
||||
}
|
||||
p{
|
||||
color: #6A7287;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.student_address_card{
|
||||
width: 24vw;
|
||||
box-shadow: 2px 2px 8px 3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px;
|
||||
padding: 20px 15px ;
|
||||
margin-top: 30px;
|
||||
.student_address_card_body{
|
||||
display: flex;align-items: center;
|
||||
|
|
@ -66,14 +67,12 @@
|
|||
width: 40px;height: 40px;
|
||||
padding: 7px;
|
||||
}
|
||||
p{
|
||||
color: #6A7287;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@media screen and (max-width:1250px) {
|
||||
.single_student{
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@
|
|||
margin-left: 29px;
|
||||
}
|
||||
|
||||
/* Ant tabs nav list */
|
||||
.ant-tabs-nav .ant-tabs-nav-wrap .ant-tabs-nav-list {
|
||||
width: 100%;
|
||||
}
|
||||
// /* Ant tabs nav list */
|
||||
// .ant-tabs-nav .ant-tabs-nav-wrap .ant-tabs-nav-list {
|
||||
// width: 100%;
|
||||
// }
|
||||
|
||||
.ant-tabs > .ant-tabs-nav,
|
||||
.ant-tabs > div > .ant-tabs-nav {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user