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:
@@ -3,7 +3,7 @@
|
||||
import { useEffect, useState } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { toast } from "sonner"
|
||||
import { InvoiceStatus } from "@garage/api"
|
||||
import { InvoiceStatus, parseApiError } from "@garage/api"
|
||||
import { confirm } from "@/shared/components/confirm-dialog"
|
||||
import { badgeVariants } from "@/shared/components/ui/badge"
|
||||
import {
|
||||
@@ -71,18 +71,13 @@ export default function InvoiceStatusBadge({ invoice }: InvoiceStatusBadgeProps)
|
||||
|
||||
setIsUpdating(true)
|
||||
|
||||
const loadingToast = toast.loading(`Updating invoice status to ${formatEnum(nextStatus)}...`)
|
||||
try {
|
||||
const promise = api.invoices.update(String(invoice.id), { status: nextStatus })
|
||||
|
||||
toast.promise(promise, {
|
||||
loading: `Updating invoice status to ${formatEnum(nextStatus)}...`,
|
||||
success: "Invoice status updated successfully.",
|
||||
error: "Failed to update invoice status.",
|
||||
})
|
||||
|
||||
await promise
|
||||
setStatus(nextStatus)
|
||||
await api.invoices.update(String(invoice.id), { status: nextStatus })
|
||||
toast.success("Invoice status updated successfully.", { id: loadingToast })
|
||||
router.refresh()
|
||||
} catch (e) {
|
||||
toast.error(parseApiError(e, "Failed to update invoice status."), { id: loadingToast })
|
||||
} finally {
|
||||
setIsUpdating(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user