diff --git a/package-lock.json b/package-lock.json index f0ff65e..87756c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "cmdk": "^1.0.4", "date-fns": "^3.0.0", "formik": "^2.4.6", + "helmet": "^8.1.0", "https": "^1.0.0", "leaflet": "^1.9.4", "lucide-react": "^0.456.0", @@ -6055,6 +6056,15 @@ "node": ">= 0.4" } }, + "node_modules/helmet": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.1.0.tgz", + "integrity": "sha512-jOiHyAZsmnr8LqoPGmCjYAaiuWwjAPLgY8ZX2XrmHawt99/u1y6RgrZMTeoPfpUbV96HOalYgz1qzkRbw54Pmg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", diff --git a/package.json b/package.json index 4dd81d2..2e30fa9 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "cmdk": "^1.0.4", "date-fns": "^3.0.0", "formik": "^2.4.6", + "helmet": "^8.1.0", "https": "^1.0.0", "leaflet": "^1.9.4", "lucide-react": "^0.456.0", diff --git a/src/layouts/demo2/footer/Footer.tsx b/src/layouts/demo2/footer/Footer.tsx index 3e4d98c..e8e9b64 100644 --- a/src/layouts/demo2/footer/Footer.tsx +++ b/src/layouts/demo2/footer/Footer.tsx @@ -15,7 +15,7 @@ const Footer = () => { className="text-gray-600 hover:text-primary" rel="noopener noreferrer" > - Brillian Dev. + TPAY Dev. diff --git a/src/pages/account/manage-currency/ManageCurrency.tsx b/src/pages/account/manage-currency/ManageCurrency.tsx index 88a37bf..8264849 100644 --- a/src/pages/account/manage-currency/ManageCurrency.tsx +++ b/src/pages/account/manage-currency/ManageCurrency.tsx @@ -2,31 +2,35 @@ import { Container, DataGridInner } from '@/components'; import { ManageCurrencyContextProvider } from './hooks/ManageCurrencyContext'; import AddDialog from './blocks/AddDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ManageCurrency = () => { return ( - - -

Manage Currency

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

Manage Currency

+ + + Dashboard + - - Accounts - + + Accounts + - - Manage Currency - - -
- -
- -
-
+ + Manage Currency + +
+
+ +
+ +
+
+ ); }; diff --git a/src/pages/dashboards/home/DashboardHomePage.tsx b/src/pages/dashboards/home/DashboardHomePage.tsx index 61e3af5..4884ebb 100644 --- a/src/pages/dashboards/home/DashboardHomePage.tsx +++ b/src/pages/dashboards/home/DashboardHomePage.tsx @@ -15,6 +15,7 @@ import { Button } from '@/components/ui/button'; import { useFetchYear } from './hooks/useFetchYear'; import { get5LastYear } from '@/utils/Date'; import { staticChartData } from './staticChart'; +import { Helmet } from 'react-helmet'; // sum -> nominal, count-> total type CountType = 'sum' | 'count'; @@ -138,64 +139,69 @@ const DashboardHomePage = () => { ); return ( - -
- -
- -
- {/* + <> + + TPAY | Dashboard + + +
+ +
+ +
+ {/* */} - - - -
- - {/* Cards */} -
-
- {cardData.map((data: any) => ( -
- -
- ))} + + +
-
- {/* Chart */} -
-
-
- data.data)} - chartType={chartType} - chartLegend={chartLegend} - /> + {/* Cards */} +
+
+ {cardData.map((data: any) => ( +
+ +
+ ))}
-
- + + {/* Chart */} +
+
+
+ data.data)} + chartType={chartType} + chartLegend={chartLegend} + /> +
+
+
+ + ); }; diff --git a/src/pages/groups/ManageGroups.tsx b/src/pages/groups/ManageGroups.tsx index 08b145f..7704ad1 100644 --- a/src/pages/groups/ManageGroups.tsx +++ b/src/pages/groups/ManageGroups.tsx @@ -2,6 +2,7 @@ import { DataTable } from '@/components/ui/DataTable'; import { columns, Group } from './Column'; import { apiConfig } from '@/config/api.config'; import axios, { AxiosResponse } from 'axios'; +import { Helmet } from 'react-helmet'; import { DialogContent, MenuItem, @@ -153,20 +154,23 @@ const ManageGroups = () => { }; return ( -
-
- setDialogOpen(false)} - title="Confirm Action" - content={ - `Are you sure you want to ` + - (dialogType === 'create' ? 'create?' : dialogType === 'update' ? 'update?' : 'delete?') - } - onYes={handleYes} - onNo={() => setDialogOpen(false)} - /> -

Groups

+ <> + + TPAY | Manage Group + + setDialogOpen(false)} + title="Confirm Action" + content={ + `Are you sure you want to ` + + (dialogType === 'create' ? 'create?' : dialogType === 'update' ? 'update?' : 'delete?') + } + onYes={handleYes} + onNo={() => setDialogOpen(false)} + /> +

