discount ccustomer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
VITE_TOKEN_NAME = 'admin_token'
|
||||
VITE_REFRESH_TOKEN_NAME = 'admin_refresh_token'
|
||||
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 {
|
||||
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 */
|
||||
overflow: hidden; /* برای رفع مشکلات برش */
|
||||
border-radius: 24px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modalGlass {
|
||||
@@ -152,22 +152,21 @@ tbody tr {
|
||||
}
|
||||
|
||||
* {
|
||||
scrollbar-width: none; /* برای فایرفاکس */
|
||||
-ms-overflow-style: none; /* برای اینترنت اکسپلورر و اج */
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
|
||||
/* برای Webkit (کروم، سافاری و اپرا) */
|
||||
*::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ql-container {
|
||||
min-height: 200px !important; /* حداقل ارتفاع برای نمایش کامل ادیتور */
|
||||
max-height: 500px; /* حداکثر ارتفاع */
|
||||
overflow-y: auto; /* فعال کردن اسکرول در صورت نیاز */
|
||||
min-height: 200px !important;
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ql-toolbar {
|
||||
position: relative !important; /* حل مشکل نمایش نوار ابزار */
|
||||
position: relative !important;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
+4
-2
@@ -359,7 +359,8 @@
|
||||
"user": "کاربر",
|
||||
"0": "درصد",
|
||||
"1": "مبلغ",
|
||||
"update_discount": "ویرایش تخفیف"
|
||||
"update_discount": "ویرایش تخفیف",
|
||||
"customer": "مشتری"
|
||||
},
|
||||
"blog": {
|
||||
"blog": "بلاگ",
|
||||
@@ -483,7 +484,8 @@
|
||||
"3": "ماهانه",
|
||||
"4": "چهارماهه",
|
||||
"5": "سالانه",
|
||||
"maxRecurringCycles": "حداکثر تعداد تکرار دوره"
|
||||
"maxRecurringCycles": "حداکثر تعداد تکرار دوره",
|
||||
"WAIT_PAYMENT": "در انتظار پرداخت"
|
||||
},
|
||||
"edit": "ویرایش",
|
||||
"transaction": {
|
||||
|
||||
@@ -40,7 +40,8 @@ const CreateDiscount: FC = () => {
|
||||
targetServices: [],
|
||||
direct: true,
|
||||
value: 0,
|
||||
isActive: true
|
||||
isActive: true,
|
||||
userPhone: ''
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
value: Yup.number().required(t('errors.required')),
|
||||
@@ -52,6 +53,9 @@ const CreateDiscount: FC = () => {
|
||||
onSubmit(values) {
|
||||
values.targetServices = serviceId
|
||||
values.type = +values.type
|
||||
if (values.userPhone === '') {
|
||||
values.userPhone = undefined
|
||||
}
|
||||
const params: CreateDiscountType = {
|
||||
...values,
|
||||
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 : ''}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{
|
||||
!formik.values.direct &&
|
||||
<div className='mt-6 rowTwoInput'>
|
||||
<Input
|
||||
label='شماره مشتری (اختیاری)'
|
||||
placeholder='شماره مشتری را وارد کنید'
|
||||
{...formik.getFieldProps('userPhone')}
|
||||
/>
|
||||
</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='text-sm flex items-center justify-between'>
|
||||
<p>
|
||||
{t('discount.service_status')}
|
||||
{'وضعیت تخفیف'}
|
||||
</p>
|
||||
<div className='flex gap-1 text-xs items-center text-description'>
|
||||
<div>
|
||||
{t('ads.deactive')}
|
||||
</div>
|
||||
<SwitchComponent
|
||||
active={false}
|
||||
onChange={() => { }}
|
||||
active={formik.values.isActive}
|
||||
onChange={(value) => formik.setFieldValue('isActive', value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,6 +85,7 @@ const DiscountList: FC = () => {
|
||||
<tr>
|
||||
<Td text={t('discount.title')} />
|
||||
<Td text={t('discount.type')} />
|
||||
<Td text={t('discount.customer')} />
|
||||
<Td text={t('discount.code')} />
|
||||
<Td text={t('discount.startDate')} />
|
||||
<Td text={t('discount.endDate')} />
|
||||
@@ -100,6 +101,7 @@ const DiscountList: FC = () => {
|
||||
<tr key={item.id} className='tr'>
|
||||
<Td text={item.title} />
|
||||
<Td text={t(`discount.${item.type}`)} />
|
||||
<Td text={item.user ? item.user.firstName + ' ' + item.user.lastName : '-'} />
|
||||
<Td text={item.code} />
|
||||
<Td text={moment(item.startDate, '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: [],
|
||||
direct: true,
|
||||
value: 0,
|
||||
isActive: true
|
||||
isActive: true,
|
||||
userPhone: ''
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
value: Yup.number().required(t('errors.required')),
|
||||
@@ -52,6 +53,9 @@ const UpdateDiscount: FC = () => {
|
||||
type: Yup.string().required(t('errors.required')),
|
||||
}),
|
||||
onSubmit(values) {
|
||||
if (values.userPhone === '') {
|
||||
values.userPhone = undefined
|
||||
}
|
||||
values.targetServices = serviceId
|
||||
const params: CreateDiscountType = {
|
||||
...values,
|
||||
@@ -81,6 +85,10 @@ const UpdateDiscount: FC = () => {
|
||||
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
|
||||
|
||||
const ids = getDiscountDetail.data?.data?.discount.subscriptionPlans.map((item: SubscriptionPlanType) => item?.service?.id)
|
||||
@@ -192,19 +200,26 @@ const UpdateDiscount: FC = () => {
|
||||
defaulValue={formik.values.endDate}
|
||||
/>
|
||||
</div>
|
||||
{
|
||||
!formik.values.direct &&
|
||||
<div className='mt-6 rowTwoInput'>
|
||||
<Input
|
||||
label='شماره مشتری (اختیاری)'
|
||||
placeholder='شماره مشتری را وارد کنید'
|
||||
{...formik.getFieldProps('userPhone')}
|
||||
/>
|
||||
</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='text-sm flex items-center justify-between'>
|
||||
<p>
|
||||
{t('discount.service_status')}
|
||||
{'وضعیت تخفیف'}
|
||||
</p>
|
||||
<div className='flex gap-1 text-xs items-center text-description'>
|
||||
<div>
|
||||
{t('ads.deactive')}
|
||||
</div>
|
||||
<SwitchComponent
|
||||
active={false}
|
||||
onChange={() => { }}
|
||||
active={formik.values.isActive}
|
||||
onChange={(value) => formik.setFieldValue('isActive', value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ export type CreateDiscountType = {
|
||||
endDate: string;
|
||||
isActive: boolean;
|
||||
targetServices: string[];
|
||||
userPhone?: string;
|
||||
};
|
||||
|
||||
export enum DiscountType {
|
||||
@@ -34,6 +35,7 @@ export type DiscountItemType = {
|
||||
updatedAt: string;
|
||||
isActive: boolean;
|
||||
users: { firstName: string; lastName: string }[];
|
||||
user: { firstName: string; lastName: string; phone: string };
|
||||
};
|
||||
|
||||
export type SubscriptionPlanType = {
|
||||
|
||||
Reference in New Issue
Block a user