import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect"; import RadioContent from "./RadioContent"; import { FormControlLabel, Switch } from "@mui/material"; import { useRouter } from "next/navigation"; import { filterList } from "@/helper"; const group1 = ["خانم", "آقا", "هر دو"]; const group2 = ["فوق تخصص", "دکترای تخصصی", "متخصص", "دکتری"]; function Content({ data, setData }) { const router = useRouter(); const { parentList, childrenList } = filterList(data); const changeUrl = (value, name, removeSpecialties) => { const current = new URLSearchParams(window.location.search); current.set(name, value.id || value); if (removeSpecialties) { current.delete("specialties"); } const queryString = current.toString(); router.push(`/doctors?${queryString}`); }; const changeData = (value, name, removeSpecialties) => { changeUrl(value, name, removeSpecialties); const newData = data; newData[name] = value; if (removeSpecialties) { newData.specialties = ""; } setData(newData); }; return (
changeData(value, name, true)} sendAll={true} value={data.category.name} label="دسته بندی" name="category" /> {!!childrenList.length && (
)}
{ changeData(event.target.checked ? 1 : 0, "turn"); }} /> } sx={{ ".MuiFormControlLabel-label": { color: "#3B3B3B", fontSize: "16px", fontWeight: 500, }, marginLeft: "0 !important", }} label="فقط پزشکان دارای نوبت" labelPlacement="start" />
); } export default Content;