change format all file
This commit is contained in:
@@ -18,14 +18,17 @@ function DoctorsPage({ params, matchedCity, matchedState }) {
|
||||
province: matchedState?.name || params?.province,
|
||||
city: matchedCity?.name || params?.city,
|
||||
});
|
||||
const findItem = (name, value) => specialties.find(item => item[name] === value)
|
||||
const itemCategory = findItem('id', params.category);
|
||||
const itemSpecialties = findItem('id', params.specialties);
|
||||
const findItem = (name, value) =>
|
||||
specialties.find((item) => item[name] === value);
|
||||
const itemCategory = findItem("id", params.category);
|
||||
const itemSpecialties = findItem("id", params.specialties);
|
||||
|
||||
const [data, setData] = useState({
|
||||
category: itemCategory || "",
|
||||
specialties: itemSpecialties ? { ...itemSpecialties, label: itemSpecialties.name } : "",
|
||||
turn: params && params.hasOwnProperty('turn') ? JSON.parse(params.turn) : 1,
|
||||
specialties: itemSpecialties
|
||||
? { ...itemSpecialties, label: itemSpecialties.name }
|
||||
: "",
|
||||
turn: params && params.hasOwnProperty("turn") ? JSON.parse(params.turn) : 1,
|
||||
gender: params.gender || "هر دو",
|
||||
degree: params.degree || "متخصص",
|
||||
});
|
||||
|
||||
@@ -6,7 +6,6 @@ import { filterList } from "@/helper";
|
||||
const group1 = ["خانم", "آقا", "هر دو"];
|
||||
const group2 = ["فوق تخصص", "دکترای تخصصی", "متخصص", "دکتری"];
|
||||
|
||||
|
||||
function Content({ data, setData }) {
|
||||
const router = useRouter();
|
||||
const { parentList, childrenList } = filterList(data);
|
||||
@@ -15,21 +14,21 @@ function Content({ data, setData }) {
|
||||
const current = new URLSearchParams(window.location.search);
|
||||
current.set(name, value.id || value);
|
||||
if (removeSpecialties) {
|
||||
current.delete('specialties')
|
||||
};
|
||||
current.delete("specialties");
|
||||
}
|
||||
const queryString = current.toString();
|
||||
router.push(`/doctors?${queryString}`)
|
||||
}
|
||||
router.push(`/doctors?${queryString}`);
|
||||
};
|
||||
|
||||
const changeData = (value, name, removeSpecialties) => {
|
||||
changeUrl(value, name, removeSpecialties);
|
||||
const newData = data;
|
||||
newData[name] = value;
|
||||
if (removeSpecialties) {
|
||||
newData.specialties = ''
|
||||
};
|
||||
newData.specialties = "";
|
||||
}
|
||||
setData(newData);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-[50px] px-[0px] md:px-[19px] lg:px-[38px] mb-[32px]">
|
||||
@@ -59,7 +58,7 @@ function Content({ data, setData }) {
|
||||
value={data.gender}
|
||||
text="جنسیت پزشک"
|
||||
group={group1}
|
||||
name='gender'
|
||||
name="gender"
|
||||
/>
|
||||
<span className="block mt-[16px] mb-[24px] w-full h-px bg-[#EFEFEF]"></span>
|
||||
<RadioContent
|
||||
@@ -67,7 +66,7 @@ function Content({ data, setData }) {
|
||||
value={data.degree}
|
||||
text="درجه علمی"
|
||||
group={group2}
|
||||
name='degree'
|
||||
name="degree"
|
||||
/>
|
||||
<span className="block mt-[16px] mb-[24px] w-full h-px bg-[#EFEFEF]"></span>
|
||||
<div className="flex items-center justify-start gap-[12px]">
|
||||
@@ -76,7 +75,7 @@ function Content({ data, setData }) {
|
||||
<Switch
|
||||
checked={data.turn}
|
||||
onChange={(event) => {
|
||||
changeData(event.target.checked ? 1 : 0, "turn")
|
||||
changeData(event.target.checked ? 1 : 0, "turn");
|
||||
}}
|
||||
/>
|
||||
}
|
||||
@@ -86,7 +85,7 @@ function Content({ data, setData }) {
|
||||
fontSize: "16px",
|
||||
fontWeight: 500,
|
||||
},
|
||||
marginLeft: '0 !important',
|
||||
marginLeft: "0 !important",
|
||||
}}
|
||||
label="فقط پزشکان دارای نوبت"
|
||||
labelPlacement="start"
|
||||
|
||||
@@ -16,7 +16,13 @@ function FilterModal({ data, setData, children }) {
|
||||
const handleClose = () => setOpen(false);
|
||||
|
||||
const deleteData = () => {
|
||||
clearFilterParams(router, ['turn', 'specialties', 'degree', 'category', 'gender'])
|
||||
clearFilterParams(router, [
|
||||
"turn",
|
||||
"specialties",
|
||||
"degree",
|
||||
"category",
|
||||
"gender",
|
||||
]);
|
||||
setData({
|
||||
category: "",
|
||||
specialties: "",
|
||||
@@ -25,7 +31,7 @@ function FilterModal({ data, setData, children }) {
|
||||
degree: "متخصص",
|
||||
});
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -31,7 +31,7 @@ function SearchBar({ data, setData, params }) {
|
||||
</FilterModal>
|
||||
<TextField
|
||||
variant="standard"
|
||||
defaultValue={params.search || ''}
|
||||
defaultValue={params.search || ""}
|
||||
InputProps={{
|
||||
disableUnderline: true,
|
||||
}}
|
||||
|
||||
@@ -29,13 +29,17 @@ function SelectSort() {
|
||||
</SvgIcon>
|
||||
{value ? (
|
||||
<ul className="flex items-center justify-start gap-1">
|
||||
{Array(sort).fill({}).map((_, idx) => (
|
||||
<li key={idx}>
|
||||
<StarDI />
|
||||
</li>
|
||||
))}
|
||||
{Array(sort)
|
||||
.fill({})
|
||||
.map((_, idx) => (
|
||||
<li key={idx}>
|
||||
<StarDI />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : "مرتب سازی"}
|
||||
) : (
|
||||
"مرتب سازی"
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
@@ -60,10 +64,15 @@ function SelectSort() {
|
||||
name={item.label}
|
||||
className="!flex !flex-col !items-start !w-full hover:!bg-transparent"
|
||||
>
|
||||
<div value={item.id} className="!p-2 !mr-2 !w-[calc(100%_-_16px)] flex items-center justify-start">
|
||||
{Array(item.label).fill({}).map((_, idx) => (
|
||||
<StarDI key={idx} />
|
||||
))}
|
||||
<div
|
||||
value={item.id}
|
||||
className="!p-2 !mr-2 !w-[calc(100%_-_16px)] flex items-center justify-start"
|
||||
>
|
||||
{Array(item.label)
|
||||
.fill({})
|
||||
.map((_, idx) => (
|
||||
<StarDI key={idx} />
|
||||
))}
|
||||
</div>
|
||||
</MenuItem>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user