From dd61240ed7fb637e05d9c25089b808229d918518 Mon Sep 17 00:00:00 2001 From: Ehsan Date: Wed, 2 Oct 2024 13:55:54 +0330 Subject: [PATCH] design dark mode add-doctor & change field time to date-picker --- app/component/TimePickerField.js | 14 +++-- app/component/TimePickerInput.js | 60 +++++++++++++++++++ app/globals.css | 4 ++ components/layoutPanel/userDetail/Date.js | 2 +- .../addDoctor/listMenu/specialDays/Form.js | 9 +-- .../workingDays/modal/ContentModal.js | 8 ++- .../listMenu/workingDays/modal/Form.js | 49 +++++++++------ helper/index.js | 3 + 8 files changed, 120 insertions(+), 29 deletions(-) create mode 100644 app/component/TimePickerInput.js diff --git a/app/component/TimePickerField.js b/app/component/TimePickerField.js index 88b42f9..a34b0b9 100644 --- a/app/component/TimePickerField.js +++ b/app/component/TimePickerField.js @@ -1,8 +1,16 @@ import { useState } from "react"; import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; import { LocalizationProvider, TimePicker } from "@mui/x-date-pickers"; +import { handleTwoLength } from "@/helper"; -function TimePickerField({ dataChange, disable, setData, timeStart, data }) { +function TimePickerField({ + dataChange, + isVacation, + disable, + setData, + timeStart, + data, +}) { const [value, setValue] = useState("00:00"); return ( @@ -10,7 +18,7 @@ function TimePickerField({ dataChange, disable, setData, timeStart, data }) { { @@ -32,8 +40,6 @@ function TimePickerField({ dataChange, disable, setData, timeStart, data }) { onChange={(e) => { const hours = e.$H; const minute = e.$m; - const handleTwoLength = (value) => - String(value).length === 1 ? `0${value}` : value; const newValue = `${handleTwoLength(hours)}:${handleTwoLength( minute )}`; diff --git a/app/component/TimePickerInput.js b/app/component/TimePickerInput.js new file mode 100644 index 0000000..4888e11 --- /dev/null +++ b/app/component/TimePickerInput.js @@ -0,0 +1,60 @@ +import { useState } from "react"; +import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; +import { LocalizationProvider, TimePicker } from "@mui/x-date-pickers"; +import { handleTwoLength } from "@/helper"; + +function TimePickerInput() { + const [value, setValue] = useState("00:00"); + + return ( +
+ + { + const hours = e.$H; + const minute = e.$m; + const newValue = `${handleTwoLength(hours)}:${handleTwoLength( + minute + )}`; + setValue(newValue); + }} + sx={{ + "& .MuiFormLabel-root": { + top: "-4px !important", + }, + "& .MuiInputBase-input": { padding: "12.5px 14px" }, + "& .MuiOutlinedInput-notchedOutline": { + border: "1px solid #D7D7D7 !important", + }, + "& .MuiInputBase-root": { + borderRadius: "8px !important", + }, + ".Mui-focused": { + "& .MuiOutlinedInput-notchedOutline": { + border: "1px solid #5559CE !important", + transition: "0.5s all", + }, + }, + "& .muirtl-jv54yp-MuiList-root-MuiMultiSectionDigitalClockSection-root::after": + { + display: "none !important", + }, + }} + /> +

+ {value} +

+
+
+ ); +} + +export default TimePickerInput; diff --git a/app/globals.css b/app/globals.css index 5dbbc1f..2062ff2 100644 --- a/app/globals.css +++ b/app/globals.css @@ -664,6 +664,10 @@ html { width: 464px !important; } +.sm-datepicker .panel-jalaali { + width: 300px !important; +} + .day-label-bar, .panel-header-inner, .days-body { diff --git a/components/layoutPanel/userDetail/Date.js b/components/layoutPanel/userDetail/Date.js index 274b2af..c73b4b7 100644 --- a/components/layoutPanel/userDetail/Date.js +++ b/components/layoutPanel/userDetail/Date.js @@ -4,7 +4,7 @@ import { DatePicker } from "jalaali-react-date-picker"; function Date() { return ( -
+
} prevIcon={<>} diff --git a/components/panel/addDoctor/listMenu/specialDays/Form.js b/components/panel/addDoctor/listMenu/specialDays/Form.js index 5f85e54..7c64d60 100644 --- a/components/panel/addDoctor/listMenu/specialDays/Form.js +++ b/components/panel/addDoctor/listMenu/specialDays/Form.js @@ -7,6 +7,7 @@ import FieldIcon from "@/app/component/FieldIcon"; import { Button } from "@mui/material"; import PlusBlueP from "@/components/icons/PlusBlueP"; import ClockP from "@/components/icons/ClockP"; +import TimePickerInput from "@/app/component/TimePickerInput"; function Form() { const [data, setData] = useState({ @@ -38,7 +39,7 @@ function Form() { list={turnsPerDay} /> - +
- + - } @@ -67,7 +68,7 @@ function Form() { /> - } diff --git a/components/panel/addDoctor/listMenu/workingDays/modal/ContentModal.js b/components/panel/addDoctor/listMenu/workingDays/modal/ContentModal.js index 449ea32..062a058 100644 --- a/components/panel/addDoctor/listMenu/workingDays/modal/ContentModal.js +++ b/components/panel/addDoctor/listMenu/workingDays/modal/ContentModal.js @@ -14,8 +14,13 @@ function ContentModal({ handleClose, }) { const [value, setValue] = useState(0); + const [isVacation, setIsVacation] = useState(false); - const handleChange = (event) => setValue(+event.target.value); + const handleChange = (event) => { + const valueRadio = +event.target.value; + setIsVacation(valueRadio); + setValue(valueRadio); + }; return ( @@ -36,6 +41,7 @@ function ContentModal({
- - - - - - +
+ + + + + + +
+