From bb42f87dcc325e6f136ceff48112148c85cdfa07 Mon Sep 17 00:00:00 2001 From: Wikzyy Date: Thu, 10 Apr 2025 17:50:48 +0700 Subject: [PATCH 1/8] fix create Product - add validation input cannot be empty --- .../master/products/blocks/AddDialog.tsx | 123 ++++++++++-------- 1 file changed, 70 insertions(+), 53 deletions(-) diff --git a/src/pages/master/products/blocks/AddDialog.tsx b/src/pages/master/products/blocks/AddDialog.tsx index 0a5e192..6c58950 100644 --- a/src/pages/master/products/blocks/AddDialog.tsx +++ b/src/pages/master/products/blocks/AddDialog.tsx @@ -23,6 +23,7 @@ import { SelectValue } from '@/components/ui/select'; import { doSaveLogActivity } from '@/actions/GlobalActions'; +import { NumericFormat } from 'react-number-format'; interface ProviderProps { provider_id: number; @@ -40,15 +41,29 @@ const AddDialog = () => { show: false, message: '' }); - const initialState = { + const initialState: { + name: string; + code: string; + type: string; + description: string; + price_point: string | number | null; + price_cash: string | number | null; + cashback_point: string | number | null; + cashback_cash: string | number | null; + status: string; + provider: string; + process_on_third_party: string; + created_by: string; + created_at: string; + } = { name: '', code: '', type: '', description: '', - price_point: 0, - price_cash: 0, - cashback_point: 0, - cashback_cash: 0, + price_point: null, + price_cash: null, + cashback_point: null, + cashback_cash: null, status: '', provider: '', process_on_third_party: '', @@ -117,11 +132,13 @@ const AddDialog = () => { formField.type.trim() === '' || formField.code.trim() === '' || formField.description.trim() === '' || - formField.price_point === 0 || - formField.price_cash === 0 || - formField.cashback_point === 0 || - formField.cashback_cash === 0 || + formField.price_point === null || + formField.price_cash === null || + formField.cashback_point === null || + formField.cashback_cash === null || formField.status.trim() === '' || + formField.provider.trim() === '' || + formField.process_on_third_party.trim() === '' || formField.created_by.trim() === '' || formField.created_at.trim() === '' ) { @@ -234,19 +251,19 @@ const AddDialog = () => { - { - const value = parseFloat(e.target.value); - setFormField({ - ...formField, - price_point: isNaN(value) ? 0 : value - }); + value={formField.price_point ?? ''} + thousandSeparator="." + decimalSeparator="," + allowNegative={false} + onValueChange={(values) => { + setFormField((prev) => ({ + ...prev, + price_point: values.floatValue !== undefined ? values.floatValue : '' + })); }} + placeholder="Enter Price Point" /> @@ -256,19 +273,19 @@ const AddDialog = () => { - { - const value = parseFloat(e.target.value); - setFormField({ - ...formField, - price_cash: isNaN(value) ? 0 : value - }); + value={formField.price_cash ?? ''} + thousandSeparator="." + decimalSeparator="," + allowNegative={false} + onValueChange={(values) => { + setFormField((prev) => ({ + ...prev, + price_cash: values.floatValue !== undefined ? values.floatValue : '' + })); }} + placeholder="Enter Price Cash" /> @@ -278,19 +295,19 @@ const AddDialog = () => { - { - const value = parseFloat(e.target.value); - setFormField({ - ...formField, - cashback_point: isNaN(value) ? 0 : value - }); + value={formField.cashback_point ?? ''} + thousandSeparator="." + decimalSeparator="," + allowNegative={false} + onValueChange={(values) => { + setFormField((prev) => ({ + ...prev, + cashback_point: values.floatValue !== undefined ? values.floatValue : '' + })); }} + placeholder="Enter Cashback Point" /> @@ -300,19 +317,19 @@ const AddDialog = () => { - { - const value = parseFloat(e.target.value); - setFormField({ - ...formField, - cashback_cash: isNaN(value) ? 0 : value - }); + value={formField.cashback_cash ?? ''} + thousandSeparator="." + decimalSeparator="," + allowNegative={false} + onValueChange={(values) => { + setFormField((prev) => ({ + ...prev, + cashback_cash: values.floatValue !== undefined ? values.floatValue : '' + })); }} + placeholder="Enter Cashback Cash" /> From 8ff29fc1b76670c258dd07f94a071d87477230db Mon Sep 17 00:00:00 2001 From: Wikzyy Date: Thu, 10 Apr 2025 17:51:07 +0700 Subject: [PATCH 2/8] fix create Wallet Rule - add validation empty input --- src/pages/master/walletRule/blocks/AddDialog.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/master/walletRule/blocks/AddDialog.tsx b/src/pages/master/walletRule/blocks/AddDialog.tsx index 0e5ce46..043f766 100644 --- a/src/pages/master/walletRule/blocks/AddDialog.tsx +++ b/src/pages/master/walletRule/blocks/AddDialog.tsx @@ -123,7 +123,16 @@ const AddDialog = () => { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - if (formField.id_group.trim() === '' || formField.status.trim() === '') { + if ( + formField.id_group.trim() === '' || + formField.status.trim() === '' || + formField.id_wallet.trim() === '' || + formField.max_transaction_per_day === null || + formField.balance_minimum === null || + formField.balance_maximum === null || + formField.credit_limit === null || + formField.monthly_limit === null + ) { setAlert({ show: true, message: 'Please fill in all required fields.' }); return; } From 5a89a80d97e501c91f89834b73201bb222e2899d Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Thu, 10 Apr 2025 21:03:12 +0700 Subject: [PATCH 3/8] fixing DeleteDialog on transfertype --- src/pages/transfer/transfertype/blocks/DeleteDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx b/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx index 421e7e5..8262c45 100644 --- a/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx @@ -37,7 +37,7 @@ const DeleteDialog = () => { setTimeout(() => toast.success('Success Delete Transaction Type'), 0); } else { setAlert({ show: true, message: response?.message }); - setTimeout(() => toast.error('Failed Delete Product'), 0); + // setTimeout(() => toast.error('Failed Delete Product'), 0); } }, [selectedTransferType, DeleteData, handleDeleteDialog, reload]); return ( From 1bfe3d47ff92653ac7104469700295a2a90d9464 Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Thu, 10 Apr 2025 21:15:29 +0700 Subject: [PATCH 4/8] Trying delete without hit api on Transfertype --- .../transfer/transfertype/blocks/DeleteDialog.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx b/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx index 8262c45..5b41295 100644 --- a/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx @@ -19,7 +19,9 @@ const DeleteDialog = () => { message: '' }); - const doDeleteTransferType = useCallback(async () => { + + + const doDeleteTransferType = useCallback(async (id:string) => { if (!selectedTransferType) { toast.error('No Transfer Type selected'); return; @@ -40,6 +42,11 @@ const DeleteDialog = () => { // setTimeout(() => toast.error('Failed Delete Product'), 0); } }, [selectedTransferType, DeleteData, handleDeleteDialog, reload]); + + const handleDelete = ((id:string) => { + console.log(id); + // doDeleteTransferType(id); + }) return ( handleDeleteDialog(open, null)}> @@ -60,7 +67,7 @@ const DeleteDialog = () => { - From 8b399496033fc2f2c5dfe941e2106261f7bbf0d6 Mon Sep 17 00:00:00 2001 From: Wikzyy Date: Thu, 10 Apr 2025 21:40:50 +0700 Subject: [PATCH 5/8] fix create update Provider - set default value agent to null --- src/pages/master/provider/blocks/AddDialog.tsx | 4 ++-- src/pages/master/provider/blocks/EditDialog.tsx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/master/provider/blocks/AddDialog.tsx b/src/pages/master/provider/blocks/AddDialog.tsx index c49d056..875b6b7 100644 --- a/src/pages/master/provider/blocks/AddDialog.tsx +++ b/src/pages/master/provider/blocks/AddDialog.tsx @@ -68,7 +68,7 @@ const AddDialog = () => { type: string; status: string; transaction_type: string; - agent: string; + agent: string | null; created_by: string; created_at: string; } = { @@ -77,7 +77,7 @@ const AddDialog = () => { type: '', status: '', transaction_type: '', - agent: '', + agent: null, created_by: '', created_at: '' }; diff --git a/src/pages/master/provider/blocks/EditDialog.tsx b/src/pages/master/provider/blocks/EditDialog.tsx index 31af42b..f1ce287 100644 --- a/src/pages/master/provider/blocks/EditDialog.tsx +++ b/src/pages/master/provider/blocks/EditDialog.tsx @@ -58,7 +58,7 @@ const EditDialog = () => { type: string; status: string; transaction_type: string; - agent: string; + agent: string | null; updated_by: string; updated_at: string; } = { @@ -67,7 +67,7 @@ const EditDialog = () => { type: '', status: '', transaction_type: '', - agent: '', + agent: null, updated_by: '', updated_at: '' }; @@ -169,8 +169,7 @@ const EditDialog = () => { formField.description.trim() === '' || formField.type.trim() === '' || formField.status.trim() === '' || - formField.transaction_type.trim() === '' || - formField.agent.trim() === '' + formField.transaction_type.trim() === '' ) { setAlert({ show: true, message: 'Please fill in all required fields.' }); return; From 5640472e4a31dabe91cbb21f9cd2606eb642e14f Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Fri, 11 Apr 2025 09:12:21 +0700 Subject: [PATCH 6/8] update title in sign in & forgot password, change name in transaction to transaction type --- src/auth/pages/jwt/Login.tsx | 194 +++++++++--------- .../jwt/reset-password/ResetPassword.tsx | 126 ++++++------ .../hooks/ApprovalTransactionContext.tsx | 2 +- .../hooks/TransactionContext.tsx | 2 +- 4 files changed, 168 insertions(+), 156 deletions(-) diff --git a/src/auth/pages/jwt/Login.tsx b/src/auth/pages/jwt/Login.tsx index 28a283f..f8c0a64 100644 --- a/src/auth/pages/jwt/Login.tsx +++ b/src/auth/pages/jwt/Login.tsx @@ -9,6 +9,7 @@ import { useAuthContext } from '@/auth'; import { useLayout } from '@/providers'; import { Alert } from '@/components'; import moment from 'moment'; +import { Helmet } from 'react-helmet'; const loginSchema = Yup.object().shape({ username: Yup.string().required('Username is required'), @@ -76,101 +77,106 @@ const Login = () => { }; return ( -
-
-
-

Sign in

-
- {formik.status && {formik.status}} -
- - - {formik.touched.username && formik.errors.username && ( - - {formik.errors.username} - - )} -
- -
-
- -
- - {formik.touched.password && formik.errors.password && ( - - {formik.errors.password} - - )} -
- -
- - - Forgot Password? - -
- - -
-

- Copyright {moment().year()} © Telkomcel All rights reserved. -

-
-
-
+
+

Sign in

+
+ {formik.status && {formik.status}} +
+ + + {formik.touched.username && formik.errors.username && ( + + {formik.errors.username} + + )} +
+ +
+
+ +
+ + {formik.touched.password && formik.errors.password && ( + + {formik.errors.password} + + )} +
+ +
+ + + Forgot Password? + +
+ + +
+

+ Copyright {moment().year()} © Telkomcel All rights reserved. +

+
+ + + ); }; diff --git a/src/auth/pages/jwt/reset-password/ResetPassword.tsx b/src/auth/pages/jwt/reset-password/ResetPassword.tsx index f8db220..857219c 100644 --- a/src/auth/pages/jwt/reset-password/ResetPassword.tsx +++ b/src/auth/pages/jwt/reset-password/ResetPassword.tsx @@ -9,6 +9,7 @@ import { useAuthContext } from '@/auth/useAuthContext'; import { Alert, KeenIcon } from '@/components'; import { useLayout } from '@/providers'; import { AxiosError } from 'axios'; +import { Helmet } from 'react-helmet'; const initialValues = { email: '' @@ -64,70 +65,75 @@ const ResetPassword = () => { } }); return ( -
-
-
-

Your Email

- - Enter your email to reset password - -
- - {hasErrors && {formik.status}} - - {hasErrors === false && ( - - Password reset link sent. Please check your email to proceed - - )} - -
- - - {formik.touched.email && formik.errors.email && ( - - {formik.errors.email} + <> + + TPAY | Reset Password + +
+ +
+

Your Email

+ + Enter your email to reset password +
+ + {hasErrors && {formik.status}} + + {hasErrors === false && ( + + Password reset link sent. Please check your email to proceed + )} -
-
- +
+ + + {formik.touched.email && formik.errors.email && ( + + {formik.errors.email} + + )} +
- - - Back to Login - -
- -
+
+ + + + + Back to Login + +
+ +
+ ); }; diff --git a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx index 5564f0d..fb4536c 100644 --- a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx +++ b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx @@ -155,7 +155,7 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } }, { accessorKey: 'type.name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: false, enableHiding: false, meta: { diff --git a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx index 5e28d8f..273dd4f 100644 --- a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx +++ b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx @@ -157,7 +157,7 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { }, { accessorKey: 'type.name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: false, enableHiding: false, meta: { From adfc42644292e6116ea4b8a524c334c10b034b58 Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Fri, 11 Apr 2025 10:11:12 +0700 Subject: [PATCH 7/8] Fixing add, delete, and managetransfertype on transfertype --- src/pages/transfer/transfertype/blocks/AddDialog.tsx | 4 ++-- src/pages/transfer/transfertype/blocks/DeleteDialog.tsx | 7 ++++--- .../transfertype/hooks/ManageTransferTypeContext.tsx | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pages/transfer/transfertype/blocks/AddDialog.tsx b/src/pages/transfer/transfertype/blocks/AddDialog.tsx index ed5576f..19760af 100644 --- a/src/pages/transfer/transfertype/blocks/AddDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/AddDialog.tsx @@ -218,7 +218,7 @@ const AddDialog = () => { order_direction: 'ASC', }; const response = await GetData(`${API_URL_MASTERDATA}/wallet/list`, params); - console.log(response) + // console.log(response) if (response?.status && response?.data) { setWallets(response.data.list); } else { @@ -230,7 +230,7 @@ const AddDialog = () => { if (!showAddDialog) return; fetchWallets(); }, [showAddDialog]); - + // console.log(formField) return ( handleAddDialog(open)}> diff --git a/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx b/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx index 5b41295..ce6a1b8 100644 --- a/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/DeleteDialog.tsx @@ -21,7 +21,7 @@ const DeleteDialog = () => { - const doDeleteTransferType = useCallback(async (id:string) => { + const doDeleteTransferType = useCallback(async (id:string|null) => { if (!selectedTransferType) { toast.error('No Transfer Type selected'); return; @@ -43,10 +43,11 @@ const DeleteDialog = () => { } }, [selectedTransferType, DeleteData, handleDeleteDialog, reload]); - const handleDelete = ((id:string) => { + const handleDelete = ((id:string|null) => { console.log(id); - // doDeleteTransferType(id); + doDeleteTransferType(id); }) + return ( handleDeleteDialog(open, null)}> diff --git a/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx b/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx index 416eef0..f5fcd14 100644 --- a/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx +++ b/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx @@ -70,8 +70,8 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React }, []); const handleDeleteDialog = useCallback((show: boolean, selected_transfertype: string | null) => { - setShowDeleteDialog(show); setSelectedTransferType(show ? selected_transfertype : null); + setShowDeleteDialog(show); }, []); const columns = useMemo[]>( From 77b4f3d11a62f30aa9fe81d87c8eb62a4540ab75 Mon Sep 17 00:00:00 2001 From: Wikzyy Date: Fri, 11 Apr 2025 10:12:34 +0700 Subject: [PATCH 8/8] fix update Provider - set default value to null --- src/pages/master/provider/blocks/AddDialog.tsx | 2 +- src/pages/master/provider/blocks/EditDialog.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/master/provider/blocks/AddDialog.tsx b/src/pages/master/provider/blocks/AddDialog.tsx index 875b6b7..3bbf91b 100644 --- a/src/pages/master/provider/blocks/AddDialog.tsx +++ b/src/pages/master/provider/blocks/AddDialog.tsx @@ -133,7 +133,7 @@ const AddDialog = () => { return; } - console.log(formField); + // console.log(formField); doCreateProvider(e); setAlert({ show: false, message: '' }); }; diff --git a/src/pages/master/provider/blocks/EditDialog.tsx b/src/pages/master/provider/blocks/EditDialog.tsx index f1ce287..85959e4 100644 --- a/src/pages/master/provider/blocks/EditDialog.tsx +++ b/src/pages/master/provider/blocks/EditDialog.tsx @@ -156,7 +156,7 @@ const EditDialog = () => { type: response?.data.type, status: response?.data.status, transaction_type: response?.data.transaction_type.id, - agent: response?.data.agent?.id || '' + agent: response?.data.agent?.id || null })); } }, []);