fixes
This commit is contained in:
parent
5f0624f20d
commit
e3c93c2330
|
|
@ -56,15 +56,36 @@ export const useColumns = () => {
|
|||
ellipsis:true
|
||||
},
|
||||
{
|
||||
title: t("columns.image"),
|
||||
dataIndex: "image",
|
||||
key: "image",
|
||||
title: `${t("columns.amount")}`,
|
||||
dataIndex: "amount",
|
||||
key: "amount",
|
||||
align: "center",
|
||||
render: (_text: any, record: Coupon) => {
|
||||
let str = record?.amount;
|
||||
|
||||
return <ColumnsImage src={str}/> ;
|
||||
},
|
||||
render: (_text, record) => record?.amount,
|
||||
ellipsis:true
|
||||
},
|
||||
{
|
||||
title: `${t("columns.code")}`,
|
||||
dataIndex: "code",
|
||||
key: "code",
|
||||
align: "center",
|
||||
render: (_text, record) => record?.code,
|
||||
ellipsis:true
|
||||
},
|
||||
{
|
||||
title: `${t("columns.due_to")}`,
|
||||
dataIndex: "due_to",
|
||||
key: "due_to",
|
||||
align: "center",
|
||||
render: (_text, record) => record?.due_to,
|
||||
// ellipsis:true
|
||||
},
|
||||
{
|
||||
title: `${t("columns.status")}`,
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
align: "center",
|
||||
render: (_text, record) => record?.status,
|
||||
ellipsis:true
|
||||
},
|
||||
{
|
||||
|
||||
|
|
@ -77,7 +98,7 @@ export const useColumns = () => {
|
|||
<ActionButtons
|
||||
canDelete={canDeleteCoupon}
|
||||
canEdit={canEditCoupon}
|
||||
canShow={canShowCoupon}
|
||||
// canShow={canShowCoupon}
|
||||
index={index}
|
||||
onDelete={() => handelDelete(record)}
|
||||
onEdit={() => handleEdit(record)}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,16 @@ import { Formik, Form } from "formik";
|
|||
import { getInitialValues, getValidationSchema } from "../Form/formUtils";
|
||||
import TitleDetailsForm from "../Form/TitleDetailsForm";
|
||||
import AttachmentForm from "../Form/AttachmentForm";
|
||||
import { useAddManager } from "../../../../api/manager";
|
||||
import { QueryStatusEnum } from "../../../../enums/QueryStatus";
|
||||
|
||||
const TableHeader = () => {
|
||||
const [t] = useTranslation();
|
||||
useSetPageTitle(t(`page_header.add_reseller`));
|
||||
const {mutate,status } = useAddManager();
|
||||
const handelSubmit = (values: any) => {
|
||||
console.log(values, "values");
|
||||
mutate({...values});
|
||||
};
|
||||
return (
|
||||
<div className="TableWithHeader">
|
||||
|
|
@ -38,7 +42,12 @@ const TableHeader = () => {
|
|||
<div className="resellerButton">
|
||||
<button type="button">{t("practical.cancel")}</button>
|
||||
<button type="submit">
|
||||
{t("practical.add")} {t("models.manager")}
|
||||
{t("practical.add")} {t("models.reseller")}
|
||||
{status === QueryStatusEnum.LOADING && (
|
||||
<span className="Spinier_Div">
|
||||
<Spin />
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,17 @@ import ValidationField from "../../../../Components/ValidationField/ValidationFi
|
|||
import { convert_data_to_select } from "../../../../Layout/app/Const";
|
||||
import { userTypeOptions } from "../../../../config/userTypeOptions";
|
||||
import { statusType } from "../../../../config/statusType";
|
||||
import { useGetRole } from "../../../../api/role";
|
||||
|
||||
const PersonalDetailsForm = () => {
|
||||
const [t] = useTranslation();
|
||||
const {data} = useGetRole();
|
||||
const RoleData = data?.data
|
||||
console.log(RoleData);
|
||||
const sex = [
|
||||
{ name: "male", id: "male" },
|
||||
{ name: "female", id: "female" },
|
||||
];
|
||||
return (
|
||||
<div className="PersonalDetailsForm">
|
||||
<header className="header_form">
|
||||
|
|
@ -23,7 +31,7 @@ const PersonalDetailsForm = () => {
|
|||
<ValidationField
|
||||
name={"last_name"}
|
||||
placeholder={"_"}
|
||||
type="Date"
|
||||
// type="Date"
|
||||
label={"last_name"}
|
||||
/>
|
||||
<ValidationField
|
||||
|
|
@ -38,6 +46,8 @@ const PersonalDetailsForm = () => {
|
|||
name={"sex"}
|
||||
placeholder={"_"}
|
||||
label={"sex"}
|
||||
type="Select"
|
||||
option={sex}
|
||||
/>
|
||||
<ValidationField
|
||||
name={"phone_number"}
|
||||
|
|
@ -49,24 +59,27 @@ const PersonalDetailsForm = () => {
|
|||
name={"email_address"}
|
||||
placeholder={"_"}
|
||||
label={"email_address"}
|
||||
type="email"
|
||||
/>
|
||||
|
||||
<ValidationField
|
||||
name={"birthday"}
|
||||
placeholder={"_"}
|
||||
label={"birthday"}
|
||||
type="Date"
|
||||
/>
|
||||
<ValidationField
|
||||
name={"join_date"}
|
||||
placeholder={"_"}
|
||||
label={"join_date"}
|
||||
type="text"
|
||||
type="Date"
|
||||
/>
|
||||
<ValidationField
|
||||
name={"role"}
|
||||
placeholder={"_"}
|
||||
label={"role"}
|
||||
type="text"
|
||||
type="Select"
|
||||
option={RoleData}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,21 @@
|
|||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FaRegAddressBook } from "react-icons/fa";
|
||||
import ValidationField from "../../../../Components/ValidationField/ValidationField";
|
||||
import { nationalities } from "../../../../types/App";
|
||||
import { useGetAllArea } from "../../../../api/Area";
|
||||
import { useGetAllCity } from "../../../../api/City";
|
||||
|
||||
const TitleDetailsForm = () => {
|
||||
const [t] = useTranslation();
|
||||
|
||||
const {data:city} = useGetAllCity();
|
||||
const [CityId, setCityId] = useState()
|
||||
console.log(city);
|
||||
|
||||
const {data} = useGetAllArea({
|
||||
city_id:CityId
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="TitleDetailsForm">
|
||||
<header className="header_form">
|
||||
|
|
@ -15,13 +24,23 @@ const TitleDetailsForm = () => {
|
|||
</header>
|
||||
<main className="main_form_body">
|
||||
<ValidationField
|
||||
name={"city_id"}
|
||||
name={"city"}
|
||||
placeholder={"_"}
|
||||
label={"city"}
|
||||
type="Select"
|
||||
option={nationalities}
|
||||
option={city?.data}
|
||||
onChange={(e)=>setCityId(e)}
|
||||
/>
|
||||
<ValidationField name={"address"} placeholder={"_"} label={"address"} />
|
||||
<ValidationField
|
||||
name={"area_id"}
|
||||
placeholder={"_"}
|
||||
label={"city"}
|
||||
type="Select"
|
||||
disabled={!CityId}
|
||||
option={data?.data}
|
||||
|
||||
/>
|
||||
{/* <ValidationField name={"address"} placeholder={"_"} label={"address"} /> */}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ const FilterForm = () => {
|
|||
const GradeOption = Grade?.data ?? []
|
||||
const canChangeGradePage = !!Grade?.links?.next;
|
||||
const GradePage = Grade?.meta?.current_page;
|
||||
console.log(Grade?.meta?.current_page);
|
||||
|
||||
|
||||
/// subject_id
|
||||
|
|
@ -68,7 +67,6 @@ const FilterForm = () => {
|
|||
page: TagCurrentPage
|
||||
});
|
||||
|
||||
console.log(Tag);
|
||||
|
||||
const TagOption = Tag?.data ?? []
|
||||
const canChangeTagPage = !!Tag?.links?.next;
|
||||
|
|
@ -92,7 +90,6 @@ const FilterForm = () => {
|
|||
canChangePage={canChangeGradePage}
|
||||
PageName={"GradeCurrentPage"}
|
||||
page={GradePage}
|
||||
|
||||
|
||||
/>
|
||||
|
||||
|
|
@ -111,7 +108,6 @@ const FilterForm = () => {
|
|||
canChangePage={canChangeSubjectPage}
|
||||
PageName={"SubjectCurrentPage"}
|
||||
page={SubjectPage}
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,69 +54,6 @@ const PersonalDetailsForm = ({isEdit}:{isEdit?:boolean}) => {
|
|||
placeholder={"_"}
|
||||
label={"ID Number"}
|
||||
/>
|
||||
{/* <ValidationField
|
||||
name={"location_lat"}
|
||||
placeholder={"_"}
|
||||
label={"lat"}
|
||||
/>
|
||||
<ValidationField
|
||||
name={"location_lng"}
|
||||
placeholder={"_"}
|
||||
label={"lng"}
|
||||
/> */}
|
||||
{/* <ValidationField
|
||||
name={"id_number"}
|
||||
placeholder={"_"}
|
||||
label={"ID Number"}
|
||||
/>
|
||||
<ValidationField
|
||||
name={"addition_date"}
|
||||
placeholder={"_"}
|
||||
type="Date"
|
||||
label={"Addition Date"}
|
||||
/>
|
||||
<ValidationField
|
||||
name={"status"}
|
||||
placeholder={"_"}
|
||||
label={"Status"}
|
||||
type="Select"
|
||||
option={statusType}
|
||||
/>
|
||||
|
||||
<ValidationField
|
||||
name={"full_name"}
|
||||
placeholder={"_"}
|
||||
label={"Full Name"}
|
||||
/>
|
||||
<ValidationField
|
||||
name={"phone_number"}
|
||||
placeholder={"_"}
|
||||
label={"Phone Number"}
|
||||
type="text"
|
||||
/>
|
||||
<ValidationField
|
||||
name={"mobile_number"}
|
||||
placeholder={"_"}
|
||||
label={"Mobile Number"}
|
||||
/>
|
||||
|
||||
<ValidationField
|
||||
name={"username"}
|
||||
placeholder={"_"}
|
||||
label={"Username"}
|
||||
/>
|
||||
<ValidationField
|
||||
name={"password"}
|
||||
placeholder={"_"}
|
||||
label={"Password"}
|
||||
type="text"
|
||||
/>
|
||||
<ValidationField
|
||||
name={"seller_percentage"}
|
||||
placeholder={"_"}
|
||||
label={"Seller Percentage"}
|
||||
type="text"
|
||||
/> */}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import React, { useState } from "react";
|
|||
import { useTranslation } from "react-i18next";
|
||||
import { FaRegAddressBook } from "react-icons/fa";
|
||||
import ValidationField from "../../../../Components/ValidationField/ValidationField";
|
||||
import { nationalities } from "../../../../types/App";
|
||||
import { useGetAllArea } from "../../../../api/Area";
|
||||
import { useGetAllCity } from "../../../../api/City";
|
||||
|
||||
|
|
@ -10,7 +9,7 @@ const TitleDetailsForm = () => {
|
|||
const [t] = useTranslation();
|
||||
const {data:city} = useGetAllCity();
|
||||
const [CityId, setCityId] = useState()
|
||||
|
||||
|
||||
const {data} = useGetAllArea({
|
||||
city_id:CityId
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ const App = ({salesTable = false ,response}:{salesTable?:boolean,response:any})
|
|||
} else {
|
||||
return <DataTable response={response} useColumns={useColumnsCollection} />;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { TableColumnsType } from "antd";
|
||||
import { user } from "../../../../types/Item";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ReSeller } from "../../../../types/ReSeller";
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ const EditModel: React.FC = () => {
|
|||
const { objectToEdit } = useObjectToEdit((state) => state);
|
||||
|
||||
const handleSubmit = (values: any) => {
|
||||
const Data_to_send = { ...values };
|
||||
const Data_to_send = { ...values, grade_id:values.grade_id?.id};
|
||||
mutate(Data_to_send);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutModel
|
||||
|
|
|
|||
|
|
@ -46,27 +46,30 @@ const Form = ({ isEdit = false }: { isEdit?: boolean }) => {
|
|||
placeholder="password"
|
||||
label="password"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Col>
|
||||
<Col>
|
||||
{!isEdit && (
|
||||
<>
|
||||
<ValidationField
|
||||
name="phone_number"
|
||||
placeholder="contact_number1"
|
||||
label="contact_number1"
|
||||
/>
|
||||
|
||||
</>
|
||||
<ValidationField
|
||||
searchBy="GradeName"
|
||||
name="grade_id"
|
||||
label="grade"
|
||||
type="Search"
|
||||
option={GradeOption}
|
||||
isLoading={isLoadingGrade}
|
||||
canChangePage={canChangeGradePage}
|
||||
PageName={"GradeCurrentPage"}
|
||||
page={GradePage}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Col>
|
||||
<Col>
|
||||
<ValidationField
|
||||
searchBy="GradeName"
|
||||
name="grade_id"
|
||||
label="grade"
|
||||
type="Search"
|
||||
option={GradeOption}
|
||||
isLoading={isLoadingGrade}
|
||||
canChangePage={canChangeGradePage}
|
||||
PageName={"GradeCurrentPage"}
|
||||
page={GradePage}
|
||||
/>
|
||||
<ValidationField type="Select" name="sex" option={sex} />
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
import { Col, Row } from "reactstrap";
|
||||
import ValidationField from "../../../../Components/ValidationField/ValidationField";
|
||||
import { useGetAllGrade } from "../../../../api/grade";
|
||||
import { useValidationValidationParamState } from "../../../../Components/ValidationField/state/ValidationValidationParamState";
|
||||
import { useObjectToEdit } from "../../../../zustand/ObjectToEditState";
|
||||
|
||||
const Form = ({ isEdit = false }: { isEdit?: boolean }) => {
|
||||
const { ValidationParamState } = useValidationValidationParamState();
|
||||
const { GradeName, GradeCurrentPage } = ValidationParamState;
|
||||
|
||||
const { data: Grade, isLoading: isLoadingGrade } = useGetAllGrade({
|
||||
name: GradeName,
|
||||
page: GradeCurrentPage,
|
||||
});
|
||||
const { objectToEdit } = useObjectToEdit((state) => state);
|
||||
const GradeOption = Grade?.data ?? [];
|
||||
const canChangeGradePage = !!Grade?.links?.next;
|
||||
const GradePage = Grade?.meta?.current_page;
|
||||
|
||||
const sex = [
|
||||
{ name: "male", id: "male" },
|
||||
{ name: "female", id: "female" },
|
||||
];
|
||||
console.log(objectToEdit);
|
||||
const GradeValue = GradeOption?.find((e:any) => e.id === objectToEdit?.grade_id)
|
||||
|
||||
return (
|
||||
<Row className="w-100">
|
||||
<Col>
|
||||
<ValidationField
|
||||
name="first_name"
|
||||
placeholder="first_name"
|
||||
label="first_name"
|
||||
/>
|
||||
<ValidationField
|
||||
name="last_name"
|
||||
placeholder="last_name"
|
||||
label="last_name"
|
||||
/>
|
||||
</Col>
|
||||
<Col>
|
||||
<ValidationField
|
||||
searchBy="GradeName"
|
||||
name="grade_id"
|
||||
label="grade"
|
||||
type="Search"
|
||||
option={GradeOption}
|
||||
isLoading={isLoadingGrade}
|
||||
canChangePage={canChangeGradePage}
|
||||
PageName={"GradeCurrentPage"}
|
||||
page={GradePage}
|
||||
value={GradeValue?.name}
|
||||
/>
|
||||
<ValidationField type="Select" name="sex" option={sex} />
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
};
|
||||
|
||||
export default Form;
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
import * as Yup from "yup";
|
||||
import { Student, StudentInitialValues } from "../../../../types/Student";
|
||||
import { useGetAllGrade } from "../../../../api/grade";
|
||||
|
||||
export const getInitialValues = (
|
||||
objectToEdit: Partial<Student>,
|
||||
): StudentInitialValues => {
|
||||
console.log(objectToEdit);
|
||||
|
||||
return {
|
||||
id: objectToEdit?.user_id,
|
||||
first_name: objectToEdit?.first_name ?? "",
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ export const useColumns = () => {
|
|||
key: "first_name",
|
||||
align: "center",
|
||||
render: (_text, record) => record?.first_name,
|
||||
ellipsis:true,
|
||||
},
|
||||
{
|
||||
title: `${t("columns.last_name")}`,
|
||||
|
|
@ -54,6 +55,8 @@ export const useColumns = () => {
|
|||
key: "last_name",
|
||||
align: "center",
|
||||
render: (_text, record) => record?.last_name,
|
||||
ellipsis:true,
|
||||
|
||||
},
|
||||
{
|
||||
title: `${t("columns.sex")}`,
|
||||
|
|
|
|||
|
|
@ -241,7 +241,9 @@
|
|||
"show":"عرض",
|
||||
"paid_price":"المبلغ المدفوع",
|
||||
"unit":"الوحدة",
|
||||
"lesson":"الدرس"
|
||||
"lesson":"الدرس",
|
||||
"code":"رمز",
|
||||
"due_to":"صالح الى"
|
||||
},
|
||||
"practical": {
|
||||
"to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال",
|
||||
|
|
|
|||
|
|
@ -17,5 +17,6 @@ export type Coupon = {
|
|||
due_to: string; // URL of the user's amount
|
||||
code: string; // URL of the user's amount
|
||||
grade: string; // URL of the user's amount
|
||||
status:string;
|
||||
};
|
||||
export type CouponInitialValues = Partial<Nullable<InitialValues>>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user