260322:1648 Correct Coresspondence / Doing RFA / Correct CI
CI Pipeline / build (push) Failing after 12m41s
Build and Deploy / deploy (push) Failing after 2m44s

This commit is contained in:
admin
2026-03-22 16:48:12 +07:00
parent e5deedb42e
commit 11984bfa29
683 changed files with 105251 additions and 29068 deletions
+46 -46
View File
@@ -1,13 +1,13 @@
"use client";
'use client';
import { RFA } from "@/types/rfa";
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, Edit, FileText } from "lucide-react";
import Link from "next/link";
import { format } from "date-fns";
import { RFA } from '@/types/rfa';
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, Edit, FileText } from 'lucide-react';
import Link from 'next/link';
import { format } from 'date-fns';
interface RFAListProps {
data: RFA[];
@@ -18,15 +18,15 @@ export function RFAList({ data }: RFAListProps) {
const columns: ColumnDef<RFA>[] = [
{
accessorKey: "rfa_number",
header: "RFA No.",
accessorKey: 'rfa_number',
header: 'RFA No.',
cell: ({ row }) => {
return <span className="font-medium">{row.original.correspondence?.correspondenceNumber || '-'}</span>;
},
},
{
accessorKey: "subject",
header: "Subject",
accessorKey: 'subject',
header: 'Subject',
cell: ({ row }) => {
const rev = row.original.revisions?.[0];
return (
@@ -37,56 +37,56 @@ export function RFAList({ data }: RFAListProps) {
},
},
{
accessorKey: "contract_name", // AccessorKey can be anything if we provide cell
header: "Contract",
accessorKey: 'contract_name', // AccessorKey can be anything if we provide cell
header: 'Contract',
cell: ({ row }) => {
return <span>{row.original.correspondence?.project?.projectName || '-'}</span>;
},
},
{
accessorKey: "discipline_name",
header: "Discipline",
accessorKey: 'discipline_name',
header: 'Discipline',
cell: ({ row }) => <span>{row.original.discipline?.name || '-'}</span>,
},
{
accessorKey: "createdAt",
header: "Created",
accessorKey: 'createdAt',
header: 'Created',
cell: ({ row }) => {
const date = row.original.correspondence?.createdAt || row.original.revisions?.[0]?.createdAt; // Fallback or strict?
// In backend I set RFA -> Correspondence (createdAt is in Correspondence base)
// But RFA revision also has createdAt?
// Use correspondence.createdAt usually for document date.
return date ? format(new Date(date), "dd MMM yyyy") : '-';
const date = row.original.correspondence?.createdAt || row.original.revisions?.[0]?.createdAt; // Fallback or strict?
// In backend I set RFA -> Correspondence (createdAt is in Correspondence base)
// But RFA revision also has createdAt?
// Use correspondence.createdAt usually for document date.
return date ? format(new Date(date), 'dd MMM yyyy') : '-';
},
},
{
accessorKey: "status",
header: "Status",
accessorKey: 'status',
header: 'Status',
cell: ({ row }) => {
const status = row.original.revisions?.[0]?.statusCode?.statusName || row.original.revisions?.[0]?.statusCode?.statusCode;
const status =
row.original.revisions?.[0]?.statusCode?.statusName || row.original.revisions?.[0]?.statusCode?.statusCode;
return <StatusBadge status={status || 'Unknown'} />;
},
},
{
id: "actions",
id: 'actions',
cell: ({ row }) => {
const item = row.original;
const handleViewFile = (e: React.MouseEvent) => {
e.preventDefault();
const firstItem = item.revisions?.[0]?.items?.[0];
const firstAttachment =
firstItem?.shopDrawingRevision?.attachments?.[0] ||
firstItem?.asBuiltDrawingRevision?.attachments?.[0];
if (firstAttachment?.url) {
window.open(firstAttachment.url, '_blank');
} else {
// Use alert or toast. Assuming toast is available or use generic alert for now if toast not imported
// But rfa.service.ts in use-rfa.ts uses 'sonner', so 'sonner' is likely available.
// I will try to use toast from 'sonner' if I import it, or just window.alert for safety.
// User said "หน้าต่างแจ้งเตือน" -> Alert window.
alert("ไม่พบไฟล์แนบ (No file attached)");
}
e.preventDefault();
const firstItem = item.revisions?.[0]?.items?.[0];
const firstAttachment =
firstItem?.shopDrawingRevision?.attachments?.[0] || firstItem?.asBuiltDrawingRevision?.attachments?.[0];
if (firstAttachment?.url) {
window.open(firstAttachment.url, '_blank');
} else {
// Use alert or toast. Assuming toast is available or use generic alert for now if toast not imported
// But rfa.service.ts in use-rfa.ts uses 'sonner', so 'sonner' is likely available.
// I will try to use toast from 'sonner' if I import it, or just window.alert for safety.
// User said "หน้าต่างแจ้งเตือน" -> Alert window.
alert('ไม่พบไฟล์แนบ (No file attached)');
}
};
return (
@@ -96,11 +96,11 @@ export function RFAList({ data }: RFAListProps) {
<Eye className="h-4 w-4" />
</Button>
</Link>
<Button variant="ghost" size="icon" title="View File" onClick={handleViewFile}>
<FileText className="h-4 w-4" />
</Button>
<Button variant="ghost" size="icon" title="View File" onClick={handleViewFile}>
<FileText className="h-4 w-4" />
</Button>
<Link href={`/rfas/${row.original.uuid}/edit`}>
<Button variant="ghost" size="icon" title="Edit">
<Button variant="ghost" size="icon" title="Edit">
<Edit className="h-4 w-4" />
</Button>
</Link>