|
@@ -1,33 +1,25 @@
|
|
|
-"use client";
|
|
|
|
|
|
|
+'use client'
|
|
|
|
|
|
|
|
-import Link from "next/link";
|
|
|
|
|
-import { Badge } from "@/components/ui/badge";
|
|
|
|
|
-import { Button } from "@/components/ui/button";
|
|
|
|
|
-import {
|
|
|
|
|
- ArrowLeft,
|
|
|
|
|
- Download,
|
|
|
|
|
- Globe,
|
|
|
|
|
- Loader2,
|
|
|
|
|
- Mail,
|
|
|
|
|
- Pencil,
|
|
|
|
|
- Trash2,
|
|
|
|
|
-} from "lucide-react";
|
|
|
|
|
-import { statusColors, paymentStatusColors, paymentStatusLabels } from "./types";
|
|
|
|
|
|
|
+import Link from 'next/link'
|
|
|
|
|
+import { Badge } from '@/components/ui/badge'
|
|
|
|
|
+import { Button } from '@/components/ui/button'
|
|
|
|
|
+import { ArrowLeft, Download, Globe, Loader2, Mail, Pencil, Trash2 } from 'lucide-react'
|
|
|
|
|
+import { statusColors, paymentStatusColors, paymentStatusLabels } from './types'
|
|
|
|
|
|
|
|
interface ServiceDetailHeaderProps {
|
|
interface ServiceDetailHeaderProps {
|
|
|
- vehicleId: string;
|
|
|
|
|
- recordId: string;
|
|
|
|
|
- title: string;
|
|
|
|
|
- status: string;
|
|
|
|
|
- serviceDate: string;
|
|
|
|
|
- shopName: string | null;
|
|
|
|
|
- techName: string | null;
|
|
|
|
|
- paymentStatus: string;
|
|
|
|
|
- downloading: boolean;
|
|
|
|
|
- onDownloadPDF: () => void;
|
|
|
|
|
- onDelete: () => void;
|
|
|
|
|
- onShowEmail: () => void;
|
|
|
|
|
- onShowShare: () => void;
|
|
|
|
|
|
|
+ vehicleId: string
|
|
|
|
|
+ recordId: string
|
|
|
|
|
+ title: string
|
|
|
|
|
+ status: string
|
|
|
|
|
+ serviceDate: string
|
|
|
|
|
+ shopName: string | null
|
|
|
|
|
+ techName: string | null
|
|
|
|
|
+ paymentStatus: string
|
|
|
|
|
+ downloading: boolean
|
|
|
|
|
+ onDownloadPDF: () => void
|
|
|
|
|
+ onDelete: () => void
|
|
|
|
|
+ onShowEmail: () => void
|
|
|
|
|
+ onShowShare: () => void
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function ServiceDetailHeader({
|
|
export function ServiceDetailHeader({
|
|
@@ -47,23 +39,26 @@ export function ServiceDetailHeader({
|
|
|
}: ServiceDetailHeaderProps) {
|
|
}: ServiceDetailHeaderProps) {
|
|
|
return (
|
|
return (
|
|
|
<div className="shrink-0 border-b bg-background px-4 pt-2 pb-2">
|
|
<div className="shrink-0 border-b bg-background px-4 pt-2 pb-2">
|
|
|
- <div className="flex items-center justify-between">
|
|
|
|
|
|
|
+ <div className="grid grid-cols-[1fr_auto] items-center gap-4">
|
|
|
<Link
|
|
<Link
|
|
|
href={`/vehicles/${vehicleId}`}
|
|
href={`/vehicles/${vehicleId}`}
|
|
|
- className="flex items-center gap-3 text-foreground transition-colors hover:text-muted-foreground"
|
|
|
|
|
|
|
+ className="flex items-center gap-3 overflow-hidden text-foreground transition-colors hover:text-muted-foreground"
|
|
|
>
|
|
>
|
|
|
<ArrowLeft className="h-4 w-4 shrink-0" />
|
|
<ArrowLeft className="h-4 w-4 shrink-0" />
|
|
|
- <div>
|
|
|
|
|
|
|
+ <div className="overflow-hidden">
|
|
|
<div className="flex items-center gap-2">
|
|
<div className="flex items-center gap-2">
|
|
|
- <Badge variant="outline" className={`text-xs ${paymentStatusColors[paymentStatus] || ""}`}>
|
|
|
|
|
- {paymentStatusLabels[paymentStatus] || "Unpaid"}
|
|
|
|
|
|
|
+ <Badge
|
|
|
|
|
+ variant="outline"
|
|
|
|
|
+ className={`shrink-0 text-xs ${paymentStatusColors[paymentStatus] || ''}`}
|
|
|
|
|
+ >
|
|
|
|
|
+ {paymentStatusLabels[paymentStatus] || 'Unpaid'}
|
|
|
</Badge>
|
|
</Badge>
|
|
|
- <Badge variant="outline" className={`text-xs ${statusColors[status] || ""}`}>
|
|
|
|
|
|
|
+ <Badge variant="outline" className={`shrink-0 text-xs ${statusColors[status] || ''}`}>
|
|
|
{status}
|
|
{status}
|
|
|
</Badge>
|
|
</Badge>
|
|
|
- <h1 className="text-lg font-semibold leading-tight">{title}</h1>
|
|
|
|
|
|
|
+ <h1 className="truncate text-lg font-semibold leading-tight">{title}</h1>
|
|
|
</div>
|
|
</div>
|
|
|
- <p className="text-xs text-muted-foreground">
|
|
|
|
|
|
|
+ <p className="truncate text-xs text-muted-foreground">
|
|
|
{serviceDate}
|
|
{serviceDate}
|
|
|
{shopName && ` · ${shopName}`}
|
|
{shopName && ` · ${shopName}`}
|
|
|
{techName && ` · Tech: ${techName}`}
|
|
{techName && ` · Tech: ${techName}`}
|
|
@@ -78,7 +73,11 @@ export function ServiceDetailHeader({
|
|
|
</Link>
|
|
</Link>
|
|
|
</Button>
|
|
</Button>
|
|
|
<Button variant="outline" size="sm" onClick={onDownloadPDF} disabled={downloading}>
|
|
<Button variant="outline" size="sm" onClick={onDownloadPDF} disabled={downloading}>
|
|
|
- {downloading ? <Loader2 className="mr-1 h-3.5 w-3.5 animate-spin" /> : <Download className="mr-1 h-3.5 w-3.5" />}
|
|
|
|
|
|
|
+ {downloading ? (
|
|
|
|
|
+ <Loader2 className="mr-1 h-3.5 w-3.5 animate-spin" />
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <Download className="mr-1 h-3.5 w-3.5" />
|
|
|
|
|
+ )}
|
|
|
PDF
|
|
PDF
|
|
|
</Button>
|
|
</Button>
|
|
|
<Button variant="outline" size="sm" onClick={onShowEmail}>
|
|
<Button variant="outline" size="sm" onClick={onShowEmail}>
|
|
@@ -101,5 +100,5 @@ export function ServiceDetailHeader({
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- );
|
|
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|