task-fixdatetime
This commit is contained in:
@@ -5,6 +5,8 @@ import type { Column, ColumnDef } from '@tanstack/react-table';
|
||||
import { Icons } from '@/components/icons';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { DataTableColumnHeader } from '@/components/ui/table/data-table-column-header';
|
||||
import { formatDate } from '@/lib/date-format';
|
||||
import { formatNumber } from '@/lib/number-format';
|
||||
import type { LeadReferenceData, LeadSummary } from '../api/types';
|
||||
import { LeadCellAction } from './lead-cell-action';
|
||||
|
||||
@@ -28,7 +30,10 @@ export function getLeadColumns({
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<div className='flex flex-col'>
|
||||
<Link href={`/dashboard/crm/leads/${row.original.id}`} className='font-medium hover:underline'>
|
||||
<Link
|
||||
href={`/dashboard/crm/leads/${row.original.id}`}
|
||||
className='font-medium hover:underline'
|
||||
>
|
||||
{row.original.code}
|
||||
</Link>
|
||||
<span className='text-muted-foreground text-xs'>{row.original.customerName ?? '-'}</span>
|
||||
@@ -48,7 +53,9 @@ export function getLeadColumns({
|
||||
header: ({ column }: { column: Column<LeadSummary, unknown> }) => (
|
||||
<DataTableColumnHeader column={column} title='Status' />
|
||||
),
|
||||
cell: ({ row }) => <Badge variant='outline'>{row.original.statusLabel ?? row.original.status}</Badge>,
|
||||
cell: ({ row }) => (
|
||||
<Badge variant='outline'>{row.original.statusLabel ?? row.original.status}</Badge>
|
||||
),
|
||||
meta: {
|
||||
label: 'Status',
|
||||
variant: 'select' as const,
|
||||
@@ -136,7 +143,9 @@ export function getLeadColumns({
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<span>
|
||||
{row.original.estimatedValue !== null ? row.original.estimatedValue.toLocaleString() : '-'}
|
||||
{row.original.estimatedValue !== null
|
||||
? formatNumber(row.original.estimatedValue)
|
||||
: '-'}
|
||||
</span>
|
||||
)
|
||||
},
|
||||
@@ -146,7 +155,7 @@ export function getLeadColumns({
|
||||
header: ({ column }: { column: Column<LeadSummary, unknown> }) => (
|
||||
<DataTableColumnHeader column={column} title='Created' />
|
||||
),
|
||||
cell: ({ row }) => <span>{new Date(row.original.createdAt).toLocaleDateString()}</span>
|
||||
cell: ({ row }) => <span>{formatDate(row.original.createdAt)}</span>
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
|
||||
@@ -7,6 +7,8 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { formatDateTime } from '@/lib/date-format';
|
||||
import { formatNumber } from '@/lib/number-format';
|
||||
import { leadByIdOptions } from '../api/queries';
|
||||
import type { LeadReferenceData } from '../api/types';
|
||||
import { LeadAssignmentDialog } from './lead-assignment-dialog';
|
||||
@@ -42,7 +44,12 @@ export function LeadDetail({
|
||||
|
||||
return (
|
||||
<div className='space-y-6'>
|
||||
<LeadForm open={editOpen} onOpenChange={setEditOpen} referenceData={referenceData} lead={lead} />
|
||||
<LeadForm
|
||||
open={editOpen}
|
||||
onOpenChange={setEditOpen}
|
||||
referenceData={referenceData}
|
||||
lead={lead}
|
||||
/>
|
||||
<LeadAssignmentDialog
|
||||
lead={lead}
|
||||
referenceData={referenceData}
|
||||
@@ -93,7 +100,7 @@ export function LeadDetail({
|
||||
<FieldItem label='Assigned Sales Owner' value={lead.assignedSalesOwnerName} />
|
||||
<FieldItem
|
||||
label='Estimated Value'
|
||||
value={lead.estimatedValue !== null ? lead.estimatedValue.toLocaleString() : null}
|
||||
value={lead.estimatedValue !== null ? formatNumber(lead.estimatedValue) : null}
|
||||
/>
|
||||
<FieldItem label='Assignment Remark' value={lead.assignmentRemark} />
|
||||
<FieldItem label='Description' value={lead.description} />
|
||||
@@ -118,7 +125,9 @@ export function LeadDetail({
|
||||
</CardHeader>
|
||||
<CardContent className='space-y-3'>
|
||||
{lead.linkedOpportunities.length === 0 ? (
|
||||
<div className='text-muted-foreground text-sm'>No linked opportunities yet.</div>
|
||||
<div className='text-muted-foreground text-sm'>
|
||||
No linked opportunities yet.
|
||||
</div>
|
||||
) : (
|
||||
lead.linkedOpportunities.map((opportunity) => (
|
||||
<div key={opportunity.id} className='border-border rounded-md border p-3'>
|
||||
@@ -156,7 +165,7 @@ export function LeadDetail({
|
||||
<div className='font-medium'>{activity.action}</div>
|
||||
<div className='text-muted-foreground mt-1 text-xs'>
|
||||
{activity.actorName ?? activity.userId} -{' '}
|
||||
{new Date(activity.createdAt).toLocaleString()}
|
||||
{formatDateTime(activity.createdAt)}
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
@@ -174,10 +183,13 @@ export function LeadDetail({
|
||||
</CardHeader>
|
||||
<CardContent className='space-y-3'>
|
||||
<FieldItem label='Current Workspace' value='Lead' />
|
||||
<FieldItem label='Related Opportunities' value={String(lead.relatedOpportunityCount)} />
|
||||
<FieldItem
|
||||
label='Related Opportunities'
|
||||
value={String(lead.relatedOpportunityCount)}
|
||||
/>
|
||||
<FieldItem
|
||||
label='Assigned At'
|
||||
value={lead.assignedAt ? new Date(lead.assignedAt).toLocaleString() : null}
|
||||
value={lead.assignedAt ? formatDateTime(lead.assignedAt) : null}
|
||||
/>
|
||||
<FieldItem label='Assigned By' value={lead.assignedByName} />
|
||||
<FieldItem label='Deleted' value={canDelete ? 'Allowed' : 'Not allowed'} />
|
||||
@@ -188,4 +200,3 @@ export function LeadDetail({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { toast } from 'sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { useAppForm, useFormFields } from '@/components/ui/tanstack-form';
|
||||
import { formatDate } from '@/lib/date-format';
|
||||
import type { LeadDetailResponse } from '../api/types';
|
||||
import { createLeadFollowupMutation } from '../api/mutations';
|
||||
|
||||
@@ -101,10 +102,10 @@ export function LeadFollowupPanel({
|
||||
detail.followups.map((followup) => (
|
||||
<div key={followup.id} className='border-border rounded-md border p-3'>
|
||||
<div className='flex items-center justify-between gap-3'>
|
||||
<div className='font-medium'>{followup.followupStatusLabel ?? followup.followupStatus}</div>
|
||||
<div className='text-muted-foreground text-xs'>
|
||||
{new Date(followup.followupDate).toLocaleDateString()}
|
||||
<div className='font-medium'>
|
||||
{followup.followupStatusLabel ?? followup.followupStatus}
|
||||
</div>
|
||||
<div className='text-muted-foreground text-xs'>{formatDate(followup.followupDate)}</div>
|
||||
</div>
|
||||
{followup.note ? <div className='mt-2 text-sm'>{followup.note}</div> : null}
|
||||
<div className='text-muted-foreground mt-2 text-xs'>
|
||||
|
||||
Reference in New Issue
Block a user