discount ccustomer
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
VITE_TOKEN_NAME = 'admin_token'
|
VITE_TOKEN_NAME = 'admin_token'
|
||||||
VITE_REFRESH_TOKEN_NAME = 'admin_refresh_token'
|
VITE_REFRESH_TOKEN_NAME = 'admin_refresh_token'
|
||||||
VITE_BASE_URL = 'https://api.danakcorp.com'
|
VITE_BASE_URL = 'https://api.danakcorp.com'
|
||||||
# VITE_BASE_URL = 'http://192.168.1.117:4000'
|
# VITE_BASE_URL = 'http://192.168.1.108:4000'
|
||||||
+8
-9
@@ -91,8 +91,8 @@ tbody tr {
|
|||||||
|
|
||||||
.borderDashed {
|
.borderDashed {
|
||||||
background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='24' ry='24' stroke='%238C90A3' stroke-width='2' stroke-dasharray='6%2C 14' stroke-dashoffset='25' stroke-linecap='square'/%3E%3C/svg%3E");
|
background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='24' ry='24' stroke='%238C90A3' stroke-width='2' stroke-dasharray='6%2C 14' stroke-dashoffset='25' stroke-linecap='square'/%3E%3C/svg%3E");
|
||||||
border-radius: 24px; /* تطابق با rx و ry */
|
border-radius: 24px;
|
||||||
overflow: hidden; /* برای رفع مشکلات برش */
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modalGlass {
|
.modalGlass {
|
||||||
@@ -152,22 +152,21 @@ tbody tr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
scrollbar-width: none; /* برای فایرفاکس */
|
scrollbar-width: none;
|
||||||
-ms-overflow-style: none; /* برای اینترنت اکسپلورر و اج */
|
-ms-overflow-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* برای Webkit (کروم، سافاری و اپرا) */
|
|
||||||
*::-webkit-scrollbar {
|
*::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ql-container {
|
.ql-container {
|
||||||
min-height: 200px !important; /* حداقل ارتفاع برای نمایش کامل ادیتور */
|
min-height: 200px !important;
|
||||||
max-height: 500px; /* حداکثر ارتفاع */
|
max-height: 500px;
|
||||||
overflow-y: auto; /* فعال کردن اسکرول در صورت نیاز */
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ql-toolbar {
|
.ql-toolbar {
|
||||||
position: relative !important; /* حل مشکل نمایش نوار ابزار */
|
position: relative !important;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -359,7 +359,8 @@
|
|||||||
"user": "کاربر",
|
"user": "کاربر",
|
||||||
"0": "درصد",
|
"0": "درصد",
|
||||||
"1": "مبلغ",
|
"1": "مبلغ",
|
||||||
"update_discount": "ویرایش تخفیف"
|
"update_discount": "ویرایش تخفیف",
|
||||||
|
"customer": "مشتری"
|
||||||
},
|
},
|
||||||
"blog": {
|
"blog": {
|
||||||
"blog": "بلاگ",
|
"blog": "بلاگ",
|
||||||
@@ -483,7 +484,8 @@
|
|||||||
"3": "ماهانه",
|
"3": "ماهانه",
|
||||||
"4": "چهارماهه",
|
"4": "چهارماهه",
|
||||||
"5": "سالانه",
|
"5": "سالانه",
|
||||||
"maxRecurringCycles": "حداکثر تعداد تکرار دوره"
|
"maxRecurringCycles": "حداکثر تعداد تکرار دوره",
|
||||||
|
"WAIT_PAYMENT": "در انتظار پرداخت"
|
||||||
},
|
},
|
||||||
"edit": "ویرایش",
|
"edit": "ویرایش",
|
||||||
"transaction": {
|
"transaction": {
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ const CreateDiscount: FC = () => {
|
|||||||
targetServices: [],
|
targetServices: [],
|
||||||
direct: true,
|
direct: true,
|
||||||
value: 0,
|
value: 0,
|
||||||
isActive: true
|
isActive: true,
|
||||||
|
userPhone: ''
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
value: Yup.number().required(t('errors.required')),
|
value: Yup.number().required(t('errors.required')),
|
||||||
@@ -52,6 +53,9 @@ const CreateDiscount: FC = () => {
|
|||||||
onSubmit(values) {
|
onSubmit(values) {
|
||||||
values.targetServices = serviceId
|
values.targetServices = serviceId
|
||||||
values.type = +values.type
|
values.type = +values.type
|
||||||
|
if (values.userPhone === '') {
|
||||||
|
values.userPhone = undefined
|
||||||
|
}
|
||||||
const params: CreateDiscountType = {
|
const params: CreateDiscountType = {
|
||||||
...values,
|
...values,
|
||||||
startDate: moment(values.startDate, 'jYYYY-jMM-jDD').format('YYYY-MM-DD'),
|
startDate: moment(values.startDate, 'jYYYY-jMM-jDD').format('YYYY-MM-DD'),
|
||||||
@@ -167,19 +171,27 @@ const CreateDiscount: FC = () => {
|
|||||||
error_text={formik.touched.endDate && formik.errors.endDate ? formik.errors.endDate : ''}
|
error_text={formik.touched.endDate && formik.errors.endDate ? formik.errors.endDate : ''}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
!formik.values.direct &&
|
||||||
|
<div className='mt-6 rowTwoInput'>
|
||||||
|
<Input
|
||||||
|
label='شماره مشتری (اختیاری)'
|
||||||
|
placeholder='شماره مشتری را وارد کنید'
|
||||||
|
{...formik.getFieldProps('userPhone')}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className='min-h-[calc(100vh-201px)] bg-white w-sidebar xl:block hidden py-10 px-5 h-fit rounded-3xl'>
|
<div className='min-h-[calc(100vh-201px)] bg-white w-sidebar xl:block hidden py-10 px-5 h-fit rounded-3xl'>
|
||||||
<div className='text-sm flex items-center justify-between'>
|
<div className='text-sm flex items-center justify-between'>
|
||||||
<p>
|
<p>
|
||||||
{t('discount.service_status')}
|
{'وضعیت تخفیف'}
|
||||||
</p>
|
</p>
|
||||||
<div className='flex gap-1 text-xs items-center text-description'>
|
<div className='flex gap-1 text-xs items-center text-description'>
|
||||||
<div>
|
|
||||||
{t('ads.deactive')}
|
|
||||||
</div>
|
|
||||||
<SwitchComponent
|
<SwitchComponent
|
||||||
active={false}
|
active={formik.values.isActive}
|
||||||
onChange={() => { }}
|
onChange={(value) => formik.setFieldValue('isActive', value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ const DiscountList: FC = () => {
|
|||||||
<tr>
|
<tr>
|
||||||
<Td text={t('discount.title')} />
|
<Td text={t('discount.title')} />
|
||||||
<Td text={t('discount.type')} />
|
<Td text={t('discount.type')} />
|
||||||
|
<Td text={t('discount.customer')} />
|
||||||
<Td text={t('discount.code')} />
|
<Td text={t('discount.code')} />
|
||||||
<Td text={t('discount.startDate')} />
|
<Td text={t('discount.startDate')} />
|
||||||
<Td text={t('discount.endDate')} />
|
<Td text={t('discount.endDate')} />
|
||||||
@@ -100,6 +101,7 @@ const DiscountList: FC = () => {
|
|||||||
<tr key={item.id} className='tr'>
|
<tr key={item.id} className='tr'>
|
||||||
<Td text={item.title} />
|
<Td text={item.title} />
|
||||||
<Td text={t(`discount.${item.type}`)} />
|
<Td text={t(`discount.${item.type}`)} />
|
||||||
|
<Td text={item.user ? item.user.firstName + ' ' + item.user.lastName : '-'} />
|
||||||
<Td text={item.code} />
|
<Td text={item.code} />
|
||||||
<Td text={moment(item.startDate, 'jYYYY-jMM-jDD').format('jYYYY-jMM-jDD')} />
|
<Td text={moment(item.startDate, 'jYYYY-jMM-jDD').format('jYYYY-jMM-jDD')} />
|
||||||
<Td text={moment(item.endDate, 'jYYYY-jMM-jDD').format('jYYYY-jMM-jDD')} />
|
<Td text={moment(item.endDate, 'jYYYY-jMM-jDD').format('jYYYY-jMM-jDD')} />
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ const UpdateDiscount: FC = () => {
|
|||||||
targetServices: [],
|
targetServices: [],
|
||||||
direct: true,
|
direct: true,
|
||||||
value: 0,
|
value: 0,
|
||||||
isActive: true
|
isActive: true,
|
||||||
|
userPhone: ''
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
value: Yup.number().required(t('errors.required')),
|
value: Yup.number().required(t('errors.required')),
|
||||||
@@ -52,6 +53,9 @@ const UpdateDiscount: FC = () => {
|
|||||||
type: Yup.string().required(t('errors.required')),
|
type: Yup.string().required(t('errors.required')),
|
||||||
}),
|
}),
|
||||||
onSubmit(values) {
|
onSubmit(values) {
|
||||||
|
if (values.userPhone === '') {
|
||||||
|
values.userPhone = undefined
|
||||||
|
}
|
||||||
values.targetServices = serviceId
|
values.targetServices = serviceId
|
||||||
const params: CreateDiscountType = {
|
const params: CreateDiscountType = {
|
||||||
...values,
|
...values,
|
||||||
@@ -81,6 +85,10 @@ const UpdateDiscount: FC = () => {
|
|||||||
direct: getDiscountDetail.data?.data?.discount.applicationType === 'DIRECT',
|
direct: getDiscountDetail.data?.data?.discount.applicationType === 'DIRECT',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (getDiscountDetail.data?.data?.discount.user) {
|
||||||
|
formik.setFieldValue('userPhone', getDiscountDetail.data?.data?.discount.user?.phone)
|
||||||
|
}
|
||||||
|
|
||||||
// delete getDiscountDetail.data?.data?.discount.subscriptionPlans
|
// delete getDiscountDetail.data?.data?.discount.subscriptionPlans
|
||||||
|
|
||||||
const ids = getDiscountDetail.data?.data?.discount.subscriptionPlans.map((item: SubscriptionPlanType) => item?.service?.id)
|
const ids = getDiscountDetail.data?.data?.discount.subscriptionPlans.map((item: SubscriptionPlanType) => item?.service?.id)
|
||||||
@@ -192,19 +200,26 @@ const UpdateDiscount: FC = () => {
|
|||||||
defaulValue={formik.values.endDate}
|
defaulValue={formik.values.endDate}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{
|
||||||
|
!formik.values.direct &&
|
||||||
|
<div className='mt-6 rowTwoInput'>
|
||||||
|
<Input
|
||||||
|
label='شماره مشتری (اختیاری)'
|
||||||
|
placeholder='شماره مشتری را وارد کنید'
|
||||||
|
{...formik.getFieldProps('userPhone')}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className='min-h-[calc(100vh-201px)] bg-white w-sidebar xl:block hidden py-10 px-5 h-fit rounded-3xl'>
|
<div className='min-h-[calc(100vh-201px)] bg-white w-sidebar xl:block hidden py-10 px-5 h-fit rounded-3xl'>
|
||||||
<div className='text-sm flex items-center justify-between'>
|
<div className='text-sm flex items-center justify-between'>
|
||||||
<p>
|
<p>
|
||||||
{t('discount.service_status')}
|
{'وضعیت تخفیف'}
|
||||||
</p>
|
</p>
|
||||||
<div className='flex gap-1 text-xs items-center text-description'>
|
<div className='flex gap-1 text-xs items-center text-description'>
|
||||||
<div>
|
|
||||||
{t('ads.deactive')}
|
|
||||||
</div>
|
|
||||||
<SwitchComponent
|
<SwitchComponent
|
||||||
active={false}
|
active={formik.values.isActive}
|
||||||
onChange={() => { }}
|
onChange={(value) => formik.setFieldValue('isActive', value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export type CreateDiscountType = {
|
|||||||
endDate: string;
|
endDate: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
targetServices: string[];
|
targetServices: string[];
|
||||||
|
userPhone?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum DiscountType {
|
export enum DiscountType {
|
||||||
@@ -34,6 +35,7 @@ export type DiscountItemType = {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
users: { firstName: string; lastName: string }[];
|
users: { firstName: string; lastName: string }[];
|
||||||
|
user: { firstName: string; lastName: string; phone: string };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SubscriptionPlanType = {
|
export type SubscriptionPlanType = {
|
||||||
|
|||||||
Reference in New Issue
Block a user