Add PDF generation modal with content picker, repairs help pages

PDF button now opens a modal where staff can select which line items,
customer-visible notes, and photos to include before generating. Defaults
to all customer notes and completed photos. Replaces the old one-click
generation.

Added 4 help/wiki pages for the Repairs module: Repairs Overview, Repair
Templates, Repair Batches, and Notes & Photos. Covers ticket workflow,
template usage, batch management, note visibility, photo phases, and
signed approval process. Updated Getting Started nav to include Repairs.
This commit is contained in:
Ryan Moon
2026-03-29 13:20:32 -05:00
parent 591be589f0
commit 916eb29895
3 changed files with 457 additions and 17 deletions

View File

@@ -20,9 +20,8 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Skeleton } from '@/components/ui/skeleton'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
import { ArrowLeft, Plus, Trash2, RotateCcw, Save, FileText, Search } from 'lucide-react'
import { generateAndUploadPdf } from '@/components/repairs/generate-pdf'
import { repairNoteListOptions } from '@/api/repairs'
import { ArrowLeft, Plus, Trash2, RotateCcw, Save, Search } from 'lucide-react'
import { PdfModal } from '@/components/repairs/pdf-modal'
import { toast } from 'sonner'
import { useAuthStore } from '@/stores/auth.store'
import type { RepairLineItem } from '@/types/repair'
@@ -76,8 +75,6 @@ function RepairTicketDetailPage() {
const { data: ticket, isLoading } = useQuery(repairTicketDetailOptions(ticketId))
const { data: lineItemsData, isLoading: itemsLoading } = useQuery(repairLineItemListOptions(ticketId, params))
const { data: notesData } = useQuery(repairNoteListOptions(ticketId))
const token = useAuthStore((s) => s.token)
const [editFields, setEditFields] = useState<Record<string, string>>({})
@@ -185,18 +182,7 @@ function RepairTicketDetailPage() {
<h1 className="text-2xl font-bold">Ticket #{ticket.ticketNumber}</h1>
<p className="text-sm text-muted-foreground">{ticket.customerName} {ticket.instrumentDescription ?? 'No instrument'}</p>
</div>
<Button variant="outline" size="sm" onClick={() => {
if (!ticket) return
generateAndUploadPdf({
ticket,
lineItems: lineItemsData?.data ?? [],
notes: notesData?.data ?? [],
includeNotes: true,
}, ticketId, token)
toast.success('PDF downloaded and saved to documents')
}}>
<FileText className="mr-2 h-4 w-4" />PDF
</Button>
<PdfModal ticket={ticket} lineItems={lineItemsData?.data ?? []} ticketId={ticketId} />
</div>
{/* Status Progress Bar */}