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/master/currency/CurrencyMaster.tsx b/src/pages/master/currency/CurrencyMaster.tsx index be439cd..17772d7 100644 --- a/src/pages/master/currency/CurrencyMaster.tsx +++ b/src/pages/master/currency/CurrencyMaster.tsx @@ -5,39 +5,43 @@ import { Delete } from 'lucide-react'; import AddDialog from './blocks/AddDialog'; import DeleteDialog from './blocks/DeleteDialog'; import EditDialog from './blocks/EditDialog'; - -// import EditDialog from './blocks/EditDialog'; +import { Helmet } from 'react-helmet'; const CurrencyMaster = () => { return ( - - -

Currency

- - - Dashboard - + <> + + TPAY | Manage Currency + + + +

Currency

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Currency - - + + Manage Currency + +
-
- -
+
+ +
- - - - {/* + + + + {/* */} -
-
+ + + ); }; 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" /> diff --git a/src/pages/master/provider/blocks/AddDialog.tsx b/src/pages/master/provider/blocks/AddDialog.tsx index 84bc992..5872eb4 100644 --- a/src/pages/master/provider/blocks/AddDialog.tsx +++ b/src/pages/master/provider/blocks/AddDialog.tsx @@ -61,16 +61,27 @@ const AddDialog = () => { show: false, message: '' }); - const initialState = { + + const initialState: { + name: string; + description: string; + type: string; + status: string; + transaction_type: string; + agent: string | null; + created_by: string; + created_at: string; + } = { name: '', description: '', type: '', status: '', transaction_type: '', - agent: '', + agent: null, created_by: '', created_at: '' }; + const [formField, setFormField] = useState(initialState); const [customers, setCustomers] = useState([]); const [transactions, setTransactions] = useState([]); @@ -116,14 +127,13 @@ const AddDialog = () => { formField.description.trim() === '' || formField.type.trim() === '' || formField.status.trim() === '' || - formField.transaction_type === '' || - formField.agent.trim() === '' + formField.transaction_type === '' ) { setAlert({ show: true, message: 'Please fill in all required fields.' }); return; } - console.log(formField); + // console.log(formField); doCreateProvider(e); setAlert({ show: false, message: '' }); }; @@ -242,7 +252,7 @@ const AddDialog = () => { - H2H + Host to Host Agent @@ -294,56 +304,67 @@ const AddDialog = () => { -
-
- - - - - - - - - { - e.currentTarget.scrollTop += e.deltaY; - }} + {formField.type === 'agent' ? ( +
+
+ + + + + + + + + { + e.currentTarget.scrollTop += e.deltaY; + }} + > + No Agent found. + + {customers.map((customer) => ( + { + setFormField({ + ...formField, + agent: customer.id + }); + setOpen(false); + }} + > + {customer.username} + + ))} + + + + + +
-
+ ) : ( +
+
+ + +
+
+ )}
-
-
- - - - - - - - - { - e.currentTarget.scrollTop += e.deltaY; - }} + {formField.type === 'agent' ? ( +
+
+ + + + + + + + + { + e.currentTarget.scrollTop += e.deltaY; + }} + > + No Agent found. + + {customers.map((customer) => ( + { + setFormField({ + ...formField, + agent: customer.id + }); + setOpen(false); + }} + > + {customer.username} + + ))} + + + + + +
-
+ ) : ( +
+
+ + +
+
+ )}
diff --git a/src/pages/master/reward/Reward.tsx b/src/pages/master/reward/Reward.tsx deleted file mode 100644 index 32e8691..0000000 --- a/src/pages/master/reward/Reward.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import AddDialog from './blocks/AddDialog'; -import EditDialog from './blocks/EditDialog'; -import DeleteDialog from './blocks/DeleteDialog'; -import { ManageRewardContextProvider } from './hooks/ManageRewardContext'; -import { Container, DataGridInner } from '@/components'; -import { Breadcrumbs, Link } from '@mui/material'; - -const RewardMaster = () => { - return ( - - -

Manage Reward

- - - Dashboard - - - - Master Data - - - - Manage Reward - - -
- -
- - - -
-
- ); -}; - -export default RewardMaster; diff --git a/src/pages/master/reward/RewardMaster.tsx b/src/pages/master/reward/RewardMaster.tsx new file mode 100644 index 0000000..f9b1ddd --- /dev/null +++ b/src/pages/master/reward/RewardMaster.tsx @@ -0,0 +1,43 @@ +import AddDialog from './blocks/AddDialog'; +import EditDialog from './blocks/EditDialog'; +import DeleteDialog from './blocks/DeleteDialog'; +import { ManageRewardContextProvider } from './hooks/ManageRewardContext'; +import { Container, DataGridInner } from '@/components'; +import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; + +const RewardMaster = () => { + return ( + <> + + TPAY | Manage Reward + + + +

Reward

+ + + Dashboard + + + + Master Data + + + + Manage Reward + + +
+ +
+ + + +
+
+ + ); +}; + +export default RewardMaster; diff --git a/src/pages/master/reward/blocks/AddDialog.tsx b/src/pages/master/reward/blocks/AddDialog.tsx index 9f44be0..6e32603 100644 --- a/src/pages/master/reward/blocks/AddDialog.tsx +++ b/src/pages/master/reward/blocks/AddDialog.tsx @@ -55,6 +55,15 @@ const AddDialog = () => { setAlert({ show: false, message: '' }); }; + const RewardType = { + 'Daily Check in': 'D', + Referal: 'R', + 'Level Pro': 'P', + 'Level Prioritas': 'L' + } as const; + + type RewardTypeValue = (typeof RewardType)[keyof typeof RewardType]; + const doCreateReward = useCallback( async (e: React.FormEvent) => { e.preventDefault(); @@ -140,15 +149,25 @@ const AddDialog = () => { Type* - - setFormField((prev) => ({ ...prev, type: target.value })) - } - /> +
+ +
- setFormField({ ...formField, type: e.target.value })} - /> +
+ +
+
+
+ +
diff --git a/src/pages/master/wallet/hooks/ManageWalletContext.tsx b/src/pages/master/wallet/hooks/ManageWalletContext.tsx index 0142fb8..28a5a96 100644 --- a/src/pages/master/wallet/hooks/ManageWalletContext.tsx +++ b/src/pages/master/wallet/hooks/ManageWalletContext.tsx @@ -7,12 +7,12 @@ import { Toaster } from 'sonner'; import ListToolbar from '../blocks/ListToolbar'; interface WalletProps { - Wallet_id: string; - Wallet_name: string; - Wallet_status: string; - Wallet_description: string; - Wallet_group: string[]; - Wallet_currency_id: string; + id: string; + name: string; + status: string; + description: string; + group: string[]; + currency_id: string; } interface ContextProps { @@ -73,7 +73,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } const columns = useMemo[]>( () => [ { - accessorFn: (row) => row.Wallet_name, + accessorFn: (row) => row.name, id: 'name', header: ({ column }) => , enableSorting: true, @@ -83,7 +83,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } } }, { - accessorFn: (row) => row.Wallet_description, + accessorFn: (row) => row.description, id: 'description', header: ({ column }) => , enableSorting: true, @@ -93,13 +93,13 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } } }, { - accessorFn: (row) => row.Wallet_status, + accessorFn: (row) => row.status, id: 'status', header: ({ column }) => , enableSorting: true, enableHiding: false, cell: ({ row }) => { - const isActive = row.original.Wallet_status === 'Y'; + const isActive = row.original.status === 'Y'; return ( } layout={{ card: true }} - sorting={[{ id: 'created_at', desc: true }]} + sorting={[{ id: 'wallets.created_at', desc: true }]} serverSide={true} onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) => getWalletLists(pageIndex, pageSize, sorting, columnFilters) diff --git a/src/pages/master/walletRule/blocks/AddDialog.tsx b/src/pages/master/walletRule/blocks/AddDialog.tsx index 6bdd088..043f766 100644 --- a/src/pages/master/walletRule/blocks/AddDialog.tsx +++ b/src/pages/master/walletRule/blocks/AddDialog.tsx @@ -40,14 +40,24 @@ interface GroupProps { status: string; } -interface WalletProps { - ID: string; +interface WalletGroupProps { + id: string; name: string; - id_currency: string; + description: string; status: string; } +interface WalletProps { + id: string; + name: string; + id_currency: string; + status: string; + group: WalletGroupProps[]; +} + const API_URL_WALLET = apiConfig.service_wallet; +const API_URL_MASTERDATA = apiConfig.service_master_data; + const AddDialog = () => { const { showAddDialog, handleAddDialog, selectedWalletRule } = useManageWalletRuleContext(); const { reload } = useDataGrid(); @@ -77,7 +87,6 @@ const AddDialog = () => { status: '' }; const [formField, setFormField] = useState(initialState); - const [groups, setGroups] = useState([]); const [wallets, setWallets] = useState([]); const resetForm = () => { @@ -114,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; } @@ -124,26 +142,9 @@ const AddDialog = () => { setAlert({ show: false, message: '' }); }; - const getGroupLists = async (sorting: any) => { - try { - const response = await GetData(`${API_URL_WALLET}/dashboard/group`, { - limit: 100, - page: 1, - with_deleted: false, - order_field: sorting[0].id, - order_direction: sorting[0].desc == false ? 'ASC' : 'DESC' - }); - - // console.log('GROUPS: ', response?.data); - setGroups(response?.data.list); - } catch (error) { - console.error('Error fetching groups', error); - } - }; - const getWalletLists = async (sorting: any) => { try { - const response = await GetData(`${API_URL_WALLET}/dashboard/wallet`, { + const response = await GetData(`${API_URL_MASTERDATA}/wallet/list`, { limit: 100, page: 1, with_deleted: false, @@ -158,9 +159,11 @@ const AddDialog = () => { } }; + const selectedWallet = wallets.find((wallet) => wallet.id === formField.id_wallet); + const filteredGroups = selectedWallet ? selectedWallet.group : []; + useEffect(() => { - getWalletLists([{ id: 'name', desc: false }]); - getGroupLists([{ id: 'name', desc: false }]); + getWalletLists([{ id: 'wallets.name', desc: false }]); }, []); useEffect(() => { @@ -193,14 +196,16 @@ const AddDialog = () => { setFormField({ ...formField, id_group: value })} + disabled={filteredGroups.length === 0} > - {groups.map((group) => ( - - {group.name} - - ))} + {filteredGroups.length > 0 ? ( + filteredGroups.map((group) => ( + + {group.name} + + )) + ) : ( + No groups available + )}
diff --git a/src/pages/master/walletRule/hooks/ManageWalletRuleContext.tsx b/src/pages/master/walletRule/hooks/ManageWalletRuleContext.tsx index 20f699f..14e66c3 100644 --- a/src/pages/master/walletRule/hooks/ManageWalletRuleContext.tsx +++ b/src/pages/master/walletRule/hooks/ManageWalletRuleContext.tsx @@ -81,6 +81,26 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo const columns = useMemo[]>( () => [ + { + accessorFn: (row) => row.wallet.name, + id: 'wallet_name', + header: ({ column }) => , + enableSorting: true, + enableHiding: false, + meta: { + headerClassName: 'w-[250px]' + } + }, + { + accessorFn: (row) => row.group.name, + id: 'group_name', + header: ({ column }) => , + enableSorting: true, + enableHiding: false, + meta: { + headerClassName: 'w-[250px]' + } + }, { accessorFn: (row) => row.balance_minimum, id: 'balance_minimum', @@ -227,7 +247,7 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo } layout={{ card: true }} sorting={[{ id: 'id', desc: false }]} diff --git a/src/pages/settings/user/log-activity/LogActivityPage.tsx b/src/pages/settings/user/log-activity/LogActivityPage.tsx index c9a9525..0859c61 100644 --- a/src/pages/settings/user/log-activity/LogActivityPage.tsx +++ b/src/pages/settings/user/log-activity/LogActivityPage.tsx @@ -1,33 +1,39 @@ import { Container, DataGridInner } from '@/components'; import { LogActivityContextProvider } from './hooks'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; export default function LogActivityPage() { return ( - - -

Log Activity

- - - Dashboard - + <> + + TPAY | Log Activity + + + +

Log Activity

+ + + Dashboard + - - Settings - + + Settings + - - User Management - + + User Management + - - Log Activity - - -
- -
-
-
+ + Log Activity + +
+
+ +
+
+
+ ); } diff --git a/src/pages/settings/user/manage-user/ManageUserPage.tsx b/src/pages/settings/user/manage-user/ManageUserPage.tsx index 5f318b0..17a7077 100644 --- a/src/pages/settings/user/manage-user/ManageUserPage.tsx +++ b/src/pages/settings/user/manage-user/ManageUserPage.tsx @@ -4,36 +4,42 @@ import { ManageUserContextProvider } from './hooks'; import { AddDialog } from './blocks/AddDialog'; import { DeleteDialog } from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; export default function ManageUserPage() { return ( - - -

Manage User

- - - Dashboard - + <> + + TPAY | Manage User + + + +

Manage User

+ + + Dashboard + - - Settings - + + Settings + - - User Management - + + User Management + - - Manage User - - -
- -
- - - -
-
+ + Manage User + +
+
+ +
+ + + +
+
+ ); } diff --git a/src/pages/settings/user/manage-user/blocks/AddDialog.tsx b/src/pages/settings/user/manage-user/blocks/AddDialog.tsx index ac69750..84298fa 100644 --- a/src/pages/settings/user/manage-user/blocks/AddDialog.tsx +++ b/src/pages/settings/user/manage-user/blocks/AddDialog.tsx @@ -25,6 +25,13 @@ import { useCallApi } from '@/hooks'; import { doSaveLogActivity } from '@/actions/GlobalActions'; import clsx from 'clsx'; +interface RoleListProps { + id: string; + name: string; + roles: string; + status: string; +} + interface CreateUserParams { email: string; username: string; @@ -40,9 +47,10 @@ type PasswordType = 'password' | 'retype_password'; const AddDialog = () => { const parentRef = useRef(null); - const { showAddDialog, handleAddDialog, roles } = useUserContext(); + const { showAddDialog, handleAddDialog } = useUserContext(); const { reload } = useDataGrid(); - const { PostData, PutData } = useCallApi(); + const { PostData, GetData } = useCallApi(); + const [roles, setRoles] = useState([]); const [alert, setAlert] = useState({ show: false, message: '' @@ -57,10 +65,6 @@ const AddDialog = () => { status: '' }; const [formField, setFormField] = useState(initialState); - const resetForm = () => { - setFormField(initialState); - setAlert({ show: false, message: '' }); - }; const [showPassword, setShowPassword] = useState({ password: false, retype_password: false @@ -97,6 +101,87 @@ const AddDialog = () => { }; }; + const resetForm = () => { + setFormField(initialState); + setAlert({ show: false, message: '' }); + }; + + /* actions */ + const doCreateUser = useCallback( + async (e: React.FormEvent) => { + e.preventDefault(); + + const response = await PostData(`${API_URL}/user/create`, formField); + + if (response?.status) { + handleAddDialog(false); + resetForm(); + reload(); + const createActivity = { + module: 'Manage User', + description: `Create New User => ${formField.username}`, + action: 'C' + }; + + doSaveLogActivity(createActivity); + toast.success('Success Create User'); + } else { + toast.error('Failed to create user'); + setAlert({ show: true, message: 'Failed to create user. Please try again.' }); + } + }, + [formField] + ); + + const fetchRoles = useCallback(async () => { + const params = { + limit: 100, + page: 1, + with_deleted: false, + order_field: 'name', + order_direction: 'ASC', + filter: JSON.stringify({ + status: 'Y' + }) + }; + const response = await GetData(`${API_URL}/user_role/list`, params); + // console.log('ini data:', response); + if (response?.status) { + const roleList = response.data?.list || []; + setRoles(roleList); + } else { + setRoles(() => []); + } + // console.log('ini data user_role:', response?.data); + }, []); + + useEffect(() => { + fetchRoles(); + }, [fetchRoles]); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + + console.log('Form data before submit:', formField); + + if ( + formField.email.trim() === '' || + formField.username.trim() === '' || + formField.password.trim() === '' || + formField.retype_password.trim() === '' || + formField.name.trim() === '' || + formField.id_role.trim() === '' || + formField.status.trim() === '' + ) { + setAlert({ show: true, message: 'Please fill name field.' }); + return; + } + + doCreateUser(e); + // console.log(formField); + setAlert({ show: false, message: '' }); + }; + useEffect(() => { const validation = validatePassword(formField.password, formField.retype_password); setMessagePassword(validation.isValid); @@ -111,38 +196,6 @@ const AddDialog = () => { } }, [showAddDialog]); - /* actions */ - const doCreateUser = useCallback( - async (e: React.FormEvent) => { - e.preventDefault(); - - const response = await PostData(`${API_URL}/user/create`, { - ...formField, - id_role: undefined - }); - if (response?.status) { - const responseUserAddRole = await PutData( - `${API_URL}/user/add_role/${response?.message?.id}/${formField.id_role}`, - {} - ); - resetForm(); - handleAddDialog(false); - toast.success('Success Create User'); - reload(); - const createActivity = { - module: 'Manage User', - description: `Create New User => ${formField.username}`, - action: 'C' - }; - - doSaveLogActivity(createActivity); - } else { - setAlert((prev) => ({ ...prev, show: true, message: response?.message })); - } - }, - [formField] - ); - const togglePassword = useCallback((event: MouseEvent, key: string) => { event.preventDefault(); setShowPassword((prev) => ({ ...prev, [key]: !prev[key as PasswordType] })); @@ -177,7 +230,7 @@ const AddDialog = () => {

{alert.message}

)} -
+
@@ -231,7 +284,12 @@ const AddDialog = () => {
setFormField((prev) => ({ ...prev, status }))} + onValueChange={(status) => { + setTimeout(() => { + setFormField((prev) => ({ ...prev, status })); + }, 0); + }} > diff --git a/src/pages/settings/user/manage-user/blocks/DeleteDialog.tsx b/src/pages/settings/user/manage-user/blocks/DeleteDialog.tsx index e715d69..13a8fc9 100644 --- a/src/pages/settings/user/manage-user/blocks/DeleteDialog.tsx +++ b/src/pages/settings/user/manage-user/blocks/DeleteDialog.tsx @@ -1,4 +1,11 @@ -import { Dialog, DialogContent, DialogFooter, DialogHeader } from '@/components/ui/dialog'; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, + DialogDescription +} from '@/components/ui/dialog'; import { useUserContext } from '../hooks'; import { Button } from '@/components/ui/button'; import { Alert, useDataGrid } from '@/components'; @@ -42,12 +49,14 @@ const DeleteDialog = () => { } else { setAlert((prev) => ({ ...prev, show: true, message: response?.message })); } - }, [selectedUser, enforce]); + }, [selectedUser, DeleteData, handleDeleteDialog, reload, enforce]); return ( handleDeleteDialog(open, null)}> + +

Are you sure?

you will delete this data! diff --git a/src/pages/settings/user/manage-user/blocks/EditDialog.tsx b/src/pages/settings/user/manage-user/blocks/EditDialog.tsx index e0110d3..0d32ca6 100644 --- a/src/pages/settings/user/manage-user/blocks/EditDialog.tsx +++ b/src/pages/settings/user/manage-user/blocks/EditDialog.tsx @@ -24,6 +24,12 @@ import { toast } from 'sonner'; import { useCallApi } from '@/hooks'; import { doSaveLogActivity } from '@/actions/GlobalActions'; +interface RoleListProps { + id: string; + name: string; + status: string; +} + const API_URL = apiConfig.service_dashboard; const initialState = { @@ -31,15 +37,15 @@ const initialState = { username: '', email: '', id_role: '', - id_role_old: '', status: '' }; const EditDialog = () => { const parentRef = useRef(null); - const { showEditDialog, selectedUser, handleEditDialog, roles } = useUserContext(); + const { showEditDialog, selectedUser, handleEditDialog } = useUserContext(); const { reload } = useDataGrid(); const { GetData, PutData } = useCallApi(); + const [roles, setRoles] = useState([]); const [alert, setAlert] = useState({ show: false, message: '' @@ -53,17 +59,11 @@ const EditDialog = () => { }; /* actions */ - const doResetForm = () => { - setAlert({ show: false, message: '' }); - setFormField(initialState); - }; - const doUpdateUser = useCallback( async (e: React.FormEvent) => { e.preventDefault(); const response = await PutData(`${API_URL}/user/update/${selectedUser}`, { - ...formField, - id_role_old: undefined + ...formField }); if (formField.name.trim() === '') { @@ -90,18 +90,36 @@ const EditDialog = () => { [selectedUser, formField] ); + const doFetchUserRole = useCallback(async (sorting: any) => { + try { + sorting = sorting.length == 0 ? [{ id: 'name', desc: false }] : sorting; + const response = await GetData(`${API_URL}/user_role/list`, { + limit: 100, + page: 1, + with_deleted: false, + order_field: sorting[0].id, + order_direction: sorting[0].desc == false ? 'ASC' : 'DESC' + }); + + // console.log('User ID_ROLE:', response?.data.id_role); + // console.log('Role: ', response?.data.list); + setRoles(response?.data.list); + } catch (error) { + console.error('Error fetching role', error); + } + }, []); + const doFetchUserData = useCallback(async (id: string) => { const response = await GetData(`${API_URL}/user/detail/${id}`, { id }); - if (response?.status) { - let id_role = response.data.role.id || ''; + // console.log('User detail response:', response); + if (response?.status) { setFormField((prev) => ({ ...prev, name: response.data.name, username: response.data.username, email: response.data.email, - id_role: id_role, - id_role_old: id_role, + id_role: response.data.idRole, status: response.data.status })); } else { @@ -111,10 +129,10 @@ const EditDialog = () => { username: '', email: '', id_role: '0', - id_role_old: '', status: '' })); } + // console.log('Fetched ID Role:', response?.data.id_role); }, []); useEffect(() => { @@ -129,6 +147,23 @@ const EditDialog = () => { } }, [showEditDialog]); + useEffect(() => { + const fetchAllData = async () => { + await doFetchUserRole([{ id: 'name', desc: false }]); + if (selectedUser) { + await doFetchUserData(selectedUser); + } + }; + + fetchAllData(); + }, [selectedUser]); + + // console.log('ini role: ', roles); + // useEffect(() => { + // console.log('Selected User ID Role:', formField.id_role); + // // console.log('Available Roles:', roles); + // }, [formField.id_role, roles]); + return ( handleEditDialog(open, null)}> @@ -206,7 +241,10 @@ const EditDialog = () => {
setFormField((prev) => ({ ...prev, status }))} + onValueChange={(status) => + setFormField((prev) => ({ ...prev, status })) + } > @@ -138,13 +160,20 @@ const ApprovalDialog = () => { {formField.status === 'N' && (
-
- + onChange={(e) => + setFormField((prev) => ({ + ...prev, + notes: e.target.value, + })) + } + />
)} @@ -164,4 +193,4 @@ const ApprovalDialog = () => { ); }; -export default ApprovalDialog; +export default ApprovalDialog; \ No newline at end of file diff --git a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx index e0d0ecc..e032a94 100644 --- a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx +++ b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx @@ -66,6 +66,24 @@ const DetailApprovalTransaction = () => { > Origin Customer + + +

Status

-

+

{(() => { let status; + let badgeClass; if (transactionDetails?.status === 'C') { status = 'COMPLETE'; + badgeClass = 'bg-green-100 text-green-800'; } else if (transactionDetails?.status === 'F') { status = 'FAILED'; + badgeClass = 'bg-red-100 text-red-800'; } else if (transactionDetails?.status === 'O') { status = 'ON PROCESS'; + badgeClass = 'bg-blue-100 text-blue-800'; } else { status = 'PENDING'; + badgeClass = 'bg-gray-100 text-gray-800'; } - return status; + + return ( + + {status} + + ); })()} -

+
+

Transaction Type

@@ -172,14 +201,7 @@ const DetailApprovalTransaction = () => {
-
-

Name

-

{transactionDetails?.origin_wallet.name}

-
-
-

Description

-

{transactionDetails?.origin_wallet.description}

-
+

@@ -208,8 +230,54 @@ const DetailApprovalTransaction = () => {

)} + {activeTab === 'detail' && transactionDetails?.kind === 'P' && ( +
+

+ Product Information + + Product Info + +

+
+
+

Product Name

+

{transactionDetails?.purchase.product.name}

+
+
+

Price Cash

+ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.product.price_cash)} +
+
+

Price Point

+

{transactionDetails?.purchase.product.price_point}

+
+
+

Product Type

+

{transactionDetails?.purchase.product.type}

+
+
+

Provider Name

+

{transactionDetails?.purchase.product.provider.description}

+
+
+

Provider Type

+

+ {(() => { + let providertype; + if (transactionDetails?.purchase.product.provider.type === 'h2h') { + providertype = 'HOST TO HOST'; + } else if (transactionDetails?.purchase.product.provider.type === 'agent') { + providertype = 'AGENT'; + } + return providertype; + })()} +

+
+
+
+ )} - {activeTab === 'detail' && transactionDetails?.kind != 'P' && transactionDetails?.transfer!=null && ( + {activeTab === 'detail' && transactionDetails?.kind != 'P' && transactionDetails?.transfer != null && (

Transaction Information @@ -291,69 +359,9 @@ const DetailApprovalTransaction = () => {

{transactionDetails?.transfer.destination_iban}

- -

- Destination Wallet - - Wallet - -

-
-
-

Name

-

{transactionDetails?.transfer.destination_wallet.name}

-
-
-

Description

-

{transactionDetails?.transfer.destination_wallet.description}

-
-
- -

- Destination Customer - - Destination Customer - -

-
-
-

Name

-

{transactionDetails?.transfer.destination_customer.fullname}

-
-
-

MSISDN

-

{transactionDetails?.transfer.destination_customer.msisdn}

-
-
-

Email

-

{transactionDetails?.transfer.destination_customer.email}

-
-
-

MSISDN

-

{transactionDetails?.transfer.destination_customer.username}

-
-
- -

- Origin Wallet - - Wallet - -

-
-
-

Name

-

{transactionDetails?.origin_wallet.name}

-
-
-

Description

-

{transactionDetails?.origin_wallet.description}

-
-
)} - {activeTab === 'origincustomer' && (

Origin Customer

@@ -378,6 +386,68 @@ const DetailApprovalTransaction = () => {
)} + {activeTab === 'destinationcustomer' && ( +
+

Destination Customer

+
+
+

Name

+

{transactionDetails?.transfer.destination_customer.fullname}

+
+
+

MSISDN

+

{transactionDetails?.transfer.destination_customer.msisdn}

+
+
+

Email

+

{transactionDetails?.transfer.destination_customer.email}

+
+
+

Username

+

{transactionDetails?.transfer.destination_customer.username}

+
+
+
+ )} + + {activeTab === 'originwallet' && ( +
+

Origin Wallet

+
+
+

Name

+

{transactionDetails?.origin_wallet.name}

+
+
+

Description

+

{transactionDetails?.origin_wallet.description}

+
+
+
+ )} + + {activeTab === 'destinationwallet' && ( +
+

Destination Wallet

+ + {!transactionDetails?.transfer ? ( +
No Data available
+ ) : ( +
+
+

Name

+

{transactionDetails.transfer.destination_wallet.name}

+
+
+

Description

+

{transactionDetails.transfer.destination_wallet.description}

+
+
+ )} +
+ )} + + {activeTab === 'log' && (

Transaction Logs

@@ -443,8 +513,8 @@ const DetailApprovalTransaction = () => { Status - Created At - Updated At + Date + {/* Updated At */} @@ -466,8 +536,19 @@ const DetailApprovalTransaction = () => { return status; })()} - {log.created_at} - {log.updated_at} + + {new Date(log.created_at).toLocaleString('sv-SE', { + timeZone: 'Asia/Jakarta', // kalau kamu mau waktu lokal (optional) + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + }).replace(' ', ' ')} + + {/* {log.updated_at} */} )) ) : ( diff --git a/src/pages/transaction/approval-transaction/blocks/ListToolbar.tsx b/src/pages/transaction/approval-transaction/blocks/ListToolbar.tsx index 3247955..3a82db3 100644 --- a/src/pages/transaction/approval-transaction/blocks/ListToolbar.tsx +++ b/src/pages/transaction/approval-transaction/blocks/ListToolbar.tsx @@ -18,12 +18,10 @@ const ListToolbar = () => { // useEffect to set the default date values useEffect(() => { const today = new Date(); - const nextWeek = new Date(today); - nextWeek.setDate(today.getDate() + 7); - + const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1); settrxDate({ - from: formatDate(today), // Set 'from' to today - to: formatDate(nextWeek), // Set 'to' to 7 days later + from: formatDate(firstDayOfMonth), + to: formatDate(today), }); }, []); diff --git a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx index 5564f0d..5c74f68 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: { @@ -163,22 +163,35 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } }, }, { - accessorFn: (row) => { - switch (row.status_approve) { - case 'W': return 'WAITING APPROVAL'; - case 'Y': return 'APPROVED'; - case 'N': return 'REJECTED'; - default: return 'PENDING'; + accessorKey: 'status_approve', + header: 'Status', + cell: ({ row }) => { + const statusCode = row.original.status_approve; + let label = ''; + let badgeClass = ''; + + switch (statusCode) { + case 'Y': + label = 'APPROVED'; + badgeClass = 'bg-green-100 text-green-800'; + break; + case 'N': + label = 'REJECTED'; + badgeClass = 'bg-red-100 text-red-800'; + break; + case 'W': + label = 'WAITING APPROVAL'; + badgeClass = 'bg-gray-100 text-gray-800'; + break; } + + return ( + + {label} + + ); }, - id: 'status_approve', - header: ({ column }) => , - enableSorting: false, - enableHiding: false, - meta: { - headerClassName: 'w-[250px]', - }, - }, + }, { id: 'actions', header: ({ column }) => , diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx index 6b44bdc..55db0a0 100644 --- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx @@ -30,7 +30,6 @@ const DetailTransaction = () => { const response = await GetData(`${API_URL}/transaction/history/detail/${selectedTransactionId}`, { id: selectedTransactionId }); - // console.log(response?.data); setTransactionDetails(response?.data); } catch (error) { console.error('Error fetching transaction', error); @@ -66,6 +65,24 @@ const DetailTransaction = () => { > Origin Customer + + +

Status

-

+

{(() => { let status; + let badgeClass; if (transactionDetails?.status === 'C') { status = 'COMPLETE'; + badgeClass = 'bg-green-100 text-green-800'; } else if (transactionDetails?.status === 'F') { status = 'FAILED'; + badgeClass = 'bg-red-100 text-red-800'; } else if (transactionDetails?.status === 'O') { status = 'ON PROCESS'; + badgeClass = 'bg-blue-100 text-blue-800'; } else { status = 'PENDING'; + badgeClass = 'bg-gray-100 text-gray-800'; } - return status; + + return ( + + {status} + + ); })()} -

+
+

Transaction Type

@@ -172,14 +200,7 @@ const DetailTransaction = () => {
-
-

Name

-

{transactionDetails?.origin_wallet.name}

-
-
-

Description

-

{transactionDetails?.origin_wallet.description}

-
+

@@ -246,7 +267,7 @@ const DetailTransaction = () => { providertype = 'HOST TO HOST'; } else if (transactionDetails?.purchase.product.provider.type === 'agent') { providertype = 'AGENT'; - } + } return providertype; })()}

@@ -337,69 +358,9 @@ const DetailTransaction = () => {

{transactionDetails?.transfer.destination_iban}

- -

- Destination Wallet - - Wallet - -

-
-
-

Name

-

{transactionDetails?.transfer.destination_wallet.name}

-
-
-

Description

-

{transactionDetails?.transfer.destination_wallet.description}

-
-
- -

- Destination Customer - - Destination Customer - -

-
-
-

Name

-

{transactionDetails?.transfer.destination_customer.fullname}

-
-
-

MSISDN

-

{transactionDetails?.transfer.destination_customer.msisdn}

-
-
-

Email

-

{transactionDetails?.transfer.destination_customer.email}

-
-
-

MSISDN

-

{transactionDetails?.transfer.destination_customer.username}

-
-
- -

- Origin Wallet - - Wallet - -

-
-
-

Name

-

{transactionDetails?.origin_wallet.name}

-
-
-

Description

-

{transactionDetails?.origin_wallet.description}

-
-
)} - {activeTab === 'origincustomer' && (

Origin Customer

@@ -424,6 +385,68 @@ const DetailTransaction = () => {
)} + {activeTab === 'destinationcustomer' && ( +
+

Destination Customer

+
+
+

Name

+

{transactionDetails?.transfer.destination_customer.fullname}

+
+
+

MSISDN

+

{transactionDetails?.transfer.destination_customer.msisdn}

+
+
+

Email

+

{transactionDetails?.transfer.destination_customer.email}

+
+
+

Username

+

{transactionDetails?.transfer.destination_customer.username}

+
+
+
+ )} + + {activeTab === 'originwallet' && ( +
+

Origin Wallet

+
+
+

Name

+

{transactionDetails?.origin_wallet.name}

+
+
+

Description

+

{transactionDetails?.origin_wallet.description}

+
+
+
+ )} + + {activeTab === 'destinationwallet' && ( +
+

Destination Wallet

+ + {!transactionDetails?.transfer ? ( +
No Data available
+ ) : ( +
+
+

Name

+

{transactionDetails.transfer.destination_wallet.name}

+
+
+

Description

+

{transactionDetails.transfer.destination_wallet.description}

+
+
+ )} +
+ )} + + {activeTab === 'log' && (

Transaction Logs

@@ -489,8 +512,8 @@ const DetailTransaction = () => { Status - Created At - Updated At + Date + {/* Updated At */} @@ -512,8 +535,19 @@ const DetailTransaction = () => { return status; })()} - {log.created_at} - {log.updated_at} + + {new Date(log.created_at).toLocaleString('sv-SE', { + timeZone: 'Asia/Jakarta', // kalau kamu mau waktu lokal (optional) + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + }).replace(' ', ' ')} + + {/* {log.updated_at} */} )) ) : ( diff --git a/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx b/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx index afc8ac5..e0a15c3 100644 --- a/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx +++ b/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx @@ -18,12 +18,10 @@ const ListToolbar = () => { // useEffect to set the default date values useEffect(() => { const today = new Date(); - const nextWeek = new Date(today); - nextWeek.setDate(today.getDate() + 7); - + const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1); settrxDate({ - from: formatDate(today), // Set 'from' to today - to: formatDate(nextWeek), // Set 'to' to 7 days later + from: formatDate(firstDayOfMonth), + to: formatDate(today), }); }, []); diff --git a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx index 5e28d8f..6a39771 100644 --- a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx +++ b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx @@ -84,7 +84,7 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { }); return formattedDateTime; // Format DD-MM-YYYY HH:MM:SS (menggunakan waktu yang sudah ada) } - }, + }, { accessorKey: 'origin_customer.fullname', header: ({ column }) => , @@ -125,19 +125,6 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { }, }, { - accessorFn: (row) => { - let status; - if (row.status === 'C') { - status = 'COMPLETE'; - } else if (row.status === 'F') { - status = 'FAILED'; - } else if (row.status === 'O') { - status = 'ON PROCESS'; - } else { - status = 'PENDING'; - } - return status; - }, accessorKey: 'status', header: ({ column }) => , enableSorting: false, @@ -145,7 +132,37 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { meta: { headerClassName: 'w-[250px]', }, - }, + cell: ({ row }) => { + const statusCode = row.original.status; + let label = ''; + let badgeClass = ''; + + switch (statusCode) { + case 'C': + label = 'COMPLETE'; + badgeClass = 'bg-green-100 text-green-800'; + break; + case 'F': + label = 'FAILED'; + badgeClass = 'bg-red-100 text-red-800'; + break; + case 'O': + label = 'ON PROCESS'; + badgeClass = 'bg-blue-100 text-blue-800'; + break; + default: + label = 'PENDING'; + badgeClass = 'bg-gray-100 text-gray-800'; + break; + } + + return ( + + {label} + + ); + }, + }, { accessorKey: 'description', header: ({ column }) => , @@ -157,7 +174,7 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { }, { accessorKey: 'type.name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: false, enableHiding: false, meta: { @@ -201,11 +218,12 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { if (filter == undefined || filter.length == 0) { const today = new Date(); - const nextWeek = new Date(); - nextWeek.setDate(today.getDate() + 7); - startdate = today.toISOString().split('T')[0]; - enddate = nextWeek.toISOString().split('T')[0]; + // Tanggal 1 di bulan sekarang + const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1); + + startdate = firstDayOfMonth.toISOString().split('T')[0]; + enddate = today.toISOString().split('T')[0]; } else if (filter != undefined || filter.length != 0) { startdate = filter[0].value.from; enddate = filter[0].value.to; diff --git a/src/pages/transfer/transfertype/TransferType.tsx b/src/pages/transfer/transfertype/TransferType.tsx index 49d7abe..ab79eca 100644 --- a/src/pages/transfer/transfertype/TransferType.tsx +++ b/src/pages/transfer/transfertype/TransferType.tsx @@ -5,7 +5,7 @@ import { } from './hooks/ManageTransferTypeContext'; import AddDialog from './blocks/AddDialog'; import { Breadcrumbs, Link } from '@mui/material'; -import { DeleteDialog } from './blocks/DeleteDialog'; +import DeleteDialog from './blocks/DeleteDialog'; import { EditDialog } from './blocks/EditDialog'; import { Helmet } from 'react-helmet'; @@ -37,7 +37,7 @@ const TransferType = () => {
- + {/* */} diff --git a/src/pages/transfer/transfertype/blocks/AddDialog.tsx b/src/pages/transfer/transfertype/blocks/AddDialog.tsx index 5a3bfbf..19760af 100644 --- a/src/pages/transfer/transfertype/blocks/AddDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/AddDialog.tsx @@ -41,8 +41,8 @@ import { } from '@/components/ui/command'; interface WalletProps { - Wallet_id: string; - Wallet_name: string; + id: string; + name: string; } interface CustomerProps { @@ -74,8 +74,8 @@ const AddDialog = () => { description: '', wallet_origin: '', wallet_destination: '', - wallet_fee_destination: '', - customer_fee_destination: '', + + minimum_amount: 0, maximum_amount: 0, max_transaction_per_day: 0, @@ -102,8 +102,6 @@ const AddDialog = () => { 'description', 'wallet_origin', 'wallet_destination', - 'wallet_fee_destination', - 'customer_fee_destination', 'status', 'status_approval' ]; @@ -216,13 +214,11 @@ const AddDialog = () => { limit: 100, page: 1, with_deleted: false, - order_field: 'name', + order_field: 'wallets.name', order_direction: 'ASC', - filter: JSON.stringify({ - status: 'Y' - }) }; const response = await GetData(`${API_URL_MASTERDATA}/wallet/list`, params); + // console.log(response) if (response?.status && response?.data) { setWallets(response.data.list); } else { @@ -234,7 +230,7 @@ const AddDialog = () => { if (!showAddDialog) return; fetchWallets(); }, [showAddDialog]); - + // console.log(formField) return ( handleAddDialog(open)}> @@ -262,9 +258,11 @@ const AddDialog = () => {
{alert.show && ( - -

{alert.message}

-
+
+ +

{alert.message}

+
+
)}
@@ -396,8 +394,8 @@ const AddDialog = () => { {wallets.map((wallet, idx) => ( - - {wallet.Wallet_name} + + {wallet.name} ))} @@ -424,8 +422,8 @@ const AddDialog = () => { {wallets.map((wallet, idx) => ( - - {wallet.Wallet_name} + + {wallet.name} ))} @@ -433,86 +431,8 @@ const AddDialog = () => {
-
-
- -
- -
-
-
-
-
- -
- - - - - - - - { - e.currentTarget.scrollTop += e.deltaY; - }} - > - No Customer found. - - {customers.map((customer) => ( - { - setFormField({ - ...formField, - customer_fee_destination: customer.id - }); - setOpen(false); - }} - > - {customer.username} - - ))} - - - - - -
-
-
+ +