change financial and pixel perfect
This commit is contained in:
@@ -0,0 +1 @@
|
||||
if('serviceWorker' in navigator) navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'classic' })
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// If the loader is already loaded, just stop.
|
||||
if (!self.define) {
|
||||
let registry = {};
|
||||
|
||||
// Used for `eval` and `importScripts` where we can't get script URL by other means.
|
||||
// In both cases, it's safe to use a global var because those functions are synchronous.
|
||||
let nextDefineUri;
|
||||
|
||||
const singleRequire = (uri, parentUri) => {
|
||||
uri = new URL(uri + ".js", parentUri).href;
|
||||
return registry[uri] || (
|
||||
|
||||
new Promise(resolve => {
|
||||
if ("document" in self) {
|
||||
const script = document.createElement("script");
|
||||
script.src = uri;
|
||||
script.onload = resolve;
|
||||
document.head.appendChild(script);
|
||||
} else {
|
||||
nextDefineUri = uri;
|
||||
importScripts(uri);
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
|
||||
.then(() => {
|
||||
let promise = registry[uri];
|
||||
if (!promise) {
|
||||
throw new Error(`Module ${uri} didn’t register its module`);
|
||||
}
|
||||
return promise;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
self.define = (depsNames, factory) => {
|
||||
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
|
||||
if (registry[uri]) {
|
||||
// Module is already loading or loaded.
|
||||
return;
|
||||
}
|
||||
let exports = {};
|
||||
const require = depUri => singleRequire(depUri, uri);
|
||||
const specialDeps = {
|
||||
module: { uri },
|
||||
exports,
|
||||
require
|
||||
};
|
||||
registry[uri] = Promise.all(depsNames.map(
|
||||
depName => specialDeps[depName] || require(depName)
|
||||
)).then(deps => {
|
||||
factory(...deps);
|
||||
return exports;
|
||||
});
|
||||
};
|
||||
}
|
||||
define(['./workbox-706c6701'], (function (workbox) { 'use strict';
|
||||
|
||||
self.skipWaiting();
|
||||
workbox.clientsClaim();
|
||||
|
||||
/**
|
||||
* The precacheAndRoute() method efficiently caches and responds to
|
||||
* requests for URLs in the manifest.
|
||||
* See https://goo.gl/S9QRab
|
||||
*/
|
||||
workbox.precacheAndRoute([{
|
||||
"url": "registerSW.js",
|
||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||
}, {
|
||||
"url": "index.html",
|
||||
"revision": "0.fjjapfr8ogo"
|
||||
}], {});
|
||||
workbox.cleanupOutdatedCaches();
|
||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||
allowlist: [/^\/$/]
|
||||
}));
|
||||
workbox.registerRoute(/^https:\/\/api\.example\.com\//, new workbox.NetworkFirst({
|
||||
"cacheName": "api-cache",
|
||||
plugins: []
|
||||
}), 'GET');
|
||||
|
||||
}));
|
||||
File diff suppressed because it is too large
Load Diff
Generated
+4139
-39
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -54,6 +54,7 @@
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2",
|
||||
"typescript-eslint": "^8.18.1",
|
||||
"vite": "^6.0.3"
|
||||
"vite": "^6.0.3",
|
||||
"vite-plugin-pwa": "^0.21.1"
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
+13
-1
@@ -1 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
<svg width="39" height="54" viewBox="0 0 39 54" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M31.1559 34.8412C31.1559 34.8412 24.6651 41.094 19.2416 46.3804V53.5924C18.6935 54.0179 38.4905 34.8845 38.4905 34.8845L19.2416 14.6909V22.3573L31.1559 34.8412Z" fill="#1D1D1B"/>
|
||||
<path d="M19.1479 39.0818L0 18.643L0.237992 18.405L19.3931 38.8583L19.1479 39.0818Z" fill="#1D1D1B"/>
|
||||
<path d="M19.1407 37.1635L1.75977 18.6719L1.99776 18.4412L19.3787 36.9399L19.1407 37.1635Z" fill="#1D1D1B"/>
|
||||
<path d="M19.1334 35.2523L3.52661 18.708L3.7574 18.47L19.3786 35.0215L19.1334 35.2523Z" fill="#1D1D1B"/>
|
||||
<path d="M19.1262 33.3337L5.28638 18.7366L5.50995 18.5059L19.3714 33.1029L19.1262 33.3337Z" fill="#1D1D1B"/>
|
||||
<path d="M19.1191 31.4155L7.05347 18.7729L7.26982 18.5349L19.3571 31.1848L19.1191 31.4155Z" fill="#1D1D1B"/>
|
||||
<path d="M0.375071 18.7368L0.144287 18.4988L19.1407 0L19.3715 0.237996L0.375071 18.7368Z" fill="#1D1D1B"/>
|
||||
<path d="M2.15645 18.7442L1.91846 18.5134L19.1263 1.73828L19.3571 1.97628L2.15645 18.7442Z" fill="#1D1D1B"/>
|
||||
<path d="M3.93049 18.7587L3.69971 18.5279L19.1117 3.48364L19.3425 3.71443L3.93049 18.7587Z" fill="#1D1D1B"/>
|
||||
<path d="M5.71187 18.7658L5.47388 18.5422L19.0973 5.22168L19.3281 5.45968L5.71187 18.7658Z" fill="#1D1D1B"/>
|
||||
<path d="M7.49326 18.7799L7.24805 18.5564L19.0901 6.95947L19.3137 7.19747L7.49326 18.7799Z" fill="#1D1D1B"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -4,6 +4,7 @@ import persian from 'react-date-object/calendars/persian';
|
||||
import persian_fa from 'react-date-object/locales/persian_fa';
|
||||
import DateObject from 'react-date-object';
|
||||
import CalenderIcon from '../assets/images/calendar.svg'
|
||||
import { clx } from '../helpers/utils';
|
||||
|
||||
type Props = {
|
||||
onChange: (date: string) => void;
|
||||
@@ -13,7 +14,8 @@ type Props = {
|
||||
reset?: boolean;
|
||||
isDateTime?: boolean;
|
||||
className?: string;
|
||||
label: string
|
||||
label: string,
|
||||
readOnly?: boolean;
|
||||
};
|
||||
|
||||
const DatePickerComponent: FC<Props> = (props: Props) => {
|
||||
@@ -48,7 +50,10 @@ const DatePickerComponent: FC<Props> = (props: Props) => {
|
||||
<div className='text-sm'>
|
||||
{props.label}
|
||||
</div>
|
||||
<div className='relative mt-1.5'>
|
||||
<div className={clx(
|
||||
'relative mt-1.5',
|
||||
props.readOnly && 'readOny'
|
||||
)}>
|
||||
<DatePicker
|
||||
placeholder={props.placeholder}
|
||||
value={value}
|
||||
@@ -57,6 +62,7 @@ const DatePickerComponent: FC<Props> = (props: Props) => {
|
||||
locale={persian_fa}
|
||||
calendarPosition="bottom-right"
|
||||
className={props.className}
|
||||
readOnly={props.readOnly}
|
||||
/>
|
||||
{props.error_text && props.error_text !== '' && (
|
||||
<div className="text-xs text-right text-red-600 mt-2 mr-2 font-medium">
|
||||
|
||||
+5
-1
@@ -44,7 +44,7 @@ textarea::placeholder {
|
||||
|
||||
@layer components {
|
||||
.rowTwoInput {
|
||||
@apply flex flex-col sm:flex-row sm:gap-5 gap-5;
|
||||
@apply flex flex-col items-start sm:flex-row sm:gap-5 gap-5;
|
||||
}
|
||||
.td {
|
||||
@apply px-6 py-4 whitespace-nowrap text-xs;
|
||||
@@ -78,6 +78,10 @@ tbody tr {
|
||||
margin: 0px;
|
||||
padding-right: 16px !important;
|
||||
}
|
||||
.readOny .rmdp-input {
|
||||
background-color: #f5f5f5 !important;
|
||||
border: none !important;
|
||||
}
|
||||
.rmdp-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
+6
-3
@@ -78,7 +78,7 @@
|
||||
"myservice": "سرویس های من",
|
||||
"active_service": "سرویس های فعال",
|
||||
"ticket": "تیکت ها",
|
||||
"unread_messages": "پیام خوانده نشده ",
|
||||
"unread_messages": "تیکت باز دارید",
|
||||
"announcement": "اطلاعیه ها",
|
||||
"unread_announcement": "اطلاعیه خوانده نشده",
|
||||
"learnings": "آموزش ها",
|
||||
@@ -347,6 +347,7 @@
|
||||
"pay": "پرداخت",
|
||||
"amount": "مبلغ",
|
||||
"enter_amount_card": "مبلغ کارت به کارت شده را وارد کنید",
|
||||
"enter_amount_sheba": "مبلغ حواله شده را وارد کنید",
|
||||
"upload_deposit_slip": "آپلود فیش واریزی",
|
||||
"submit_slip": "ثبت فیش",
|
||||
"sheba": "شبا",
|
||||
@@ -428,7 +429,9 @@
|
||||
"city": "شهر",
|
||||
"notice_cannot_edit": "ویرایش مشخصات فردی بعد از تکمیل اطلاعات امکان پذیر نیست",
|
||||
"notice_cannot_edit_legal": "ویرایش مشخصات حقوقی بعد از تکمیل اطلاعات امکان پذیر نیست",
|
||||
"phone": "شماره تماس"
|
||||
"phone": "شماره تماس",
|
||||
"iranian": "ایرانی",
|
||||
"foreign": "خارجی"
|
||||
},
|
||||
"man": "مرد",
|
||||
"woman": "زن",
|
||||
@@ -439,7 +442,7 @@
|
||||
"order_number": "کد رهگیری",
|
||||
"amount": "مبلغ پرداختی",
|
||||
"date": "تاریخ",
|
||||
"back": "بازگشت",
|
||||
"back": "تراکنش ها",
|
||||
"failed": "پرداخت ناموفق!",
|
||||
"desc_failed": "متأسفیم! پرداخت شما انجام نشد. لطفاً دوباره تلاش کنید یا روش پرداخت دیگری انتخاب کنید.",
|
||||
"pending": "وضعیت پرداخت نامشخص است!",
|
||||
|
||||
@@ -7,45 +7,51 @@ import Button from '../../../components/Button'
|
||||
import { InfoCircle, TickCircle } from 'iconsax-react'
|
||||
import { CreateLegalUserType, ProvinesItemType } from '../types/FinancialTypes'
|
||||
import * as Yup from 'yup'
|
||||
import { useCreateLegalUser, useGetCities, useGetFinancialInfo, useGetProvines } from '../hooks/useFinancialData'
|
||||
import { useCreateLegalUser, useGetCities, useGetLegalInfo, useGetProvines } from '../hooks/useFinancialData'
|
||||
import Select from '../../../components/Select'
|
||||
import PageLoading from '../../../components/PageLoading'
|
||||
import { toast } from 'react-toastify'
|
||||
import { ErrorType } from '../../../helpers/types'
|
||||
import { useGetProfile } from '../../profile/hooks/useProfileData'
|
||||
|
||||
const Legal: FC = () => {
|
||||
|
||||
const { t } = useTranslation('global')
|
||||
const [isReadOnly, setIsReadOnly] = useState<boolean>(false)
|
||||
const [provinesId, setProvinesId] = useState<string>('')
|
||||
const getFinancialInfo = useGetFinancialInfo()
|
||||
const getProvines = useGetProvines()
|
||||
const getLegalInfo = useGetLegalInfo()
|
||||
const getCities = useGetCities(provinesId)
|
||||
const createLegalUser = useCreateLegalUser()
|
||||
const getProfile = useGetProfile()
|
||||
|
||||
const formik = useFormik<CreateLegalUserType>({
|
||||
initialValues: {
|
||||
address: '',
|
||||
cityId: '',
|
||||
companyRegisteredName: '',
|
||||
registrationName: '',
|
||||
economicCode: '',
|
||||
nationalId: '',
|
||||
number: '',
|
||||
nationalIdentity: '',
|
||||
phone: '',
|
||||
postalCode: '',
|
||||
registrationId: ''
|
||||
registrationCode: ''
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
address: Yup.string().required(t('errors.required')),
|
||||
cityId: Yup.string().required(t('errors.required')),
|
||||
companyRegisteredName: Yup.string().required(t('errors.required')),
|
||||
registrationName: Yup.string().required(t('errors.required')),
|
||||
economicCode: Yup.string().required(t('errors.required')),
|
||||
nationalId: Yup.string().required(t('errors.required')),
|
||||
number: Yup.string().required(t('errors.required')),
|
||||
nationalIdentity: Yup.string().required(t('errors.required')),
|
||||
phone: Yup.string().required(t('errors.required')),
|
||||
postalCode: Yup.string().required(t('errors.required')),
|
||||
registrationId: Yup.string().required(t('errors.required'))
|
||||
registrationCode: Yup.string().required(t('errors.required'))
|
||||
}),
|
||||
onSubmit: values => {
|
||||
createLegalUser.mutate(values, {
|
||||
const params = {
|
||||
...values,
|
||||
cityId: +values.cityId
|
||||
}
|
||||
createLegalUser.mutate(params, {
|
||||
onSuccess: () => {
|
||||
toast.success(t('success'))
|
||||
window.location.reload()
|
||||
@@ -57,33 +63,63 @@ const Legal: FC = () => {
|
||||
}
|
||||
})
|
||||
|
||||
// useEffect(() => {
|
||||
|
||||
// if (getFinancialInfo.data?.data?.user?.legalUser || getFinancialInfo.data?.data?.user?.realUser) {
|
||||
// setIsReadOnly(true)
|
||||
// }
|
||||
// if (getFinancialInfo.data?.data?.user?.legalUser) {
|
||||
// const data = getFinancialInfo.data.data?.user
|
||||
// formik.setValues({
|
||||
// address: data?.address.address,
|
||||
// cityId: data?.address?.city?.id,
|
||||
// companyRegisteredName: data?.legalUser.companyRegisteredName,
|
||||
// economicCode: data?.legalUser.economicCode,
|
||||
// nationalId: data?.legalUser.nationalId,
|
||||
// number: data?.legalUser.number,
|
||||
// postalCode: data?.address.postalCode,
|
||||
// registrationId: data?.legalUser.registrationId
|
||||
// })
|
||||
// setProvinesId(data?.address?.city?.province?.id)
|
||||
// }
|
||||
|
||||
// }, [getFinancialInfo.data])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (getFinancialInfo.data?.data?.user?.legalUser || getFinancialInfo.data?.data?.user?.realUser) {
|
||||
if (getLegalInfo.data?.data?.legalUser) {
|
||||
setIsReadOnly(true)
|
||||
}
|
||||
if (getFinancialInfo.data?.data?.user?.legalUser) {
|
||||
const data = getFinancialInfo.data.data?.user
|
||||
if (getLegalInfo.data?.data?.legalUser) {
|
||||
const data = getLegalInfo.data?.data?.legalUser
|
||||
formik.setValues({
|
||||
address: data?.address.address,
|
||||
address: data?.address.fullAddress,
|
||||
cityId: data?.address?.city?.id,
|
||||
companyRegisteredName: data?.legalUser.companyRegisteredName,
|
||||
economicCode: data?.legalUser.economicCode,
|
||||
nationalId: data?.legalUser.nationalId,
|
||||
number: data?.legalUser.number,
|
||||
registrationName: data.registrationName,
|
||||
economicCode: data.economicCode,
|
||||
nationalIdentity: data.nationalIdentity,
|
||||
phone: data.phone,
|
||||
postalCode: data?.address.postalCode,
|
||||
registrationId: data?.legalUser.registrationId
|
||||
registrationCode: data.registrationCode
|
||||
})
|
||||
setProvinesId(data?.address?.city?.province?.id)
|
||||
}
|
||||
|
||||
}, [getFinancialInfo.data])
|
||||
}, [getLegalInfo.data])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (getProfile.data && getProfile.data?.data?.user?.financialType) {
|
||||
setIsReadOnly(true)
|
||||
}
|
||||
|
||||
}, [getProfile.data])
|
||||
|
||||
|
||||
return (
|
||||
<div className='bg-white rounded-3xl xl:p-6 p-4 mt-8 text-sm'>
|
||||
{
|
||||
getProvines.isPending || getFinancialInfo.isPending ?
|
||||
getProvines.isPending || getLegalInfo.isPending ?
|
||||
<PageLoading />
|
||||
:
|
||||
<Fragment>
|
||||
@@ -100,8 +136,8 @@ const Legal: FC = () => {
|
||||
<div className='flex items-end xl:gap-6 gap-3'>
|
||||
<Input
|
||||
label={t('financial.company_name')}
|
||||
{...formik.getFieldProps('companyRegisteredName')}
|
||||
error_text={formik.touched.companyRegisteredName && formik.errors.companyRegisteredName ? formik.errors.companyRegisteredName : ''}
|
||||
{...formik.getFieldProps('registrationName')}
|
||||
error_text={formik.touched.registrationName && formik.errors.registrationName ? formik.errors.registrationName : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
</div>
|
||||
@@ -109,8 +145,8 @@ const Legal: FC = () => {
|
||||
<div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
<Input
|
||||
label={t('financial.company_code')}
|
||||
{...formik.getFieldProps('registrationId')}
|
||||
error_text={formik.touched.registrationId && formik.errors.registrationId ? formik.errors.registrationId : ''}
|
||||
{...formik.getFieldProps('registrationCode')}
|
||||
error_text={formik.touched.registrationCode && formik.errors.registrationCode ? formik.errors.registrationCode : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
</div>
|
||||
@@ -118,8 +154,8 @@ const Legal: FC = () => {
|
||||
<div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
<Input
|
||||
label={t('financial.national_id')}
|
||||
{...formik.getFieldProps('nationalId')}
|
||||
error_text={formik.touched.nationalId && formik.errors.nationalId ? formik.errors.nationalId : ''}
|
||||
{...formik.getFieldProps('nationalIdentity')}
|
||||
error_text={formik.touched.nationalIdentity && formik.errors.nationalIdentity ? formik.errors.nationalIdentity : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
|
||||
@@ -166,8 +202,8 @@ const Legal: FC = () => {
|
||||
<div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
<Input
|
||||
label={t('financial.company_phone')}
|
||||
{...formik.getFieldProps('number')}
|
||||
error_text={formik.touched.number && formik.errors.number ? formik.errors.number : ''}
|
||||
{...formik.getFieldProps('phone')}
|
||||
error_text={formik.touched.phone && formik.errors.phone ? formik.errors.phone : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
|
||||
|
||||
@@ -8,9 +8,11 @@ import Button from '../../../components/Button'
|
||||
import { InfoCircle, TickCircle } from 'iconsax-react'
|
||||
import { CreateRealUserType, ProvinesItemType } from '../types/FinancialTypes'
|
||||
import * as Yup from 'yup'
|
||||
import { useCreateRealUser, useGetCities, useGetFinancialInfo, useGetProvines } from '../hooks/useFinancialData'
|
||||
import { useCreateRealUser, useGetCities, useGetProvines, useGetRealInfo } from '../hooks/useFinancialData'
|
||||
import { toast } from 'react-toastify'
|
||||
import { ErrorType } from '../../../helpers/types'
|
||||
import DatePickerComponent from '../../../components/DatePicker'
|
||||
import { useGetProfile } from '../../profile/hooks/useProfileData'
|
||||
|
||||
const Personal: FC = () => {
|
||||
|
||||
@@ -18,30 +20,45 @@ const Personal: FC = () => {
|
||||
|
||||
const [isReadOnly, setIsReadOnly] = useState<boolean>(false)
|
||||
const [provinesId, setProvinesId] = useState<string>('')
|
||||
const getFinancialInfo = useGetFinancialInfo()
|
||||
const createRealUser = useCreateRealUser()
|
||||
const getProvines = useGetProvines()
|
||||
const getRealInfo = useGetRealInfo()
|
||||
const getCities = useGetCities(provinesId)
|
||||
const getProfile = useGetProfile()
|
||||
|
||||
const formik = useFormik<CreateRealUserType>({
|
||||
initialValues: {
|
||||
address: '',
|
||||
cityId: '',
|
||||
fatherName: '',
|
||||
birthDate: '',
|
||||
firstName: '',
|
||||
gender: '',
|
||||
lastName: '',
|
||||
nationalCode: '',
|
||||
nationality: '',
|
||||
phone: '',
|
||||
postalCode: ''
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
address: Yup.string().required(t('errors.required')),
|
||||
cityId: Yup.string().required(t('errors.required')),
|
||||
fatherName: Yup.string().required(t('errors.required')),
|
||||
fatherName: Yup.string().required(t('rerrors.equired')),
|
||||
gender: Yup.string().required(t('errors.required')),
|
||||
firstName: Yup.string().required(t('errors.required')),
|
||||
lastName: Yup.string().required(t('rerrors.equired')),
|
||||
nationalCode: Yup.string().required(t('errors.required')),
|
||||
nationality: Yup.string().required(t('errors.required')),
|
||||
postalCode: Yup.string().required(t('errors.required'))
|
||||
phone: Yup.string().required(t('errors.required')),
|
||||
postalCode: Yup.string().required(t('errors.required')),
|
||||
birthDate: Yup.string().required(t('errors.required'))
|
||||
}),
|
||||
onSubmit: values => {
|
||||
createRealUser.mutate(values, {
|
||||
const params = {
|
||||
...values,
|
||||
cityId: +values.cityId
|
||||
}
|
||||
createRealUser.mutate(params, {
|
||||
onSuccess: () => {
|
||||
toast.success(t('success'))
|
||||
window.location.reload()
|
||||
@@ -55,25 +72,35 @@ const Personal: FC = () => {
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
if (getFinancialInfo.data?.data?.user?.legalUser || getFinancialInfo.data?.data?.user?.realUser) {
|
||||
setIsReadOnly(true)
|
||||
}
|
||||
if (getFinancialInfo.data?.data?.user?.realUser) {
|
||||
const data = getFinancialInfo.data?.data?.user
|
||||
if (getRealInfo.data?.data?.realUser) {
|
||||
const data = getRealInfo.data?.data?.realUser
|
||||
setIsReadOnly(true)
|
||||
formik.setValues({
|
||||
address: data.address.address,
|
||||
cityId: data.address?.city?.cityId,
|
||||
fatherName: data?.realUser?.fatherName,
|
||||
gender: data?.realUser?.gender,
|
||||
nationality: data?.realUser?.nationality,
|
||||
postalCode: data?.address?.postalCode
|
||||
address: data.address.fullAddress,
|
||||
cityId: data.address?.city?.id,
|
||||
fatherName: data?.fatherName,
|
||||
gender: data?.gender,
|
||||
nationality: data?.nationality,
|
||||
postalCode: data?.address?.postalCode,
|
||||
birthDate: data?.birthDate,
|
||||
firstName: data?.firstName,
|
||||
lastName: data?.lastName,
|
||||
nationalCode: data?.nationalCode,
|
||||
phone: data?.phone
|
||||
})
|
||||
setProvinesId(data?.address?.city?.province?.id)
|
||||
}
|
||||
|
||||
}, [getFinancialInfo.data])
|
||||
}, [getRealInfo.data])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (getProfile.data && getProfile.data?.data?.user?.financialType) {
|
||||
setIsReadOnly(true)
|
||||
}
|
||||
|
||||
}, [getProfile.data])
|
||||
|
||||
|
||||
|
||||
return (
|
||||
@@ -88,31 +115,33 @@ const Personal: FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex-1'>
|
||||
{/* <div className='flex items-end xl:gap-6 gap-3'>
|
||||
<div className='flex xl:gap-6 gap-3'>
|
||||
<Input
|
||||
label={t('financial.name')}
|
||||
{...formik.getFieldProps('company_name')}
|
||||
error_text={formik.touched.company_name && formik.errors.company_name ? formik.errors.company_name : ''}
|
||||
{...formik.getFieldProps('firstName')}
|
||||
error_text={formik.touched.firstName && formik.errors.firstName ? formik.errors.firstName : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label={t('financial.family')}
|
||||
{...formik.getFieldProps('company_name')}
|
||||
error_text={formik.touched.company_name && formik.errors.company_name ? formik.errors.company_name : ''}
|
||||
{...formik.getFieldProps('lastName')}
|
||||
error_text={formik.touched.lastName && formik.errors.lastName ? formik.errors.lastName : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
</div> */}
|
||||
<div className='flex items-end xl:gap-6 gap-3'>
|
||||
</div>
|
||||
<div className='flex xl:gap-6 gap-3 mt-8'>
|
||||
<Select
|
||||
label={t('financial.sex')}
|
||||
placeholder={t('select')}
|
||||
items={[
|
||||
{
|
||||
label: t('man'),
|
||||
value: 'male'
|
||||
value: 'MALE'
|
||||
},
|
||||
{
|
||||
label: t('woman'),
|
||||
value: 'female'
|
||||
value: 'FEMALE'
|
||||
},
|
||||
]}
|
||||
{...formik.getFieldProps('gender')}
|
||||
@@ -128,37 +157,51 @@ const Personal: FC = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* <div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
<div className='flex xl:gap-6 gap-3 mt-8'>
|
||||
<Input
|
||||
label={t('financial.phone_number')}
|
||||
{...formik.getFieldProps('company_name')}
|
||||
error_text={formik.touched. && formik.errors.company_name ? formik.errors.company_name : ''}
|
||||
{...formik.getFieldProps('phone')}
|
||||
error_text={formik.touched.phone && formik.errors.phone ? formik.errors.phone : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label={t('financial.national_code')}
|
||||
{...formik.getFieldProps('company_name')}
|
||||
error_text={formik.touched.na && formik.errors.company_name ? formik.errors.company_name : ''}
|
||||
/>
|
||||
</div> */}
|
||||
|
||||
<div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
{/* <DatePickerComponent
|
||||
label={t('financial.date_of_birth')}
|
||||
onChange={(value) => formik.setFieldValue('dateOfBirth', value)}
|
||||
placeholder={t('financial.date_of_birth')}
|
||||
error_text={formik.touched. && formik.errors.dateOfBirth ? formik.errors.dateOfBirth : ''}
|
||||
/> */}
|
||||
|
||||
<Input
|
||||
label={t('financial.nationality')}
|
||||
{...formik.getFieldProps('nationality')}
|
||||
error_text={formik.touched.nationality && formik.errors.nationality ? formik.errors.nationality : ''}
|
||||
{...formik.getFieldProps('nationalCode')}
|
||||
error_text={formik.touched.nationalCode && formik.errors.nationalCode ? formik.errors.nationalCode : ''}
|
||||
readOnly={isReadOnly}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* <div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
<div className='flex xl:gap-6 gap-3 mt-8'>
|
||||
<DatePickerComponent
|
||||
label={t('financial.date_of_birth')}
|
||||
onChange={(value) => formik.setFieldValue('birthDate', value)}
|
||||
placeholder={t('financial.date_of_birth')}
|
||||
error_text={formik.touched.birthDate && formik.errors.birthDate ? formik.errors.birthDate : ''}
|
||||
readOnly={isReadOnly}
|
||||
defaulValue={formik.values.birthDate}
|
||||
/>
|
||||
|
||||
<Select
|
||||
items={[
|
||||
{
|
||||
label: t('financial.iranian'),
|
||||
value: 'IRANIAN'
|
||||
},
|
||||
{
|
||||
label: t('financial.foreign'),
|
||||
value: 'FOREIGN'
|
||||
},
|
||||
]}
|
||||
{...formik.getFieldProps('nationality')}
|
||||
error_text={formik.touched.nationality && formik.errors.nationality ? formik.errors.nationality : ''}
|
||||
readOnly={isReadOnly}
|
||||
label={t('financial.nationality')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* <div className='flex xl:gap-6 gap-3 mt-8'>
|
||||
<Input
|
||||
label={t('financial.company_phone')}
|
||||
{...formik.getFieldProps('number')}
|
||||
@@ -187,7 +230,7 @@ const Personal: FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex-1'>
|
||||
<div className='flex items-end xl:gap-6 gap-3'>
|
||||
<div className='flex xl:gap-6 gap-3'>
|
||||
<Select
|
||||
value={provinesId}
|
||||
label={t('financial.state')}
|
||||
@@ -215,7 +258,7 @@ const Personal: FC = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='flex items-end xl:gap-6 gap-3 mt-8'>
|
||||
<div className='flex xl:gap-6 gap-3 mt-8'>
|
||||
<Textarea
|
||||
{...formik.getFieldProps('address')}
|
||||
error_text={formik.touched.address && formik.errors.address ? formik.errors.address : ''}
|
||||
|
||||
@@ -40,3 +40,17 @@ export const useGetFinancialInfo = () => {
|
||||
queryFn: () => api.getFinancialInfo(),
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetLegalInfo = () => {
|
||||
return useQuery({
|
||||
queryKey: ["legal-info"],
|
||||
queryFn: () => api.getLegalInfo(),
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetRealInfo = () => {
|
||||
return useQuery({
|
||||
queryKey: ["real-info"],
|
||||
queryFn: () => api.getRealInfo(),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
} from "../types/FinancialTypes";
|
||||
|
||||
export const createLegalUser = async (params: CreateLegalUserType) => {
|
||||
const { data } = await axios.post(`/users/legal-user`, params);
|
||||
const { data } = await axios.post(`/users/legal`, params);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const createRealUser = async (params: CreateRealUserType) => {
|
||||
const { data } = await axios.post(`/users/real-user`, params);
|
||||
const { data } = await axios.post(`/users/real`, params);
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -28,3 +28,13 @@ export const getFinancialInfo = async () => {
|
||||
const { data } = await axios.get(`/users/me/financial-info`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getLegalInfo = async () => {
|
||||
const { data } = await axios.get(`/users/legal`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getRealInfo = async () => {
|
||||
const { data } = await axios.get(`/users/real`);
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
export type CreateRealUserType = {
|
||||
phone: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
birthDate: string;
|
||||
nationalCode: string;
|
||||
gender: string;
|
||||
fatherName: string;
|
||||
nationality: string;
|
||||
address: string;
|
||||
postalCode: string;
|
||||
cityId: string;
|
||||
cityId: string | number;
|
||||
};
|
||||
|
||||
export type CreateLegalUserType = {
|
||||
economicCode: string;
|
||||
companyRegisteredName: string;
|
||||
registrationId: string;
|
||||
nationalId: string;
|
||||
number: string;
|
||||
postalCode: string;
|
||||
registrationCode: string;
|
||||
registrationName: string;
|
||||
nationalIdentity: string;
|
||||
address: string;
|
||||
cityId: string;
|
||||
postalCode: string;
|
||||
cityId: string | number;
|
||||
phone: string;
|
||||
};
|
||||
|
||||
export type ProvinesItemType = {
|
||||
|
||||
@@ -6,15 +6,18 @@ import { clx } from '../../helpers/utils';
|
||||
import StatusCircle from '../../components/StatusCircle';
|
||||
import { useOutsideClick } from '../../hooks/useOutSideClick';
|
||||
import { useGetNotification, useReadAll } from './hooks/useNotificationData';
|
||||
import { NotificationItemType } from './types/NotificationTypes';
|
||||
import { NotificationItemType, NotificationTypeEnum } from './types/NotificationTypes';
|
||||
import { timeAgo } from '../../config/func';
|
||||
import InfiniteScroll from 'react-infinite-scroll-component';
|
||||
import MoonLoader from "react-spinners/MoonLoader"
|
||||
import Button from '../../components/Button';
|
||||
import { toast } from 'react-toastify';
|
||||
import { useGetDashboardSummary } from '../home/hooks/useHomeData';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Pages } from '../../config/Pages';
|
||||
|
||||
const Notifications: FC = () => {
|
||||
const navigate = useNavigate()
|
||||
const { t } = useTranslation('global');
|
||||
const ref = useOutsideClick(() => setShowModal(false));
|
||||
const [activeTab, setActiveTab] = useState<'all' | 'read' | 'unread'>('all');
|
||||
@@ -34,6 +37,48 @@ const Notifications: FC = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleRedirect = (type: NotificationTypeEnum) => {
|
||||
switch (type) {
|
||||
case NotificationTypeEnum.USER_LOGIN:
|
||||
break;
|
||||
case NotificationTypeEnum.ANNOUNCEMENT:
|
||||
navigate(Pages.announcement.list)
|
||||
break;
|
||||
case NotificationTypeEnum.WALLET_CHARGE:
|
||||
navigate(Pages.transactions)
|
||||
break;
|
||||
case NotificationTypeEnum.WALLET_DEDUCTION:
|
||||
navigate(Pages.transactions)
|
||||
break;
|
||||
case NotificationTypeEnum.BILL_INVOICE_REMINDER:
|
||||
navigate(Pages.receipts.index)
|
||||
break;
|
||||
case NotificationTypeEnum.BILL_INVOICE:
|
||||
navigate(Pages.receipts.index)
|
||||
break;
|
||||
case NotificationTypeEnum.CREATE_INVOICE:
|
||||
navigate(Pages.receipts.index)
|
||||
break;
|
||||
case NotificationTypeEnum.CREATE_SERVICE:
|
||||
navigate(Pages.services.other)
|
||||
break;
|
||||
case NotificationTypeEnum.UNBLOCK_SERVICE:
|
||||
navigate(Pages.services.other)
|
||||
break;
|
||||
case NotificationTypeEnum.BLOCK_SERVICE:
|
||||
navigate(Pages.services.other)
|
||||
break;
|
||||
case NotificationTypeEnum.ANSWER_TICKET:
|
||||
navigate(Pages.ticket.list)
|
||||
break;
|
||||
case NotificationTypeEnum.CREATE_TICKET:
|
||||
navigate(Pages.ticket.list)
|
||||
break;
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={ref}>
|
||||
<div onClick={() => setShowModal(!showModal)} className='relative cursor-pointer'>
|
||||
@@ -106,7 +151,7 @@ const Notifications: FC = () => {
|
||||
>
|
||||
{
|
||||
posts.map((item: NotificationItemType) => (
|
||||
<div className="bg-white h-fit gap-4 items-start rounded-xl bg-opacity-60 p-3 mb-4 flex" key={item.id}>
|
||||
<div onClick={() => handleRedirect(item.type)} className="bg-white h-fit gap-4 items-start rounded-xl bg-opacity-60 p-3 mb-4 flex" key={item.id}>
|
||||
<div className="mt-1">
|
||||
<StatusCircle color="#00BA4B" />
|
||||
</div>
|
||||
|
||||
@@ -4,4 +4,28 @@ export type NotificationItemType = {
|
||||
message: string;
|
||||
createdAt: string;
|
||||
isRead: boolean;
|
||||
type: NotificationTypeEnum;
|
||||
};
|
||||
|
||||
export enum NotificationTypeEnum {
|
||||
USER_LOGIN = "USER_LOGIN",
|
||||
ANNOUNCEMENT = "ANNOUNCEMENT",
|
||||
|
||||
// Finance category
|
||||
WALLET_CHARGE = "WALLET_CHARGE",
|
||||
WALLET_DEDUCTION = "WALLET_DEDUCTION",
|
||||
|
||||
//Invoice
|
||||
BILL_INVOICE_REMINDER = "BILL_INVOICE_REMINDER",
|
||||
BILL_INVOICE = "BILL_INVOICE",
|
||||
CREATE_INVOICE = "CREATE_INVOICE",
|
||||
|
||||
// Service category
|
||||
CREATE_SERVICE = "CREATE_SERVICE",
|
||||
UNBLOCK_SERVICE = "UNBLOCK_SERVICE",
|
||||
BLOCK_SERVICE = "BLOCK_SERVICE",
|
||||
|
||||
// Support category
|
||||
ANSWER_TICKET = "ANSWER_TICKET",
|
||||
CREATE_TICKET = "CREATE_TICKET",
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@ import { FC, useCallback, useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import AvatarImage from '../../assets/images/avatar_image.png'
|
||||
import Button from '../../components/Button'
|
||||
import { DocumentUpload, TickCircle } from 'iconsax-react'
|
||||
import { DocumentUpload } from 'iconsax-react'
|
||||
import Input from '../../components/Input'
|
||||
import DatePickerComponent from '../../components/DatePicker'
|
||||
import Select from '../../components/Select'
|
||||
import Textarea from '../../components/Textarea'
|
||||
import { useGetProfile, useUpdateProfile } from './hooks/useProfileData'
|
||||
import Username from './components/Username'
|
||||
import { useDropzone } from 'react-dropzone'
|
||||
@@ -15,8 +13,7 @@ import { useSingleUpload } from '../ticket/hooks/useTicketData'
|
||||
import { ErrorType } from '../../helpers/types'
|
||||
import { UpdateProfileType } from './types/ProfileTypes'
|
||||
import PageLoading from '../../components/PageLoading'
|
||||
import { useGetCities, useGetProvines } from '../financial/hooks/useFinancialData'
|
||||
import { ProvinesItemType } from '../financial/types/FinancialTypes'
|
||||
import { useGetProvines } from '../financial/hooks/useFinancialData'
|
||||
import { useFormik } from 'formik'
|
||||
import * as Yup from 'yup'
|
||||
import Email from './components/Email'
|
||||
@@ -27,9 +24,7 @@ const Profile: FC = () => {
|
||||
const { t } = useTranslation('global')
|
||||
const singleUpload = useSingleUpload()
|
||||
const [file, setFile] = useState<File>()
|
||||
const [provinesId, setProvinesId] = useState<string>('')
|
||||
const getProvines = useGetProvines()
|
||||
const getCities = useGetCities(provinesId)
|
||||
const getProfile = useGetProfile()
|
||||
const updateProfile = useUpdateProfile()
|
||||
|
||||
@@ -65,7 +60,6 @@ const Profile: FC = () => {
|
||||
postalCode: getProfile.data.data.user.postalCode || '',
|
||||
})
|
||||
if (getProfile.data.data.user.city) {
|
||||
setProvinesId(getProfile.data.data.user.city.province?.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +191,7 @@ const Profile: FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='mt-8 flex xl:flex-row flex-col xl:gap-0 gap-7'>
|
||||
{/* <div className='mt-8 flex xl:flex-row flex-col xl:gap-0 gap-7'>
|
||||
<div className='flex-1'>
|
||||
<div>
|
||||
{t('profile.address')}
|
||||
@@ -260,7 +254,7 @@ const Profile: FC = () => {
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className='h-20 xl:hidden'></div>
|
||||
</div>
|
||||
|
||||
@@ -72,7 +72,7 @@ const CardtoCard: FC = () => {
|
||||
label={t('wallet.select_sheba')}
|
||||
placeholder={t('select')}
|
||||
items={getBankAccount.data?.data?.bankAccounts?.map((item: any) => ({
|
||||
label: item.IBan,
|
||||
label: 'IR' + item.IBan,
|
||||
value: item.id
|
||||
}))}
|
||||
name='bankAccountId'
|
||||
@@ -84,7 +84,7 @@ const CardtoCard: FC = () => {
|
||||
<div className='mt-8'>
|
||||
<Input
|
||||
label={t('wallet.amount')}
|
||||
placeholder={t('wallet.enter_amount_card')}
|
||||
placeholder={t('wallet.enter_amount_sheba')}
|
||||
name='amount'
|
||||
onChange={formik.handleChange}
|
||||
error_text={formik.touched.amount && formik.errors.amount ? formik.errors.amount : ''}
|
||||
|
||||
+49
-4
@@ -1,7 +1,52 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
})
|
||||
plugins: [
|
||||
react(),
|
||||
VitePWA({
|
||||
registerType: "autoUpdate",
|
||||
devOptions: {
|
||||
enabled: true, // در حالت توسعه هم کار کند
|
||||
},
|
||||
manifest: {
|
||||
name: "Danak Console",
|
||||
short_name: "Danak Console",
|
||||
description: "Danak Console",
|
||||
theme_color: "#ffffff",
|
||||
background_color: "#ffffff",
|
||||
display: "standalone",
|
||||
icons: [
|
||||
{
|
||||
src: "/icon-192x192.png",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: "/icon-512x512.png",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
},
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: /^https:\/\/console\.danakcorp\.com\//,
|
||||
handler: "NetworkFirst",
|
||||
options: {
|
||||
cacheName: "api-cache",
|
||||
expiration: {
|
||||
maxEntries: 50, // تعداد درخواستهای کششده
|
||||
maxAgeSeconds: 60 * 60 * 24, // مدتزمان نگهداری در کش (اینجا 1 روز)
|
||||
},
|
||||
networkTimeoutSeconds: 10, // بعد از 10 ثانیه اگر پاسخ نداد، از کش استفاده کن
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user