260323:1050 fix CI : Verify Build frontend #02 correct _???
This commit is contained in:
@@ -72,7 +72,6 @@ export function GenericCrudTable<T extends { id?: number; uuid?: string }>({
|
||||
const {
|
||||
data: rawData,
|
||||
isLoading,
|
||||
_refetch,
|
||||
} = useQuery({
|
||||
queryKey,
|
||||
queryFn: fetchFn,
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
import { Circulation, CirculationListResponse } from '@/types/circulation';
|
||||
import { DataTable } from '@/components/common/data-table';
|
||||
import { ColumnDef } from '@tanstack/react-table';
|
||||
import { _StatusBadge } from '@/components/common/status-badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Eye, _CheckCircle2 } from 'lucide-react';
|
||||
import { Eye } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { format } from 'date-fns';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import Link from 'next/link';
|
||||
import { PendingTask } from '@/types/dashboard';
|
||||
import { _AlertCircle, ArrowRight } from 'lucide-react';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
|
||||
interface PendingTasksProps {
|
||||
tasks: PendingTask[] | undefined;
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
useReactTable,
|
||||
PaginationState,
|
||||
SortingState,
|
||||
_getPaginationRowModel,
|
||||
OnChangeFn,
|
||||
} from '@tanstack/react-table';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { DrawingRevision } from '@/types/drawing';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Download, _FileText } from 'lucide-react';
|
||||
import { Download } from 'lucide-react';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
export function RevisionHistory({ revisions }: { revisions: DrawingRevision[] }) {
|
||||
|
||||
@@ -16,6 +16,11 @@ import {
|
||||
useShopSubCategories,
|
||||
useProjects,
|
||||
} from '@/hooks/use-master-data';
|
||||
import {
|
||||
ShopMainCategory,
|
||||
ShopSubCategory,
|
||||
ContractDrawingCategory,
|
||||
} from '@/types/master-data';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
@@ -232,13 +237,11 @@ export function DrawingUploadForm() {
|
||||
<SelectValue placeholder="Select Category" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{contractCategories?.map(
|
||||
(c: { id: number; catName?: string; catCode?: string; name?: string }) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.catName || c.catCode || c.name}
|
||||
</SelectItem>
|
||||
)
|
||||
)}
|
||||
{contractCategories?.map((c: ContractDrawingCategory) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.catName || c.catCode || c.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{formErrors.mapCatId && <p className="text-sm text-destructive">{formErrors.mapCatId.message}</p>}
|
||||
@@ -287,13 +290,11 @@ export function DrawingUploadForm() {
|
||||
<SelectValue placeholder="Select Main Category" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{shopMainCats?.map(
|
||||
(c: { id: number; mainCategoryName?: string; mainCategoryCode?: string; name?: string }) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.mainCategoryName || c.mainCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
)
|
||||
)}
|
||||
{shopMainCats?.map((c: ShopMainCategory) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.mainCategoryName || c.mainCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{formErrors.mainCategoryId && (
|
||||
@@ -307,13 +308,11 @@ export function DrawingUploadForm() {
|
||||
<SelectValue placeholder="Select Sub Category" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{shopSubCats?.map(
|
||||
(c: { id: number; subCategoryName?: string; subCategoryCode?: string; name?: string }) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.subCategoryName || c.subCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
)
|
||||
)}
|
||||
{shopSubCats?.map((c: ShopSubCategory) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.subCategoryName || c.subCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{formErrors.subCategoryId && (
|
||||
@@ -365,13 +364,11 @@ export function DrawingUploadForm() {
|
||||
<SelectValue placeholder="Select Main Category" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{shopMainCats?.map(
|
||||
(c: { id: number; mainCategoryName?: string; mainCategoryCode?: string; name?: string }) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.mainCategoryName || c.mainCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
)
|
||||
)}
|
||||
{shopMainCats?.map((c: ShopMainCategory) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.mainCategoryName || c.mainCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{formErrors.mainCategoryId && (
|
||||
@@ -385,13 +382,11 @@ export function DrawingUploadForm() {
|
||||
<SelectValue placeholder="Select Sub Category" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{shopSubCats?.map(
|
||||
(c: { id: number; subCategoryName?: string; subCategoryCode?: string; name?: string }) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.subCategoryName || c.subCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
)
|
||||
)}
|
||||
{shopSubCats?.map((c: ShopSubCategory) => (
|
||||
<SelectItem key={c.id} value={String(c.id)}>
|
||||
{c.subCategoryName || c.subCategoryCode || c.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{formErrors.subCategoryId && (
|
||||
|
||||
@@ -4,9 +4,10 @@ import { useEffect, useState } from 'react';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { documentNumberingService } from '@/lib/services/document-numbering.service';
|
||||
import { format } from 'date-fns';
|
||||
import { NumberingAuditLog } from '@/types/dto/numbering.dto';
|
||||
|
||||
export function AuditLogsTable() {
|
||||
const [logs, setLogs] = useState<unknown[]>([]); // Replace with AuditLog type
|
||||
const [logs, setLogs] = useState<NumberingAuditLog[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -51,7 +52,7 @@ export function AuditLogsTable() {
|
||||
<TableRow key={log.id}>
|
||||
<TableCell>{format(new Date(log.createdAt), 'yyyy-MM-dd HH:mm:ss')}</TableCell>
|
||||
<TableCell>{log.operation}</TableCell>
|
||||
<TableCell>{log.generatedNumber}</TableCell>
|
||||
<TableCell>{log.documentNumber}</TableCell>
|
||||
<TableCell>{log.createdBy || 'System'}</TableCell>
|
||||
<TableCell>{log.status}</TableCell>
|
||||
</TableRow>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, CardContent, CardHeader, CardTitle, _CardDescription } from '@/components/ui/card';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import { documentNumberingService } from '@/lib/services/document-numbering.service';
|
||||
import { NumberingMetrics } from '@/types/dto/numbering.dto';
|
||||
|
||||
@@ -8,8 +8,9 @@ import { Button } from '@/components/ui/button';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { NumberingTemplate } from '@/lib/api/numbering';
|
||||
import { NumberingTemplate, SaveTemplateDto } from '@/lib/api/numbering';
|
||||
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card';
|
||||
import { CorrespondenceType, Discipline } from '@/types/master-data';
|
||||
|
||||
// Aligned with Backend replacement logic
|
||||
const VARIABLES = [
|
||||
@@ -29,9 +30,9 @@ export interface TemplateEditorProps {
|
||||
template?: NumberingTemplate;
|
||||
projectId: number | string;
|
||||
projectName: string;
|
||||
correspondenceTypes: unknown[];
|
||||
disciplines: unknown[];
|
||||
onSave: (data: Partial<NumberingTemplate>) => void;
|
||||
correspondenceTypes: CorrespondenceType[];
|
||||
disciplines: Discipline[];
|
||||
onSave: (data: SaveTemplateDto) => void;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ export function TemplateEditor({
|
||||
|
||||
// Dynamic context based on selection (optional visual enhancement)
|
||||
if (v.key === '{TYPE}' && typeId) {
|
||||
const t = (correspondenceTypes as { id: number; typeCode: string; typeName: string }[]).find(
|
||||
const t = correspondenceTypes.find(
|
||||
(ct) => ct.id?.toString() === typeId
|
||||
);
|
||||
if (t) replacement = t.typeCode;
|
||||
@@ -117,11 +118,10 @@ export function TemplateEditor({
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="__default__">Default (All Types)</SelectItem>
|
||||
{correspondenceTypes.map((type: unknown) => {
|
||||
const typedType = type as { id: number; typeCode: string; typeName: string };
|
||||
{correspondenceTypes.map((type) => {
|
||||
return (
|
||||
<SelectItem key={typedType.id} value={typedType.id.toString()}>
|
||||
{typedType.typeCode} - {typedType.typeName}
|
||||
<SelectItem key={type.id} value={type.id.toString()}>
|
||||
{type.typeCode} - {type.typeName}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
@@ -141,7 +141,7 @@ export function TemplateEditor({
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="0">All Disciplines</SelectItem>
|
||||
{disciplines.map((d: unknown) => (
|
||||
{disciplines.map((d) => (
|
||||
<SelectItem key={d.id} value={d.id.toString()}>
|
||||
{d.disciplineCode} - {d.codeNameEn || d.codeNameTh}
|
||||
</SelectItem>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import axios from 'axios';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -72,7 +73,12 @@ export function TemplateTester({ open, onOpenChange, template }: TemplateTesterP
|
||||
isDefault: result.isDefault,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const errMsg = error?.response?.data?.message || error?.message || 'Unknown error';
|
||||
let errMsg = 'Unknown error';
|
||||
if (axios.isAxiosError(error)) {
|
||||
errMsg = error.response?.data?.message || error.message;
|
||||
} else if (error instanceof Error) {
|
||||
errMsg = error.message;
|
||||
}
|
||||
setTestResult({ number: `Error: ${errMsg}`, isDefault: false });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import * as React from 'react';
|
||||
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
||||
import { _Check, ChevronRight, _Circle } from 'lucide-react';
|
||||
import { ChevronRight } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root;
|
||||
|
||||
Reference in New Issue
Block a user