Groups

+
Dashboard @@ -180,6 +184,8 @@ const ManageGroups = () => { Manage Groups +
+
{ onUpdate={handleUpdate} onDelete={null} /> - - -
- Create New Group - - - -
- -
-
-
- - -
-
- - - - } - label="Yes" - /> - } - label="No" - /> - - -
-
- - -
- -
-
-
-
-
+ + + +
+ Create New Group + + + +
+ +
+
+
+ + +
+
+ + + + } + label="Yes" + /> + } + label="No" + /> + + +
+
+ + +
+ +
+
+
+
+ ); }; diff --git a/src/pages/master/aldeias/AldeiasMaster.tsx b/src/pages/master/aldeias/AldeiasMaster.tsx index 3ebb197..bb3fec1 100644 --- a/src/pages/master/aldeias/AldeiasMaster.tsx +++ b/src/pages/master/aldeias/AldeiasMaster.tsx @@ -4,34 +4,39 @@ import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; - +import { Helmet } from 'react-helmet'; const AldeiasMaster = () => { return ( - - -

Aldeias

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

Aldeias

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Aldeias - - + + Manage Aldeias + +
-
- -
- - - -
-
+
+ +
+ + + + + + ); }; diff --git a/src/pages/master/conversion/ConversionMaster.tsx b/src/pages/master/conversion/ConversionMaster.tsx index b33db82..94d0c60 100644 --- a/src/pages/master/conversion/ConversionMaster.tsx +++ b/src/pages/master/conversion/ConversionMaster.tsx @@ -5,37 +5,40 @@ import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; import { Delete } from 'lucide-react'; import DeleteDialog from './blocks/DeleteDialog'; - +import { Helmet } from 'react-helmet'; // import EditDialog from './blocks/EditDialog'; const ConversionMaster = () => { return ( - - -

Conversion

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

Conversion

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Conversion - - + + Manage Conversion + +
-
- -
+
+ +
- - - -
-
+ + + + + + ); }; diff --git a/src/pages/master/municipios/Municipios.tsx b/src/pages/master/municipios/Municipios.tsx index 388b269..cc82b5c 100644 --- a/src/pages/master/municipios/Municipios.tsx +++ b/src/pages/master/municipios/Municipios.tsx @@ -5,34 +5,40 @@ import SearchDialog from './blocks/SearchDialog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const Municipios = () => { return ( - - -

MUNICIPIOS

- - - Dashboard - + <> + + TPAY | Municipios + + + +

