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:
@@ -1,14 +1,16 @@
|
||||
import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
|
||||
import EditField from "../../../app/component/fields/EditField";
|
||||
import Content from "./Content";
|
||||
import EditField from "../../../app/component/fields/EditField";
|
||||
import DefaultSelect from "@/app/component/selectors/DefaultSelect";
|
||||
|
||||
const bime = [
|
||||
{ label: "بیمه 1", id: 10 },
|
||||
{ label: "بیمه 2", id: 20 },
|
||||
{ label: "بیمه 3", id: 30 },
|
||||
];
|
||||
function Form({ changeData, insurance, data, updateSelect, isForAnother }) {
|
||||
const findVal = () => {
|
||||
return insurance?.find(
|
||||
(g) =>
|
||||
g.id ===
|
||||
(data?.basic_insurance?.value ? data?.basic_insurance.value.id : false)
|
||||
);
|
||||
};
|
||||
|
||||
function Form({ changeData, data, updateSelect, isForAnother }) {
|
||||
return (
|
||||
<div
|
||||
className="grid mt-[12px] sm:mt-[14px] md:mt-[17px] lg:mt-[20px] items-start
|
||||
@@ -20,19 +22,20 @@ function Form({ changeData, data, updateSelect, isForAnother }) {
|
||||
<Content title="کد ملی">
|
||||
<EditField
|
||||
changeData={changeData}
|
||||
data={data?.codemeli}
|
||||
name="codemeli"
|
||||
data={data?.national_code}
|
||||
name="national_code"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="نام و نام خانوادگی">
|
||||
<EditField changeData={changeData} data={data?.name} name="name" />
|
||||
</Content>
|
||||
<Content title="نوع بیمه">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
<DefaultSelect
|
||||
updateData={(name, val) => updateSelect(val, "value", name)}
|
||||
label="نوع بیمه"
|
||||
name="first"
|
||||
list={bime}
|
||||
name="basic_insurance"
|
||||
list={insurance}
|
||||
value={findVal()}
|
||||
/>
|
||||
</Content>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Button } from "@mui/material";
|
||||
import AddCircleBlueA from "@/components/icons/AddCircleBlueA";
|
||||
import ArrowLeftB from "@/components/icons/ArrowLeftB";
|
||||
import ButtonFixed from "../paying/ButtonFixed";
|
||||
import Form from "./Form";
|
||||
import { request } from "@/services/response";
|
||||
|
||||
function Detail({
|
||||
isForAnother,
|
||||
@@ -14,6 +15,7 @@ function Detail({
|
||||
fadeElement,
|
||||
setIsPay,
|
||||
}) {
|
||||
const [insurance, setInsurance] = useState();
|
||||
const [selected, setSelected] = useState({
|
||||
first: "",
|
||||
second: "",
|
||||
@@ -31,6 +33,19 @@ function Detail({
|
||||
const updateSelect = (event, name) =>
|
||||
setSelected({ ...selected, [name]: event });
|
||||
|
||||
const newStep = () => {
|
||||
// if(data)
|
||||
setStep((prev) => prev + 1);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
request.getInsuranceType().then((res) => {
|
||||
if (res && res.data) {
|
||||
setInsurance(res.data);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
// ${typePay === 'success' || typePay === 'failed' ? 'bg-transparent border-transparent md:bg-[#FFF] md:border-[#EFEFEF]' : ''}
|
||||
<div className="w-full lg:w-[59%]">
|
||||
@@ -43,10 +58,11 @@ function Detail({
|
||||
{isForAnother ? "اطلاعات کاربر جدید" : "اطلاعات حساب کاربری"}
|
||||
</p>
|
||||
<Form
|
||||
isForAnother={isForAnother}
|
||||
updateSelect={updateSelect}
|
||||
changeData={changeData}
|
||||
data={data}
|
||||
insurance={insurance}
|
||||
changeData={changeData}
|
||||
updateSelect={updateSelect}
|
||||
isForAnother={isForAnother}
|
||||
/>
|
||||
{!isForAnother && (
|
||||
<Button
|
||||
@@ -77,7 +93,7 @@ function Detail({
|
||||
: "!mt-0 md:!mt-[32px]"
|
||||
}`}
|
||||
variant="contained"
|
||||
onClick={() => setStep((prev) => prev + 1)}
|
||||
onClick={newStep}
|
||||
>
|
||||
<p className="text-[#EFEFEF] text-[16px] font-medium">
|
||||
ثبت اطلاعات
|
||||
|
||||
Reference in New Issue
Block a user