task-fixdatetime
This commit is contained in:
@@ -4,6 +4,8 @@ import { useMemo } from 'react';
|
||||
import { parseAsString, useQueryStates } from 'nuqs';
|
||||
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { formatDate } from '@/lib/date-format';
|
||||
import { formatNumber } from '@/lib/number-format';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -12,10 +14,7 @@ import {
|
||||
TableHeader,
|
||||
TableRow
|
||||
} from '@/components/ui/table';
|
||||
import type {
|
||||
CrmOpportunityAgingReportResponse,
|
||||
CrmLeadAgingReportResponse
|
||||
} from '../api/types';
|
||||
import type { CrmOpportunityAgingReportResponse, CrmLeadAgingReportResponse } from '../api/types';
|
||||
import {
|
||||
crmOpportunityAgingReportQueryOptions,
|
||||
crmLeadAgingReportQueryOptions,
|
||||
@@ -23,10 +22,6 @@ import {
|
||||
} from '../api/queries';
|
||||
import { ReportFilterBar } from './report-filter-bar';
|
||||
|
||||
function formatNumber(value: number) {
|
||||
return new Intl.NumberFormat('en-US').format(value);
|
||||
}
|
||||
|
||||
function AgingReportLayout({
|
||||
variant,
|
||||
canExport,
|
||||
@@ -67,8 +62,16 @@ function AgingReportLayout({
|
||||
reportCode={variant === 'lead' ? 'lead_aging' : 'opportunity_aging'}
|
||||
pageLinks={[
|
||||
{ href: '/dashboard/crm/reports/pipeline', label: 'Pipeline Suite' },
|
||||
{ href: '/dashboard/crm/reports/lead-aging', label: 'Lead Aging', active: variant === 'lead' },
|
||||
{ href: '/dashboard/crm/reports/opportunity-aging', label: 'Opportunity Aging', active: variant === 'opportunity' }
|
||||
{
|
||||
href: '/dashboard/crm/reports/lead-aging',
|
||||
label: 'Lead Aging',
|
||||
active: variant === 'lead'
|
||||
},
|
||||
{
|
||||
href: '/dashboard/crm/reports/opportunity-aging',
|
||||
label: 'Opportunity Aging',
|
||||
active: variant === 'opportunity'
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -87,7 +90,9 @@ function AgingReportLayout({
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{variant === 'lead' ? 'Lead Aging Buckets' : 'Opportunity Aging Buckets'}</CardTitle>
|
||||
<CardTitle>
|
||||
{variant === 'lead' ? 'Lead Aging Buckets' : 'Opportunity Aging Buckets'}
|
||||
</CardTitle>
|
||||
<CardDescription>Bucketed view to spot stagnant records quickly.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className='grid gap-4 md:grid-cols-2 xl:grid-cols-4'>
|
||||
@@ -142,7 +147,9 @@ function AgingReportLayout({
|
||||
<TableCell>{row.leadCode}</TableCell>
|
||||
<TableCell>{row.customerName}</TableCell>
|
||||
<TableCell>{row.assignedUserName ?? '-'}</TableCell>
|
||||
<TableCell>{new Date(row.createdDate).toLocaleDateString('en-CA')}</TableCell>
|
||||
<TableCell>
|
||||
{formatDate(row.createdDate)}
|
||||
</TableCell>
|
||||
<TableCell>{formatNumber(row.agingDays)}</TableCell>
|
||||
</>
|
||||
) : (
|
||||
@@ -152,7 +159,7 @@ function AgingReportLayout({
|
||||
<TableCell>{row.salesmanName ?? '-'}</TableCell>
|
||||
<TableCell>
|
||||
{row.lastFollowupDate
|
||||
? new Date(row.lastFollowupDate).toLocaleDateString('en-CA')
|
||||
? formatDate(row.lastFollowupDate)
|
||||
: '-'}
|
||||
</TableCell>
|
||||
<TableCell>{formatNumber(row.agingDays)}</TableCell>
|
||||
@@ -240,4 +247,3 @@ export function AgingReportView({
|
||||
<OpportunityAgingReportInner canExport={canExport} />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user