MUNICIPIOS

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Municipios - - -
- -
- - - - -
-
+ + Manage Municipios + +
+
+ +
+ + + + +
+
+ ); }; diff --git a/src/pages/master/postoadms/PostoAdmsMaster.tsx b/src/pages/master/postoadms/PostoAdmsMaster.tsx index 163b97f..90823ab 100644 --- a/src/pages/master/postoadms/PostoAdmsMaster.tsx +++ b/src/pages/master/postoadms/PostoAdmsMaster.tsx @@ -5,36 +5,42 @@ import SearchDialog from './blocks/SearchDialog'; import { ManagePostoAdmsContextProvider } from './hooks/ManagePostoAdmsContext'; import { Container, DataGridInner } from '@/components'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const PostoAdmsMaster = () => { return ( - - -

- Postu Administrativo -

- - - Dashboard - + <> + + TPAY | Manage Postu Administrativo + + + +

+ Postu Administrativo +

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Postu Administrativo - - -
- -
- - - - -
-
+ + Manage Postu Administrativo + +
+
+ +
+ + + + +
+
+ ); }; diff --git a/src/pages/master/products/ProductsMaster.tsx b/src/pages/master/products/ProductsMaster.tsx index b0b9792..a751269 100644 --- a/src/pages/master/products/ProductsMaster.tsx +++ b/src/pages/master/products/ProductsMaster.tsx @@ -4,33 +4,37 @@ import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ProductsMaster = () => { return ( - - -

Manage Products

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

Manage Products

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Products - - -
- -
- - - -
-
+ + Manage Products + +
+
+ +
+ + + +
+
+ ); }; diff --git a/src/pages/master/profession/ProfessionMaster.tsx b/src/pages/master/profession/ProfessionMaster.tsx index 07583f5..19c435a 100644 --- a/src/pages/master/profession/ProfessionMaster.tsx +++ b/src/pages/master/profession/ProfessionMaster.tsx @@ -4,33 +4,37 @@ import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ProfessionMaster = () => { return ( - - -

Manage Profession

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

Manage Profession

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Profession - - -
- -
- - - -
-
+ + Manage Profession + +
+
+ +
+ + + +
+
+ ); }; diff --git a/src/pages/master/provider/ProviderMaster.tsx b/src/pages/master/provider/ProviderMaster.tsx index dce73d1..2a564f8 100644 --- a/src/pages/master/provider/ProviderMaster.tsx +++ b/src/pages/master/provider/ProviderMaster.tsx @@ -4,33 +4,37 @@ import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ProviderMaster = () => { return ( - - -

Manage Provider

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

Manage Provider

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Provider - - -
- -
- - - -
-
+ + Manage Provider + +
+
+ +
+ + + +
+
+ ); }; diff --git a/src/pages/master/sucos/SucosMaster.tsx b/src/pages/master/sucos/SucosMaster.tsx index ac7b7e5..46c3215 100644 --- a/src/pages/master/sucos/SucosMaster.tsx +++ b/src/pages/master/sucos/SucosMaster.tsx @@ -5,36 +5,42 @@ import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import SearchDialog from './blocks/SearchDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const SucosMaster = () => { return ( - - -

Sucos

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

Sucos

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Sucos - - + + Manage Sucos + +
-
- -
+
+ +
- - - - -
-
+ + + + + + + ); }; diff --git a/src/pages/master/wallet/WalletMaster.tsx b/src/pages/master/wallet/WalletMaster.tsx index 3190787..1442bc4 100644 --- a/src/pages/master/wallet/WalletMaster.tsx +++ b/src/pages/master/wallet/WalletMaster.tsx @@ -3,32 +3,36 @@ import { ManageWalletContextProvider } from './hooks/ManageWalletContext'; import { Breadcrumbs, Link } from '@mui/material'; import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; +import { Helmet } from 'react-helmet'; const WalletMaster = () => { return ( - - -

Manage Wallet

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

Manage Wallet

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Wallet - - -
- -
- - -
-
+ + Manage Wallet + +
+
+ +
+ + +
+
+ ); }; diff --git a/src/pages/master/walletRule/WalletRuleMaster.tsx b/src/pages/master/walletRule/WalletRuleMaster.tsx index 08e56d2..6020c56 100644 --- a/src/pages/master/walletRule/WalletRuleMaster.tsx +++ b/src/pages/master/walletRule/WalletRuleMaster.tsx @@ -4,35 +4,39 @@ import { Breadcrumbs, Link } from '@mui/material'; import AddDialog from './blocks/AddDialog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; +import { Helmet } from 'react-helmet'; const WalletRuleMaster = () => { return ( - - -

Wallet Rule

- - - Dashboard - + <> + TPAY | Manage Wallet Rule + + +

