fix area bug and some fixes
This commit is contained in:
parent
a9aa5cbcef
commit
b6acf12431
|
|
@ -45,6 +45,7 @@ const SearchFieldWithSelect: React.FC<Props> = ({
|
||||||
const toggleDropdown = () => {
|
const toggleDropdown = () => {
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const handleOptionClick = (option: Option) => {
|
const handleOptionClick = (option: Option) => {
|
||||||
setSelectedOption(option);
|
setSelectedOption(option);
|
||||||
|
|
@ -57,7 +58,7 @@ const SearchFieldWithSelect: React.FC<Props> = ({
|
||||||
const filteredOptions = options.filter((option) =>
|
const filteredOptions = options.filter((option) =>
|
||||||
option.label.toLowerCase().includes(searchTerm.toLowerCase()),
|
option.label.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||||
);
|
);
|
||||||
|
const Type = localStorage.getItem('type');
|
||||||
return (
|
return (
|
||||||
<div ref={node} className={`search-field ${isOpen ? "open" : ""}`}>
|
<div ref={node} className={`search-field ${isOpen ? "open" : ""}`}>
|
||||||
<div className="search-header" onClick={toggleDropdown}>
|
<div className="search-header" onClick={toggleDropdown}>
|
||||||
|
|
@ -75,16 +76,19 @@ const SearchFieldWithSelect: React.FC<Props> = ({
|
||||||
{(isOpen || (searchTerm !== "" && filteredOptions.length > 0)) && (
|
{(isOpen || (searchTerm !== "" && filteredOptions.length > 0)) && (
|
||||||
<div className="search-options">
|
<div className="search-options">
|
||||||
<div className="search-options-list">
|
<div className="search-options-list">
|
||||||
{filteredOptions.map((option) => (
|
{filteredOptions.map((option) => {
|
||||||
<div
|
console.log(option);
|
||||||
key={option.value}
|
return(
|
||||||
className="search-option"
|
<div
|
||||||
onClick={() => handleOptionClick(option)}
|
key={option.value}
|
||||||
>
|
className="search-option"
|
||||||
<div>{option.label}</div>
|
onClick={() => handleOptionClick(option)}
|
||||||
{/* {withIcon && <IoSearch className="search__icon" />} */}
|
>
|
||||||
</div>
|
<div>{option.label}</div>
|
||||||
))}
|
{/* {withIcon && <IoSearch className="search__icon" />} */}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ const TooltipComp = ({
|
||||||
const { handel_open_model } = useModalHandler();
|
const { handel_open_model } = useModalHandler();
|
||||||
|
|
||||||
const handleEdit = () => {
|
const handleEdit = () => {
|
||||||
handel_open_model(ModalEnum.CHANGE_PASSWORD);
|
// handel_open_model(ModalEnum.CHANGE_PASSWORD);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className={className} onClick={onClick}>
|
<div className={className} onClick={onClick}>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ const NavBar = ({ isOpen }: { isOpen: boolean }) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const PrevPath = getPrevPathRoute(location.pathname);
|
const PrevPath = getPrevPathRoute(location.pathname);
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
console.log(search_array);
|
||||||
|
|
||||||
const translateArray = translateOptions(search_array, t);
|
const translateArray = translateOptions(search_array, t);
|
||||||
|
|
||||||
const handelNavigate = () => {
|
const handelNavigate = () => {
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,12 @@ const TableHeader = ({canEdit,ModelAbility}:{canEdit?: any;ModelAbility?: any;})
|
||||||
const { objectToEdit , setObjectToEdit } = useObjectToEdit();
|
const { objectToEdit , setObjectToEdit } = useObjectToEdit();
|
||||||
const {mutate, isSuccess,status} = useUpdateReseller();
|
const {mutate, isSuccess,status} = useUpdateReseller();
|
||||||
const Navigate = useNavigate()
|
const Navigate = useNavigate()
|
||||||
console.log(objectToEdit);
|
|
||||||
|
|
||||||
useSetPageTitle(t(`page_header.add_reseller`));
|
useSetPageTitle(t(`page_header.add_reseller`));
|
||||||
|
|
||||||
const handleSubmit = (values: any) => {
|
const handleSubmit = (values: any) => {
|
||||||
|
console.log(values);
|
||||||
|
|
||||||
const DataToSend = {
|
const DataToSend = {
|
||||||
...values,
|
...values,
|
||||||
location: {
|
location: {
|
||||||
|
|
@ -32,6 +34,10 @@ const TableHeader = ({canEdit,ModelAbility}:{canEdit?: any;ModelAbility?: any;})
|
||||||
lng: values.lng,
|
lng: values.lng,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (values.username === objectToEdit?.user?.username) {
|
||||||
|
delete DataToSend.username;
|
||||||
|
}
|
||||||
mutate(DataToSend);
|
mutate(DataToSend);
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -66,9 +72,9 @@ const TableHeader = ({canEdit,ModelAbility}:{canEdit?: any;ModelAbility?: any;})
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
{t("practical.edit")} {t("models.reseller")}
|
{t("practical.edit")} {t("models.reseller")}
|
||||||
{status === QueryStatusEnum.LOADING && (
|
{status === QueryStatusEnum.LOADING && (
|
||||||
<span className="Spinier_Div">
|
<span className="Spinier_Div">
|
||||||
<Spin />
|
<Spin />
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@ import { useTranslation } from "react-i18next";
|
||||||
import { FaRegAddressBook } from "react-icons/fa";
|
import { FaRegAddressBook } from "react-icons/fa";
|
||||||
import ValidationField from "../../../../Components/ValidationField/ValidationField";
|
import ValidationField from "../../../../Components/ValidationField/ValidationField";
|
||||||
import { nationalities } from "../../../../types/App";
|
import { nationalities } from "../../../../types/App";
|
||||||
|
import { useGetAllArea } from "../../../../api/Area";
|
||||||
|
|
||||||
const TitleDetailsForm = () => {
|
const TitleDetailsForm = () => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
const {data} = useGetAllArea();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="TitleDetailsForm">
|
<div className="TitleDetailsForm">
|
||||||
<header className="header_form">
|
<header className="header_form">
|
||||||
|
|
@ -18,8 +20,8 @@ const TitleDetailsForm = () => {
|
||||||
name={"area_id"}
|
name={"area_id"}
|
||||||
placeholder={"_"}
|
placeholder={"_"}
|
||||||
label={"city"}
|
label={"city"}
|
||||||
// type="Select"
|
type="Select"
|
||||||
// option={nationalities}
|
option={data?.data}
|
||||||
/>
|
/>
|
||||||
{/* <ValidationField name={"address"} placeholder={"_"} label={"address"} /> */}
|
{/* <ValidationField name={"address"} placeholder={"_"} label={"address"} /> */}
|
||||||
</main>
|
</main>
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,14 @@ interface PersonalDetailsEditForm {
|
||||||
contact_number2: string | null;
|
contact_number2: string | null;
|
||||||
card_number: string | null;
|
card_number: string | null;
|
||||||
user: User;
|
user: User;
|
||||||
area_id: number | null;
|
area_id: any | null;
|
||||||
lat:number,
|
lat:number,
|
||||||
lng:number
|
lng:number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getInitialValues = (objectToEdit: Partial<PersonalDetailsForm>) => {
|
export const getInitialValues = (objectToEdit: Partial<PersonalDetailsForm>) => {
|
||||||
const location = objectToEdit?.location?.[0] || { lat: 33.5138, lng: 36.2765 };
|
const location = objectToEdit?.location?.[0] || { lat: 33.5138, lng: 36.2765 };
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: objectToEdit?.id ?? 0,
|
id: objectToEdit?.id ?? 0,
|
||||||
first_name: objectToEdit?.first_name ?? null,
|
first_name: objectToEdit?.first_name ?? null,
|
||||||
|
|
@ -71,14 +72,13 @@ export const getValidationSchema = () => {
|
||||||
contact_number1: Yup.string().required('contact_number1 is required'),
|
contact_number1: Yup.string().required('contact_number1 is required'),
|
||||||
contact_number2: Yup.string().required('contact_number2 is required'),
|
contact_number2: Yup.string().required('contact_number2 is required'),
|
||||||
username: Yup.string().required('username is required'),
|
username: Yup.string().required('username is required'),
|
||||||
area_id: Yup.number().required('area_id is required'),
|
area_id: Yup.mixed().required('area_id is required'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const getInitialValuesEdit = (objectToEdit: Partial<PersonalDetailsEditForm>) => {
|
export const getInitialValuesEdit = (objectToEdit: Partial<PersonalDetailsEditForm>) => {
|
||||||
const location = objectToEdit?.location || { lat: 0, lng: 0 };
|
const location = objectToEdit?.location || { lat: 0, lng: 0 };
|
||||||
console.log(objectToEdit);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: objectToEdit?.id ?? 0,
|
id: objectToEdit?.id ?? 0,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Row } from "reactstrap";
|
import { Row } from "reactstrap";
|
||||||
import React, { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useFormikContext } from "formik";
|
import { useFormikContext } from "formik";
|
||||||
import { FaCirclePlus } from "react-icons/fa6";
|
import { FaCirclePlus } from "react-icons/fa6";
|
||||||
import { Choice } from "../../../../../types/Item";
|
import { Choice } from "../../../../../types/Item";
|
||||||
|
|
@ -15,7 +15,7 @@ import useUnsavedChangesWarning from "../../../../../Hooks/useUnsavedChangesWarn
|
||||||
const Form = () => {
|
const Form = () => {
|
||||||
const formik = useFormikContext<any>();
|
const formik = useFormikContext<any>();
|
||||||
const { setSuccess, Success ,ShowHint} = useObjectToEdit();
|
const { setSuccess, Success ,ShowHint} = useObjectToEdit();
|
||||||
|
|
||||||
const handleAddChoice = (
|
const handleAddChoice = (
|
||||||
parent_index: number,
|
parent_index: number,
|
||||||
fromKeyCombination: boolean = false,
|
fromKeyCombination: boolean = false,
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ const TableHeader = () => {
|
||||||
if(objectToEdit){
|
if(objectToEdit){
|
||||||
setObjectToEdit(null)
|
setObjectToEdit(null)
|
||||||
}
|
}
|
||||||
}, [])
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="TableWithHeader">
|
<div className="TableWithHeader">
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ const LoginForm = () => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const handelSubmit = (values: FormValues) => {
|
const handelSubmit = (values: FormValues) => {
|
||||||
mutate(values);
|
mutate(values);
|
||||||
|
// localStorage.setItem('type',)
|
||||||
};
|
};
|
||||||
|
|
||||||
const { login } = useAuthState();
|
const { login } = useAuthState();
|
||||||
|
|
|
||||||
|
|
@ -428,14 +428,15 @@ export const AppRoutes: Record<string, string> = Object.fromEntries(
|
||||||
export const CrudRoutes: any = Object.fromEntries(
|
export const CrudRoutes: any = Object.fromEntries(
|
||||||
CrudRoute.map((route) => [route?.path, route?.header]),
|
CrudRoute.map((route) => [route?.path, route?.header]),
|
||||||
);
|
);
|
||||||
export const search_array: { label: string; value: string }[] = menuItems
|
export const search_array: { label: string; value: string; type: string }[] = menuItems
|
||||||
?.filter((item: TMenuItem) => {
|
?.filter((item: TMenuItem) => {
|
||||||
return hasAbility(item.abilities, item.abilities_value);
|
return hasAbility(item.abilities, item.abilities_value);
|
||||||
})
|
})
|
||||||
.map((item: TMenuItem) => ({
|
.map((item: TMenuItem) => ({
|
||||||
label: item.header as string,
|
label: item.header as string,
|
||||||
value: item.path as string,
|
value: item.path as string,
|
||||||
}));
|
type: item.type ? item.type : "admin",
|
||||||
|
}))
|
||||||
|
|
||||||
const AllRoute = [...menuItems, ...CrudRoute];
|
const AllRoute = [...menuItems, ...CrudRoute];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,10 @@
|
||||||
.search_select_icon.open {
|
.search_select_icon.open {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
|
.search-options{
|
||||||
|
border: 1px solid var(--value);
|
||||||
|
|
||||||
|
}
|
||||||
.search-options-list {
|
.search-options-list {
|
||||||
max-height: 220px;
|
max-height: 220px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
@ -82,11 +85,12 @@
|
||||||
direction: rtl;
|
direction: rtl;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
scroll-padding: 10rem;
|
scroll-padding: 10rem;
|
||||||
|
@include Scrollbar;
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 10px;
|
// background: var(--value);
|
||||||
|
// width: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle */
|
/* Handle */
|
||||||
&::-webkit-scrollbar-thumb {
|
&::-webkit-scrollbar-thumb {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
|
||||||
|
|
@ -1003,7 +1003,13 @@
|
||||||
"Area":"المنطقة",
|
"Area":"المنطقة",
|
||||||
"Coupon":"قسيمة",
|
"Coupon":"قسيمة",
|
||||||
"financial_collection":"التحصيلات",
|
"financial_collection":"التحصيلات",
|
||||||
"show_collection":"حصيلة"
|
"show_collection":"حصيلة",
|
||||||
|
"dashboard":"لوحة القيادة",
|
||||||
|
"reSeller":"البائعين",
|
||||||
|
"city":"مدينة",
|
||||||
|
"questionBank":"بنك الأسئلة",
|
||||||
|
"roles":"الدور",
|
||||||
|
"coupon":"قسيمة"
|
||||||
},
|
},
|
||||||
"table": {
|
"table": {
|
||||||
"student": "قائمة الطلاب",
|
"student": "قائمة الطلاب",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user