mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:56:28 +00:00
Add end-user photo & UI refinements
Show end-user info and improve responsive layout and form UX. Changes include: make grid responsive (md:grid-cols-2) and add an inline end-user card with LazyImage in ClientDetailComponent; update ProjectAssignmentForm to show a default header description when no clientId, add bottom spacing to CardContent, and hide the "add client" (+) button when a clientId exists; remove a debug console.log and show client.description (with fallback) in project detail page; and add a photo field to Client and EndUser types in type.assignment.ts. These tweaks improve visual clarity and prevent creating duplicate clients from the assignment form.
This commit is contained in:
@@ -84,7 +84,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
|
||||
: viewMode === 'grid' ?
|
||||
/* --- GRID VIEW --- */
|
||||
<div className="grid grid-cols-2 gap-8 auto-rows-fr h-full">
|
||||
<div className="grid md:grid-cols-2 gap-8 auto-rows-fr h-full">
|
||||
{assignmentLists.map((assignment) => {
|
||||
const isProject = assignment.wo_name
|
||||
|
||||
@@ -127,7 +127,17 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
|
||||
<p className="text-muted-foreground line-clamp-2 text-sm mb-4">{assignmentDesc}</p>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-6 text-sm text-muted-foreground">
|
||||
<div className="inline-flex flex-col sm:flex-row items-center gap-3 rounded-xl backdrop-blur-sm mb-3">
|
||||
<div className="h-20 sm:h-8 rounded-sm bg-linear-to-br from-primary to-his shadow-lg shrink-0 hidden sm:flex">
|
||||
<LazyImage alt={assignment.end_user.name} src={assignment.end_user.photo ? assignment.end_user.photo : '/assets/ilustration.png'} className='w-full h-full object-cover rounded-lg' />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-[10px] tracking-wider text-muted-foreground font-semibold">End User</p>
|
||||
<p className="sm:text-base font-bold text-foreground">{assignment.end_user.name}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-3 sm:gap-6 text-sm text-muted-foreground">
|
||||
<div className="flex items-center gap-2">
|
||||
<CalendarIcon className="w-4 h-4" />
|
||||
<span>
|
||||
|
||||
+7
-5
@@ -256,7 +256,7 @@ export default function ProjectAssignmentForm({ client, clientId, isEdit, assign
|
||||
</Button>
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold">{isEdit ? 'Update' : 'Create Project'} Assignment</h1>
|
||||
<p className="text-muted-foreground">{clientId ? `For ${client?.name}` : ''}</p>
|
||||
<p className="text-muted-foreground">{clientId ? `For ${client?.name}` : 'Manage the creation and modification of assignment information'}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -346,7 +346,7 @@ export default function ProjectAssignmentForm({ client, clientId, isEdit, assign
|
||||
<CardTitle>Client Details</CardTitle>
|
||||
<CardDescription>Select the client and end user information for this assignment.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-6">
|
||||
<CardContent className="space-y-6 mb-8">
|
||||
<FormField control={form.control} name='client_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
@@ -377,9 +377,11 @@ export default function ProjectAssignmentForm({ client, clientId, isEdit, assign
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Button type="button" variant="outline" size="icon" onClick={() => setShowClientForm(true)}>
|
||||
<Plus className="w-4 h-4" />
|
||||
</Button>
|
||||
{clientId ? null :
|
||||
<Button type="button" variant="outline" size="icon" onClick={() => setShowClientForm(true)}>
|
||||
<Plus className="w-4 h-4" />
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
@@ -31,7 +31,6 @@ export default async function ProjectDetailPage({ params, searchParams }: Props)
|
||||
|
||||
const [client, project] = await Promise.all([getClientById, getAssignmentByProjectId]);
|
||||
|
||||
console.log(project)
|
||||
// 3. Handle 404 Securely on the server
|
||||
if (!project) {
|
||||
return (
|
||||
@@ -200,7 +199,7 @@ export default async function ProjectDetailPage({ params, searchParams }: Props)
|
||||
</p>
|
||||
<p className="text-base font-bold text-foreground">{client?.name}</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
End user: {client?.end_user_name}
|
||||
{client?.description ?? "No description available for this client."}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,12 +29,14 @@ export interface Client {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
photo: string
|
||||
}
|
||||
|
||||
export interface EndUser {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
photo: string
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
|
||||
Reference in New Issue
Block a user