This commit is contained in:
hamid zarghami
2024-12-22 16:59:53 +03:30
parent f925bc9361
commit 75a5149a8d
17 changed files with 705 additions and 492 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ function App() {
const handleGetUsersInformation = async () => { const handleGetUsersInformation = async () => {
await userMutate({}, { await userMutate({}, {
onSuccess: (res: any) => { onSuccess: (res: any) => {
updateUser(res?.data) updateUser(res?.data?.user)
}, },
onError: (err: any) => handleError(err) onError: (err: any) => handleError(err)
}) })
+1 -1
View File
@@ -14,7 +14,7 @@ type Props = {
export const ButtonComponent: FC<Props> = ({ title, type = "button", pending = false, theme = "primary", onClick, disable = false, className }) => { export const ButtonComponent: FC<Props> = ({ title, type = "button", pending = false, theme = "primary", onClick, disable = false, className }) => {
return ( return (
<Button type={type} disabled={disable} onClick={onClick} className={clsx(`flex flex-row gap-3 items-center justify-center ${className}`, { <Button type={type} disabled={disable} onClick={onClick} className={clsx(`flex h-12 flex-row gap-3 items-center justify-center ${className}`, {
"bg-primary-color text-white": theme === "primary", "bg-primary-color text-white": theme === "primary",
"bg-transparent text-primary-color": theme === "glass", "bg-transparent text-primary-color": theme === "glass",
"bg-dark-blue text-white": theme === "secondary", "bg-dark-blue text-white": theme === "secondary",
+4 -1
View File
@@ -28,7 +28,10 @@ export const Input: FC<Props> = ({ placeholder, type = "text", icon, field, clas
: icon} : icon}
{placeholder === "شماره کارت" && field.value && findBankByPAN(field.value).icon} {placeholder === "شماره کارت" && field.value && findBankByPAN(field.value).icon}
</div> </div>
<InputComponent ref={field?.ref} {...field} value={value} onChange={onChange || field?.onChange} type={type === "password" && hidden ? "text" : type} placeholder={placeholder} className={`input-style min-w-full ${className}`} disabled={disabled} />
<div className="maxh-10">
<InputComponent ref={field?.ref} {...field} value={value} onChange={onChange || field?.onChange} type={type === "password" && hidden ? "text" : type} placeholder={placeholder} className={`input-style min-w-full ${className}`} disabled={disabled} />
</div>
</div> </div>
) )
} }
+4 -4
View File
@@ -32,9 +32,9 @@ export const Imei = () => {
}) })
} }
return ( return (
<form onSubmit={handleSubmit(handleCheckIMEI)} className="w-full flex flex-col lg:flex-row bg-auth-form p-[30px] rounded-[40px] gap-8"> <form onSubmit={handleSubmit(handleCheckIMEI)} className="w-full flex flex-col lg:flex-row bg-auth-form px-10 py-10 rounded-[40px] gap-8">
<div className="w-full h-full flex items-center justify-center"> <div className="w-full h-full flex items-center justify-center">
<img src="/svgs/dashboard/binary.svg" alt="binary" className="size-full max-w-[500px] max-h-[500px]" /> <img src="/svgs/dashboard/binary.svg" alt="binary" className="size-full max-w-[500px] max-h-[200px]" />
</div> </div>
<div className="flex flex-col w-full gap-10 justify-center lg:justify-between"> <div className="flex flex-col w-full gap-10 justify-center lg:justify-between">
<Controller control={control} name="IMEI" render={({ field }) => ( <Controller control={control} name="IMEI" render={({ field }) => (
@@ -44,9 +44,9 @@ export const Imei = () => {
</div> </div>
)} /> )} />
<p className="font-normal text-base text-primary-text-color text-justify lg:text-wrap"> <p className="font-normal text-base text-primary-text-color text-justify lg:text-wrap">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز لطفا کد imei را وارد کنید
</p> </p>
<div className="w-full flex justify-end"> <div className="w-full flex ">
<ButtonComponent title="ثبت کد" className="w-full min-w-full xl:min-w-min xl:max-w-60" pending={isPending} type="submit" /> <ButtonComponent title="ثبت کد" className="w-full min-w-full xl:min-w-min xl:max-w-60" pending={isPending} type="submit" />
</div> </div>
</div> </div>
@@ -1,7 +1,8 @@
import { Edit, Trash } from "iconsax-react" import { Edit, Trash } from "iconsax-react"
import { CardBank } from "../../types" import { CardBank } from "../../types"
import { FC } from "react" import { FC, useState } from "react"
import { findBankByPAN, formatCartNumber } from "../../utility/cart" import { findBankByPAN, formatCartNumber } from "../../utility/cart"
import { EditCardDialog } from "./edit-cart-dialog"
type Props = { type Props = {
item: CardBank, item: CardBank,
@@ -10,10 +11,19 @@ type Props = {
} }
export const BankCart: FC<Props> = ({ item, handleOpenDeleteDialog, setSelectedCard }) => { export const BankCart: FC<Props> = ({ item, handleOpenDeleteDialog, setSelectedCard }) => {
const [showEdit, setShowEdit] = useState<boolean>(false)
const handleDeleteCard = () => { const handleDeleteCard = () => {
handleOpenDeleteDialog() handleOpenDeleteDialog()
setSelectedCard(item?.id) setSelectedCard(item?.id)
} }
const handleEdit = () => {
setShowEdit(true)
}
return ( return (
<div className={`w-full flex flex-col justify-between rounded-[40px] bg-auth-form p-[18px] cursor-pointer bank-bg min-h-[226px]`} style={{ backgroundImage: `url('/svgs/banks/${findBankByPAN(item.PAN)?.name}.svg')` }}> <div className={`w-full flex flex-col justify-between rounded-[40px] bg-auth-form p-[18px] cursor-pointer bank-bg min-h-[226px]`} style={{ backgroundImage: `url('/svgs/banks/${findBankByPAN(item.PAN)?.name}.svg')` }}>
<div className="flex flex-row justify-between items-center"> <div className="flex flex-row justify-between items-center">
@@ -23,7 +33,7 @@ export const BankCart: FC<Props> = ({ item, handleOpenDeleteDialog, setSelectedC
</div> </div>
<div className="flex flex-row gap-3 items-center"> <div className="flex flex-row gap-3 items-center">
<Trash color="#777577" onClick={handleDeleteCard} /> <Trash color="#777577" onClick={handleDeleteCard} />
<Edit color="#777577" /> <Edit onClick={handleEdit} color="#777577" />
</div> </div>
</div> </div>
<p className="font-medium text-2xl text-primary-text-color text-center" style={{ direction: "ltr" }}>{formatCartNumber(item?.PAN)}</p> <p className="font-medium text-2xl text-primary-text-color text-center" style={{ direction: "ltr" }}>{formatCartNumber(item?.PAN)}</p>
@@ -31,6 +41,12 @@ export const BankCart: FC<Props> = ({ item, handleOpenDeleteDialog, setSelectedC
<p className="text-sm text-secondary-text-color font-medium">{item?.holderName}</p> <p className="text-sm text-secondary-text-color font-medium">{item?.holderName}</p>
<p className="font-medium text-lg text-primary-text-color">{item?.IBAN}</p> <p className="font-medium text-lg text-primary-text-color">{item?.IBAN}</p>
</div> </div>
<EditCardDialog
isOpen={showEdit}
close={() => setShowEdit(false)}
id={item?.id}
/>
</div> </div>
) )
} }
@@ -0,0 +1,98 @@
import { CardAdd } from "iconsax-react"
import { DialogComponent } from "../common/dialog"
import { FC, useEffect } from "react"
import { Input } from "../common/input"
import { Controller, SubmitHandler, useForm } from "react-hook-form"
import { AddNewCartInterface } from "../../types"
import { yupResolver } from "@hookform/resolvers/yup"
import { AddNewCardSchema } from "../../schema"
import { ErrorComponent } from "../common/error"
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
import { createNewCardMutation, getCardDetail, updateCard } from "../../services/api/bank-card"
import toast from "react-hot-toast"
import { ButtonComponent } from "../common/button"
import { handleError } from "../../utility/error-handle"
type Props = {
isOpen: boolean,
close: () => void,
id: string,
}
export const EditCardDialog: FC<Props> = ({ isOpen, close, id }) => {
const queryClient = useQueryClient()
const { mutate, isPending } = useMutation({
mutationFn: updateCard
})
const { data }: any = useQuery({
queryKey: ["awards"],
queryFn: () => getCardDetail({ id }),
enabled: !!isOpen
});
const { handleSubmit, formState: { errors }, control, reset, getValues } = useForm<any>({
// resolver: yupResolver(AddNewCardSchema)
})
const createNewCard: SubmitHandler<AddNewCartInterface> = async (data) => {
mutate({
holderName: data?.holderName,
PAN: data?.PAN,
IBAN: data?.IBAN,
id: id,
}, {
onSuccess: () => {
toast.success("کارت با موفقیت اضافه شد")
queryClient.invalidateQueries({ queryKey: ["bank-card"] })
close()
},
onError: (err: any) => handleError(err)
})
}
useEffect(() => {
if (data?.data?.userCart) {
reset({
holderName: data?.data?.userCart?.holderName,
IBAN: data?.data?.userCart?.IBAN,
PAN: data?.data?.userCart?.PAN,
})
}
}, [isOpen, reset, data])
return (
<DialogComponent isOpen={isOpen} close={close} title="ویرایش حساب بانکی" subTitle="لطفا اطلاعات را با دقت وارد نمایید" icon={<CardAdd color="#11212D" className="size-[50px]" />}>
<form onSubmit={handleSubmit(createNewCard)} className="flex flex-col gap-[42px] mt-9">
<div className="w-full flex flex-col gap-6">
<Controller control={control} name="holderName" render={({ field }) => (
<div>
<Input value={getValues('holderName')} placeholder="نام صاحب کارت" field={field} className="bg-auth-form" />
<ErrorComponent show={errors.name} message={errors.name?.message} />
</div>
)} />
{/* <Controller control={control} name="family" render={({ field }) => (
<div>
<Input field={field} placeholder="نام خانوادگی صاحب کارت" className="bg-auth-form" />
<ErrorComponent show={errors.family} message={errors.family?.message} />
</div>
)} /> */}
<Controller control={control} name="PAN" render={({ field }) => (
<div>
<Input value={getValues('PAN')} field={field} placeholder="شماره کارت" className="bg-auth-form" />
<ErrorComponent show={errors.PAN} message={errors.PAN?.message} />
</div>
)} />
<Controller control={control} name="IBAN" render={({ field }) => (
<div>
<Input value={getValues('IBAN')} field={field} placeholder="شماره شبا" className="bg-auth-form" />
<ErrorComponent show={errors.IBAN} message={errors.IBAN?.message} />
</div>
)} />
</div>
<div className="flex flex-col gap-[6px]">
<ButtonComponent title="ویرایش کارت" pending={isPending} type="submit" />
<ButtonComponent title="لغو" type="button" theme="glass" onClick={close} />
</div>
</form>
</DialogComponent>
)
}
+17 -12
View File
@@ -20,7 +20,7 @@ import { ImageUpload } from "../common/upload"
export const MyAccountPage = () => { export const MyAccountPage = () => {
const [selectedImage, setSelectedImage] = useState<any>(null); const [selectedImage, setSelectedImage] = useState<any>(null);
const { user, updateUser } = useUserStore() const { user, updateUser }: any = useUserStore()
const { mutate, isPending } = useMutation({ const { mutate, isPending } = useMutation({
mutationFn: updateUSerInformations, mutationFn: updateUSerInformations,
mutationKey: ["update-user"] mutationKey: ["update-user"]
@@ -55,6 +55,8 @@ export const MyAccountPage = () => {
onSuccess: (res: any) => { onSuccess: (res: any) => {
toast?.success("اطلاعات کاربر با موفقیت بروز رسانی شد") toast?.success("اطلاعات کاربر با موفقیت بروز رسانی شد")
updateUser(res?.data?.user) updateUser(res?.data?.user)
console.log('user', res?.data?.user);
}, },
onError: (err: any) => handleError(err) onError: (err: any) => handleError(err)
}) })
@@ -69,6 +71,9 @@ export const MyAccountPage = () => {
setProvinceData(tempArray) setProvinceData(tempArray)
}, [provinces]) }, [provinces])
console.log('user 1 ', user);
useEffect(() => { useEffect(() => {
const tempCities: any = [] const tempCities: any = []
const newCities = cities?.data?.data?.filter((city: CitiesType) => city?.ProvinceName?.toLocaleLowerCase()?.includes(provinceName?.name?.toLowerCase())) const newCities = cities?.data?.data?.filter((city: CitiesType) => city?.ProvinceName?.toLocaleLowerCase()?.includes(provinceName?.name?.toLowerCase()))
@@ -84,8 +89,8 @@ export const MyAccountPage = () => {
reset({ reset({
address: user?.address, address: user?.address,
birthDate: user?.birthDate, birthDate: user?.birthDate,
city_name: { id: 1, name: user?.city_name }, city_name: { id: user?.city_name?.id, name: user?.city_name?.cityName },
province_name: { id: 1, name: user?.province_name }, province_name: { id: user?.province_name?.id, name: user?.province_name?.provinceName },
mobile_number: user?.mobile_number, mobile_number: user?.mobile_number,
first_name: user?.first_name, first_name: user?.first_name,
last_name: user?.last_name, last_name: user?.last_name,
@@ -93,7 +98,7 @@ export const MyAccountPage = () => {
shopName: user?.shopName, shopName: user?.shopName,
cell_number: user?.cell_number, cell_number: user?.cell_number,
}) })
}, [reset]) }, [reset, user])
return ( return (
<div className="w-full h-full flex flex-col gap-10 bg-auth-form rounded-[40px] p-[30px]"> <div className="w-full h-full flex flex-col gap-10 bg-auth-form rounded-[40px] p-[30px]">
<form onSubmit={handleSubmit(handleUpdateUser)} className="w-full h-full flex flex-col gap-10 bg-auth-form rounded-[40px]"> <form onSubmit={handleSubmit(handleUpdateUser)} className="w-full h-full flex flex-col gap-10 bg-auth-form rounded-[40px]">
@@ -101,14 +106,14 @@ export const MyAccountPage = () => {
<div className="flex flex-col gap-y-5 w-full xl:max-w-fit"> <div className="flex flex-col gap-y-5 w-full xl:max-w-fit">
<p className="font-medium text-xl text-primary-text-color">اطلاعات اولیه</p> <p className="font-medium text-xl text-primary-text-color">اطلاعات اولیه</p>
<p className="font-normal text-base text-secondary-text-color text-wrap xl:max-w-xs"> <p className="font-normal text-base text-secondary-text-color text-wrap xl:max-w-xs">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون اطلاعات اولیه خود را وارد کنید
</p> </p>
</div> </div>
<div className="flex flex-col gap-10 w-full"> <div className="flex flex-col gap-10 w-full">
<div className="grid grid-cols-1 md:grid-cols-2 gap-[18px]"> <div className="grid grid-cols-1 md:grid-cols-2 gap-[18px]">
<Controller name="mobile_number" control={control} render={({ field }) => ( <Controller name="mobile_number" control={control} render={({ field }) => (
<div> <div>
<Input placeholder={user?.mobile_number ? user?.mobile_number : "شماره تماس"} type="number" disabled field={field} /> <Input placeholder={user?.mobile_number ? user?.mobile_number : "شماره تماس"} type="number" field={field} />
<ErrorComponent show={errors.mobile_number} message={errors.mobile_number?.message} /> <ErrorComponent show={errors.mobile_number} message={errors.mobile_number?.message} />
</div> </div>
)} /> )} />
@@ -132,13 +137,13 @@ export const MyAccountPage = () => {
)} /> )} />
<Controller name="province_name" control={control} render={({ field }) => ( <Controller name="province_name" control={control} render={({ field }) => (
<div> <div>
<ComboBox field={field} data={provinceData} placeholder={user?.province_name} /> <ComboBox field={field} data={provinceData} placeholder={user?.province_name.provinceName} />
<ErrorComponent show={errors.province_name} message={errors.province_name?.message} /> <ErrorComponent show={errors.province_name} message={errors.province_name?.message} />
</div> </div>
)} /> )} />
<Controller name="city_name" control={control} render={({ field }) => ( <Controller name="city_name" control={control} render={({ field }) => (
<div> <div>
<ComboBox field={field} data={citiesData} placeholder={user?.city_name} /> <ComboBox field={field} data={citiesData} placeholder={user?.city_name?.cityName} />
<ErrorComponent show={errors.city_name} message={errors.city_name?.message} /> <ErrorComponent show={errors.city_name} message={errors.city_name?.message} />
</div> </div>
)} /> )} />
@@ -151,7 +156,7 @@ export const MyAccountPage = () => {
<div className="flex flex-col gap-y-5 w-full xl:max-w-fit"> <div className="flex flex-col gap-y-5 w-full xl:max-w-fit">
<p className="font-medium text-xl text-primary-text-color">اطلاعات تکمیلی</p> <p className="font-medium text-xl text-primary-text-color">اطلاعات تکمیلی</p>
<p className="font-normal text-base text-secondary-text-color text-wrap xl:max-w-xs"> <p className="font-normal text-base text-secondary-text-color text-wrap xl:max-w-xs">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون لطفا اطلاعات خود را کامل پر کنید
</p> </p>
</div> </div>
<div className="flex flex-col gap-10 w-full"> <div className="flex flex-col gap-10 w-full">
@@ -164,13 +169,13 @@ export const MyAccountPage = () => {
)} /> )} />
<Controller name="national_code" control={control} render={({ field }) => ( <Controller name="national_code" control={control} render={({ field }) => (
<div> <div>
<Input placeholder={user?.national_code} type="number" field={field} disabled /> <Input placeholder={user?.national_code} type="number" field={field} />
<ErrorComponent show={errors.national_code} message={errors.national_code?.message} /> <ErrorComponent show={errors.national_code || 'شماره ملی'} message={errors.national_code?.message} />
</div> </div>
)} /> )} />
<Controller name="cell_number" control={control} render={({ field }) => ( <Controller name="cell_number" control={control} render={({ field }) => (
<div> <div>
<Input placeholder={user?.cell_number} type="number" field={field} /> <Input placeholder={user?.cell_number || 'شماره تلفن ثابت'} type="number" field={field} />
<ErrorComponent show={errors.cell_number} message={errors.cell_number?.message} /> <ErrorComponent show={errors.cell_number} message={errors.cell_number?.message} />
</div> </div>
)} /> )} />
+1 -1
View File
@@ -13,7 +13,7 @@ export const SidebarItem: FC<Props> = ({ item }) => {
"bg-secondary-color": item?.route === pathname "bg-secondary-color": item?.route === pathname
})}> })}>
{item?.route === pathname ? item?.activeIcon : item?.icon} {item?.route === pathname ? item?.activeIcon : item?.icon}
<p className={clsx("font-normal text-base text-secondary-text-color", { <p className={clsx("font-normal text-sm text-secondary-text-color", {
"!text-primary-text-color": item?.route === pathname "!text-primary-text-color": item?.route === pathname
})}>{item?.title}</p> })}>{item?.title}</p>
</Link> </Link>
+2 -2
View File
@@ -11,10 +11,10 @@ export const Sidebar = () => {
navigate("/auth/login") navigate("/auth/login")
} }
return ( return (
<div className="hidden lg:flex bg-auth-form min-w-[318px] max-w-[318px] flex-col items-center py-[42px] gap-y-20"> <div className="hidden lg:flex bg-auth-form min-w-[250px] max-w-[318px] flex-col items-center py-[42px] gap-y-20">
<img src="/svgs/logo/logo.svg" alt="logo" className="auth-logo-size" /> <img src="/svgs/logo/logo.svg" alt="logo" className="auth-logo-size" />
<div className="flex flex-col justify-between h-full bg-auth-form "> <div className="flex flex-col justify-between h-full bg-auth-form ">
<div className="flex flex-col gap-y-3"> <div className="flex text-xs flex-col gap-y-3">
{sidebarItems?.map((item: SidebarInterface) => <SidebarItem key={item?.name} item={item} />)} {sidebarItems?.map((item: SidebarInterface) => <SidebarItem key={item?.name} item={item} />)}
</div> </div>
<div className="w-full flex flex-row gap-x-3 items-center rounded-[20px] p-3 min-w-52 cursor-pointer" onClick={handleExit}> <div className="w-full flex flex-row gap-x-3 items-center rounded-[20px] p-3 min-w-52 cursor-pointer" onClick={handleExit}>
+3 -1
View File
@@ -9,6 +9,7 @@ import { useMutation } from "@tanstack/react-query"
import { sendwithdraw } from "../../services/api/wallet" import { sendwithdraw } from "../../services/api/wallet"
import toast from "react-hot-toast" import toast from "react-hot-toast"
import { handleError } from "../../utility/error-handle" import { handleError } from "../../utility/error-handle"
import { Input } from "../common/input"
type Props = { type Props = {
pending: boolean pending: boolean
@@ -65,11 +66,12 @@ export const WalletAddress: FC<Props> = ({ pending }) => {
<> <>
<ComboBox placeholder="حساب بانکی مورد نظر خود را انتخاب کنید" data={userBanks} field={field} /> <ComboBox placeholder="حساب بانکی مورد نظر خود را انتخاب کنید" data={userBanks} field={field} />
<ErrorComponent show={errors?.card} message={errors?.card?.message} /> <ErrorComponent show={errors?.card} message={errors?.card?.message} />
{/* <Input placeholder="مبلغ را وارد کنید" /> */}
</> </>
)} />} )} />}
</div> </div>
{!pending && <p className="font-normal text-base text-primary-text-color text-justify lg:text-wrap"> {!pending && <p className="font-normal text-base text-primary-text-color text-justify lg:text-wrap">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز برای درخواست برداشت از حساب، حساب بانکی مورد نظر خود را انتخاب کنید. پس از انتخاب حساب بانکی، مبلغ مورد نظر خود را وارد کرده و درخواست خود را ثبت کنید.
</p>} </p>}
{pending && <p className="text-lg font-normal text-justify lg:text-wrap"> {pending && <p className="text-lg font-normal text-justify lg:text-wrap">
{`همکار گرامی {`همکار گرامی
+48 -50
View File
@@ -3,73 +3,71 @@
@tailwind utilities; @tailwind utilities;
@font-face { @font-face {
font-family: "vazirmatn"; font-family: "vazirmatn";
src: url("../public/fonts/Vazir.woff") format('woff'); src: url("../public/fonts/Vazir.woff") format("woff");
} }
@font-face { @font-face {
font-family: "vaziren"; font-family: "vaziren";
src: url("../public/fonts/VazirEn.woff") format('woff'); src: url("../public/fonts/VazirEn.woff") format("woff");
} }
@layer base { @layer base {
* { * {
font-family: 'vazirmatn', 'vaziren'; font-family: "vazirmatn", "vaziren";
} }
body { body {
direction: rtl; direction: rtl;
scrollbar-width: none; scrollbar-width: none;
} font-size: 14px;
}
input[type=number]::-webkit-outer-spin-button, input[type="number"]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
input[type=number] { input[type="number"] {
-moz-appearance: textfield; -moz-appearance: textfield;
} }
button { button {
@apply text-base font-medium flex w-full justify-center bg-primary-color max-h-[55px] rounded-[20px] p-[18px] text-white @apply text-base font-medium flex w-full justify-center bg-primary-color max-h-[55px] rounded-[20px] p-[18px] text-white;
} }
table { table {
@apply w-full border-collapse @apply w-full border-collapse;
} }
#otp { #otp {
direction: ltr !important; direction: ltr !important;
} }
} }
@layer components { @layer components {
.auth-image-desktop { .auth-image-desktop {
@apply size-[550px] max-w-[550px] @apply size-[550px] max-w-[550px];
} }
.input-style { .input-style {
@apply w-full bg-white rounded-[60px] p-[18px] max-w-[442px] shadow-sm focus:outline-none @apply w-full bg-white rounded-[60px] h-12 px-4 max-w-[442px] shadow-sm focus:outline-none;
} }
.auth-logo-size { .auth-logo-size {
@apply w-full max-w-[198px] h-auto @apply w-full max-w-[198px] h-auto;
} }
.otp-inputs { .otp-inputs {
@apply !w-full max-w-[40px] min-h-[40px] sm:max-w-[50px] sm:min-h-[50px] lg:max-w-[72px] lg:min-h-[72px] rounded-full ml-2 @apply !w-full max-w-[40px] min-h-[40px] sm:max-w-[50px] sm:min-h-[50px] lg:max-w-[72px] lg:min-h-[72px] rounded-full ml-2;
} }
.otp-container { .otp-container {
@apply min-w-max @apply min-w-max;
} }
.bank-bg { .bank-bg {
@apply bg-contain bg-center bg-no-repeat @apply bg-contain bg-center bg-no-repeat;
} }
} }
+190 -105
View File
@@ -1,130 +1,215 @@
import * as yup from 'yup' import * as yup from "yup";
export const loginSchema = yup.object({ export const loginSchema = yup.object({
username: yup.string() username: yup
.required("وارد کردن نام کاربری الزامی میباشد") .string()
.min(10, "نام کاربری نمیتوند کمتر از 10 رقم باشد") .required("وارد کردن نام کاربری الزامی میباشد")
.max(10, "نام کاربری نمیتواند بیشتر از 10 رقم باشد") .min(10, "نام کاربری نمیتوند کمتر از 10 رقم باشد")
.matches(/^[0-9]{10}$/, "شماره تماس نامعتبر"), .max(10, "نام کاربری نمیتواند بیشتر از 10 رقم باشد")
password: yup.string() .matches(/^[0-9]{10}$/, "شماره تماس نامعتبر"),
.required("وارد کردن رمزعبور الزامی میباشد") password: yup
.min(8, "رمزعبور نمیتواند کمتر از 8 کاراکتر باشد") .string()
}) .required("وارد کردن رمزعبور الزامی میباشد")
.min(8, "رمزعبور نمیتواند کمتر از 8 کاراکتر باشد"),
});
export const resetPasswordSchema = yup.object({ export const resetPasswordSchema = yup.object({
password: yup.string().min(8, "رمز عبور نمیتواند کمتر از 8 کاراکتر باشد").required("رمز عبور الزامی میباشد"), password: yup
password_confirmation: yup.string() .string()
.oneOf([yup.ref('password')], "رمز عبور و تکرار آن باید یکسان باشند") .min(8, "رمز عبور نمیتواند کمتر از 8 کاراکتر باشد")
.required("تکرار رمز عبور الزامی میباشد"), .required("رمز عبور الزامی میباشد"),
}) password_confirmation: yup
.string()
.oneOf([yup.ref("password")], "رمز عبور و تکرار آن باید یکسان باشند")
.required("تکرار رمز عبور الزامی میباشد"),
});
export const forgotPasswordSchema = yup.object({ export const forgotPasswordSchema = yup.object({
mobile_number: yup.string() mobile_number: yup
.required("وارد کردن شماره تماس الزامی میباشد") .string()
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد") .required("وارد کردن شماره تماس الزامی میباشد")
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد") .min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"), .max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد")
}) .matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"),
});
export const LoginWithCodeSchema = yup.object({ export const LoginWithCodeSchema = yup.object({
mobile_number: yup.string() mobile_number: yup
.required("وارد کردن شماره تماس الزامی میباشد") .string()
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد") .required("وارد کردن شماره تماس الزامی میباشد")
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد") .min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"), .max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد")
}) .matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"),
});
export const ResetPasswordCodeSchema = yup.object({ export const ResetPasswordCodeSchema = yup.object({
mobile_number: yup.string() mobile_number: yup
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد") .string()
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد") .min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"), .max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد")
otp: yup.string() .matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"),
.required("وارد کردن کد الزامی میباشد") otp: yup
.min(6, "کد نمیتوند کمتر از 6 رقم باشد") .string()
.max(6, "کد نمیتواند بیشتر از 6 رقم باشد") .required("وارد کردن کد الزامی میباشد")
.matches(/^[0-9]{6}$/, "کد نامعتبر"), .min(6, "کد نمیتوند کمتر از 6 رقم باشد")
}) .max(6, "کد نمیتواند بیشتر از 6 رقم باشد")
.matches(/^[0-9]{6}$/, "کد نامعتبر"),
});
export const LoginCodeSchema = yup.object({ export const LoginCodeSchema = yup.object({
mobile_number: yup.string() mobile_number: yup
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد") .string()
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد") .min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"), .max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد")
otp: yup.string() .matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"),
.required("وارد کردن کد الزامی میباشد") otp: yup
.min(6, "کد نمیتوند کمتر از 6 رقم باشد") .string()
.max(6, " کد نمیتواند بیشتر از 6 رقم باشد") .required("وارد کردن کد الزامی میباشد")
.matches(/^[0-9]{6}$/, "کد نامعتبر"), .min(6, "کد نمیتوند کمتر از 6 رقم باشد")
}) .max(6, " کد نمیتواند بیشتر از 6 رقم باشد")
.matches(/^[0-9]{6}$/, "کد نامعتبر"),
});
export const RegisterSchema = yup.object({ export const RegisterSchema = yup.object({
first_name: yup.string().required("وارد کردن نام الزامی میباشد").min(3, "نام نمیتواند کمتر از 3 کاراکتر باشد").max(20, "نام نمیتواند بیشتر از 20 کاراکتر باشد"), first_name: yup
last_name: yup.string().required("وارد کردن نام خانوادگی الزامی میباشد").min(3, "نام خانوادگی نمیتواند کمتر از 3 کاراکتر باشد").max(25, "نام خانوادگی نمیتواند بیشتر از 25 کاراکتر باشد"), .string()
national_code: yup.string().required("وارد کردن کد ملی الزامی میباشد").min(10, "کد ملی نمیتواند کمتر از 10 کاراکتر باشد").max(10, "کد ملی نمیتونه بیشتر از 10 کاراکتر باشه").matches(/^[0-9]{10}$/, "کد نامعتبر"), .required("وارد کردن نام الزامی میباشد")
city_name: yup.object().required("وارد کردن شهر الزامی مباشد"), .min(3, "نام نمیتواند کمتر از 3 کاراکتر باشد")
province_name: yup.object().required("وارد کردن استان الزامی مباشد"), .max(20, "نام نمیتواند بیشتر از 20 کاراکتر باشد"),
shopName: yup.string().required("وارد کردن نام فروشگاه الزامی میباشد").min(2, "نام فروشگاه نمیتواند کمتر از 3 کاراکتر باشد").max(30, "نام فروشگاه نمیتواند بیشتر از 30 کاراکتر باشد"), last_name: yup
mobile_number: yup.string() .string()
.required("وارد کردن شماره تماس الزامی میباشد") .required("وارد کردن نام خانوادگی الزامی میباشد")
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد") .min(3, "نام خانوادگی نمیتواند کمتر از 3 کاراکتر باشد")
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد") .max(25, "نام خانوادگی نمیتواند بیشتر از 25 کاراکتر باشد"),
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"), national_code: yup
password: yup.string().min(8, "رمز عبور نمیتواند کمتر از 8 کاراکتر باشد").required("رمز عبور الزامی میباشد"), .string()
password_confirmation: yup.string() .required("وارد کردن کد ملی الزامی میباشد")
.oneOf([yup.ref('password')], "رمز عبور و تکرار آن باید یکسان باشند") .min(10, "کد ملی نمیتواند کمتر از 10 کاراکتر باشد")
.required("تکرار رمز عبور الزامی میباشد"), .max(10, "کد ملی نمیتونه بیشتر از 10 کاراکتر باشه")
}) .matches(/^[0-9]{10}$/, "کد نامعتبر"),
city_name: yup.object().required("وارد کردن شهر الزامی مباشد"),
province_name: yup.object().required("وارد کردن استان الزامی مباشد"),
shopName: yup
.string()
.required("وارد کردن نام فروشگاه الزامی میباشد")
.min(2, "نام فروشگاه نمیتواند کمتر از 3 کاراکتر باشد")
.max(30, "نام فروشگاه نمیتواند بیشتر از 30 کاراکتر باشد"),
mobile_number: yup
.string()
.required("وارد کردن شماره تماس الزامی میباشد")
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد")
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"),
password: yup
.string()
.min(8, "رمز عبور نمیتواند کمتر از 8 کاراکتر باشد")
.required("رمز عبور الزامی میباشد"),
password_confirmation: yup
.string()
.oneOf([yup.ref("password")], "رمز عبور و تکرار آن باید یکسان باشند")
.required("تکرار رمز عبور الزامی میباشد"),
});
export const UpdateUserSchema = yup.object({ export const UpdateUserSchema = yup.object({
first_name: yup.string().required("وارد کردن نام الزامی میباشد").min(3, "نام نمیتواند کمتر از 3 کاراکتر باشد").max(20, "نام نمیتواند بیشتر از 20 کاراکتر باشد"), first_name: yup
last_name: yup.string().required("وارد کردن نام خانوادگی الزامی میباشد").min(3, "نام خانوادگی نمیتواند کمتر از 3 کاراکتر باشد").max(25, "نام خانوادگی نمیتواند بیشتر از 25 کاراکتر باشد"), .string()
city_name: yup.object().required("وارد کردن شهر الزامی مباشد"), .required("وارد کردن نام الزامی میباشد")
province_name: yup.object().required("وارد کردن استان الزامی مباشد"), .min(3, "نام نمیتواند کمتر از 3 کاراکتر باشد")
shopName: yup.string().required("وارد کردن نام فروشگاه الزامی میباشد").min(2, "نام فروشگاه نمیتواند کمتر از 3 کاراکتر باشد").max(30, "نام فروشگاه نمیتواند بیشتر از 30 کاراکتر باشد"), .max(20, "نام نمیتواند بیشتر از 20 کاراکتر باشد"),
birthDate: yup.string().required("وارد کردن تاریخ تولد الزامی میباشد"), last_name: yup
address: yup.string().required("وارد کردن آدرس الزامی میباشد").min(5, "آدرس نمیتواند کمتر از 5 کاراکتر باشد").max(50, "آدرس نمیتواند بیشتر از از 50 کاراکتر باشد"), .string()
cell_number: yup.string() .required("وارد کردن نام خانوادگی الزامی میباشد")
.min(11, "شماره تلفن ثابت نمیتوند کمتر از 11 رقم باشد") .min(3, "نام خانوادگی نمیتواند کمتر از 3 کاراکتر باشد")
.max(11, "شماره ثابت نمیتواند بیشتر از 11 رقم باشد") .max(25, "نام خانوادگی نمیتواند بیشتر از 25 کاراکتر باشد"),
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر").required("وارد کردن شماره تلفن ثابت الزامی میباشد"), city_name: yup.object().required("وارد کردن شهر الزامی مباشد"),
national_code: yup.string().min(10, "کد ملی نمیتواند کمتر از 10 کاراکتر باشد").max(10, "کد ملی نمیتونه بیشتر از 10 کاراکتر باشه").matches(/^[0-9]{10}$/, "کد نامعتبر"), province_name: yup.object().required("وارد کردن استان الزامی مباشد"),
mobile_number: yup.string() shopName: yup
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد") .string()
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد") .required("وارد کردن نام فروشگاه الزامی میباشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"), .min(2, "نام فروشگاه نمیتواند کمتر از 3 کاراکتر باشد")
}) .max(30, "نام فروشگاه نمیتواند بیشتر از 30 کاراکتر باشد"),
birthDate: yup.string().required("وارد کردن تاریخ تولد الزامی میباشد"),
address: yup
.string()
.required("وارد کردن آدرس الزامی میباشد")
.min(5, "آدرس نمیتواند کمتر از 5 کاراکتر باشد")
.max(50, "آدرس نمیتواند بیشتر از از 50 کاراکتر باشد"),
cell_number: yup
.string()
.min(11, "شماره تلفن ثابت نمیتوند کمتر از 11 رقم باشد")
.max(11, "شماره ثابت نمیتواند بیشتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر")
.required("وارد کردن شماره تلفن ثابت الزامی میباشد"),
national_code: yup
.string()
.min(10, "کد ملی نمیتواند کمتر از 10 کاراکتر باشد")
.max(10, "کد ملی نمیتونه بیشتر از 10 کاراکتر باشه")
.matches(/^[0-9]{10}$/, "کد نامعتبر"),
mobile_number: yup
.string()
.min(11, "شماره تماس نمیتوند کمتر از 11 رقم باشد")
.max(11, "شماره تماس نمیتواند بیشتر از 11 رقم باشد")
.matches(/^[0-9]{11}$/, "شماره تماس نامعتبر"),
});
export const AddNewCardSchema = yup.object({ export const AddNewCardSchema = yup.object({
name: yup.string().required("وارد کردن نام الزامی میباشد").min(3, "نام نمیتواند کمتر از 3 کاراکتر باشد").max(20, "نام نمیتواند بیشتر از 20 کاراکتر باشد"), name: yup
family: yup.string().required("وارد کردن نام خانوادگی الزامی میباشد").min(3, "نام خانوادگی نمیتواند کمتر از 3 کاراکتر باشد").max(25, "نام خانوادگی نمیتواند بیشتر از 25 کاراکتر باشد"), .string()
PAN: yup.string() .required("وارد کردن نام الزامی میباشد")
.required("وارد کردن شماره کارت الزامی میباشد") .min(3, "نام نمیتواند کمتر از 3 کاراکتر باشد")
.min(16, "شماره کارت نمیتوند کمتر از 16 رقم باشد") .max(20, "نام نمیتواند بیشتر از 20 کاراکتر باشد"),
.max(16, " شماره کارت نمیتواند بیشتر از 16 رقم باشد") family: yup
.matches(/^[0-9]{16}$/, "شماره کارت نامعتبر"), .string()
IBAN: yup.string() .required("وارد کردن نام خانوادگی الزامی میباشد")
.required("وارد کردن شماره شبا الزامی میباشد") .min(3, "نام خانوادگی نمیتواند کمتر از 3 کاراکتر باشد")
.min(26, "شماره شبا نمیتوند کمتر از 26 رقم باشد") .max(25, "نام خانوادگی نمیتواند بیشتر از 25 کاراکتر باشد"),
.max(26, " شماره شبا نمیتواند بیشتر از 26 رقم باشد") PAN: yup
.matches(/^IR[0-9]{24}$/, "شماره شبا نامعتبر"), .string()
}) .required("وارد کردن شماره کارت الزامی میباشد")
.min(16, "شماره کارت نمیتوند کمتر از 16 رقم باشد")
.max(16, " شماره کارت نمیتواند بیشتر از 16 رقم باشد")
.matches(/^[0-9]{16}$/, "شماره کارت نامعتبر"),
IBAN: yup
.string()
.required("وارد کردن شماره شبا الزامی میباشد")
.min(24, "شماره شبا نمیتوند کمتر از 24 رقم باشد")
.max(24, " شماره شبا نمیتواند بیشتر از 24 رقم باشد"),
// .matches(/^IR[0-9]{24}$/, "شماره شبا نامعتبر"),
});
export const ResetPasswordUserSchema = yup.object({ export const ResetPasswordUserSchema = yup.object({
password: yup.string().min(8, "رمز عبور نمی‌تواند کمتر از 8 کاراکتر باشد").required("رمز عبور الزامی می‌باشد"), password: yup
newPassword: yup.string().min(8, "رمز عبور جدید نمی‌تواند کمتر از 8 کاراکتر باشد") .string()
.notOneOf([yup.ref('password')], "رمز عبور جدید نباید با رمز عبور فعلی یکسان باشد") .min(8, "رمز عبور نمی‌تواند کمتر از 8 کاراکتر باشد")
.required("رمز عبور جدید الزامی می‌باشد"), .required("رمز عبور الزامی می‌باشد"),
password_confirmation: yup.string() newPassword: yup
.oneOf([yup.ref('newPassword')], "رمز عبور جدید و تکرار آن باید یکسان باشند") .string()
.required("تکرار رمز عبور الزامی می‌باشد"), .min(8, "رمز عبور جدید نمی‌تواند کمتر از 8 کاراکتر باشد")
.notOneOf(
[yup.ref("password")],
"رمز عبور جدید نباید با رمز عبور فعلی یکسان باشد"
)
.required("رمز عبور جدید الزامی می‌باشد"),
password_confirmation: yup
.string()
.oneOf(
[yup.ref("newPassword")],
"رمز عبور جدید و تکرار آن باید یکسان باشند"
)
.required("تکرار رمز عبور الزامی می‌باشد"),
}); });
export const SendWithdrawSchema = yup.object({ export const SendWithdrawSchema = yup.object({
holderName: yup.string().required("وارد کردن اطلاعات صاحب کارت الزامی میباشد"), holderName: yup
card: yup.object(), .string()
}) .required("وارد کردن اطلاعات صاحب کارت الزامی میباشد"),
card: yup.object(),
});
export const checkIMEISchema = yup.object({ export const checkIMEISchema = yup.object({
IMEI: yup.string().required("وارد کردن اطلاعات IMEI الزامی میباشد").min(15,"شناسه IMEI نمیتواند کمتر از 15 کاراکتر باشد").max(15,"شناسه IMEI نمیتواند بیشتر از 15 کاراکتر باشد"), IMEI: yup
}) .string()
.required("وارد کردن اطلاعات IMEI الزامی میباشد")
.min(15, "شناسه IMEI نمیتواند کمتر از 15 کاراکتر باشد")
.max(15, "شناسه IMEI نمیتواند بیشتر از 15 کاراکتر باشد"),
});
+15 -9
View File
@@ -1,15 +1,21 @@
import axiosInstance from "../axios"; import axiosInstance from "../axios";
type CreateNewCard = { type CreateNewCard = {
holderName: string, holderName: string;
PAN: string, PAN: string;
IBAN: string IBAN: string;
} };
type DeleteCard = { type DeleteCard = {
id: string | number | null id: string | number | null;
} };
export const createNewCardMutation = (payload: CreateNewCard) => axiosInstance.post<any>("gps/bank-card", payload) export const createNewCardMutation = (payload: CreateNewCard) =>
export const deleteCardMutation = (payload: DeleteCard) => axiosInstance.delete<any>(`gps/bank-card/${payload?.id}`) axiosInstance.post<any>("gps/bank-card", payload);
export const getUserCardsList = () => axiosInstance.get<any>("gps/bank-card") export const updateCard = (payload: any) =>
axiosInstance.put<any>(`gps/bank-card/${payload.id}`, payload);
export const deleteCardMutation = (payload: DeleteCard) =>
axiosInstance.delete<any>(`gps/bank-card/${payload?.id}`);
export const getCardDetail = (payload: DeleteCard) =>
axiosInstance.get<any>(`gps/bank-card/${payload?.id}`);
export const getUserCardsList = () => axiosInstance.get<any>("gps/bank-card");
+9 -8
View File
@@ -1,16 +1,17 @@
import axios from "axios"; import axios from "axios";
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: 'https://asan-service.com/api', // baseURL: "http://192.168.0.217:7420/api",
baseURL: "https://asan-service.com/api",
}); });
axiosInstance.interceptors.request.use(async function (config) { axiosInstance.interceptors.request.use(async function (config) {
// const search = window.location.search; // const search = window.location.search;
// const params = new URLSearchParams(search) // const params = new URLSearchParams(search)
const token = localStorage.getItem("token") && localStorage.getItem("token") const token = localStorage.getItem("token") && localStorage.getItem("token");
config.headers.Authorization = 'Bearer ' + token config.headers.Authorization = "Bearer " + token;
// config.params = params && params // config.params = params && params
return await config; return await config;
}); });
export default axiosInstance; export default axiosInstance;
+49 -49
View File
@@ -1,56 +1,56 @@
import { create } from 'zustand'; import { create } from "zustand";
import { UserInterface } from '../types'; import { UserInterface } from "../types";
import { persist } from "zustand/middleware"; import { persist } from "zustand/middleware";
type ZustandState = { type ZustandState = {
user: UserInterface; user: UserInterface;
updateUser: (userData: Partial<UserInterface>) => void; updateUser: (userData: Partial<UserInterface>) => void;
clearUser: () => void; clearUser: () => void;
}; };
const defaultParams: UserInterface = { const defaultParams: UserInterface = {
cardBank: [], cardBank: [],
city_name: "", city_name: "",
created_at: "", created_at: "",
dollarBalance: "", dollarBalance: "",
first_name: "", first_name: "",
id: "", id: "",
last_name: "", last_name: "",
mobile_number: "", mobile_number: "",
national_code: "", national_code: "",
profilePic: "", profilePic: "",
province_name: "", province_name: "",
score: 0, score: 0,
shopName: "", shopName: "",
updated_at: "", updated_at: "",
walletBalance: 0, walletBalance: 0,
active: true, active: true,
_id: "", _id: "",
address: "", address: "",
birthDate: "", birthDate: "",
cell_number: "", cell_number: "",
} };
export const useUserStore = create<ZustandState>()( export const useUserStore = create<ZustandState>()(
persist( persist(
(set) => ({ (set) => ({
user: defaultParams, user: defaultParams,
updateUser: (userData: Partial<UserInterface>) => updateUser: (userData: Partial<UserInterface>) =>
set((state) => ({ set((state) => ({
...state, ...state,
user: { user: {
...state.user, ...state.user,
...userData, ...userData,
}, },
})), })),
clearUser: () => clearUser: () =>
set((state) => ({ set((state) => ({
...state, ...state,
user: defaultParams, user: defaultParams,
})), })),
}), }),
{ {
name: 'user-store', name: "user-store",
getStorage: () => localStorage getStorage: () => localStorage,
} }
) )
); );
+227 -228
View File
@@ -1,356 +1,355 @@
import React from "react" import React from "react";
export interface LoginFormInterface { export interface LoginFormInterface {
username: string, username: string;
password: string, password: string;
remember_me?: boolean remember_me?: boolean;
} }
export interface LoginResponseInterface { export interface LoginResponseInterface {
token: string token: string;
} }
export interface ResetPasswordInterface { export interface ResetPasswordInterface {
mobile_number?: string | any, mobile_number?: string | any;
otp?: string | any, otp?: string | any;
password: string, password: string;
password_confirmation: string password_confirmation: string;
} }
export interface ForgotPasswordInterface { export interface ForgotPasswordInterface {
mobile_number: string mobile_number: string;
} }
export interface LoginWithCodeInterface { export interface LoginWithCodeInterface {
mobile_number: string | any mobile_number: string | any;
} }
export interface ResetPasswordCodeInterface { export interface ResetPasswordCodeInterface {
mobile_number?: string | any mobile_number?: string | any;
otp: string otp: string;
} }
export interface LoginCodeInterface { export interface LoginCodeInterface {
mobile_number: any mobile_number: any;
otp: string otp: string;
} }
export interface RegisterInterface { export interface RegisterInterface {
first_name: string first_name: string;
last_name: string last_name: string;
national_code: string national_code: string;
city_name: object | any city_name: object | any;
province_name: object | any province_name: object | any;
shopName: string shopName: string;
mobile_number: string mobile_number: string;
password: string password: string;
password_confirmation: string password_confirmation: string;
} }
export interface SidebarInterface { export interface SidebarInterface {
name: string, name: string;
title: string, title: string;
route: string, route: string;
icon: React.ReactNode, icon: React.ReactNode;
activeIcon: React.ReactNode activeIcon: React.ReactNode;
} }
export interface SocialsInterface { export interface SocialsInterface {
name: string, name: string;
path: string path: string;
} }
export interface StatusBoxItemInterface { export interface StatusBoxItemInterface {
name: string, name: string;
title: string, title: string;
icon: React.ReactNode, icon: React.ReactNode;
value: number, value: number;
detail?: boolean detail?: boolean;
} }
export interface UpdateUserInterface { export interface UpdateUserInterface {
id?: any, id?: any;
first_name: string first_name: string;
last_name: string last_name: string;
city_name: object | any city_name: object | any;
province_name: object | any province_name: object | any;
shopName: string shopName: string;
birthDate: string birthDate: string;
address: string address: string;
cell_number: string, cell_number: string;
national_code?: string, national_code?: string;
mobile_number?: string, mobile_number?: string;
image?: any image?: any;
} }
export interface CardBank { export interface CardBank {
_id: string, _id: string;
holderName: string, holderName: string;
PAN: number, PAN: number;
IBAN: string, IBAN: string;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
id: string id: string;
} }
export interface BankCartInterface { export interface BankCartInterface {
_id: string, _id: string;
cardBank: CardBank[] | [] | CardBank cardBank: CardBank[] | [] | CardBank;
id: string id: string;
} }
export interface BanksInterface { export interface BanksInterface {
name: string, name: string;
name_farsi: string, name_farsi: string;
icon: React.ReactNode, icon: React.ReactNode;
iban_nbc: string, iban_nbc: string;
pan_iin: string[] | [] pan_iin: string[] | [];
} }
export interface AddNewCartInterface { export interface AddNewCartInterface {
name: string name: string;
family: string family: string;
PAN: string PAN: string;
IBAN: string IBAN: string;
holderName?: string;
} }
export interface installationReportsInterface { export interface installationReportsInterface {
status: boolean status: boolean;
dollar: string dollar: string;
score: string score: string;
device_model: string device_model: string;
imei_number: string imei_number: string;
install_date: string install_date: string;
install_iemi: string install_iemi: string;
} }
export interface colConfig { export interface colConfig {
accessor: string accessor: string;
header: string header: string;
cellRenderer?: (info: any) => JSX.Element; cellRenderer?: (info: any) => JSX.Element;
} }
export interface TransactionsInterface { export interface TransactionsInterface {
status: boolean status: boolean;
amount: string amount: string;
request_date: string request_date: string;
traking_number: string traking_number: string;
deposit_date: string deposit_date: string;
} }
export interface ScoreInterface { export interface ScoreInterface {
title: string title: string;
score: number score: number;
date: string date: string;
} }
export interface SubscriptionReportInterface { export interface SubscriptionReportInterface {
imei_number: string imei_number: string;
renewal_date: string renewal_date: string;
renewal_type: string renewal_type: string;
amount: string amount: string;
contribution: string, contribution: string;
percentage: string percentage: string;
} }
export interface DeviceId { export interface DeviceId {
tomanPrice: number, tomanPrice: number;
dollarProfit: number, dollarProfit: number;
profit: number, profit: number;
status: number, status: number;
_id: string, _id: string;
IMEI: string, IMEI: string;
model: string, model: string;
score: number, score: number;
renewalProfit: number, renewalProfit: number;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
__v: number, __v: number;
id: string id: string;
} }
export interface RegisterDeviceResponse { export interface RegisterDeviceResponse {
data: RegisterDeviceData[] | [], data: RegisterDeviceData[] | [];
total: number total: number;
} }
export interface RegisterDeviceData { export interface RegisterDeviceData {
status: number, status: number;
_id: string, _id: string;
deviceId: DeviceId[] | [], deviceId: DeviceId[] | [];
registerDate: string, registerDate: string;
userId: string, userId: string;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
__v: number, __v: number;
id: string id: string;
} }
export interface RegisterDeviceId { export interface RegisterDeviceId {
tomanPrice: number, tomanPrice: number;
dollarProfit: number, dollarProfit: number;
profit: number, profit: number;
status: number, status: number;
_id: string, _id: string;
IMEI: string, IMEI: string;
model: string, model: string;
score: number, score: number;
renewalProfit: number, renewalProfit: number;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
__v: number, __v: number;
id: string id: string;
} }
export interface AwardsResponse { export interface AwardsResponse {
score: number, score: number;
title: string, title: string;
desc: string desc: string;
req: { req: {
userId: string, userId: string;
desc: string, desc: string;
metaData: null | any, metaData: null | any;
status: number status: number;
}, };
status: number, status: number;
expireDate: string expireDate: string;
} }
interface TransactionsData { interface TransactionsData {
_id: string, _id: string;
card: TransactionsCard card: TransactionsCard;
userId: string, userId: string;
amount: number, amount: number;
dollarAmount: number, dollarAmount: number;
status: number, status: number;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
__v: number, __v: number;
id: string id: string;
} }
interface TransactionsCard { interface TransactionsCard {
_id: string, _id: string;
holderName: string, holderName: string;
PAN: number, PAN: number;
IBAN: string, IBAN: string;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
id: string id: string;
} }
export interface TransactionsResponse { export interface TransactionsResponse {
data: TransactionsData[] | [], data: TransactionsData[] | [];
total: number total: number;
} }
type OverviewUser = { type OverviewUser = {
walletBalance: number, walletBalance: number;
dollarBalance: number, dollarBalance: number;
score: number, score: number;
_id: string, _id: string;
id: string id: string;
} };
export interface OverviewResponse { export interface OverviewResponse {
pending: boolean, pending: boolean;
user: OverviewUser user: OverviewUser;
} }
type ScoreData = { type ScoreData = {
_id: string, _id: string;
deviceId: string, deviceId: string;
score: number, score: number;
created_at: string, created_at: string;
updated_at: string, updated_at: string;
__v: number, __v: number;
userId: string, userId: string;
id: string id: string;
} };
export interface ScoreResponse { export interface ScoreResponse {
data: ScoreData[] | [] data: ScoreData[] | [];
score: number, score: number;
total: number total: number;
} }
export interface ComboBoxItems { export interface ComboBoxItems {
name: string, name: string;
id: number id: number;
} }
export interface TableParams { export interface TableParams {
page: number, page: number;
rows: number, rows: number;
search: string search: string;
} }
export type ProvinceType = { export type ProvinceType = {
ProvinceID: number, ProvinceID: number;
ProvinceName: string ProvinceName: string;
} };
export interface ProvinceResponse { export interface ProvinceResponse {
data: { data: ProvinceType[] | [], } data: { data: ProvinceType[] | [] };
error: string | null error: string | null;
} }
export interface LoginWithOTP { export interface LoginWithOTP {
mobile_number?: string | any mobile_number?: string | any;
otp: string otp: string;
} }
export type CitiesType = { export type CitiesType = {
CityID: number, CityID: number;
CityName: string, CityName: string;
ProvinceID: string, ProvinceID: string;
ProvinceName: string ProvinceName: string;
} };
export interface CitiesResponse { export interface CitiesResponse {
data: CitiesType[] | [], data: CitiesType[] | [];
error: string | null | any error: string | null | any;
} }
export interface UserInterface { export interface UserInterface {
cardBank: CardBank[] | [], cardBank: CardBank[] | [];
city_name: string, city_name: string;
created_at: string, created_at: string;
dollarBalance: string, dollarBalance: string;
first_name: string, first_name: string;
id: string, id: string;
last_name: string, last_name: string;
mobile_number: string, mobile_number: string;
national_code: string, national_code: string;
profilePic: string, profilePic: string;
province_name: string province_name: string;
score: number score: number;
shopName: string shopName: string;
updated_at: string updated_at: string;
walletBalance: number walletBalance: number;
active: boolean, active: boolean;
_id: string, _id: string;
address: string, address: string;
birthDate: string, birthDate: string;
cell_number: string cell_number: string;
} }
export interface ResetPasswordUser { export interface ResetPasswordUser {
password: string, password: string;
newPassword: string, newPassword: string;
password_confirmation: string password_confirmation: string;
} }
export interface AwardStatus { export interface AwardStatus {
awards: number, awards: number;
my_score: number my_score: number;
} }
export interface SendWithdraw { export interface SendWithdraw {
holderName: string, holderName: string;
card: any card: any;
} }
export interface CheckIMEI { export interface CheckIMEI {
IMEI: string IMEI: string;
} }
+18 -18
View File
@@ -7,63 +7,63 @@ export const sidebarItems: SidebarInterface[] | [] = [
name: "home", name: "home",
title: "صفحه اصلی", title: "صفحه اصلی",
route: "/", route: "/",
icon: <Home2 color="#777577" className="size-[27px]" variant="Bold" />, icon: <Home2 color="#777577" className="size-5" variant="Bold" />,
activeIcon: <Home2 color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <Home2 color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "my-account", name: "my-account",
title: "حساب من", title: "حساب من",
route: "/my-account", route: "/my-account",
icon: <UserSquare color="#777577" className="size-[27px]" variant="Bold" />, icon: <UserSquare color="#777577" className="size-5" variant="Bold" />,
activeIcon: <UserSquare color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <UserSquare color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "wallet", name: "wallet",
title: "کیف پول", title: "کیف پول",
route: "/wallet", route: "/wallet",
icon: <Wallet color="#777577" className="size-[27px]" variant="Bold" />, icon: <Wallet color="#777577" className="size-5" variant="Bold" />,
activeIcon: <Wallet color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <Wallet color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "management-bank-accounts", name: "management-bank-accounts",
title: "مدیریت حساب های بانکی", title: "مدیریت حساب های بانکی",
route: "/management-bank-accounts", route: "/management-bank-accounts",
icon: <CardPos color="#777577" className="size-[27px]" variant="Bold" />, icon: <CardPos color="#777577" className="size-5" variant="Bold" />,
activeIcon: <CardPos color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <CardPos color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "installation-reports", name: "installation-reports",
title: "گزارش نصب ها", title: "گزارش نصب ها",
route: "/installation-reports", route: "/installation-reports",
icon: <SmartCar color="#777577" className="size-[27px]" variant="Bold" />, icon: <SmartCar color="#777577" className="size-5" variant="Bold" />,
activeIcon: <SmartCar color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <SmartCar color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "transactions", name: "transactions",
title: "تراکنش ها", title: "تراکنش ها",
route: "/transactions", route: "/transactions",
icon: <ReceiptItem color="#777577" className="size-[27px]" variant="Bold" />, icon: <ReceiptItem color="#777577" className="size-5" variant="Bold" />,
activeIcon: <ReceiptItem color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <ReceiptItem color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "my-score", name: "my-score",
title: "امتیاز من", title: "امتیاز من",
route: "/my-score", route: "/my-score",
icon: <StarSlash color="#777577" className="size-[27px]" variant="Bold" />, icon: <StarSlash color="#777577" className="size-5" variant="Bold" />,
activeIcon: <StarSlash color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <StarSlash color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "awards", name: "awards",
title: "جوایز", title: "جوایز",
route: "/awards", route: "/awards",
icon: <Cup color="#777577" className="size-[27px]" variant="Bold" />, icon: <Cup color="#777577" className="size-5" variant="Bold" />,
activeIcon: <Cup color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <Cup color="#11212D" className="size-5" variant="Bold" />
}, },
{ {
name: "subscription-report", name: "subscription-report",
title: "گزارش تمدید اشتراک اینترنتی", title: "گزارش تمدید اشتراک اینترنتی",
route: "/subscription-report", route: "/subscription-report",
icon: <DocumentText color="#777577" className="size-[27px]" variant="Bold" />, icon: <DocumentText color="#777577" className="size-5" variant="Bold" />,
activeIcon: <DocumentText color="#11212D" className="size-[27px]" variant="Bold" /> activeIcon: <DocumentText color="#11212D" className="size-5" variant="Bold" />
}, },
] ]