feat: add logo field to settings schema and update settings client to handle file uploads
feat: integrate dialog close context in vendor select field and CRUD dialog components feat: enhance vendor general info to format status using utility function feat: implement form dialog context for managing dialog close actions feat: add async select field dialog close context for better form handling fix: update form mutation hook to close dialog on successful submission feat: extend document print types to include expense and credit note feat: add settings update payload type to include logo and other fields feat: create employee attendance and work history pages with resource management feat: implement payment made and received detail pages with actions feat: add quick shortcuts component for easy navigation in the dashboard feat: create actions for payment made and received with print and delete options feat: implement dialog close context for better dialog management feat: add error parsing utility for improved error handling in API responses
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useAuthApi } from "@/shared/useApi"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { parseApiError } from "@garage/api"
|
||||
import { Button } from "@/shared/components/ui/button"
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/shared/components/ui/dialog"
|
||||
import { ScrollArea } from "@/shared/components/ui/scroll-area"
|
||||
@@ -50,17 +51,18 @@ export function InspectionActions({ inspectionId, status, onStatusChange }: Insp
|
||||
}
|
||||
|
||||
const handleStatusChange = async (newStatus: string) => {
|
||||
const promise = api.inspections.changeStatus({
|
||||
status: newStatus,
|
||||
} as never)
|
||||
toast.promise(promise, {
|
||||
loading: "Updating status...",
|
||||
success: "Status updated successfully",
|
||||
error: "Failed to update status",
|
||||
})
|
||||
await promise
|
||||
onStatusChange?.()
|
||||
router.refresh()
|
||||
const loadingToast = toast.loading("Updating status...")
|
||||
try {
|
||||
await api.inspections.changeStatus({
|
||||
id: Number(inspectionId),
|
||||
status: newStatus,
|
||||
} as never)
|
||||
toast.success("Status updated successfully", { id: loadingToast })
|
||||
onStatusChange?.()
|
||||
router.refresh()
|
||||
} catch (e) {
|
||||
toast.error(parseApiError(e, "Failed to update status"), { id: loadingToast })
|
||||
}
|
||||
}
|
||||
|
||||
const transition = status ? STATUS_TRANSITIONS[status] : undefined
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
MoreHorizontal,
|
||||
Pencil,
|
||||
PlayCircle,
|
||||
Printer,
|
||||
Share2,
|
||||
Trash2,
|
||||
XCircle,
|
||||
@@ -28,6 +29,7 @@ import { useAuthApi } from "@/shared/useApi"
|
||||
import { confirm } from "@/shared/components/confirm-dialog"
|
||||
import { InspectionShareDialog } from "@/modules/inspections/inspection-share-dialog"
|
||||
import { INSPECTION_ROUTES } from "@garage/api"
|
||||
import { useDocumentPrint } from "@/shared/hooks/use-document-print"
|
||||
|
||||
type InspectionStatus = "in_progress" | "completed" | "cancelled"
|
||||
|
||||
@@ -48,6 +50,7 @@ export function InspectionRowActions({
|
||||
const router = useRouter()
|
||||
const api = useAuthApi()
|
||||
const queryClient = useQueryClient()
|
||||
const { print, isPrinting } = useDocumentPrint()
|
||||
const [shareOpen, setShareOpen] = useState(false)
|
||||
|
||||
const inspectionId = String(inspection.id)
|
||||
@@ -125,6 +128,9 @@ export function InspectionRowActions({
|
||||
<Pencil className="size-3.5 text-muted-foreground" /> Edit
|
||||
</DropdownMenuItem>
|
||||
|
||||
<DropdownMenuItem onClick={() => print("inspection", inspectionId, "print")} disabled={isPrinting}>
|
||||
<Printer className="size-3.5 text-muted-foreground" /> {isPrinting ? "Printing..." : "Print"}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setShareOpen(true)}>
|
||||
<Share2 className="size-3.5 text-muted-foreground" /> Share with customer
|
||||
</DropdownMenuItem>
|
||||
|
||||
Reference in New Issue
Block a user