|
|
@@ -3,7 +3,6 @@
|
|
|
import { useState, useEffect } from 'react';
|
|
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
-import { Badge } from '@/components/ui/badge';
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
|
import { format } from 'date-fns';
|
|
|
import { useToast } from '@/hooks/use-toast';
|
|
|
@@ -17,12 +16,13 @@ interface CintasSummary {
|
|
|
trrPlus4Wk: number;
|
|
|
powerAdds: number;
|
|
|
weekId: number;
|
|
|
+ importId: number;
|
|
|
}
|
|
|
|
|
|
interface ImportDetail {
|
|
|
id: number;
|
|
|
name: string;
|
|
|
- importDate: string;
|
|
|
+ importDate: Date;
|
|
|
layout: {
|
|
|
id: number;
|
|
|
name: string;
|
|
|
@@ -31,8 +31,16 @@ interface ImportDetail {
|
|
|
name: string;
|
|
|
tableName: string;
|
|
|
fields: Array<{
|
|
|
+ id: number;
|
|
|
name: string;
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
+ layoutSectionId: number;
|
|
|
+ cellPosition: string;
|
|
|
+ dataType: string;
|
|
|
+ dataTypeFormat: string | null;
|
|
|
importTableColumnName: string;
|
|
|
+ importColumnOrderNumber: number;
|
|
|
}>;
|
|
|
}>;
|
|
|
};
|
|
|
@@ -60,7 +68,7 @@ export function ImportDetailDialog({ open, onOpenChange, importId }: ImportDetai
|
|
|
async function loadImportDetail() {
|
|
|
try {
|
|
|
const result = await getImportById(importId);
|
|
|
- if (result.success) {
|
|
|
+ if (result.success && result.data) {
|
|
|
setImportDetail(result.data);
|
|
|
} else {
|
|
|
toast({
|
|
|
@@ -68,13 +76,15 @@ export function ImportDetailDialog({ open, onOpenChange, importId }: ImportDetai
|
|
|
description: result.error || 'Failed to load import details',
|
|
|
variant: 'destructive',
|
|
|
});
|
|
|
+ setImportDetail(null);
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
+ } catch {
|
|
|
toast({
|
|
|
title: 'Error',
|
|
|
description: 'Failed to load import details',
|
|
|
variant: 'destructive',
|
|
|
});
|
|
|
+ setImportDetail(null);
|
|
|
} finally {
|
|
|
setLoading(false);
|
|
|
}
|
|
|
@@ -97,7 +107,7 @@ export function ImportDetailDialog({ open, onOpenChange, importId }: ImportDetai
|
|
|
variant: 'destructive',
|
|
|
});
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
+ } catch {
|
|
|
toast({
|
|
|
title: 'Error',
|
|
|
description: 'Failed to calculate summaries',
|
|
|
@@ -148,7 +158,7 @@ export function ImportDetailDialog({ open, onOpenChange, importId }: ImportDetai
|
|
|
</div>
|
|
|
<div className="flex justify-between">
|
|
|
<span className="font-medium">Import Date:</span>
|
|
|
- <span>{format(new Date(importDetail.importDate), 'PPpp')}</span>
|
|
|
+ <span>{format(importDetail.importDate, 'PPpp')}</span>
|
|
|
</div>
|
|
|
</CardContent>
|
|
|
</Card>
|