Wallet Rule

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Wallet Rule - - + + Manage Wallet Rule + +
-
- -
+
+ +
- - - -
-
+ + + + + + ); }; diff --git a/src/pages/members/kyc/Kyc.tsx b/src/pages/members/kyc/Kyc.tsx index 6291aa7..eb038ff 100644 --- a/src/pages/members/kyc/Kyc.tsx +++ b/src/pages/members/kyc/Kyc.tsx @@ -12,6 +12,7 @@ import { toast } from 'sonner'; const BASE_URL = apiConfig.service_customer; import CustomerDialog from '../manage-members/CustomerDetailModal'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; export interface IDataGridContextProps { props: TDataGridProps; @@ -141,42 +142,59 @@ const Kyc = () => { }; return ( -
-
- setDialogOpen(false)} - title="Confirm Action" - content={`Are you sure you want to ${dialogType}?`} - onYes={handleYes} - onNo={() => setDialogOpen(false)} - /> - -

Manage Member KYC

- - - Dashboard - + <> + + TPAY | KYC + +
+
+ setDialogOpen(false)} + title="Confirm Action" + content={`Are you sure you want to ${dialogType}?`} + onYes={handleYes} + onNo={() => setDialogOpen(false)} + /> + +

Manage Member KYC

+
+ + + Dashboard + - - Members - + + Members + - - Manage Member KYC - - - + + Manage Member KYC + + +
+
+
+ +
+
+ +
-
+ ); }; diff --git a/src/pages/members/manage-members/ManageMembers.tsx b/src/pages/members/manage-members/ManageMembers.tsx index a258539..7ef563b 100644 --- a/src/pages/members/manage-members/ManageMembers.tsx +++ b/src/pages/members/manage-members/ManageMembers.tsx @@ -10,6 +10,7 @@ import { ScreenLoader } from '@/components'; import { toast } from 'sonner'; import { Breadcrumbs, Link } from '@mui/material'; const BASE_URL = apiConfig.service_customer; +import { Helmet } from 'react-helmet'; const ManageMembers = () => { const [loading, setLoading] = useState(false); @@ -115,6 +116,7 @@ const ManageMembers = () => { if (loading) return ; return ( +<<<<<<< Updated upstream
{ Dashboard +======= + <> + + TPAY | Manage Members + +
+
+ setDialogOpen(false)} + title="Confirm Action" + content={`Are you sure you want to ${dialogType}?`} + onYes={handleYes} + onNo={() => setDialogOpen(false)} + /> + +

Manage Members

+
+ + + Dashboard + +>>>>>>> Stashed changes - - Members - + + Members + - - Manage Members - - - + + Manage Members + + +
+
+
+ +
+
+
-
+ ); }; diff --git a/src/pages/menu/manage-menu/ManageMenu.tsx b/src/pages/menu/manage-menu/ManageMenu.tsx index c0849a7..855733f 100644 --- a/src/pages/menu/manage-menu/ManageMenu.tsx +++ b/src/pages/menu/manage-menu/ManageMenu.tsx @@ -4,33 +4,37 @@ import AddDialog from './blocks/AddDIalog'; import EditDialog from './blocks/EditDialog'; import DeleteDialog from './blocks/DeleteDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ManageMenu = () => { return ( - - -

Manage Menu

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

Manage Menu

+ + + Dashboard + - - Master Data - + + Master Data + - - Manage Menu - - -
- -
- - - -
-
+ + Manage Menu + +
+
+ +
+ + + +
+
+ ); }; diff --git a/src/pages/notification/ManageNotification.tsx b/src/pages/notification/ManageNotification.tsx index 088627b..bb30743 100644 --- a/src/pages/notification/ManageNotification.tsx +++ b/src/pages/notification/ManageNotification.tsx @@ -2,33 +2,39 @@ import { Container, DataGridInner } from '@/components'; import { ManageNotifContextProvider } from './hooks/ManageNotificationContext'; import AddDialog from './blocks/AddDialog'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ManageNotification = () => { return ( - - -

- Manage Notifications -

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

+ Manage Notifications +

+ + + Dashboard + - - Notification - + + Notification + - - Manage Notification - - -
- -
- -
-
+ + Manage Notification + +
+
+ +
+ +
+
+ ); }; diff --git a/src/pages/settings/user/manage-position/ManagePositionPage.tsx b/src/pages/settings/user/manage-position/ManagePositionPage.tsx index 6ddcd6d..2971a2d 100644 --- a/src/pages/settings/user/manage-position/ManagePositionPage.tsx +++ b/src/pages/settings/user/manage-position/ManagePositionPage.tsx @@ -4,36 +4,42 @@ import { ManagePositionContextProvider } 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 ManagePositionPage() { return ( - - -

Manage Positions

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

Manage Positions

+ + + Dashboard + - - Settings - + + Settings + - - User Management - + + User Management + - - Manage Position - - -
- -
- - - -
-
+ + Manage Position + +
+
+ +
+ + + +
+
+ ); } diff --git a/src/pages/transaction/approval-transaction/ApprovalTransaction.tsx b/src/pages/transaction/approval-transaction/ApprovalTransaction.tsx index e6aa68b..b433e1d 100644 --- a/src/pages/transaction/approval-transaction/ApprovalTransaction.tsx +++ b/src/pages/transaction/approval-transaction/ApprovalTransaction.tsx @@ -1,30 +1,36 @@ import { Container, DataGridInner } from '@/components'; import { ApprovalTransactionProvider } from './hooks/ApprovalTransactionContext'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const ApprovalTransaction = () => { return ( - - -

TRANSACTION

- - - Dashboard - + <> + + TPAY | Approval Transaction + + + +

TRANSACTION

+ + + Dashboard + - - Transaction - + + Transaction + - - Approval Transaction - - -
- -
-
-
+ + Approval Transaction + +
+
+ +
+
+
+ ); }; diff --git a/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx b/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx new file mode 100644 index 0000000..076f924 --- /dev/null +++ b/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx @@ -0,0 +1,152 @@ +import { useTransactionContext } from '../hooks/useApprovalTransactionContext'; +import { useCallApi } from '@/hooks'; +import { apiConfig } from '@/config/api.config'; +import { useCallback, useEffect, useRef, useState } from 'react'; +import { + Dialog, + DialogBody, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle +} from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue +} from '@/components/ui/select'; +import { Alert, KeenIcon, useDataGrid } from '@/components'; +import { doSaveLogActivity } from '@/actions/GlobalActions'; +import { toast } from 'sonner'; +import { Input } from '@/components/ui/input'; + +const API_URL = apiConfig.transaction; + +const ApprovalDialog = () => { + const { GetData, PostData } = useCallApi(); + // const { reload } = useDataGrid(); + const { + showApprovalDialog, + setShowApprovalDialog, + selectedTransactionIdForApproval + } = useTransactionContext(); + + const [transactionDetails, setTransactionDetails] = useState(null); + + const [formField, setFormField] = useState({ + transaction_code: '', + status: '' + }); + + const [alert, setAlert] = useState({ + show: false, + message: '' + }); + + const doApproval = useCallback( + async (e: React.FormEvent) => { + e.preventDefault(); + + if (!transactionDetails || !transactionDetails.code) { + toast.error('Transaction data not loaded yet.'); + return; + } + + if (!formField.status) { + toast.error('Please select a status.'); + return; + } + + const response = await PostData(`${API_URL}/transaction/set-approval`, { + transaction_code: transactionDetails.code, + status: formField.status, + }); + + if (response?.status) { + setAlert((prev) => ({ ...prev, show: false, message: '' })); + toast.success('Success Update Position'); + const createActivity = { + module: 'Approval Transaction', + description: `Change status approve for transaction => ${transactionDetails.code}`, + action: 'U' + }; + doSaveLogActivity(createActivity); + setShowApprovalDialog(false); // optionally close dialog + } else { + setAlert((prev) => ({ ...prev, show: true, message: response?.message })); + } + }, + [formField, transactionDetails] + ); + + useEffect(() => { + const fetchTransactionDetails = async () => { + if (selectedTransactionIdForApproval) { + try { + const response = await GetData(`${API_URL}/transaction/history/detail/${selectedTransactionIdForApproval}`, { + id: selectedTransactionIdForApproval + }); + // console.log(response?.data.code); + // console.log(selectedTransactionIdForApproval); + setTransactionDetails(response?.data); + } catch (error) { + console.error('Error fetching transaction', error); + } + } + }; + + if (showApprovalDialog && selectedTransactionIdForApproval) { + fetchTransactionDetails(); + } + }, [showApprovalDialog, selectedTransactionIdForApproval, GetData]); + + + return ( + + + + Approval Transaction + + +
+
+
+
+ + +
+ +
+
+
+ + +
+
+ +
+
+
+
+
+
+ ); +}; + +export default ApprovalDialog; diff --git a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx index 91c87c2..84b0f3a 100644 --- a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx +++ b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx @@ -1,14 +1,18 @@ +import React, { createContext, useMemo, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; // FIXED HERE +import { ColumnDef } from '@tanstack/react-table'; +import axios from 'axios'; + import { DataGridColumnHeader, DataGridProvider, KeenIcon } from '@/components'; import { Toaster } from '@/components/ui/sonner'; import { apiConfig } from '@/config/api.config'; -import { ColumnDef } from '@tanstack/react-table'; -import axios from 'axios'; -import React, { createContext, useCallback, useEffect, useMemo, useState } from 'react'; import { useCallApi } from '@/hooks'; + import ListToolbar from '../blocks/ListToolbar'; -import { Button } from '@/components/ui/button'; -import { useNavigate } from 'react-router'; import DetailApprovalTransaction from '../blocks/DetailApprovalTransaction'; +import ApprovalDialog from '../blocks/ApprovalDialog'; + +import { Button } from '@/components/ui/button'; interface ApprovalTransactionProps { id: number; @@ -17,25 +21,31 @@ interface ApprovalTransactionProps { interface ContextProps { getTransactionLists: ( - limit: number, page: number, - with_deleted: boolean, - order_field: any, - order_direction: any, + limit: number, + sorting: any, filter: any ) => Promise<{ data: ApprovalTransactionProps[]; totalCount: number } | undefined>; showDetailDialog: boolean; setShowDetailDialog: React.Dispatch>; + showApprovalDialog: boolean; + setShowApprovalDialog: React.Dispatch>; selectedTransactionId: number | null; setSelectedTransactionId: React.Dispatch>; + selectedTransactionIdForApproval: number | null; + setSelectedTransactionIdForApproval: React.Dispatch>; } const initialProps: ContextProps = { getTransactionLists: async () => ({ data: [], totalCount: 0 }), showDetailDialog: false, setShowDetailDialog: () => { }, + showApprovalDialog: false, + setShowApprovalDialog: () => { }, selectedTransactionId: null, - setSelectedTransactionId: () => { } + setSelectedTransactionId: () => { }, + selectedTransactionIdForApproval: null, + setSelectedTransactionIdForApproval: () => { }, }; const ManageApprovalTransactionContext = createContext(initialProps); @@ -43,63 +53,54 @@ const API_URL = apiConfig.transaction; const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode }) => { const [showDetailDialog, setShowDetailDialog] = useState(false); + const [showApprovalDialog, setShowApprovalDialog] = useState(false); const [selectedTransactionId, setSelectedTransactionId] = useState(null); + const [selectedTransactionIdForApproval, setSelectedTransactionIdForApproval] = useState(null); const [transaction, setTransaction] = useState([]); + const { GetData } = useCallApi(); const navigate = useNavigate(); - const handleNavigate = (path: string) => { - const url = navigate(`${API_URL}/transaction/history/${path}`); - }; const columns = useMemo[]>( () => [ - // { - // accessorKey: 'transaction_date', - // header: ({ column }) => , - // enableSorting: false, - // enableHiding: false, - // meta: { - // headerClassName: 'w-[250px]' - // } - // }, { accessorKey: 'transaction_date', header: ({ column }) => , enableSorting: false, enableHiding: false, meta: { - headerClassName: 'w-[250px]' + headerClassName: 'w-[250px]', }, cell: ({ row }) => { - // Memformat tanggal dan waktu dari ISO ke format biasa (DD-MM-YYYY HH:MM:SS) const transactionDate = new Date(row.original.transaction_date); - const formattedDateTime = transactionDate.toLocaleString('en-GB', { + return transactionDate.toLocaleString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit', - hour12: false // Gunakan format 24 jam + hour12: false, }); - return formattedDateTime; // Format DD-MM-YYYY HH:MM:SS (menggunakan waktu yang sudah ada) - } - }, + }, + }, { accessorKey: 'origin_customer.fullname', header: ({ column }) => , enableSorting: false, enableHiding: false, meta: { - headerClassName: 'w-[250px]' - } + headerClassName: 'w-[250px]', + }, }, { accessorFn: (row) => { const purchaseAmount = row?.purchase?.amount; const transferAmount = row?.transfer?.amount; - - return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(purchaseAmount ?? transferAmount ?? 0); + return new Intl.NumberFormat('en-US', { + style: 'currency', + currency: 'USD', + }).format(purchaseAmount ?? transferAmount ?? 0); }, id: 'amount', header: ({ column }) => , @@ -111,10 +112,12 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } }, { accessorFn: (row) => { - const purchaseAmount = row?.purchase?.fee_amount; - const transferAmount = row?.transfer?.fee_amount; - - return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(purchaseAmount ?? transferAmount ?? 0); + const purchaseFee = row?.purchase?.fee_amount; + const transferFee = row?.transfer?.fee_amount; + return new Intl.NumberFormat('en-US', { + style: 'currency', + currency: 'USD', + }).format(purchaseFee ?? transferFee ?? 0); }, id: 'feeamount', header: ({ column }) => , @@ -126,19 +129,14 @@ const ApprovalTransactionProvider = ({ 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'; + switch (row.status) { + case 'C': return 'COMPLETE'; + case 'F': return 'FAILED'; + case 'O': return 'ON PROCESS'; + default: return 'PENDING'; } - return status; }, - accessorKey: 'status', + id: 'status', header: ({ column }) => , enableSorting: false, enableHiding: false, @@ -152,8 +150,8 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } enableSorting: false, enableHiding: false, meta: { - headerClassName: 'w-[250px]' - } + headerClassName: 'w-[250px]', + }, }, { accessorKey: 'type.name', @@ -161,8 +159,25 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } enableSorting: false, enableHiding: false, meta: { - headerClassName: 'w-[250px]' - } + headerClassName: 'w-[250px]', + }, + }, + { + accessorFn: (row) => { + switch (row.status_approve) { + case 'W': return 'WAITING APPROVAL'; + case 'Y': return 'APPROVED'; + case 'N': return 'REJECTED'; + default: return 'PENDING'; + } + }, + id: 'status_approve', + header: ({ column }) => , + enableSorting: false, + enableHiding: false, + meta: { + headerClassName: 'w-[250px]', + }, }, { id: 'actions', @@ -172,7 +187,7 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } cell: (data) => { const row = data.row.original; return ( -
+
+
); }, meta: { headerClassName: 'w-[100px]', - cellClassName: 'text-center' - } - } + cellClassName: 'text-center', + }, + }, ], - []); + [] + ); const getTransactionLists = async (page: number, limit: number, sorting: any, filter: any) => { try { - let startdate; - let enddate; - let formattedFilter; + let startdate, enddate; - if (filter == undefined || filter.length == 0) { + if (!filter || 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]; - } else if (filter != undefined || filter.length != 0) { - startdate = filter[0].value.from; - enddate = filter[0].value.to; + } else { + startdate = filter[0]?.value?.from; + enddate = filter[0]?.value?.to; } - formattedFilter = { + const formattedFilter = { "Transactions.transaction_date": { - from: startdate + " 00:00:00", - to: enddate + " 23:59:59" - } + from: `${startdate} 00:00:00`, + to: `${enddate} 23:59:59`, + }, + "Transactions.status_approve": { in: ["W", "Y", "N"] }, }; const response = await GetData(`${API_URL}/transaction/history`, { @@ -224,11 +247,14 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } with_deleted: false, order_field: "Transactions.created_at", order_direction: 'DESC', - filter: JSON.stringify(formattedFilter) + filter: JSON.stringify(formattedFilter), }); - setTransaction(response?.data.list); - return { data: response?.data.list, totalCount: response?.data.total_count }; + setTransaction(response?.data?.list || []); + return { + data: response?.data?.list || [], + totalCount: response?.data?.total_count || 0, + }; } catch (error) { console.error('Error fetching transaction', error); } @@ -240,12 +266,17 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } getTransactionLists, showDetailDialog, setShowDetailDialog, + showApprovalDialog, + setShowApprovalDialog, selectedTransactionId, - setSelectedTransactionId + setSelectedTransactionId, + selectedTransactionIdForApproval, + setSelectedTransactionIdForApproval, }} > + { return ( - - -

TRANSACTION

- - - Dashboard - + <> + + TPAY | History Transaction + + + +

TRANSACTION

+ + + Dashboard + - - Transaction - + + Transaction + - - History Transaction - - -
- -
-
-
+ + History Transaction + +
+
+ +
+
+
+ ); }; diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx index 5f3ad0d..6b44bdc 100644 --- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx @@ -227,7 +227,7 @@ const DetailTransaction = () => {

Price Point

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

{transactionDetails?.purchase.product.price_point}

Product Type

@@ -239,7 +239,17 @@ const DetailTransaction = () => {

Provider Type

-

{transactionDetails?.purchase.product.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; + })()} +

