29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { getServerApi } from '@garage/api/server'
|
|
import { InvoiceGeneralInfo } from '@/modules/invoices/invoice-general-info'
|
|
import { InvoicePartsSection } from '@/modules/invoices/invoice-parts-section'
|
|
import { InvoiceServicesSection } from '@/modules/invoices/invoice-services-section'
|
|
import { InvoiceExpensesSection } from '@/modules/invoices/invoice-expenses-section'
|
|
import DashboardPage from '@/base/components/layout/dashboard/dashboard-page'
|
|
|
|
export default async function InvoiceDetailPage(props: { params: Promise<{ id: string }> }) {
|
|
const { id } = await props.params
|
|
const api = await getServerApi()
|
|
const invoice = await api.invoices.show(id)
|
|
const data = (invoice as any)?.data ?? invoice
|
|
|
|
if (!data) {
|
|
return <div className="text-muted-foreground">Invoice not found.</div>
|
|
}
|
|
|
|
return (
|
|
<DashboardPage header={null}>
|
|
<div className="grid gap-6">
|
|
<InvoiceGeneralInfo invoice={data} />
|
|
<InvoicePartsSection parts={data.invoice_parts} />
|
|
<InvoiceServicesSection services={data.invoice_services} />
|
|
<InvoiceExpensesSection expenses={data.invoice_expenses} />
|
|
</div>
|
|
</DashboardPage>
|
|
)
|
|
}
|