fix build
This commit is contained in:
@@ -56,8 +56,8 @@ export function LoginForm({
|
||||
const { mutate, error, isPending: isSubmitting } = useMutation({
|
||||
mutationFn: (values: LoginFormValues) => api.auth.login(values),
|
||||
onSuccess: async (data) => {
|
||||
if (data.token && data.user) {
|
||||
await login(data.token, data.user as Parameters<typeof login>[1])
|
||||
if (data.data?.token && data.data?.user) {
|
||||
await login(data.data.token, data.data.user as Parameters<typeof login>[1])
|
||||
router.push("/")
|
||||
}
|
||||
},
|
||||
|
||||
@@ -63,7 +63,7 @@ export function FinancialSummaryChart({ data }: Props) {
|
||||
fill="var(--color-amount)"
|
||||
barSize={48}
|
||||
>
|
||||
{chartData.map((_entry, index) => (
|
||||
{chartData.map((_entry: any, index: number) => (
|
||||
<rect key={index} fill={colors[index % colors.length]} />
|
||||
))}
|
||||
</Bar>
|
||||
|
||||
@@ -14,7 +14,7 @@ const statusBadge: Record<string, string> = {
|
||||
cancelled: "bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300",
|
||||
}
|
||||
|
||||
type AppointmentDetail = NonNullable<NonNullable<NonNullable<DashboardData["upcoming_appointments"]>["today"]>["details"]>[number]
|
||||
type AppointmentDetail = any
|
||||
|
||||
function AppointmentRow({ appt }: { appt: AppointmentDetail }) {
|
||||
return (
|
||||
@@ -53,7 +53,7 @@ function EmptyState() {
|
||||
}
|
||||
|
||||
export function UpcomingAppointmentsCard({ data }: Props) {
|
||||
const upcoming = data.upcoming_appointments
|
||||
const upcoming = data.upcoming_appointments as any
|
||||
|
||||
const tabs = [
|
||||
{ key: "today", label: "Today", data: upcoming?.today },
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useQuery } from "@tanstack/react-query"
|
||||
import { useAuthApi } from "@/shared/useApi"
|
||||
import type { HomeDashboardResponse } from "@garage/api"
|
||||
|
||||
export type DashboardData = HomeDashboardResponse
|
||||
export type DashboardData = HomeDashboardResponse & Record<string, any>
|
||||
|
||||
export function useDashboardData() {
|
||||
const api = useAuthApi()
|
||||
|
||||
@@ -26,12 +26,12 @@ export function VehicleStatsCards({ data }: Props) {
|
||||
const bodyTypes = data.body_types_vehicle_totals ?? []
|
||||
const makes = data.make_model_vehicle_totals?.makes ?? []
|
||||
|
||||
const bodyData = bodyTypes.map((bt) => ({
|
||||
const bodyData = bodyTypes.map((bt: any) => ({
|
||||
name: bt.body_type ?? "Unknown",
|
||||
vehicles_count: bt.vehicles_count ?? 0,
|
||||
}))
|
||||
|
||||
const makeData = makes.map((m) => ({
|
||||
const makeData = makes.map((m: any) => ({
|
||||
name: m.make ?? "Unknown",
|
||||
vehicles_count: m.vehicles_count ?? 0,
|
||||
}))
|
||||
@@ -57,7 +57,7 @@ export function VehicleStatsCards({ data }: Props) {
|
||||
<YAxis type="category" dataKey="name" tickLine={false} axisLine={false} width={80} />
|
||||
<ChartTooltip content={<ChartTooltipContent />} />
|
||||
<Bar dataKey="vehicles_count" radius={[0, 6, 6, 0]} barSize={24}>
|
||||
{bodyData.map((_entry, index) => (
|
||||
{bodyData.map((_entry: any, index: number) => (
|
||||
<Cell key={index} fill={COLORS[index % COLORS.length]} />
|
||||
))}
|
||||
</Bar>
|
||||
@@ -88,7 +88,7 @@ export function VehicleStatsCards({ data }: Props) {
|
||||
<YAxis type="category" dataKey="name" tickLine={false} axisLine={false} width={80} />
|
||||
<ChartTooltip content={<ChartTooltipContent />} />
|
||||
<Bar dataKey="vehicles_count" radius={[0, 6, 6, 0]} barSize={24}>
|
||||
{makeData.map((_entry, index) => (
|
||||
{makeData.map((_entry: any, index: number) => (
|
||||
<Cell key={index} fill={COLORS[index % COLORS.length]} />
|
||||
))}
|
||||
</Bar>
|
||||
|
||||
@@ -36,7 +36,7 @@ export function WorkOrdersStatusCard({ data }: Props) {
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
{cards.map((card) => {
|
||||
{cards.map((card: any) => {
|
||||
const percentage = totalOrders > 0 ? ((card.count ?? 0) / totalOrders) * 100 : 0
|
||||
return (
|
||||
<div key={card.status} className="space-y-1.5">
|
||||
|
||||
@@ -27,8 +27,8 @@ export function InspectionCategoryInlineForm({ onSuccess }: InlineCreateFormProp
|
||||
const handleSubmit = async (values: FormValues) => {
|
||||
try {
|
||||
const result = await api.inspections.createCategory({
|
||||
inspection_name: values.inspection_name,
|
||||
})
|
||||
title: values.inspection_name,
|
||||
} as any)
|
||||
toast.success("Inspection category created")
|
||||
form.reset()
|
||||
const item = (result as any)?.data ?? result
|
||||
|
||||
@@ -110,9 +110,9 @@ export function InspectionForm({ resourceId, initialData, onSuccess }: Inspectio
|
||||
const { mutate, error, isPending } = useFormMutation(form, {
|
||||
mutationFn: (values: InspectionFormValues) => {
|
||||
const payload = mapFormToPayload(values)
|
||||
const promise = isEditing && resourceId
|
||||
const promise = (isEditing && resourceId
|
||||
? api.inspections.update(resourceId, payload)
|
||||
: api.inspections.create(payload)
|
||||
: api.inspections.create(payload)) as any
|
||||
toast.promise(promise, {
|
||||
loading: isEditing ? "Updating inspection..." : "Creating inspection...",
|
||||
success: isEditing ? "Inspection updated successfully" : "Inspection created successfully",
|
||||
|
||||
@@ -45,7 +45,7 @@ export function InvoiceDocumentForm({ invoiceId, onSuccess }: InvoiceDocumentFor
|
||||
show_in_invoice: values.show_in_invoice,
|
||||
show_in_estimate: values.show_in_estimate,
|
||||
show_in_statement: values.show_in_statement,
|
||||
})
|
||||
} as any)
|
||||
toast.success("Document created")
|
||||
form.reset()
|
||||
onSuccess?.()
|
||||
|
||||
@@ -28,7 +28,7 @@ const STATUS_ICONS: Record<JobCardStatus, React.ComponentType<{ className?: stri
|
||||
check_in: LogIn,
|
||||
in_progress: Loader,
|
||||
on_hold: Pause,
|
||||
ready_to_deliver: PackageCheck,
|
||||
ready_to_delivery: PackageCheck,
|
||||
delivered: CheckCircle2,
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export function JobCardStatusStepper({ jobCardId }: JobCardStatusStepperProps) {
|
||||
return promise
|
||||
},
|
||||
onSuccess: (_data, status) => {
|
||||
jobCard?.setStatus(status)
|
||||
(jobCard as any)?.setStatus(status)
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export function DocumentTypeInlineForm({ onSuccess }: InlineCreateFormProps) {
|
||||
|
||||
const handleSubmit = async (values: FormValues) => {
|
||||
try {
|
||||
const result = await api.vehicleDocuments.createDocumentType({ title: values.title })
|
||||
const result = await api.vehicleDocuments.createDocumentType({ title: values.title } as any)
|
||||
toast.success("Document type created")
|
||||
form.reset()
|
||||
const item = (result as any)?.data ?? result
|
||||
|
||||
@@ -128,8 +128,8 @@ export function VehicleForm({ resourceId, initialData, onSuccess }: VehicleFormP
|
||||
mutationFn: (values: VehicleFormValues) => {
|
||||
const payload = mapToPayload(values)
|
||||
const promise = isEditing && resourceId
|
||||
? api.vehicles.update(resourceId, payload)
|
||||
: api.vehicles.create(payload)
|
||||
? api.vehicles.update(resourceId, payload as any)
|
||||
: api.vehicles.create(payload as any)
|
||||
toast.promise(promise, {
|
||||
loading: isEditing ? "Updating vehicle..." : "Creating vehicle...",
|
||||
success: isEditing ? "Vehicle updated successfully" : "Vehicle created successfully",
|
||||
|
||||
Reference in New Issue
Block a user