fix filter gender, req and set new data when delete all filters, show date time with timestamp in doctors list, fix send data in home page list specialty, change data of params for request to doctors in doctors page
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import CloseOrangeModal from "@/components/icons/CloseOrangeModal";
|
||||
import { Button, CircularProgress } from "@mui/material";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { clearFilterParams } from "@/helper";
|
||||
import { useState } from "react";
|
||||
|
||||
function DeleteAllButton({ filter, sendReq, setFilter, handleClose }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
const resetFilter = () => {
|
||||
setLoading(true);
|
||||
clearFilterParams(router, [
|
||||
"category",
|
||||
"specialty",
|
||||
"active",
|
||||
"gender",
|
||||
"degree",
|
||||
]);
|
||||
|
||||
const newFilter = {
|
||||
...filter,
|
||||
...{
|
||||
category: undefined,
|
||||
specialty: undefined,
|
||||
active: 0,
|
||||
gender: "هر دو",
|
||||
degree: "همه موارد",
|
||||
},
|
||||
};
|
||||
sendReq(newFilter).finally(() => {
|
||||
setLoading(false);
|
||||
handleClose();
|
||||
setFilter(newFilter);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">فیلترها</p>
|
||||
<Button
|
||||
variant="text"
|
||||
disabled={loading}
|
||||
onClick={resetFilter}
|
||||
className="cursor-pointer !py-0 !px-2 flex items-center justify-center gap-1"
|
||||
>
|
||||
{loading ? (
|
||||
<CircularProgress className="!max-w-[17px] !max-h-[17px] !w-[17px] !h-[17px] !text-[#F17732]" />
|
||||
) : (
|
||||
<CloseOrangeModal />
|
||||
)}
|
||||
<p className="text-[#F17732] text-[14px] font-normal">حذف همه</p>
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DeleteAllButton;
|
||||
@@ -1,13 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import CloseOrangeModal from "@/components/icons/CloseOrangeModal";
|
||||
import { styleDefault } from "@/mui";
|
||||
import { Button, Modal } from "@mui/material";
|
||||
import { Modal } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import Content from "./Content";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { clearFilterParams } from "@/helper";
|
||||
import ButtonApply from "./ButtonApply";
|
||||
import DeleteAllButton from "./DeleteAllButton";
|
||||
|
||||
function FilterModal({
|
||||
filter,
|
||||
@@ -17,7 +15,6 @@ function FilterModal({
|
||||
updateData,
|
||||
setDataInURL,
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const handleOpen = () => setOpen(true);
|
||||
@@ -25,30 +22,6 @@ function FilterModal({
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const resetFilter = () => {
|
||||
clearFilterParams(router, [
|
||||
"category",
|
||||
"specialty",
|
||||
"active",
|
||||
"gender",
|
||||
"degree",
|
||||
]);
|
||||
|
||||
const newFilter = {
|
||||
category: undefined,
|
||||
specialty: undefined,
|
||||
active: 0,
|
||||
gender: "هر دو",
|
||||
degree: "همه موارد",
|
||||
};
|
||||
setFilter({
|
||||
...filter,
|
||||
...newFilter,
|
||||
});
|
||||
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Button Modal */}
|
||||
@@ -62,19 +35,12 @@ function FilterModal({
|
||||
!w-full md:!w-fit !h-full md:!h-fit !flex !flex-col !justify-between !max-h-screen md:!max-h-[calc(100%_-_32px)]"
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">فیلترها</p>
|
||||
<Button
|
||||
className="cursor-pointer !p-0 flex items-center justify-center gap-1"
|
||||
onClick={resetFilter}
|
||||
variant="text"
|
||||
>
|
||||
<CloseOrangeModal />
|
||||
<p className="text-[#F17732] text-[14px] font-normal">
|
||||
حذف همه
|
||||
</p>
|
||||
</Button>
|
||||
</div>
|
||||
<DeleteAllButton
|
||||
filter={filter}
|
||||
sendReq={sendReq}
|
||||
setFilter={setFilter}
|
||||
handleClose={handleClose}
|
||||
/>
|
||||
<Content
|
||||
filter={filter}
|
||||
setFilter={setFilter}
|
||||
|
||||
Reference in New Issue
Block a user