diff --git a/src/pages/transfer/transfertype/TransferType.tsx b/src/pages/transfer/transfertype/TransferType.tsx index daa87c6..49d7abe 100644 --- a/src/pages/transfer/transfertype/TransferType.tsx +++ b/src/pages/transfer/transfertype/TransferType.tsx @@ -7,35 +7,41 @@ import AddDialog from './blocks/AddDialog'; import { Breadcrumbs, Link } from '@mui/material'; import { DeleteDialog } from './blocks/DeleteDialog'; import { EditDialog } from './blocks/EditDialog'; +import { Helmet } from 'react-helmet'; const TransferType = () => { - + return ( - - -

Manage Transaction Type

- - - Dashboard - + <> + + TPAY | Manage Transaction Type + + + +

Manage Transaction Type

+ + + Dashboard + - - Transfer Type - + + Transfer Type + - - Manage Transfer Type - - -
- -
- - - - -
-
+ + Manage Transfer Type + +
+
+ +
+ + + + +
+
+ ); }; diff --git a/src/pages/wallet/wallet-history/WalletHistory.tsx b/src/pages/wallet/wallet-history/WalletHistory.tsx index d146a2d..d914746 100644 --- a/src/pages/wallet/wallet-history/WalletHistory.tsx +++ b/src/pages/wallet/wallet-history/WalletHistory.tsx @@ -1,31 +1,37 @@ import { Container, DataGridInner } from '@/components'; import { ManageWalletContextProvider } from './hooks/ManageWalletHistoryContext'; import { Breadcrumbs, Link } from '@mui/material'; +import { Helmet } from 'react-helmet'; const WalletHistory = () => { return ( - - -

Wallet History

- - - Dashboard - + <> + + TPAY | Wallet History + + + +

Wallet History

+ + + Dashboard + - - Wallet - + + Wallet + - - Wallet History - - + + Wallet History + +
-
- -
-
-
+
+ +
+ + + ); }; diff --git a/yarn.lock b/yarn.lock index 3212aa5..68a5c2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2762,6 +2762,11 @@ hasown@^2.0.0, hasown@^2.0.2: dependencies: function-bind "^1.1.2" +helmet@^8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/helmet/-/helmet-8.1.0.tgz" + integrity sha512-jOiHyAZsmnr8LqoPGmCjYAaiuWwjAPLgY8ZX2XrmHawt99/u1y6RgrZMTeoPfpUbV96HOalYgz1qzkRbw54Pmg== + hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@3: version "3.3.2" resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz"