change date type for req & design and fields & add requests & fix bug appointment and dashboard
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
import CalendarAdD from "@/components/icons/CalendarAdD";
|
||||
import CardTickD from "@/components/icons/CardTickD";
|
||||
import { Button } from "@mui/material";
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import Image from "next/image";
|
||||
|
||||
function Head({ user }) {
|
||||
const userInfo = getParsedUserInfo();
|
||||
|
||||
return (
|
||||
<div className="hidden md:flex flex-col lg:flex-row w-full items-stretch justify-center gap-[12px] lg:gap-[24px]">
|
||||
<div className="bg-head-dashboard rounded-[8px] relative w-full !bg-no-repeat !bg-cover py-[20px] px-[24px] !bg-center flex items-center">
|
||||
<div className="flex w-full pl-[calc(5%+140px)] lg:pl-[calc(9%+171px)] flex-col justify-start items-start gap-[8px]">
|
||||
<p className="text-[#3B3B3B] text-[16px] font-bold">
|
||||
{user.name}{" "}
|
||||
{userInfo.realName}{" "}
|
||||
<span className="text-[#3B3B3B] text-[16px] font-normal">
|
||||
عزیز!
|
||||
</span>
|
||||
@@ -18,12 +20,6 @@ function Head({ user }) {
|
||||
در این قسمت میتوانید اطلاعات حساب خود و نوبت های گرفته شده را مدیریت
|
||||
کنید.{" "}
|
||||
</p>
|
||||
<Button
|
||||
variant="contained"
|
||||
className="!bg-[#5559CE] !rounded-[4px] !py-[4px] !px-[8px] !text-[#EFEFEF] !text-[12px] !font-medium !leading-[22px]"
|
||||
>
|
||||
مشاهده اطلاعات
|
||||
</Button>
|
||||
</div>
|
||||
<Image
|
||||
className="w-[120px] lg:w-[140px] xl:w-[170px] xl:min-w-[170px] h-fit absolute bottom-0 left-[3%] md:left-[5%] lg:left-[9%]"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ArrowLeftWhiteD from "@/components/icons/ArrowLeftWhiteD";
|
||||
import {
|
||||
convertJalaliTimestamp,
|
||||
handleTimeExpiresToken,
|
||||
removeAdditionalKeysDashboard,
|
||||
} from "@/helper";
|
||||
@@ -23,7 +24,23 @@ function ButtonSendData({
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const changeDateType = (data) => {
|
||||
const newData = data;
|
||||
const splitedDate = newData.birthday.split("/");
|
||||
newData.birthday = convertJalaliTimestamp(
|
||||
{
|
||||
jy: Number(splitedDate[0]),
|
||||
jm: Number(splitedDate[1]),
|
||||
jd: Number(splitedDate[2]),
|
||||
},
|
||||
true
|
||||
);
|
||||
return newData;
|
||||
};
|
||||
|
||||
const postData = () => {
|
||||
console.log(changeDateType(information));
|
||||
|
||||
request
|
||||
.postUserProfile(information)
|
||||
.then((response) => {
|
||||
@@ -67,6 +84,7 @@ function ButtonSendData({
|
||||
|
||||
const patchData = () => {
|
||||
const usedKays = removeAdditionalKeysDashboard(information);
|
||||
console.log(changeDateType(information));
|
||||
|
||||
request
|
||||
.patchUserProfile(
|
||||
|
||||
+4
-2
@@ -1,8 +1,8 @@
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import Content from "./Content";
|
||||
import DateBirthday from "./DateBirthday";
|
||||
import AutoSelector from "./component/AutoSelector";
|
||||
import Field from "./component/Field";
|
||||
import AutoSelector from "../component/AutoSelector";
|
||||
import Field from "../component/Field";
|
||||
import {
|
||||
gender,
|
||||
blood_group,
|
||||
@@ -20,6 +20,8 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
list.find((g) => g.id === information[name]);
|
||||
const parsedUserInfo = getParsedUserInfo();
|
||||
|
||||
console.log(information);
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-[24px] gap-y-[10px]">
|
||||
<Content title="شماره موبایل" isConfirmed={true}>
|
||||
-6
@@ -31,9 +31,3 @@ export const job = [
|
||||
{ label: "آزاد", id: "azad" },
|
||||
{ label: "دولتی", id: "dolati" },
|
||||
];
|
||||
|
||||
export const insurance = [
|
||||
{ label: "بیمه 1", id: 10 },
|
||||
{ label: "بیمه 2", id: 20 },
|
||||
{ label: "بیمه 3", id: 30 },
|
||||
];
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import Form from "./Form";
|
||||
import Form from "./form";
|
||||
import { request } from "@/services/response";
|
||||
import ButtonSendData from "./ButtonSendData";
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import { disease } from "../information/disease";
|
||||
import { disease } from "./form/disease";
|
||||
|
||||
function Information({ information, setInformation }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
@@ -13,16 +13,11 @@ function ItemRelatives({ row, idx, changeData }) {
|
||||
address: row.contact.address,
|
||||
};
|
||||
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
const [data, setData] = useState(row);
|
||||
const resetData = () => setData(row);
|
||||
|
||||
useEffect(() => {
|
||||
setData({
|
||||
name: row.name,
|
||||
relation: row.relation,
|
||||
phone: row.contact.phone,
|
||||
address: row.contact.address,
|
||||
});
|
||||
setData(row);
|
||||
}, [row]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -9,6 +9,7 @@ function Relatives({ data, changeData, loading, updateData }) {
|
||||
const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "آدرس", ""];
|
||||
const centerTable = [0];
|
||||
const [open, setOpen] = useState(false);
|
||||
console.log(relatives);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
|
||||
@@ -3,7 +3,18 @@ import Field from "@/app/component/Field";
|
||||
|
||||
function Content({ setData, data }) {
|
||||
const handleChange = (name, value) =>
|
||||
setData((prev) => ({ ...prev, [name]: value }));
|
||||
name === "phone" || name === "address"
|
||||
? setData((prev) => ({
|
||||
...prev,
|
||||
contact: {
|
||||
...prev.contact,
|
||||
[name]: value,
|
||||
},
|
||||
}))
|
||||
: setData((prev) => ({
|
||||
...prev,
|
||||
[name]: value,
|
||||
}));
|
||||
|
||||
return (
|
||||
<div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
|
||||
@@ -33,7 +44,7 @@ function Content({ setData, data }) {
|
||||
type="number"
|
||||
name="phone"
|
||||
isPlaceHolder={true}
|
||||
value={Number(data?.phone.replace(/^\+/, ""))}
|
||||
value={Number(data?.contact?.phone.replace(/^\+/, ""))}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
@@ -43,7 +54,7 @@ function Content({ setData, data }) {
|
||||
type="text"
|
||||
name="address"
|
||||
isPlaceHolder={true}
|
||||
value={data?.address}
|
||||
value={data?.contact?.address}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
|
||||
@@ -10,27 +10,21 @@ function ModalAddRelatives({ open, setOpen, changeData, loading, updateData }) {
|
||||
const contentItem = {
|
||||
name: "",
|
||||
relation: "",
|
||||
phone: "",
|
||||
address: "",
|
||||
contact: {
|
||||
phone: "",
|
||||
address: "",
|
||||
},
|
||||
};
|
||||
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => setOpen(false);
|
||||
const [newItem, setNewItem] = useState(contentItem);
|
||||
const handleAddData = () => {
|
||||
const changedKey = {
|
||||
name: newItem.name,
|
||||
relation: newItem.relation,
|
||||
contact: {
|
||||
phone: newItem.phone,
|
||||
address: newItem.address,
|
||||
},
|
||||
};
|
||||
|
||||
changeData("add", "relatives", null, changedKey);
|
||||
changeData("add", "relatives", null, newItem);
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
console.log(newItem);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -64,8 +58,8 @@ function ModalAddRelatives({ open, setOpen, changeData, loading, updateData }) {
|
||||
disabled={
|
||||
!newItem.name ||
|
||||
!newItem.relation ||
|
||||
!newItem.phone ||
|
||||
!newItem.address
|
||||
!newItem.contact.phone ||
|
||||
!newItem.contact.address
|
||||
}
|
||||
variant="contained"
|
||||
>
|
||||
|
||||
@@ -1,26 +1,21 @@
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import Image from "next/image";
|
||||
|
||||
function Head({ user }) {
|
||||
// const userInfo = Cookies.get("userInfo");
|
||||
// const parsedInfo = userInfo && JSON.parse(userInfo);
|
||||
const userInfo = getParsedUserInfo();
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-row md:flex-col items-center justify-center md:justify-start gap-[12px] md:gap-[4px]">
|
||||
<Image
|
||||
className="rounded-full border-[3px] border-solid border-[#F8F8FF] shadow-[0px_1px_25.6px_0px_rgba(85,_89,_205,_0.20)]"
|
||||
src={user.profile}
|
||||
src={userInfo?.picture[0]?.url}
|
||||
alt="profile"
|
||||
height={73}
|
||||
width={73}
|
||||
/>
|
||||
<div className="flex flex-col items-start md:items-center justify-center gap-[8px] md:gap-[4px]">
|
||||
<p className="text-[#3B3B3B] text-[14px] font-bold">
|
||||
{/* {parsedInfo?.realName} */}
|
||||
user
|
||||
</p>
|
||||
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
||||
{/* {parsedInfo?.username} */}
|
||||
user
|
||||
{userInfo?.realName}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user