This commit is contained in:
wayanrivan
2025-06-12 17:44:53 +07:00
2 changed files with 21 additions and 12 deletions

View File

@ -1,3 +1,4 @@
// exportFunctions.ts
import * as XLSX from 'xlsx';
import jsPDF from 'jspdf';
import autoTable from 'jspdf-autotable';
@ -6,6 +7,7 @@ import { format } from 'date-fns';
import { toast } from 'sonner';
import { toAbsoluteUrl } from '@/utils';
// Types
interface WalletData {
ID?: string;
name?: string;
@ -26,6 +28,7 @@ interface TransactionItem {
notes?: string;
}
// Category mapping
const categoryMap: Record<string, string> = {
T: 'TRANSFER',
P: 'PURCHASE',

View File

@ -1,3 +1,4 @@
// ShowDetailWalletDialog.tsx - Versi yang sudah disederhanakan
import React, { createContext, useCallback, useEffect, useState } from 'react';
import {
Dialog,
@ -149,6 +150,7 @@ const ShowDetailWalletDialog = () => {
}
];
// Function untuk mendapatkan data transaksi dengan pagination
const getTransactionLists = useCallback(
async (page: number, limit: number, sorting: any, _columnFilters: any) => {
try {
@ -179,6 +181,7 @@ const ShowDetailWalletDialog = () => {
[GetData, filters, selectedWallet]
);
// Function untuk mendapatkan semua data transaksi
const getAllTransactionData = async () => {
try {
const response = await GetData(
@ -200,6 +203,7 @@ const ShowDetailWalletDialog = () => {
}
};
// Function untuk export Excel - sekarang hanya memanggil function terpisah
const doExportExcel = async () => {
try {
if (!selectedWallet) {
@ -213,8 +217,10 @@ const ShowDetailWalletDialog = () => {
console.error('Error in doExportExcel:', error);
toast.error('Failed to export Excel');
}
};
};
// Function untuk export PDF - sekarang hanya memanggil function terpisah
const doExportPDF = async () => {
try {
if (!selectedWallet) {