Add InvoiceService and initial invoice dashboard widget
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
import { computed, ref, onMounted } from 'vue'
|
||||
import { type Invoice } from '@/types'
|
||||
import { newInvoice } from '@/types/index.d'
|
||||
import axios from 'axios'
|
||||
import AppLayout from '@/layouts/AppLayout.vue'
|
||||
import AppHeader from '@/components/AppHeader.vue'
|
||||
import { Button } from '@/components/ui/crm-button'
|
||||
@@ -18,6 +17,7 @@ import { Kbd, KbdGroup } from '@/components/ui/kbd'
|
||||
import { statusBadgeLabels } from '@/components/ui/status-badge'
|
||||
import InvoiceDialog from '@/components/documents/InvoiceDialog.vue'
|
||||
import { hotkey, getPlatformModifierSymbol } from '@/lib/utils'
|
||||
import InvoiceService from '@/services/InvoiceService'
|
||||
|
||||
// Initial invoice data from inertia (see InvoiceController::show)
|
||||
interface Props {
|
||||
@@ -34,8 +34,8 @@ const searchField = ref()
|
||||
onMounted(async () => {
|
||||
// Load older invoices after initial page load
|
||||
try {
|
||||
const invoiceBeforeThisYearResponse = await axios.get('/api/invoices/summaryBeforeThisYear')
|
||||
invoicesData.value = invoicesData.value.concat(invoiceBeforeThisYearResponse.data as Invoice[])
|
||||
const invoiceBeforeThisYearResponse = await InvoiceService.getSummaryBeforeThisYear()
|
||||
invoicesData.value = invoicesData.value.concat(invoiceBeforeThisYearResponse)
|
||||
invoicesData.value = invoicesData.value.sort(
|
||||
(a, b) => new Date(a.invoiceDate).getTime() - new Date(b.invoiceDate).getTime()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user