Compare commits
2 Commits
4675311fce
...
40b0ef3ab2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40b0ef3ab2 | ||
|
|
5b304c8952 |
|
|
@ -34,10 +34,9 @@ const SideBar = ({
|
|||
return (
|
||||
<div className={isOpen ? "side_bar" : "side_bar side_bar_closed"}>
|
||||
<div className="side_bar_header">
|
||||
<img src={isOpen ? "/App/Logo.svg" : "/App/Logo.svg"} alt="" />
|
||||
<img src={"/App/Logo.svg"} alt="" />
|
||||
<HiMenuAlt3 onClick={toggleSidebar} />
|
||||
</div>
|
||||
{/* <Divider /> */}
|
||||
<HiMenuAlt2
|
||||
className="side_bar_close_menu"
|
||||
style={isOpen ? { display: "none" } : { display: "inline" }}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,24 @@ import { NotificationArray } from './NotificationArray';
|
|||
import { notifications } from '../../../types/Notifications';
|
||||
import Card from './Card';
|
||||
import TrashButton from '../../../Components/Ui/TrashButton';
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const Page = () => {
|
||||
const {t} = useTranslation();
|
||||
const [pop, setPop] = useState(NotificationArray)
|
||||
const [pop, setPop] = useState(NotificationArray);
|
||||
const [isEmpty, setIsEmpty] = useState(pop.length < 1 ? true : false);
|
||||
|
||||
const handleDeleteAll = () => {
|
||||
setPop([])
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
if(pop.length < 1){
|
||||
setIsEmpty(true);
|
||||
}else{
|
||||
setIsEmpty(false);
|
||||
}
|
||||
},[pop])
|
||||
return (
|
||||
<div className='notification_container'>
|
||||
<div className='notification_header'>
|
||||
|
|
@ -23,17 +31,26 @@ const Page = () => {
|
|||
name='delete_all'/>
|
||||
</div>
|
||||
<Divider/>
|
||||
<div className="notification_body">
|
||||
{pop?.map((not:notifications)=>(
|
||||
<Card
|
||||
id={not?.id}
|
||||
name={not?.name}
|
||||
date={not?.date}
|
||||
pop={pop}
|
||||
setPop={setPop}
|
||||
image={not?.image}/>
|
||||
))}
|
||||
</div>
|
||||
{
|
||||
isEmpty === false
|
||||
?
|
||||
<div className="notification_body">
|
||||
{pop?.map((not:notifications)=>(
|
||||
<Card
|
||||
id={not?.id}
|
||||
name={not?.name}
|
||||
date={not?.date}
|
||||
pop={pop}
|
||||
setPop={setPop}
|
||||
image={not?.image}/>
|
||||
))}
|
||||
</div>
|
||||
:
|
||||
<div className='notification_body_empty'>
|
||||
{t("practical.does_not_exist_notification")}
|
||||
</div>
|
||||
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,17 +5,20 @@ import LayoutModel from "../../../../../Layout/Dashboard/LayoutModel";
|
|||
import ModelForm from "./ModelForm";
|
||||
import { QueryStatusEnum } from "../../../../../enums/QueryStatus";
|
||||
import { useObjectToEdit } from "../../../../../zustand/ObjectToEditState";
|
||||
import { useUpdateReseller } from "../../../../../api/reseller";
|
||||
import { useUpdateReseller, useUpdateResellerCollection } from "../../../../../api/reseller";
|
||||
import { formatDate } from "../../../../../utils/formatDate";
|
||||
|
||||
const EditModel: React.FC = () => {
|
||||
const { mutate, status } = useUpdateReseller();
|
||||
const { mutate, status } = useUpdateResellerCollection();
|
||||
const { objectToEdit } = useObjectToEdit((state) => state);
|
||||
|
||||
const handleSubmit = (values: any) => {
|
||||
mutate({
|
||||
...values,
|
||||
date:formatDate(values?.date),
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutModel
|
||||
|
|
|
|||
|
|
@ -1,13 +1,23 @@
|
|||
import ValidationField from "../../../../../Components/ValidationField/ValidationField";
|
||||
import { Col, Row } from "reactstrap";
|
||||
import ValidationField from "../../../../../Components/ValidationField/ValidationField";
|
||||
|
||||
const FilterForm = () => {
|
||||
return (
|
||||
<div>
|
||||
<Row>
|
||||
<Col>
|
||||
<ValidationField placeholder="amount_value" label="amount_value" name="amount_value" />
|
||||
<ValidationField type="Date" placeholder="date_of_receipt" label="date_of_receipt" name="date_of_receipt" />
|
||||
<ValidationField
|
||||
placeholder="activation_date"
|
||||
label="activation_date"
|
||||
name="activation_date"
|
||||
type="Date"
|
||||
/>
|
||||
<ValidationField
|
||||
placeholder="expiration_date"
|
||||
label="expiration_date"
|
||||
name="expiration_date"
|
||||
type="Date"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
|
|
|||
19
src/Pages/Admin/Reseller/show/Model/FilterFormCollection.tsx
Normal file
19
src/Pages/Admin/Reseller/show/Model/FilterFormCollection.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Col, Row } from "reactstrap";
|
||||
import ValidationField from "../../../../../Components/ValidationField/ValidationField";
|
||||
|
||||
const FilterFormCollection = () => {
|
||||
|
||||
return (
|
||||
|
||||
<div>
|
||||
<Row>
|
||||
<Col>
|
||||
<ValidationField placeholder="description" label="description" name="description" />
|
||||
<ValidationField placeholder="amount" label="amount" name="amount" />
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default FilterFormCollection;
|
||||
|
|
@ -5,9 +5,9 @@ const Form = () => {
|
|||
return (
|
||||
<Row className="w-100">
|
||||
<Col>
|
||||
<ValidationField placeholder="amount_value" label="amount_value" name="amount_value" />
|
||||
<ValidationField type="Date" placeholder="date_of_receipt" label="date_of_receipt" name="date_of_receipt" />
|
||||
<ValidationField placeholder="description" label="description" name="description" />
|
||||
<ValidationField placeholder="amount" label="amount" name="amount" />
|
||||
<ValidationField type="Date" placeholder="date" label="date" name="date" />
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,22 @@
|
|||
import dayjs from "dayjs";
|
||||
import * as Yup from "yup";
|
||||
export const getInitialValues = (objectToEdit: any): any => {
|
||||
console.log(objectToEdit?.date);
|
||||
|
||||
return {
|
||||
id: objectToEdit?.id ?? null,
|
||||
amount_value: objectToEdit?.amount_value ?? null,
|
||||
amount: objectToEdit?.amount ?? null,
|
||||
description: objectToEdit?.description ?? null,
|
||||
date_of_receipt: objectToEdit?.date_of_receipt ?? null,
|
||||
date: objectToEdit?.date ? dayjs(objectToEdit.date) : null,
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
export const getValidationSchema = () => {
|
||||
return Yup.object().shape({
|
||||
amount_value: Yup.string().required("validation.required"),
|
||||
amount: Yup.string().required("validation.required"),
|
||||
description: Yup.string().required("validation.required"),
|
||||
date_of_receipt: Yup.string().required("validation.required"),
|
||||
date: Yup.string().required("validation.required"),
|
||||
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { useParams } from "react-router-dom";
|
|||
import { ParamsEnum } from "../../../../enums/params";
|
||||
import AttachmentsCard from "../../../../Components/Cards/AttachmentsCard";
|
||||
import { ModalEnum } from "../../../../enums/Model";
|
||||
import { useDeleteReseller } from "../../../../api/reseller";
|
||||
import { useDeleteReseller, useDeleteResellerCollection } from "../../../../api/reseller";
|
||||
import { useObjectToEdit } from "../../../../zustand/ObjectToEditState";
|
||||
import useModalHandler from "../../../../utils/useModalHandler";
|
||||
const DeleteModalForm = lazy(
|
||||
|
|
@ -21,12 +21,12 @@ const DeleteModalForm = lazy(
|
|||
|
||||
const TableHeader = () => {
|
||||
const [t] = useTranslation();
|
||||
const { re_seller_id } = useParams<ParamsEnum>()
|
||||
const { reseller_id } = useParams<ParamsEnum>()
|
||||
|
||||
useSetPageTitle([
|
||||
{ name: `${t(`page_header.home`)}`, path: "/" },
|
||||
{ name: `${t(`page_header.reseller`)}`, path: "reseller" },
|
||||
{ name: `${t(`page_header.reseller_details`)}`, path: `reseller/${re_seller_id}` },
|
||||
{ name: `${t(`page_header.reseller_details`)}`, path: `reseller/${reseller_id}` },
|
||||
]);
|
||||
const { handel_open_model } = useModalHandler();
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ const TableHeader = () => {
|
|||
handel_open_model(ModalEnum?.RE_SELLER_COLLECTION_ADD);
|
||||
}
|
||||
|
||||
const deleteMutation = useDeleteReseller();
|
||||
const deleteMutation = useDeleteResellerCollection();
|
||||
return (
|
||||
<div className="TableWithHeader single_student">
|
||||
<Suspense fallback={<Spin />}>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ import { lazy } from 'react';
|
|||
import { FaMoneyBills } from "react-icons/fa6";
|
||||
import useSearchQuery from '../../../../api/utils/useSearchQuery';
|
||||
import { useFilterState } from '../../../../Components/Utils/Filter/FilterState';
|
||||
import { useGetAllReseller } from '../../../../api/reseller';
|
||||
import { useGetAllReseller, useGetAllResellerCollection, useGetAllResellerSales } from '../../../../api/reseller';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { ParamsEnum } from '../../../../enums/params';
|
||||
import FilterFormCollection from './Model/FilterFormCollection';
|
||||
|
||||
const Table = lazy(() => import("./Table"));
|
||||
|
||||
|
|
@ -16,11 +19,21 @@ const ReSellerTabs = () => {
|
|||
|
||||
const [searchQuery] = useSearchQuery("name");
|
||||
const { filterState } = useFilterState();
|
||||
const response = useGetAllReseller({
|
||||
const {reseller_id} = useParams<ParamsEnum>();
|
||||
|
||||
const response = useGetAllResellerSales({
|
||||
name: searchQuery,
|
||||
pagination: true,
|
||||
...filterState,
|
||||
});
|
||||
reseller_id:reseller_id,
|
||||
});
|
||||
|
||||
const responseCollection = useGetAllResellerCollection({
|
||||
name: searchQuery,
|
||||
pagination: true,
|
||||
...filterState,
|
||||
reseller_id:reseller_id,
|
||||
});
|
||||
|
||||
const items: TabsProps['items'] = [
|
||||
{
|
||||
|
|
@ -43,10 +56,10 @@ const ReSellerTabs = () => {
|
|||
children:
|
||||
<>
|
||||
<FilterLayout
|
||||
sub_children={<FilterForm />}
|
||||
sub_children={<FilterFormCollection />}
|
||||
filterTitle="practical.collections"
|
||||
/>
|
||||
<Table response={response}/>
|
||||
<Table response={responseCollection}/>
|
||||
</>,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -8,32 +8,40 @@ export const useColumns = () => {
|
|||
const columns: TableColumnsType<ReSeller> = [
|
||||
{
|
||||
title: t("columns.student_full_name"),
|
||||
dataIndex: "student_full_name",
|
||||
key: "student_full_name",
|
||||
align: "center",
|
||||
render: (row) => {
|
||||
console.log(row);
|
||||
|
||||
return row?.student?.first_name +" "+ row?.student?.last_name;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t("columns.grade"),
|
||||
dataIndex: "grade",
|
||||
key: "grade",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.package"),
|
||||
dataIndex: "package",
|
||||
render: (row) => {
|
||||
return row?.package?.name;
|
||||
},
|
||||
key: "package",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.amount_paid"),
|
||||
dataIndex: "amount_paid",
|
||||
key: "amount_paid",
|
||||
title: t("columns.paid_price"),
|
||||
render: (row) => {
|
||||
return row?.package?.price;
|
||||
},
|
||||
key: "price",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.sale_date"),
|
||||
dataIndex: "sale_date",
|
||||
key: "sale_date",
|
||||
title: t("columns.activation_date"),
|
||||
dataIndex: "activation_date",
|
||||
key: "activation_date",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.expiration_date"),
|
||||
dataIndex: "expiration_date",
|
||||
key: "expiration_date",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -29,18 +29,6 @@ export const useColumnsCollection = () => {
|
|||
key: "ID",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.amount"),
|
||||
dataIndex: "amount",
|
||||
key: "amount",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.date_of_receipt"),
|
||||
dataIndex: "date_of_receipt",
|
||||
key: "date_of_receipt",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.description"),
|
||||
dataIndex: "description",
|
||||
|
|
@ -48,15 +36,15 @@ export const useColumnsCollection = () => {
|
|||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.residual"),
|
||||
dataIndex: "residual",
|
||||
key: "residual",
|
||||
title: t("columns.amount"),
|
||||
dataIndex: "amount",
|
||||
key: "amount",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: t("columns.procedure"),
|
||||
dataIndex: "procedure",
|
||||
key: "procedure",
|
||||
title: t("columns.date"),
|
||||
dataIndex: "date",
|
||||
key: "date",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import React from 'react'
|
||||
import DataTable from '../../../../Layout/Dashboard/Table/DataTable'
|
||||
import { useColumns } from './useTableColumns'
|
||||
import { useFormikContext } from 'formik'
|
||||
|
|
@ -15,14 +14,14 @@ const FormTable = ({response,...props}:IFormTable) => {
|
|||
<div>
|
||||
|
||||
<DataTable
|
||||
response={response}
|
||||
useColumns={useColumns}
|
||||
dataSource={values}
|
||||
pagination={false}
|
||||
loading={false}
|
||||
rowKey={"name"}
|
||||
{...props}
|
||||
/>
|
||||
response={response}
|
||||
useColumns={useColumns}
|
||||
dataSource={values}
|
||||
pagination={false}
|
||||
loading={false}
|
||||
rowKey={"name"}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@ import type { TabsProps } from 'antd';
|
|||
import { Tabs } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useWindowResize } from '../../../../Hooks/useWindowResize';
|
||||
const FileSetting = lazy(() => import("./FileSetting"));
|
||||
const SecuritySetting = lazy(() => import("./SecuritySetting"));
|
||||
const Notification = lazy(() => import("./Notification"));
|
||||
|
||||
import FileSetting from './FileSetting';
|
||||
import SecuritySetting from './SecuritySetting';
|
||||
import Notification from './Notification';
|
||||
type TabPosition = 'left' | 'right' | 'top' | 'bottom';
|
||||
|
||||
const SettingTabs: React.FC = () => {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export const useColumns = () => {
|
|||
const navigate = useNavigate();
|
||||
|
||||
const handelShow = (record: Student) => {
|
||||
navigate(`${record?.user_id}`);
|
||||
// navigate(`${record?.user_id}`);
|
||||
};
|
||||
|
||||
const handelDelete = (data: Student) => {
|
||||
|
|
@ -56,7 +56,6 @@ export const useColumns = () => {
|
|||
align: "center",
|
||||
render: (_text, record) => record?.last_name,
|
||||
ellipsis:true,
|
||||
|
||||
},
|
||||
{
|
||||
title: `${t("columns.sex")}`,
|
||||
|
|
@ -76,7 +75,7 @@ export const useColumns = () => {
|
|||
<ActionButtons
|
||||
canDelete={canDeleteStudent}
|
||||
canEdit={canEditStudent}
|
||||
canShow={canShowStudent}
|
||||
// canShow={canShowStudent}
|
||||
index={index}
|
||||
onDelete={() => handelDelete(record)}
|
||||
onEdit={() => handleEdit(record)}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.notification_body_empty{
|
||||
@include Flex;
|
||||
}
|
||||
|
||||
.notification_body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const BaseURL = "https://nerd-back.point-dev.net/api/";
|
||||
// export const BaseURL = "http://192.168.1.109:8000/api/";
|
||||
// export const BaseURL = "http://192.168.1.106:8000/api/";
|
||||
|
||||
export const HEADER_KEY = "X-Custom-Query-Key";
|
||||
|
|
|
|||
|
|
@ -8,14 +8,36 @@ const API = {
|
|||
ADD: "/reseller",
|
||||
DELETE: "/reseller",
|
||||
UPDATE: "/reseller",
|
||||
|
||||
GET_COLLECTION: "/financialCollection",
|
||||
Update_COLLECTION: "/financialCollection",
|
||||
DELETE_COLLECTION : "/financialCollection",
|
||||
|
||||
GET_SAlES: "/reseller/getStudentPackage",
|
||||
|
||||
};
|
||||
|
||||
const KEY = "reseller";
|
||||
const KEY_SALE = "reseller_sale";
|
||||
const KEY_COLLECTION = "reseller_collection";
|
||||
|
||||
export const useGetAllReseller = (params?: any, options?: any) =>
|
||||
useGetQuery(KEY, API.GET, params, options);
|
||||
export const useAddReseller = () => useAddMutation(KEY, API.ADD);
|
||||
export const useUpdateReseller = (params?: any) =>
|
||||
export const useUpdateReseller = () =>
|
||||
useUpdateMutation(KEY, API.GET);
|
||||
export const useDeleteReseller = (params?: any) =>
|
||||
export const useDeleteReseller = () =>
|
||||
useDeleteMutation(KEY, API.DELETE);
|
||||
|
||||
|
||||
export const useGetAllResellerCollection = (params?: any, options?: any) =>
|
||||
useGetQuery(KEY_COLLECTION, API.GET_COLLECTION, params, options);
|
||||
export const useUpdateResellerCollection = () =>
|
||||
useUpdateMutation(KEY_COLLECTION, API.Update_COLLECTION);
|
||||
export const useDeleteResellerCollection = () =>
|
||||
useDeleteMutation(KEY_COLLECTION, API.DELETE_COLLECTION);
|
||||
|
||||
|
||||
|
||||
export const useGetAllResellerSales = (params?: any, options?: any) =>
|
||||
useGetQuery(KEY_SALE, API.GET_SAlES, params, options);
|
||||
|
|
@ -11,11 +11,12 @@ export enum ParamsEnum {
|
|||
LESSON_ID = "lesson_id",
|
||||
QUESTION_ID = "question_id",
|
||||
CHILDREN_QUESTION_ID = "children_question_id",
|
||||
RE_SELLER_ID = "re_seller_id",
|
||||
RE_SELLER_ID = "reseller_id",
|
||||
ROLE_ID = "role_id",
|
||||
CITY_ID = "city_id",
|
||||
Collection_ID = "collection_id",
|
||||
Manager_ID = "manager_id",
|
||||
// RESELLER_ID = "reseller_id",
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,7 +325,8 @@
|
|||
"Hide":"اخفاء",
|
||||
"sale":"بيع",
|
||||
"financial_collection":"التحصيلات",
|
||||
"show_collection":"حصيلة"
|
||||
"show_collection":"حصيلة",
|
||||
"does_not_exist_notification":"عذرا لا يوجد إشعارات..."
|
||||
},
|
||||
"Table": {
|
||||
"header": "",
|
||||
|
|
|
|||
|
|
@ -2,5 +2,7 @@ export type notifications = {
|
|||
id:number,
|
||||
name:string,
|
||||
date:string,
|
||||
image:string
|
||||
image:string,
|
||||
setPop?:any,
|
||||
pop?:any,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user