fix tx isdone checkbox text size
This commit is contained in:
@@ -173,6 +173,31 @@ const fetchData = async (fetchPlanned: boolean = true, fetchInstant: boolean = t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const downloadTransactions = async () => {
|
||||||
|
if (!spaceStore.selectedSpaceId) return
|
||||||
|
try {
|
||||||
|
await transactionService.exportTransactions(spaceStore.selectedSpaceId, {
|
||||||
|
query: searchQuery.value || null,
|
||||||
|
categoriesIds: selectedCategoryIds.value.length > 0 ? selectedCategoryIds.value : null,
|
||||||
|
dateFrom: filterDateFrom.value ? toDateOnly(filterDateFrom.value) : null,
|
||||||
|
dateTo: filterDateTo.value ? toDateOnly(filterDateTo.value) : null,
|
||||||
|
} as TransactionFilters)
|
||||||
|
toast.add({
|
||||||
|
severity: 'success',
|
||||||
|
summary: 'Success',
|
||||||
|
detail: 'Transactions exported successfully',
|
||||||
|
life: 3000,
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Failed to export transactions.',
|
||||||
|
detail: String(e),
|
||||||
|
life: 3000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchCategories()
|
await fetchCategories()
|
||||||
await fetchData()
|
await fetchData()
|
||||||
@@ -194,6 +219,7 @@ onMounted(async () => {
|
|||||||
<InputIcon class="pi pi-search"> </InputIcon>
|
<InputIcon class="pi pi-search"> </InputIcon>
|
||||||
<InputText v-model="searchQuery" placeholder="Search" class="!w-full !bg-white !text-left" />
|
<InputText v-model="searchQuery" placeholder="Search" class="!w-full !bg-white !text-left" />
|
||||||
</IconField>
|
</IconField>
|
||||||
|
<Button icon="pi pi-download" @click="downloadTransactions" text rounded aria-label="Download" />
|
||||||
<Button icon="pi pi-filter" @click="isFilterSheetVisible = true" text rounded aria-label="Filter" />
|
<Button icon="pi pi-filter" @click="isFilterSheetVisible = true" text rounded aria-label="Filter" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
|
|||||||
@@ -80,6 +80,24 @@ async function deleteTransaction(spaceId: number, txId: number): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function exportTransactions(spaceId: number, filters: TransactionFilters): Promise<void> {
|
||||||
|
try {
|
||||||
|
let response = await api.post(`/spaces/${spaceId}/transactions/_export`, filters, {
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute('download', `transactions_${spaceId}_${toDateOnly(new Date())}.csv`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
link.remove();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const TransactionService = {
|
export const TransactionService = {
|
||||||
getTransactions, getTransaction, createTransaction, updateTransaction, deleteTransaction,
|
getTransactions, getTransaction, createTransaction, updateTransaction, deleteTransaction, exportTransactions
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user