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:
@@ -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' && (
|
||||
|
||||
Reference in New Issue
Block a user