Added Setting page and Profile Componnent

master
YasamanKahdooei 2024-07-24 15:36:55 +03:30
parent 4d399f2124
commit 2a01f82b76
13 changed files with 641 additions and 53 deletions

View File

@ -1,7 +1,6 @@
import PnpUser from '@/components/Settings/pnp/PnpUser'
import React from 'react' import React from 'react'
export default function page() { export default function page() {
return ( return <PnpUser />
<div>page</div>
)
} }

View File

@ -1,4 +1,4 @@
import Profile from "@/components/Settings/Profile"; import Profile from "@/components/Settings/profile/Profile";
import React from "react"; import React from "react";
export default function page() { export default function page() {

View File

@ -1,4 +1,4 @@
import Settings from "@/components/Settings/Settings"; import Settings from "@/components/Settings/setting/Settings";
import React from "react"; import React from "react";
export default function page() { export default function page() {

View File

@ -0,0 +1,73 @@
import React from "react";
function PnpUser() {
return (
<>
<section className="w-full max-w-2xl m-auto">
<section className="">
<h1 className="my-5 mx-auto text-lg text-blue font-bold">سیاست نامه حریم خصوصی</h1>
<p className="text-sm text-black text-justify leading-relaxed">
«شهربین» به حریم خصوصی کاربران خود احترام می‌گذارد و متعهد به حفاظت
از اطلاعات شخصی است که شما در اختیار آن می‌گذارید. از آنجا که
جمع‌آوری و پردازش اطلاعات شخصی بخش غیرقابل اجتنابی در فرایندهای
مبتنی بر گوشی همراه و اینترنت است لذا به منظور آگاهی کامل از سیاست و
عملکرد شهربین در این زمینه، مطالعه این سند تحت عنوان «سیاست نامه
حریم خصوصی» و هر گونه پیام دیگری که در خصوص جمع‌آوری و پردازش
اطلاعات توسط شهربین به حساب کاربری شما ارسال می‌شود، ضروری است. این
سند مشتمل بر موارد ذیل در خصوص اطلاعات شخصی و یک واژه‌نامه است که
مطالعه آن را برای درک بهتر اصطلاحات تخصصی پیشنهاد می‌کنیم.
</p>
</section>
<section className="">
<h1 className="my-5 mx-auto text-lg text-blue font-bold">درباره شهربین</h1>
<p className="text-sm text-black text-justify leading-relaxed">
نرم‌افزار شهربین یک سامانه آنلاین شهروندی است که اولین نسخه آن در
سال 1397 طراحی و منتشر شد. این محصول متعلق به شرکت آوای شتاب دهنده
پیشگامان به شماره ثبت 16856 است.
</p>
</section>
<section className="">
<h1 className="my-5 mx-auto text-lg text-blue font-bold">تغییرات این سند</h1>
<p className="text-sm text-black text-justify leading-relaxed">
این سند مطابق با آخرین تغییرات قوانین و مقررات موضوعه کشور تدوین شده
و مبیّن کلیه حقوق شما تحت قانون تجارت الکترونیکی مصوب ۱۳۸۲و اسناد
بین‌المللی ذی‌ربط است. این سند ممکن است دستخوش تغییرات و تجدیدنظر
شود و در صورتی که اطلاع‌رسانی تغییرات به موجب قانون الزامی باشد، این
تغییرات از طریق حساب کاربری به کاربران اطلاع داده خواهد شد. این سند،
آخرین بار در تاریخ شهریور 1400 مورد بازبینی و به‌روزرسانی قرار گرفت.
</p>
</section>
<section className="">
<h1 className="my-5 mx-auto text-lg text-blue font-bold">
کدام اطلاعات توسط شهربین جمع آوری می شوند
</h1>
<p className="text-sm text-black text-justify leading-relaxed">
اطلاعات ممکن است توام با نصب و/یا استفاده شما از خدمات شهربین
(اطلاعات فنی و گزارش‌های سرور عمدتاً به این شیوه جمع‌آوری می‌شوند و
در سرورهای ما نگهداری می‌شوند) در دسترس و اختیار شهربین قرار گیرد،
همچنین شهربین ممکن است اطلاعات را مستقیماً از شما دریافت کند (هنگام
ایجاد حساب کاربری، ثبت نظر، تماس و مکاتبه با پشتیبانی و یا تکمیل هر
فرم یا ورود اختیاری اطلاعات)
</p>
</section>
<section className="">
<h1 className="my-5 mx-auto text-lg text-blue font-bold">
اطلاعاتی که با نصب و/یا استفاده از نرم‌افزار شهربین جمع‌آوری می‌شوند
</h1>
<p className="text-sm text-black text-justify leading-relaxed">
اطلاعات مربوط به استفاده از خدمات شهربین و اطلاعات دستگاهی که
نرم‌افزار شهربین بر روی آن نصب شده‌ است همزمان با نصب نرم‌افزار بر
روی دستگاه شما (بدون ایجاد حساب کاربری) جمع‌آوری می‌شوند. برخی از
این اطلاعات عبارتند از:
</p>
</section>
</section>
</>
);
}
export default PnpUser;

View File

@ -1,7 +1,7 @@
"use client"; "use client";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
import * as z from "zod"; import * as z from "zod";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
@ -27,8 +27,22 @@ import {
SelectItem, SelectItem,
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "../ui/select"; } from "@/components/ui/select";
import { educations, genders } from "@/constants"; import { educations, genders } from "@/constants";
import DatePicker, { DateObject } from "react-multi-date-picker";
import gregorian from "react-date-object/calendars/gregorian";
import gregorian_en from "react-date-object/locales/gregorian_en";
import persian from "react-date-object/calendars/persian";
import persian_fa from "react-date-object/locales/persian_fa";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import jalaliday from "jalaliday";
// import 'react-modern-calendar-datepicker/lib/DatePicker.css';
// import DatePicker from 'react-modern-calendar-datepicker';
dayjs.extend(jalaliday);
dayjs.extend(utc);
const FormSchema = z.object({ const FormSchema = z.object({
firstName: z.string().min(1, { firstName: z.string().min(1, {
@ -60,8 +74,8 @@ const FormSchema = z.object({
if (Number.isNaN(parsedNumber)) { if (Number.isNaN(parsedNumber)) {
throw new Error("شماره موبایل معتبر نمی باشد."); throw new Error("شماره موبایل معتبر نمی باشد.");
} else if ( } else if (
Number(parsedNumber) > 1000000000 && Number(parsedNumber) > 10000000000 &&
Number(parsedNumber) < 9999999999 Number(parsedNumber) < 99999999999
) { ) {
throw new Error("شماره موبایل معتبر نمی باشد."); throw new Error("شماره موبایل معتبر نمی باشد.");
} }
@ -73,10 +87,20 @@ const FormSchema = z.object({
education: z.string({ education: z.string({
required_error: "لطفا تحصیلات خود را انتخاب نمایید.", required_error: "لطفا تحصیلات خود را انتخاب نمایید.",
}), }),
birthday: z.nullable(
z.any({
required_error: "لطفا تاریخ تولد خود را وارد کنید",
// invalid_type_error: "Age must be a number",
})
),
}); });
export default function Profile() { export default function Profile() {
const router = useRouter(); const router = useRouter();
const [value, setValue] = useState(new Date());
const [date, setDate] = useState<any>();
// const [selectedDay, setSelectedDay] = useState<any | null>(null);
// const [profileData, setProfileData] = useState<any | null>(null); // const [profileData, setProfileData] = useState<any | null>(null);
const { const {
@ -96,66 +120,95 @@ export default function Profile() {
refetch(); refetch();
// toast("پروفایل شما با موفقیت ویرایش شد.", { // toast("پروفایل شما با موفقیت ویرایش شد.", {
toast(res.message, { toast(res.message, {
className: "!bg-green-500 !text-white", className: "!bg-green !text-black flex justify-end",
}); });
router.push("/"); // router.push("/");
}, },
onError: (err: any | string) => { onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, { toast(<>{err.response.data.detail}</>, {
className: "!bg-red !text-white", className: "!bg-red-500 !text-white",
}); });
}, },
}); });
const form = useForm<z.infer<typeof FormSchema>>({ const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema), resolver: zodResolver(FormSchema),
defaultValues:{
gender:'',
education:''
}
}); });
useEffect(() => { useEffect(() => {
if (profileData) { if (profileData) {
// setProfileData(data?.data); // setProfileData(data?.data);
console.log(profileData);
form.setValue("firstName", profileData.data?.firstName); form.setValue("firstName", profileData.data?.firstName);
form.setValue("lastName", profileData.data?.lastName); form.setValue("lastName", profileData.data?.lastName);
form.setValue("nationalId", profileData.data?.nationalId); form.setValue("nationalId", profileData.data?.nationalId);
form.setValue("phoneNumber", profileData.data?.phoneNumber); form.setValue("phoneNumber", profileData.data?.phoneNumber);
form.setValue("gender", profileData.data?.gender); form.setValue("gender", String(profileData.data?.gender));
form.setValue("education", profileData.data?.education); form.setValue("education", profileData.data?.education);
console.log(String(profileData.data?.gender));
const birthDate = new DateObject(profileData.data?.birthDate).convert(
gregorian,
gregorian_en
);
form.setValue(
"birthday",
birthDate.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS")
);
const date2 = new DateObject(profileData.data?.birthDate).convert(
persian,
persian_fa
);
setDate(date2);
} }
}, [profileData]); }, [profileData, setValue]);
function onSubmit(data: z.infer<typeof FormSchema>) { function onSubmit(data: z.infer<typeof FormSchema>) {
const strNationalId = String(data.nationalId); const strNationalId = String(data.nationalId);
const strPhoneNumber = String(data.phoneNumber); const strPhoneNumber = String(data.phoneNumber);
const NumGender = Number(data.gender);
const NumEducation = Number(data.education);
const payload = { const payload = {
...data, ...data,
nationalId: strNationalId, nationalId: strNationalId,
phoneNumber: strPhoneNumber, phoneNumber: strPhoneNumber,
gender: NumGender,
education: NumEducation,
}; };
// editProfileMutation.mutate(payload); console.log(payload);
editProfileMutation.mutate(payload);
} }
return ( return (
<div className="w-full h-full pt-12 sm:w-2/3 md:w-2/4 max-sm:p-8 mx-auto bg-white p-20 rounded-md"> <div className="w-full sm:w-2/3 mx-auto bg-transparent border-2 p-2 sm:p-5 rounded-md">
<div className="flex flex-col justify-center h-full space-y-4 md:space-y-4"> <div className="flex flex-col justify-center space-y-2 md:space-y-4">
<h2 className=" w-full font-bold">پروفایل کاربری</h2> <h2 className=" w-full font-bold">پروفایل کاربری</h2>
{profileData && ( {profileData && (
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="flex flex-col w-full mt-6 " className="flex flex-col w-full mt-6 "
> >
<div className="flex flex-row flex-wrap justify-between border p-4 rounded-md"> <div className="flex flex-row flex-wrap justify-between p-4 rounded-md gap-4 md:gap-2 lg:gap-4">
<FormField <FormField
control={form.control} control={form.control}
name="firstName" name="firstName"
render={({ field }) => ( render={({ field }) => (
<FormItem className="w-full sm:w-[48%]"> <FormItem className="w-full md:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium"> <FormLabel className="text-gray-800 text-sm font-medium">
نام نام
</FormLabel> </FormLabel>
<FormControl> <FormControl>
<Input <Input
className="text-opacity-100"
placeholder="نام خود را وارد نمایید" placeholder="نام خود را وارد نمایید"
{...field} {...field}
/> />
@ -168,12 +221,13 @@ export default function Profile() {
control={form.control} control={form.control}
name="lastName" name="lastName"
render={({ field }) => ( render={({ field }) => (
<FormItem className="w-full sm:w-[48%] "> <FormItem className="w-full md:w-[48%] ">
<FormLabel className="text-[#7C838A] text-sm font-medium"> <FormLabel className="text-gray-800 text-sm font-medium">
نام خانوادگی نام خانوادگی
</FormLabel> </FormLabel>
<FormControl> <FormControl>
<Input <Input
className="text-opacity-100"
placeholder="نام خانوادگی خود را وارد نمایید" placeholder="نام خانوادگی خود را وارد نمایید"
{...field} {...field}
/> />
@ -183,17 +237,18 @@ export default function Profile() {
)} )}
/> />
<FormField <Controller
control={form.control} control={form.control}
name="gender" name="gender"
render={({ field }) => ( render={({ field }) => (
<FormItem className=" w-full sm:w-[48%]"> <FormItem className=" w-full md:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7"> <FormLabel className="text-gray-800 text-sm font-medium">
جنسیت جنسیت
</FormLabel> </FormLabel>{" "}
<Select <Select
onValueChange={field.onChange} onValueChange={field.onChange}
defaultValue={field.value} // defaultValue={field.value}
value={field.value}
dir="rtl" dir="rtl"
> >
<FormControl> <FormControl>
@ -228,13 +283,15 @@ export default function Profile() {
control={form.control} control={form.control}
name="education" name="education"
render={({ field }) => ( render={({ field }) => (
<FormItem className=" w-full sm:w-[48%]"> <FormItem className=" w-full md:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7"> <FormLabel className="text-gray-800 text-sm font-medium">
تحصیلات تحصیلات
</FormLabel> </FormLabel>
<Select <Select
onValueChange={field.onChange} onValueChange={field.onChange}
defaultValue={field.value} // defaultValue={field.value}
value={field.value}
dir="rtl" dir="rtl"
> >
<FormControl> <FormControl>
@ -269,12 +326,13 @@ export default function Profile() {
control={form.control} control={form.control}
name="nationalId" name="nationalId"
render={({ field }) => ( render={({ field }) => (
<FormItem className="w-full sm:w-[48%]"> <FormItem className="w-full md:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7"> <FormLabel className="text-gray-800 text-sm font-medium">
کد ملی کد ملی
</FormLabel> </FormLabel>
<FormControl> <FormControl>
<Input <Input
className="text-opacity-100"
type="text" type="text"
placeholder="کد ملی خود را وارد نمایید " placeholder="کد ملی خود را وارد نمایید "
{...field} {...field}
@ -288,12 +346,13 @@ export default function Profile() {
control={form.control} control={form.control}
name="phoneNumber" name="phoneNumber"
render={({ field }) => ( render={({ field }) => (
<FormItem className="w-full sm:w-[48%]"> <FormItem className="w-full md:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7"> <FormLabel className="text-gray-800 text-sm font-medium">
شماره موبایل شماره موبایل
</FormLabel> </FormLabel>
<FormControl> <FormControl>
<Input <Input
className="text-opacity-100"
type="text" type="text"
placeholder="شماره موبایل خود را وارد نمایید " placeholder="شماره موبایل خود را وارد نمایید "
{...field} {...field}
@ -303,10 +362,53 @@ export default function Profile() {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="birthday"
render={({ field }) => (
<FormItem className="w-full md:w-[48%] flex flex-col ">
<FormLabel className="text-gray-800 text-sm font-medium">
تاریخ تولد
</FormLabel>
<FormControl>
{/* <Input
type="text"
placeholder="شماره موبایل خود را وارد نمایید "
{...field}
/> */}
{/* <DatePicker value={value} onChange={setValue} /> */}
<DatePicker
inputClass="h-10 w-full rounded border border-input text-gray text-sm"
calendar={persian}
locale={persian_fa}
calendarPosition="bottom-right"
value={date || ""}
onChange={(ab: any) => {
const date = new DateObject(ab).convert(
gregorian,
gregorian_en
);
form.setValue(
"birthday",
date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS")
);
console.log(
date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS")
);
}}
placeholder="تاریخ تولد خود را انتخاب نمایید"
onOpenPickNewDate={false}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div> </div>
<div className="flex justify-end w-full gap-2 mt-8"> <div className="flex justify-end w-full gap-2">
<Button <Button
className="w-full text-black bg-yellow rounded-md hover:bg-yellow/80 mt-5" className="w-full sm:w-1/4 text-black bg-yellow rounded-md hover:bg-yellow/80 mt-3 sm:ml-3"
disabled={editProfileMutation.isPending} disabled={editProfileMutation.isPending}
type="submit" type="submit"
> >

View File

@ -0,0 +1,386 @@
"use client";
import React, { useState } from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm, Controller } from "react-hook-form";
import * as z from "zod";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Input } from "@/components/ui/input";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { getOperatorProfile } from "../../utils/api";
import { getCookie } from "cookies-next";
import DatePicker, { DateObject } from "react-multi-date-picker";
import gregorian from "react-date-object/calendars/gregorian";
import gregorian_en from "react-date-object/locales/gregorian_en";
import persian from "react-date-object/calendars/persian";
import persian_fa from "react-date-object/locales/persian_fa";
import { editOperator, getOperator } from "../../utils/api/Operator";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import jalaliday from "jalaliday";
import { useToast } from "@/components/ui/use-toast";
import dynamic from "next/dynamic";
import { Dna } from "react-loader-spinner";
import { errorMessages, messageIcons } from "@/app/constants";
const ProfileUploader = dynamic(
() => import("@/app/components/UploadProfile"),
{
ssr: false,
}
);
dayjs.extend(jalaliday);
dayjs.extend(utc);
function OperatorProfile(props: any) {
const [value, setValue] = useState<any>();
const [url, setUrl] = useState<any>();
const queryClient = useQueryClient();
const token = getCookie("token");
const { toast } = useToast();
console.log(token);
const formSchema = z.object({
userName: z
.string({
required_error: "تلفن الزامیست",
invalid_type_error: "Age must be a number",
})
.nullish(),
firstName: z.nullable(
z.string({
required_error: "رمز عبور الزامیست",
// invalid_type_error: "Age must be a number",
})
),
lastName: z.nullable(
z.string({
required_error: "رمز عبور الزامیست",
// invalid_type_error: "Age must be a number",
})
),
birthday: z.nullable(
z.any({
required_error: "رمز عبور الزامیست",
// invalid_type_error: "Age must be a number",
})
),
gender: z.nullable(
z.any({
required_error: "رمز عبور الزامیست",
// invalid_type_error: "Age must be a number",
})
),
});
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
});
const editOperatorMutation = useMutation({
mutationFn: editOperator,
onSuccess: (res) => {
queryClient.invalidateQueries(["OperatorProfile"]);
toast({
description: (
<p className=" flex gap-1 items-center">
{messageIcons.success}
تغییرات شما با موفقیت ثبت شد.
</p>
),
className: "bg-green-600 text-white",
});
},
onError: (err: any) => {
toast({
description: (
<p className=" flex gap-1 items-center">
{messageIcons.error}
{errorMessages[err.response.status]}
</p>
),
className: "bg-red-600 text-white",
});
},
});
const onSubmit = (Data: z.infer<typeof formSchema>) => {
console.log(Data);
const formData = new FormData();
const gender = Number(Data.gender);
formData.append("Id", data.id);
formData.append("FirstName", Data.firstName ? Data.firstName : null);
formData.append("LastName", Data.lastName ? Data.lastName : null);
if (gender) {
formData.append("Gender", Data.gender);
}
if (Data.birthday) {
formData.append("BirthDate", Data.birthday);
}
if (url) {
formData.append("AvatarFile", url?.originFileObj);
}
editOperatorMutation.mutate({ token: token, Data: formData });
};
const { data, isLoading, isFetching } = useQuery({
queryKey: ["OperatorProfile"],
queryFn: () => getOperator(token),
onSuccess: (res) => {
if (res.gender != null) {
form.setValue("gender", (res.gender + 1).toString());
}
if (res.birthDate) {
console.log(res.birthDate);
const date = new DateObject(res.birthDate).convert(
gregorian,
gregorian_en
);
form.setValue("birthday", date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS"));
const date2 = new DateObject(res.birthDate).convert(
persian,
persian_fa
);
setValue(date2);
}
},
});
console.log(data);
// console.log(data?.gender.toString());
console.log(form.getValues("birthday"));
// console.log(data?.birthDate);
if (isLoading) {
return (
<div>
<Dna
visible={true}
height="80"
width="80"
ariaLabel="dna-loading"
wrapperStyle={{}}
wrapperClass="dna-wrapper mx-auto mt-20"
/>
</div>
);
}
return (
<div className="w-full mt-8 sm:mt-5 lg:mx-auto sm:overflow-y-auto scrollbar-thumb-gray-600 scrollbar-track-gray-100 scrollbar-thin p-2">
<p className="text-[#686868] font-bold mb-2">پروفایل اپراتور</p>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="">
{!isLoading && (
<>
<div className=" bg-white rounded-lg shadow-md p-7">
<div className="grid md:grid-cols-3 grid-cols-1 gag-x-5 place-content-center">
<div className=" w-full col-span-1 flex justify-center items-center">
<ProfileUploader
fileUrl={(file) => setUrl(file)}
Picture={data?.avatar}
/>
</div>
<div className="grid md:grid-cols-2 gap-x-5 col-span-2">
<FormField
control={form.control}
name="userName"
defaultValue={data?.userName}
disabled
render={({ field }) => (
<FormItem>
<FormLabel className="text-black">
نام کاربری
</FormLabel>
<FormControl>
<Input
// id="firstName"
disabled
className=" text-black"
placeholder="نام"
{...field}
/>
</FormControl>
<FormDescription></FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="firstName"
defaultValue={data?.firstName}
render={({ field }) => (
<FormItem>
<FormLabel className="text-black">نام</FormLabel>
<FormControl>
<Input
id="firstName"
className=" text-black"
placeholder="نام"
{...field}
/>
</FormControl>
<FormDescription></FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="lastName"
rules={{ required: false }}
defaultValue={data?.lastName}
render={({ field }) => (
<FormItem>
<FormLabel className="text-black">
نام خانوادگی
</FormLabel>
<FormControl>
<Input
// id="lastName"
className="text-black"
placeholder="نام خانوادگی"
{...field}
/>
</FormControl>
<FormDescription></FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="gender"
render={({ field }) => (
<FormItem>
<FormLabel className=" text-black">جنسیت</FormLabel>
<Select
onValueChange={field.onChange}
defaultValue={field.value}
>
<FormControl>
<SelectTrigger
dir="rtl"
className=" text-black placeholder:text-gray-400"
>
<SelectValue
// className=" placeholder:text-gray-400"
placeholder="جنسیت خود را انتخاب نمایید"
/>
</SelectTrigger>
</FormControl>
<SelectContent className="text-black" dir="rtl">
<SelectItem value="1">مرد</SelectItem>
<SelectItem value="2">زن</SelectItem>
</SelectContent>
</Select>
<FormDescription>
{/* You can manage email addresses in your{" "}
<Link href="/examples/forms">email settings</Link>. */}
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
{/* <div className=" flex flex-col">
<label className="">
<span className="text-sm text-gray-900 ">تاریخ تولد</span>
</label>
<DatePicker
calendar={persian}
locale={persian_fa}
// value={date2?.format()}
className=" !text-black"
inputClass=" text-black border w-full text-sm md:text-base h-10 rounded-md px-2 cursor-pointer"
onChange={(ab) => {
const date = new DateObject(ab).convert(
gregorian,
gregorian_en
);
setValue(date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS"));
}}
onOpenPickNewDate={false}
// format="YYYY-MM-DDTHH:mm:ss.sssZ"
/>
</div> */}
<FormField
control={form.control}
name="birthday"
render={({ field }) => (
<FormItem className="">
<FormLabel className="text-black">
تاریخ تولد
</FormLabel>
<FormControl className="w-full">
<DatePicker
calendar={persian}
locale={persian_fa}
style={{ width: "100%" }}
// value={date2?.format()}
className=" !text-black"
inputClass=" text-black border w-full placeholder:text-sm md:text-base h-10 rounded-md px-2 cursor-pointer"
arrowClassName=""
value={value || ""}
onChange={(ab) => {
const date = new DateObject(ab).convert(
gregorian,
gregorian_en
);
form.setValue(
"birthday",
date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS")
);
console.log(
date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS")
);
// setValue(
// date.format("YYYY-MM-DDTHH:mm:ss.SSSSSSS")
// );
// console.log(ab.format("YYYY-MM-DD"));
}}
placeholder="تاریخ تولد خود را انتخاب نمایید"
onOpenPickNewDate={false}
// {...field}
// format="YYYY-MM-DDTHH:mm:ss.sssZ"
/>
</FormControl>
<FormDescription></FormDescription>
<FormMessage />
</FormItem>
)}
/>
</div>
{/* <Button className=" w-full" type="submit">
ثبت نام
</Button> */}
{/* <Filepond /> */}
{/* <Input></Input> */}
</div>
</div>
<div className=" flex justify-end">
<button
type="submit"
className=" mt-6 px-2 h-12 w-24 sm:w-28 md:w-36 text-xs md:text-sm text-white rounded-full bg-main hover:bg-main-dark hover:shadow-sm hover:shadow-main"
>
ذخیره
</button>
</div>
</>
)}
</form>
</Form>
</div>
);
}
export default OperatorProfile;

View File

@ -11,33 +11,32 @@ const SocialMedia = () => {
<Link <Link
href={"https://instagram.com/shahrbin_app?utm_medium=copy_link"} href={"https://instagram.com/shahrbin_app?utm_medium=copy_link"}
target="blank" target="blank"
className="w-[50px] h-[50px] text-blue" className=" text-blue"
> >
<SlSocialInstagram className="w-full h-full text-blue" /> <SlSocialInstagram strokeWidth={'20px'} className="h-11 w-11 text-blue" />
</Link> </Link>
<Link <Link
href={"https://api.whatsapp.com/send?phone=989055685243"} href={"https://api.whatsapp.com/send?phone=989055685243"}
target="blank" target="blank"
className="w-[50px] h-[50px] text-blue"
> >
<FaWhatsapp className="w-full h-full text-blue" /> <FaWhatsapp className="h-12 w-12 text-blue" />
</Link> </Link>
<Link <Link
href={"https://t.me/shahrbin"} href={"https://t.me/shahrbin"}
target="blank" target="blank"
className="w-[50px] h-[50px] text-blue" className=" text-blue"
> >
<RiTelegramLine className="w-full h-full text-blue" /> <RiTelegramLine strokeWidth={0} className="h-14 w-14 text-blue " />
</Link> </Link>
<Link <Link
href={"https://shahrbinapp.com"} href={"https://shahrbinapp.com"}
target="blank" target="blank"
className="w-[50px] h-[50px] text-blue" className=" text-blue"
> >
<TfiWorld className="w-full h-full text-blue" /> <TfiWorld strokeWidth={'0.2px'} className="h-11 w-11 text-blue" />
</Link> </Link>
</div> </div>
); );

View File

@ -16,7 +16,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
3xl:h-9 h-10 transition-all 3xl:h-9 h-10 transition-all
hover:cursor-pointer focus:cursor-auto hover:cursor-pointer focus:cursor-auto
focus:outline-4 focus:outline-slate-300 focus:outline-4 focus:outline-slate-300
bg-white focus:bg-white hover:bg-white text-center bg-white focus:bg-white hover:bg-white text-right
`, `,
className className

View File

@ -44,37 +44,37 @@ export const menuItems = [
export const educations = [ export const educations = [
{ {
id: 0, id: "0",
title: "تعریف نشده", title: "تعریف نشده",
value: 0, value: 0,
}, },
{ {
id: 1, id: "1",
title: "ابتدایی", title: "ابتدایی",
value: 1, value: 1,
}, },
{ {
id: 2, id: "2",
title: "دیپلم", title: "دیپلم",
value: 2, value: 2,
}, },
{ {
id: 3, id: "3",
title: "فوق دیپلم", title: "فوق دیپلم",
value: 3, value: 3,
}, },
{ {
id: 4, id: "4",
title: "لیسانس", title: "لیسانس",
value: 4, value: 4,
}, },
{ {
id: 5, id: "5",
title: "فوق لیسانس", title: "فوق لیسانس",
value: 5, value: 5,
}, },
{ {
id: 6, id: "6",
title: "دکترا", title: "دکترا",
value: 6, value: 6,
}, },

28
package-lock.json generated
View File

@ -39,6 +39,7 @@
"react-icons": "^5.1.0", "react-icons": "^5.1.0",
"react-loader-spinner": "^6.1.6", "react-loader-spinner": "^6.1.6",
"react-mapbox-gl": "^5.1.1", "react-mapbox-gl": "^5.1.1",
"react-multi-date-picker": "^4.5.2",
"react-otp-input": "^3.1.1", "react-otp-input": "^3.1.1",
"sonner": "^1.4.41", "sonner": "^1.4.41",
"tailwind-merge": "^2.2.2", "tailwind-merge": "^2.2.2",
@ -5226,6 +5227,11 @@
"react-dom": ">= 15" "react-dom": ">= 15"
} }
}, },
"node_modules/react-date-object": {
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/react-date-object/-/react-date-object-2.1.9.tgz",
"integrity": "sha512-BHxD/quWOTo9fLKV/cfL/M31ePoj4a1JaJ/CnOf8Ndg3mrkh4x9wEMMkCfTrzduxDOgU8ZgR8uarhqI5G71sTg=="
},
"node_modules/react-dom": { "node_modules/react-dom": {
"version": "18.2.0", "version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
@ -5238,6 +5244,15 @@
"react": "^18.2.0" "react": "^18.2.0"
} }
}, },
"node_modules/react-element-popper": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/react-element-popper/-/react-element-popper-2.1.6.tgz",
"integrity": "sha512-8va7mUmrKIkUnaM2t5Dyctd8cjgVgVcrv5vVD0FRay0sN6EPBCKa0bDi1/KmVDAjfgSIn7zQnjtc4VojcGrkgQ==",
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
},
"node_modules/react-hook-form": { "node_modules/react-hook-form": {
"version": "7.51.2", "version": "7.51.2",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.51.2.tgz", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.51.2.tgz",
@ -5305,6 +5320,19 @@
"react-dom": "^16.11.0" "react-dom": "^16.11.0"
} }
}, },
"node_modules/react-multi-date-picker": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/react-multi-date-picker/-/react-multi-date-picker-4.5.2.tgz",
"integrity": "sha512-FgWjZB3Z6IA6XpcWiLPk85PwcRUhOiYhKK42o5k672gD/n2I6rzPfQ8bUrldOIiF/Z7FfOCdH7a6FeubzqteLg==",
"dependencies": {
"react-date-object": "^2.1.8",
"react-element-popper": "^2.1.6"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
},
"node_modules/react-otp-input": { "node_modules/react-otp-input": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/react-otp-input/-/react-otp-input-3.1.1.tgz", "resolved": "https://registry.npmjs.org/react-otp-input/-/react-otp-input-3.1.1.tgz",

View File

@ -40,6 +40,7 @@
"react-icons": "^5.1.0", "react-icons": "^5.1.0",
"react-loader-spinner": "^6.1.6", "react-loader-spinner": "^6.1.6",
"react-mapbox-gl": "^5.1.1", "react-mapbox-gl": "^5.1.1",
"react-multi-date-picker": "^4.5.2",
"react-otp-input": "^3.1.1", "react-otp-input": "^3.1.1",
"sonner": "^1.4.41", "sonner": "^1.4.41",
"tailwind-merge": "^2.2.2", "tailwind-merge": "^2.2.2",