payment method
This commit is contained in:
@@ -35,7 +35,6 @@ const CreatePaymentMethod: FC = () => {
|
||||
|
||||
const formik = useFormik<CreateRestaurantPaymentMethodType>({
|
||||
initialValues: {
|
||||
title: '',
|
||||
method: '',
|
||||
gateway: '',
|
||||
description: '',
|
||||
@@ -44,7 +43,6 @@ const CreatePaymentMethod: FC = () => {
|
||||
merchantId: '',
|
||||
},
|
||||
validationSchema: Yup.object().shape({
|
||||
title: Yup.string().required('عنوان الزامی است'),
|
||||
method: Yup.string().required('روش پرداخت الزامی است'),
|
||||
gateway: Yup.string().when('method', {
|
||||
is: PaymentMethodEnum.Online,
|
||||
@@ -62,7 +60,6 @@ const CreatePaymentMethod: FC = () => {
|
||||
}),
|
||||
onSubmit: (values) => {
|
||||
const submitValues: CreateRestaurantPaymentMethodType = {
|
||||
title: values.title,
|
||||
method: values.method,
|
||||
description: values.description,
|
||||
enabled: values.enabled,
|
||||
@@ -120,15 +117,6 @@ const CreatePaymentMethod: FC = () => {
|
||||
error_text={formik.touched.method && formik.errors.method ? formik.errors.method : ''}
|
||||
/>
|
||||
</div>
|
||||
<div className='mt-6'>
|
||||
<Input
|
||||
label='عنوان'
|
||||
name='title'
|
||||
value={formik.values.title}
|
||||
onChange={formik.handleChange}
|
||||
error_text={formik.touched.title && formik.errors.title ? formik.errors.title : ''}
|
||||
/>
|
||||
</div>
|
||||
{formik.values.method === PaymentMethodEnum.Online && (
|
||||
<>
|
||||
<div className='mt-6'>
|
||||
|
||||
@@ -39,7 +39,6 @@ const UpdatePaymentMethod: FC = () => {
|
||||
if (paymentMethodData?.data) {
|
||||
const data = paymentMethodData.data as CreateRestaurantPaymentMethodType & { id: string }
|
||||
return {
|
||||
title: data.title || '',
|
||||
method: data.method || '',
|
||||
gateway: data.gateway || '',
|
||||
description: data.description || '',
|
||||
@@ -49,7 +48,6 @@ const UpdatePaymentMethod: FC = () => {
|
||||
}
|
||||
}
|
||||
return {
|
||||
title: '',
|
||||
method: '',
|
||||
gateway: '',
|
||||
description: '',
|
||||
@@ -63,7 +61,6 @@ const UpdatePaymentMethod: FC = () => {
|
||||
initialValues,
|
||||
enableReinitialize: true,
|
||||
validationSchema: Yup.object().shape({
|
||||
title: Yup.string().required('عنوان الزامی است'),
|
||||
method: Yup.string().required('روش پرداخت الزامی است'),
|
||||
gateway: Yup.string().when('method', {
|
||||
is: PaymentMethodEnum.Online,
|
||||
@@ -83,7 +80,6 @@ const UpdatePaymentMethod: FC = () => {
|
||||
if (!id) return
|
||||
|
||||
const submitValues: CreateRestaurantPaymentMethodType = {
|
||||
title: values.title,
|
||||
method: values.method,
|
||||
description: values.description,
|
||||
enabled: values.enabled,
|
||||
@@ -160,15 +156,6 @@ const UpdatePaymentMethod: FC = () => {
|
||||
error_text={formik.touched.method && formik.errors.method ? formik.errors.method : ''}
|
||||
/>
|
||||
</div>
|
||||
<div className='mt-6'>
|
||||
<Input
|
||||
label='عنوان'
|
||||
name='title'
|
||||
value={formik.values.title}
|
||||
onChange={formik.handleChange}
|
||||
error_text={formik.touched.title && formik.errors.title ? formik.errors.title : ''}
|
||||
/>
|
||||
</div>
|
||||
{formik.values.method === PaymentMethodEnum.Online && (
|
||||
<>
|
||||
<div className='mt-6'>
|
||||
|
||||
@@ -13,13 +13,6 @@ interface GetPaymentMethodTableColumnsParams {
|
||||
|
||||
export const getPaymentMethodTableColumns = ({ onDelete, isDeleting }: GetPaymentMethodTableColumnsParams = {}): ColumnType<RestaurantPaymentMethod>[] => {
|
||||
return [
|
||||
{
|
||||
key: 'title',
|
||||
title: 'عنوان',
|
||||
render: (item: RestaurantPaymentMethod) => {
|
||||
return item.title || '-'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'method',
|
||||
title: 'روش',
|
||||
@@ -46,9 +39,9 @@ export const getPaymentMethodTableColumns = ({ onDelete, isDeleting }: GetPaymen
|
||||
title: 'وضعیت',
|
||||
render: (item: RestaurantPaymentMethod) => {
|
||||
return (
|
||||
<Status
|
||||
variant={item.enabled ? 'success' : 'error'}
|
||||
label={item.enabled ? 'فعال' : 'غیرفعال'}
|
||||
<Status
|
||||
variant={item.enabled ? 'success' : 'error'}
|
||||
label={item.enabled ? 'فعال' : 'غیرفعال'}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ export type RestaurantPaymentMethod = {
|
||||
updatedAt: string;
|
||||
deletedAt: string | null;
|
||||
restaurant: Restaurant;
|
||||
title: string;
|
||||
method: string;
|
||||
gateway: string;
|
||||
description: string;
|
||||
@@ -75,7 +74,6 @@ export type RestaurantPaymentMethodResponse = IResponse<
|
||||
>;
|
||||
|
||||
export type CreateRestaurantPaymentMethodType = {
|
||||
title: string;
|
||||
method: string;
|
||||
gateway?: string;
|
||||
description: string;
|
||||
|
||||
Reference in New Issue
Block a user