From c7098dd410b4fd174e050cc829101d34ef9cc827 Mon Sep 17 00:00:00 2001 From: Amirhossein Mahmoodi Date: Sun, 14 Jul 2024 14:46:08 +0330 Subject: [PATCH] fixed bug --- .../Forms/CreateOrUpdate.jsx | 810 +++++++++--------- src/lib/contexts/DataTable.js | 8 +- 2 files changed, 410 insertions(+), 408 deletions(-) diff --git a/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx b/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx index 18e511c..b589b05 100644 --- a/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx +++ b/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx @@ -1,7 +1,7 @@ import LtrTextField from "@/core/components/LtrTextField"; import StyledForm from "@/core/components/StyledForm"; import useRequest from "@/lib/hooks/useRequest"; -import { Autocomplete, Box, Button, Chip, DialogActions, DialogContent, Fade, Grid, InputAdornment, Stack, TextField, Typography } from "@mui/material"; +import { Autocomplete, Box, Button, Chip, Container, DialogActions, DialogContent, Fade, Grid, InputAdornment, Stack, TextField, Typography } from "@mui/material"; import { DatePicker, LocalizationProvider, faIR } from "@mui/x-date-pickers"; import { AdapterDateFnsJalali } from "@mui/x-date-pickers/AdapterDateFnsJalali"; import moment from "jalali-moment"; @@ -141,246 +141,34 @@ const CreateOrUpdateForm = ({ handleClose, mutate, defaultValues, url }) => { localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText} > - - - - - - - ( - onChange(moment(newValue))} - label="تاریخ نامه درخواست *" - slotProps={{ - textField: { fullWidth: true, size: "small", autoComplete: 'off' }, - }} - /> - )} - /> - - - - - - ( - { - onChange(newValue) - }} - options={["حقوقی", "حقیقی"]} - renderInput={(params) => } - /> - )} - /> - - - - - ( - { - onChange(newValue) - }} - options={["دولتی", "خصوصی"]} - renderInput={(params) => } - /> - )} - /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - { - onChange(newValue) - }} - options={["تهران"]} - renderInput={(params) => ( - - )} - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["تهران"]} - renderInput={(params) => } - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["آزاد راه", "بزرگراه", 'راه فرعی درجه 3']} - renderInput={(params) => } - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["سایر"]} - renderInput={(params) => } - /> - )} - /> - - - - - - - - ( - { - onChange(newValue) - }} - options={["چپ", "راست"]} - renderInput={(params) => } - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["12.5", "17.5"]} - renderInput={(params) => } - /> - )} - /> - - - - - ( - { - onChange(newValue) - }} - options={["15", "30"]} - renderInput={(params) => } - /> - )} - /> - - - - - - - - - - - - - + + + + + + + ( + onChange(moment(newValue))} + label="تاریخ نامه درخواست *" + slotProps={{ + textField: { fullWidth: true, size: "small", autoComplete: 'off' }, + }} + /> + )} + /> + + + + + + ( { onChange={(event, newValue) => { onChange(newValue) }} - options={["38", "39"]} - renderInput={(params) => } + options={["حقوقی", "حقیقی"]} + renderInput={(params) => } /> )} /> - - - - ( - { - onChange(newValue) - }} - options={["اتاقک نگهبانی", "دولتی"]} - renderInput={(params) => } + + + + + ( + { + onChange(newValue) + }} + options={["دولتی", "خصوصی"]} + renderInput={(params) => } + /> + )} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + ( + { + onChange(newValue) + }} + options={["تهران"]} + renderInput={(params) => ( + + )} + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["تهران"]} + renderInput={(params) => } + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["آزاد راه", "بزرگراه", 'راه فرعی درجه 3']} + renderInput={(params) => } + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["سایر"]} + renderInput={(params) => } + /> + )} + /> + + + + + + + + ( + { + onChange(newValue) + }} + options={["چپ", "راست"]} + renderInput={(params) => } + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["12.5", "17.5"]} + renderInput={(params) => } + /> + )} + /> + + + + + ( + { + onChange(newValue) + }} + options={["15", "30"]} + renderInput={(params) => } + /> + )} + /> + + + + + + + + + + + + + + ( + { + onChange(newValue) + }} + options={["38", "39"]} + renderInput={(params) => } + /> + )} /> - )} - /> + + + + ( + { + onChange(newValue) + }} + options={["اتاقک نگهبانی", "دولتی"]} + renderInput={(params) => } + /> + )} + /> + + + + + + + مترمربع, + }} /> + + + ( + { + onChange(newValue) + }} + renderTags={(value, getTagProps) => + value.map((option, index) => { + const { key, ...tagProps } = getTagProps({ index }); + return ( + + ); + }) + } + options={["تعمیرات", "احداث بنا"]} + renderInput={(params) => } + /> + )} + /> + + + متر, + }} /> + + + متر, + }} /> + + + ( + { + onChange(newValue) + }} + options={["داخل حریم"]} + renderInput={(params) => } + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["سبک (ضریب ۱)"]} + renderInput={(params) => } + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["تست"]} + renderInput={(params) => } + /> + )} + /> + + + ( + { + onChange(newValue) + }} + options={["بله", "خیر"]} + renderInput={(params) => } + /> + )} + /> + + + + + + + حداکثر مدت زمان شروع عملیات: * + + + + + + + + + + + + + + + + + + - - - - - - مترمربع, - }} /> - - - ( - { - onChange(newValue) - }} - renderTags={(value, getTagProps) => - value.map((option, index) => { - const { key, ...tagProps } = getTagProps({ index }); - return ( - - ); - }) - } - options={["تعمیرات", "احداث بنا"]} - renderInput={(params) => } - /> - )} - /> - - - متر, - }} /> - - - متر, - }} /> - - - ( - { - onChange(newValue) - }} - options={["داخل حریم"]} - renderInput={(params) => } - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["سبک (ضریب ۱)"]} - renderInput={(params) => } - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["تست"]} - renderInput={(params) => } - /> - )} - /> - - - ( - { - onChange(newValue) - }} - options={["بله", "خیر"]} - renderInput={(params) => } - /> - )} - /> - - - - - - - حداکثر مدت زمان شروع عملیات: * - - - - - - - - - - - - - - - - - - - - + + diff --git a/src/lib/contexts/DataTable.js b/src/lib/contexts/DataTable.js index 34e90e4..3ada093 100644 --- a/src/lib/contexts/DataTable.js +++ b/src/lib/contexts/DataTable.js @@ -14,8 +14,8 @@ const DataTableProvider = ({ children, user_id, page_name, table_name, columns } const [filterData, setFilterData] = useState({}); const [initSort, setInitSort] = useState([]); const [sortData, setSortData] = useState([]); - const [initHide, setInitHide] = useState([]); - const [hideData, setHideData] = useState([]); + const [initHide, setInitHide] = useState({}); + const [hideData, setHideData] = useState({}); useEffect(() => { if (!settingStore) return; @@ -52,8 +52,8 @@ const DataTableProvider = ({ children, user_id, page_name, table_name, columns } setInitFilter(values); setSortData(settingStore?.[user_id]?.[page_name]?.[table_name]?.["sorts"] || []); setInitSort(settingStore?.[user_id]?.[page_name]?.[table_name]?.["sorts"] || []); - setHideData(settingStore?.[user_id]?.[page_name]?.[table_name]?.["hides"] || []); - setInitHide(settingStore?.[user_id]?.[page_name]?.[table_name]?.["hides"] || []); + setHideData(settingStore?.[user_id]?.[page_name]?.[table_name]?.["hides"] || {}); + setInitHide(settingStore?.[user_id]?.[page_name]?.[table_name]?.["hides"] || {}); setInitStates(true); }, [settingStore, isInitStates]);