diff --git a/public/media/file-templates/batch-sample.xlsx b/public/media/file-templates/batch-sample.xlsx new file mode 100644 index 0000000..25b7318 Binary files /dev/null and b/public/media/file-templates/batch-sample.xlsx differ diff --git a/src/pages/disbursement/history-transaction/blocks/ListToolbar.tsx b/src/pages/disbursement/history-transaction/blocks/ListToolbar.tsx index 4b6c69f..f810d53 100644 --- a/src/pages/disbursement/history-transaction/blocks/ListToolbar.tsx +++ b/src/pages/disbursement/history-transaction/blocks/ListToolbar.tsx @@ -3,6 +3,7 @@ import { useTransactionContext } from '../hooks/useTransactionContext'; import { Button } from '@/components/ui/button'; import { useCallback, useState, useEffect } from 'react'; import { toast } from 'sonner'; +import { toAbsoluteUrl } from '@/utils'; const ListToolbar = () => { const { table, reload } = useDataGrid(); @@ -23,8 +24,8 @@ const ListToolbar = () => { nextWeek.setDate(today.getDate() + 7); settrxDate({ - from: formatDate(today), // Set 'from' to today - to: formatDate(nextWeek), // Set 'to' to 7 days later + from: formatDate(today), // Set 'from' to today + to: formatDate(nextWeek) // Set 'to' to 7 days later }); }, []); @@ -37,6 +38,15 @@ const ListToolbar = () => { } }, [trxDate, table]); + const handleExportData = () => { + const link = document.createElement('a'); + link.href = toAbsoluteUrl('/media/file-templates/batch-sample.xlsx'); + link.download = 'upload-batch-template.xlsx'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }; + useEffect(() => { if (trxDate.from && trxDate.to) { handleFilterData(); @@ -55,6 +65,15 @@ const ListToolbar = () => { > Upload Batch + + +