mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
Revamp project assignment review UI
Redesign the Review step of ProjectAssignmentForm: add new icons (Building2, CheckCircle2), restructure the overview card with distinct Client and End User sections, improve layout and spacing, introduce clearer Assignment Details and Work Order detail panels, add separators and a confirmation note. Adjust some date formatting to use native Date.toLocaleDateString for compact display. Also make a minor visual tweak in StatusTimeline: change the date separator from a dot to a dash and increase its opacity.
This commit is contained in:
+112
-63
@@ -5,7 +5,7 @@ import { useRouter } from 'next/navigation';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { motion, AnimatePresence } from 'motion/react';
|
||||
import { ArrowLeft, ArrowRight, Save, Briefcase, Clock, Search, Check, CheckCircle, Plus } from 'lucide-react';
|
||||
import { ArrowLeft, ArrowRight, Save, Briefcase, Clock, Search, Check, CheckCircle, Plus, Building2, CheckCircle2 } from 'lucide-react';
|
||||
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -602,85 +602,134 @@ export default function ProjectAssignmentForm({ client, clientId, isEdit, assign
|
||||
{/* STEP 5: REVIEW */}
|
||||
{step === 'review' && (
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<h2 className="text-2xl font-bold">Review Assignment</h2>
|
||||
<p className="text-muted-foreground">Double check everything before saving.</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6">
|
||||
<Card900>
|
||||
<CardHeader>
|
||||
<CardTitle>Overview</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-6">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Type</Label>
|
||||
<div className="mt-1">
|
||||
<Badge variant={formValues.type === 'Project' ? 'default' : 'info'}>{formValues.type}</Badge>
|
||||
<Card className="overflow-hidden">
|
||||
<div className="bg-primary/5 px-6 py-4 border-b flex justify-between items-center">
|
||||
<CardTitle className="text-lg">Project Assignment Overview</CardTitle>
|
||||
<Badge variant={formValues.type === 'IM' ? 'info' : 'default'} className="px-3">{formValues.type}</Badge>
|
||||
</div>
|
||||
<CardContent className="p-6 space-y-8">
|
||||
{/* Business Relationship Section */}
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
<div className="space-y-3">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-widest font-bold">Client Information</Label>
|
||||
<div className="flex items-center gap-4 p-4 rounded-xl border bg-card/50">
|
||||
<div className="w-12 h-12 rounded-lg bg-white border flex items-center justify-center overflow-hidden shrink-0">
|
||||
{selectedClient?.photo ?
|
||||
<LazyImage src={selectedClient.photo} alt={selectedClient.name} className="w-11 h-11 object-contain rounded" />
|
||||
:
|
||||
<Briefcase className="w-6 h-6 text-muted-foreground" />
|
||||
}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<p className="font-bold text-lg truncate">{selectedClient?.name}</p>
|
||||
<p className="text-xs text-muted-foreground truncate">{selectedClient?.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Client</Label>
|
||||
<p className="font-medium mt-1">{client?.name}</p>
|
||||
|
||||
<div className="space-y-3">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-widest font-bold">End User Information</Label>
|
||||
<div className="flex items-center gap-4 p-4 rounded-xl border bg-card/50">
|
||||
<div className="w-12 h-12 rounded-lg bg-white border flex items-center justify-center overflow-hidden shrink-0">
|
||||
{selectedEndUser?.photo ?
|
||||
<LazyImage src={selectedEndUser.photo} alt={selectedEndUser.name} className="w-11 h-11 object-contain rounded" />
|
||||
:
|
||||
<Building2 className="w-6 h-6 text-muted-foreground" />
|
||||
}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<p className="font-bold text-lg truncate">{selectedEndUser?.name}</p>
|
||||
<p className="text-xs text-muted-foreground truncate">{selectedEndUser?.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Name</Label>
|
||||
<p className="text-xl font-bold mt-1">{formValues.name || 'Untitled Assignment'}</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Code</Label>
|
||||
<p className="font-medium mt-1">{formValues.code || 'N/A'}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Year</Label>
|
||||
<p className="font-medium mt-1">{formValues.year || 'N/A'}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Start Date</Label>
|
||||
<p className="font-medium mt-1">{formValues.startDate ? dayjs(formValues.startDate).format('MMMM DD, YYYY') : 'N/A'}</p>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">End Date</Label>
|
||||
<p className="font-medium mt-1">{formValues.endDate ? dayjs(formValues.endDate).format('MMMM DD, YYYY') : 'N/A'}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Description</Label>
|
||||
<p className="text-muted-foreground mt-1">{formValues.description || 'No description provided.'}</p>
|
||||
</div>
|
||||
|
||||
{formValues.type === 'Project' && (formValues.workOrder as any)?.name && (
|
||||
<>
|
||||
<Separator />
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase mb-3 block">Work Order</Label>
|
||||
<div className="flex flex-col gap-5 p-5 bg-accent/30 rounded-md text-xs">
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase">Name</Label>
|
||||
<p className="text-sm font-bold mt-1">{(formValues.workOrder as any).name || 'Untitled Work Order'} ({(formValues.workOrder as any).code})</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase mb-0.5">Start Date</Label>
|
||||
<p>{(formValues.workOrder as any).startDate ? dayjs((formValues.workOrder as any).startDate).format('MMMM DD, YYYY') : 'N/A'}</p>
|
||||
<Separator />
|
||||
|
||||
{/* Assignment Details */}
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
<div className="md:col-span-2 space-y-4">
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-wider font-semibold">{formValues.type === 'IM' ? 'Internal Memo' : 'Project'} Name</Label>
|
||||
<p className="text-xl font-bold">{formValues.name}</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-wider font-semibold">Description</Label>
|
||||
<p className="text-sm text-muted-foreground leading-relaxed">
|
||||
{formValues.description || 'No description provided.'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 bg-muted/30 p-4 rounded-lg self-start">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-wider">{formValues.type === 'IM' ? 'IM' : 'Project'} Year</Label>
|
||||
<p className="font-mono text-sm">{formValues.year || '-'}</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-wider">{formValues.type === 'IM' ? 'IM' : 'Project'} Code</Label>
|
||||
<p className="font-mono text-sm">{formValues.code || '-'}</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-wider">Start Date</Label>
|
||||
<p className="text-sm font-medium">{formValues.startDate ? new Date(formValues.startDate).toLocaleDateString() : 'N/A'}</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-wider">End Date</Label>
|
||||
<p className="text-sm font-medium">{formValues.endDate ? new Date(formValues.endDate).toLocaleDateString() : 'N/A'}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{(formValues.workOrder as any)?.name && (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<Separator className="flex-1" />
|
||||
<Label className="text-[10px] text-muted-foreground uppercase tracking-widest font-bold px-2">Work Order Detail</Label>
|
||||
<Separator className="flex-1" />
|
||||
</div>
|
||||
<div className="bg-primary/5 rounded-xl border border-primary/10 overflow-hidden">
|
||||
<div className="p-4 flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="w-8 h-8 rounded-full bg-primary/20 text-primary flex items-center justify-center shrink-0 mt-1">
|
||||
<Building2 className="w-4 h-4" />
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase mb-0.5">End Date</Label>
|
||||
<p>{(formValues.workOrder as any).endDate ? dayjs((formValues.workOrder as any).endDate).format('MMMM DD, YYYY') : 'N/A'}</p>
|
||||
<div className="space-y-1">
|
||||
<p className="font-bold text-primary">{(formValues.workOrder as any).name}</p>
|
||||
<p className="text-xs text-muted-foreground line-clamp-2">{(formValues.workOrder as any).description}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-xs text-muted-foreground uppercase mb-0.5">Description</Label>
|
||||
<p className="text-muted-foreground">{(formValues.workOrder as any).description || 'No description provided.'}</p>
|
||||
<div className="flex gap-4 text-right">
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[9px] text-muted-foreground uppercase tracking-wider">WO Code</Label>
|
||||
<p className="text-xs font-mono">{(formValues.workOrder as any).code || '-'}</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[9px] text-muted-foreground uppercase tracking-wider">Schedule</Label>
|
||||
<p className="text-[10px] font-medium leading-none">
|
||||
{(formValues.workOrder as any).startDate ? new Date((formValues.workOrder as any).startDate).toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) : '-'} — {(formValues.workOrder as any).endDate ? new Date((formValues.workOrder as any).endDate).toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) : '-'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card900>
|
||||
</Card>
|
||||
</div>
|
||||
<div className="flex items-center justify-center gap-2 text-sm text-muted-foreground">
|
||||
<CheckCircle2 className="w-4 h-4 text-green-500" />
|
||||
<span className="italic">Employees can be assigned after the assignment is created.</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ const StatusTimeline = ({ history }: StatusTimelineProps) => {
|
||||
<div className="flex items-center gap-1.5 text-xs text-muted-foreground mb-1.5">
|
||||
<Clock className="w-3 h-3" />
|
||||
<span>{item.start_date ? dayjs(item.start_date).format('MMM D, YYYY') : ''}</span>
|
||||
<span className="opacity-50">·</span>
|
||||
<span className="opacity-70">-</span>
|
||||
<span className="font-mono">{item.end_date ? dayjs(item.end_date).format('MMM D, YYYY') : ''}</span>
|
||||
</div>
|
||||
{/* {item.status_remarks &&
|
||||
|
||||
Reference in New Issue
Block a user