- Implemented TemplateCheckpointEditDialog for creating and editing inspection checkpoints. - Added VendorActions component for managing vendor actions including edit, activate/deactivate, and delete. - Created VendorContext for managing vendor state across components. - Developed VendorGeneralInfo component to display detailed vendor information. - Introduced AedSymbol and Money components for consistent currency representation. - Added PromptDialog for user input prompts throughout the application. - Implemented RelationLink component for unified related-data display in CRUD tables. - Created InspectionTemplatesClient for API interactions related to inspection templates.
69 lines
2.9 KiB
TypeScript
69 lines
2.9 KiB
TypeScript
"use client"
|
|
|
|
import { ResourcePage } from "@/shared/data-view/resource-page"
|
|
import { ColumnHeader } from "@/shared/data-view/table-view"
|
|
import FormDialog from "@/shared/components/form-dialog"
|
|
import { ExpenseItemForm } from "@/modules/expense-items/expense-item-form"
|
|
import { EXPENSE_ITEM_ROUTES } from "@garage/api"
|
|
import type { ExpenseItemsClient } from "@garage/api"
|
|
|
|
export default function ExpenseItemPage() {
|
|
return (
|
|
<ResourcePage<ExpenseItemsClient>
|
|
pageTitle="Expense Items"
|
|
routeKey={EXPENSE_ITEM_ROUTES.INDEX}
|
|
searchable
|
|
searchPlaceholder="Search expense items..."
|
|
getClient={(api) => api.expenseItems}
|
|
headerProps={({ selectedItem, invalidateQuery }) => ({
|
|
actions: (
|
|
<FormDialog title="Expense Item">
|
|
{(resourceId, { close }) => (
|
|
<ExpenseItemForm
|
|
resourceId={resourceId}
|
|
initialData={selectedItem}
|
|
onSuccess={() => {
|
|
invalidateQuery()
|
|
close()
|
|
}}
|
|
/>
|
|
)}
|
|
</FormDialog>
|
|
),
|
|
})}
|
|
columns={({ actionsColumn }) => [
|
|
{
|
|
accessorKey: "item_name",
|
|
header: ({ column }) => <ColumnHeader column={column} title="Item Name" />,
|
|
},
|
|
{
|
|
accessorKey: "purchase_price",
|
|
header: ({ column }) => <ColumnHeader column={column} title="Purchase Price" />,
|
|
cell: ({ row }) => {
|
|
const val = (row.original as any).purchase_price
|
|
return val != null ? `$${Number(val).toFixed(2)}` : "—"
|
|
},
|
|
},
|
|
{
|
|
accessorKey: "purchase_chart_of_account",
|
|
header: ({ column }) => <ColumnHeader column={column} title="Chart of Account" />,
|
|
cell: ({ row }) => (row.original as any).purchase_chart_of_account || "—",
|
|
},
|
|
{
|
|
accessorKey: "is_active",
|
|
header: ({ column }) => <ColumnHeader column={column} title="Status" />,
|
|
cell: ({ row }) => {
|
|
const active = (row.original as any).is_active
|
|
return (
|
|
<span className={active ? "text-green-600" : "text-muted-foreground"}>
|
|
{active ? "Active" : "Inactive"}
|
|
</span>
|
|
)
|
|
},
|
|
},
|
|
actionsColumn(),
|
|
]}
|
|
/>
|
|
)
|
|
}
|