fix bug save and set data just with one key, remove page login from appo page, disable not avalaible data in calendar, change steps for pages in appo, get data user, edit and set in page user-info
This commit is contained in:
@@ -2,30 +2,18 @@ import BottomSelect from "@/components/icons/BottomSelect";
|
||||
import { Autocomplete, Button, TextField } from "@mui/material";
|
||||
import { styleTextSelectRight } from "@/mui";
|
||||
|
||||
function AutoSelector({
|
||||
list,
|
||||
value,
|
||||
isError,
|
||||
updateData,
|
||||
label,
|
||||
error,
|
||||
disabled = false,
|
||||
listboxProps,
|
||||
name,
|
||||
}) {
|
||||
function AutoSelector({ list, value, updateData, label, error, name }) {
|
||||
return (
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
options={list}
|
||||
disabled={disabled}
|
||||
value={value || ""}
|
||||
ListboxProps={listboxProps}
|
||||
getOptionLabel={(option) => {
|
||||
if (typeof option === "string") return option;
|
||||
return option?.name || option?.label || "";
|
||||
}}
|
||||
className="!w-full !rounded-lg auto-complete-selector"
|
||||
onChange={(e, newValue) => {
|
||||
onChange={(_, newValue) => {
|
||||
updateData(name, newValue?.label || newValue || "");
|
||||
}}
|
||||
sx={{
|
||||
@@ -62,9 +50,6 @@ function AutoSelector({
|
||||
{
|
||||
border: "1px solid #5559CE !important",
|
||||
},
|
||||
"& .MuiOutlinedInput-notchedOutline": {
|
||||
border: isError ? "1px solid red !important" : "",
|
||||
},
|
||||
}}
|
||||
renderOption={(props, option) => (
|
||||
<Button
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import Content from "./Content";
|
||||
import DateBirthday from "./DateBirthday";
|
||||
import AutoSelector from "../component/AutoSelector";
|
||||
import Field from "../component/Field";
|
||||
import { gender, blood_group, marital_status, job } from "./listSelector";
|
||||
import education from "@/data/education.json";
|
||||
import DefaultSelect from "@/app/component/selectors/DefaultSelect";
|
||||
|
||||
function Form({ insurance, errors, changeData, information }) {
|
||||
const findVal = (list, name) =>
|
||||
@@ -72,7 +72,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
/>
|
||||
</Content>
|
||||
<Content req={true} error={errors?.gender} title="جنسیت">
|
||||
<AutoSelector
|
||||
<DefaultSelect
|
||||
error={errors?.gender}
|
||||
updateData={(name, data) =>
|
||||
changeData(data === "زن" ? "female" : "male", name)
|
||||
@@ -107,7 +107,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
/>
|
||||
</Content>
|
||||
<Content req={true} error={errors?.basic_insurance} title="نوع بیمه">
|
||||
<AutoSelector
|
||||
<DefaultSelect
|
||||
error={errors?.basic_insurance}
|
||||
updateData={(name, val) => {
|
||||
changeData([Number(val.id)], name);
|
||||
@@ -141,7 +141,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
/>
|
||||
</Content>
|
||||
<Content req={true} error={errors?.blood_type} title="گروه خونی">
|
||||
<AutoSelector
|
||||
<DefaultSelect
|
||||
error={errors?.blood_type}
|
||||
updateData={(name, value) =>
|
||||
changeData(blood_group.find((g) => g.label === value).id, name)
|
||||
@@ -153,7 +153,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
/>
|
||||
</Content>
|
||||
<Content req={true} error={errors?.marital_status} title="وضعیت تاهل">
|
||||
<AutoSelector
|
||||
<DefaultSelect
|
||||
error={errors?.marital_status}
|
||||
updateData={(name, value) =>
|
||||
changeData(value === "متاهل" ? "married" : "single", name)
|
||||
@@ -175,7 +175,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
/>
|
||||
</Content>
|
||||
<Content req={true} error={errors?.education} title="تحصیلات">
|
||||
<AutoSelector
|
||||
<DefaultSelect
|
||||
error={errors?.education}
|
||||
updateData={(name, value) =>
|
||||
changeData(education.find((g) => g.label === value).id, name)
|
||||
@@ -187,7 +187,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
/>
|
||||
</Content>
|
||||
<Content req={true} error={errors?.job} title="شغل">
|
||||
<AutoSelector
|
||||
<DefaultSelect
|
||||
error={errors?.job}
|
||||
updateData={(name, value) =>
|
||||
changeData(value === "آزاد" ? "azad" : "dolati", name)
|
||||
|
||||
Reference in New Issue
Block a user