This commit is contained in:
Viet An
2026-07-01 16:54:21 +07:00
parent c2c695cbe4
commit 8d620b8bce
16 changed files with 155 additions and 157 deletions

View File

@@ -0,0 +1,20 @@
import { groupBy } from "es-toolkit";
const invoices = ref([]);
const isPending = ref(false);
export function useInvoices() {
const { $getdata } = useNuxtApp();
async function fetchInvoices() {
isPending.value = true;
invoices.value = await $getdata("Invoice");
isPending.value = false;
}
const invoicesByStatus = computed(() => {
return groupBy(invoices.value, (invoice) => invoice.invoice_status__code);
});
return { invoices, isPending, fetchInvoices, invoicesByStatus };
}