Add dev seed data, batch status progress bar, pre-fill account from batch

Dev seed script creates 8 accounts, 8 members, 16 repair templates,
6 repair tickets in various statuses, and a school batch with 5
instruments. Run with bun run db:seed-dev.

Batch detail page now has a status progress bar matching the ticket
detail pattern. Add Repair from batch pre-fills the account and
contact name. New repair form reads accountId and contactName from
search params when linked from a batch.
This commit is contained in:
Ryan Moon
2026-03-29 14:04:02 -05:00
parent f7e78bec84
commit 55f8591cf1
5 changed files with 281 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import { Badge } from '@/components/ui/badge'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Skeleton } from '@/components/ui/skeleton'
import { ArrowLeft, Check, X, Plus, FileText, Download } from 'lucide-react'
import { BatchStatusProgress } from '@/components/repairs/batch-status-progress'
import { toast } from 'sonner'
import { useAuthStore } from '@/stores/auth.store'
import jsPDF from 'jspdf'
@@ -99,8 +100,8 @@ function RepairBatchDetailPage() {
}
function handleAddRepair() {
// Navigate to new repair with batch pre-linked
navigate({ to: '/repairs/new', search: { batchId, batchName: batch!.batchNumber ?? '' } as any })
// Navigate to new repair with batch and account pre-linked
navigate({ to: '/repairs/new', search: { batchId, batchName: batch!.batchNumber ?? '', accountId: batch!.accountId, contactName: batch!.contactName ?? '' } as any })
}
async function generateBatchPdf() {
@@ -248,6 +249,16 @@ function RepairBatchDetailPage() {
</Badge>
</div>
{/* Status Progress Bar */}
<Card>
<CardContent className="pt-6 pb-4">
<BatchStatusProgress
currentStatus={batch.status}
onStatusClick={hasPermission('repairs.edit') ? (status) => statusMutation.mutate(status) : undefined}
/>
</CardContent>
</Card>
{/* Actions */}
<div className="flex gap-2 flex-wrap">
{hasPermission('repairs.admin') && batch.approvalStatus === 'pending' && (