260322:1648 Correct Coresspondence / Doing RFA / Correct CI
This commit is contained in:
@@ -58,10 +58,7 @@ export default function ContractCategoriesPage() {
|
||||
const projectFilter = (
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-sm font-medium">Project:</span>
|
||||
<Select
|
||||
value={selectedProjectId ?? ''}
|
||||
onValueChange={(v) => setSelectedProjectId(v || undefined)}
|
||||
>
|
||||
<Select value={selectedProjectId ?? ''} onValueChange={(v) => setSelectedProjectId(v || undefined)}>
|
||||
<SelectTrigger className="w-[300px]">
|
||||
{isLoadingProjects ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
@@ -106,7 +103,12 @@ export default function ContractCategoriesPage() {
|
||||
const data = await drawingMasterDataService.getContractCategories(selectedProjectId);
|
||||
return data;
|
||||
}}
|
||||
createFn={(data: Record<string, unknown>) => drawingMasterDataService.createContractCategory({ ...(data as unknown as CreateContractCategoryDto), projectId: selectedProjectId })}
|
||||
createFn={(data: Record<string, unknown>) =>
|
||||
drawingMasterDataService.createContractCategory({
|
||||
...(data as unknown as CreateContractCategoryDto),
|
||||
projectId: selectedProjectId,
|
||||
})
|
||||
}
|
||||
updateFn={(id, data) => drawingMasterDataService.updateContractCategory(id, data)}
|
||||
deleteFn={(id) => drawingMasterDataService.deleteContractCategory(id)}
|
||||
columns={columns}
|
||||
@@ -198,7 +200,7 @@ function ManageMappings({ projectId }: { projectId: string }) {
|
||||
const { data: rawMappings, isLoading: isLoadingMappings } = useQuery({
|
||||
queryKey: ['contract-mappings', String(projectId), selectedCat],
|
||||
queryFn: () =>
|
||||
drawingMasterDataService.getContractMappings(projectId, selectedCat ? parseInt(selectedCat) : undefined),
|
||||
drawingMasterDataService.getContractMappings(projectId, selectedCat ? Number(selectedCat) : undefined),
|
||||
enabled: !!selectedCat,
|
||||
});
|
||||
|
||||
@@ -231,8 +233,8 @@ function ManageMappings({ projectId }: { projectId: string }) {
|
||||
if (!selectedCat || !selectedSubCat) return;
|
||||
createMutation.mutate({
|
||||
projectId,
|
||||
categoryId: parseInt(selectedCat),
|
||||
subCategoryId: parseInt(selectedSubCat),
|
||||
categoryId: Number(selectedCat),
|
||||
subCategoryId: Number(selectedSubCat),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -50,10 +50,7 @@ export default function ContractSubCategoriesPage() {
|
||||
const projectFilter = (
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-sm font-medium">Project:</span>
|
||||
<Select
|
||||
value={selectedProjectId ?? ''}
|
||||
onValueChange={(v) => setSelectedProjectId(v || undefined)}
|
||||
>
|
||||
<Select value={selectedProjectId ?? ''} onValueChange={(v) => setSelectedProjectId(v || undefined)}>
|
||||
<SelectTrigger className="w-[300px]">
|
||||
{isLoadingProjects ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
@@ -99,7 +96,10 @@ export default function ContractSubCategoriesPage() {
|
||||
return data;
|
||||
}}
|
||||
createFn={(data: Record<string, unknown>) =>
|
||||
drawingMasterDataService.createContractSubCategory({ ...(data as unknown as CreateContractSubCategoryDto), projectId: selectedProjectId })
|
||||
drawingMasterDataService.createContractSubCategory({
|
||||
...(data as unknown as CreateContractSubCategoryDto),
|
||||
projectId: selectedProjectId,
|
||||
})
|
||||
}
|
||||
updateFn={(id, data) => drawingMasterDataService.updateContractSubCategory(id, data)}
|
||||
deleteFn={(id) => drawingMasterDataService.deleteContractSubCategory(id)}
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
"use client";
|
||||
'use client';
|
||||
|
||||
import { useState } from "react";
|
||||
import { GenericCrudTable } from "@/components/admin/reference/generic-crud-table";
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import { useProjects } from "@/hooks/use-master-data";
|
||||
import { drawingMasterDataService } from "@/lib/services/drawing-master-data.service";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { useState } from 'react';
|
||||
import { GenericCrudTable } from '@/components/admin/reference/generic-crud-table';
|
||||
import { ColumnDef } from '@tanstack/react-table';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { useProjects } from '@/hooks/use-master-data';
|
||||
import { drawingMasterDataService } from '@/lib/services/drawing-master-data.service';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
interface Volume {
|
||||
id: number;
|
||||
@@ -29,43 +23,34 @@ export default function ContractVolumesPage() {
|
||||
|
||||
const columns: ColumnDef<Volume>[] = [
|
||||
{
|
||||
accessorKey: "volumeCode",
|
||||
header: "Code",
|
||||
accessorKey: 'volumeCode',
|
||||
header: 'Code',
|
||||
cell: ({ row }) => (
|
||||
<Badge variant="outline" className="font-mono">
|
||||
{row.getValue("volumeCode")}
|
||||
{row.getValue('volumeCode')}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "volumeName",
|
||||
header: "Volume Name",
|
||||
accessorKey: 'volumeName',
|
||||
header: 'Volume Name',
|
||||
},
|
||||
{
|
||||
accessorKey: "description",
|
||||
header: "Description",
|
||||
cell: ({ row }) => (
|
||||
<span className="text-muted-foreground text-sm">
|
||||
{row.getValue("description") || "-"}
|
||||
</span>
|
||||
),
|
||||
accessorKey: 'description',
|
||||
header: 'Description',
|
||||
cell: ({ row }) => <span className="text-muted-foreground text-sm">{row.getValue('description') || '-'}</span>,
|
||||
},
|
||||
{
|
||||
accessorKey: "sortOrder",
|
||||
header: "Order",
|
||||
cell: ({ row }) => (
|
||||
<span className="font-mono">{row.getValue("sortOrder")}</span>
|
||||
),
|
||||
accessorKey: 'sortOrder',
|
||||
header: 'Order',
|
||||
cell: ({ row }) => <span className="font-mono">{row.getValue('sortOrder')}</span>,
|
||||
},
|
||||
];
|
||||
|
||||
const projectFilter = (
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-sm font-medium">Project:</span>
|
||||
<Select
|
||||
value={selectedProjectId ?? ''}
|
||||
onValueChange={(v) => setSelectedProjectId(v || undefined)}
|
||||
>
|
||||
<Select value={selectedProjectId ?? ''} onValueChange={(v) => setSelectedProjectId(v || undefined)}>
|
||||
<SelectTrigger className="w-[300px]">
|
||||
{isLoadingProjects ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
@@ -89,9 +74,7 @@ export default function ContractVolumesPage() {
|
||||
<div className="p-6 space-y-6">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">Contract Drawing Volumes</h1>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
Manage drawing volumes (เล่ม) for contract drawings
|
||||
</p>
|
||||
<p className="text-muted-foreground mt-1">Manage drawing volumes (เล่ม) for contract drawings</p>
|
||||
</div>
|
||||
{projectFilter}
|
||||
<div className="text-center py-12 text-muted-foreground border rounded-lg border-dashed">
|
||||
@@ -107,17 +90,22 @@ export default function ContractVolumesPage() {
|
||||
entityName="Volume"
|
||||
title="Contract Drawing Volumes"
|
||||
description="Manage drawing volumes (เล่ม) for contract drawings"
|
||||
queryKey={["contract-drawing-volumes", String(selectedProjectId)]}
|
||||
queryKey={['contract-drawing-volumes', String(selectedProjectId)]}
|
||||
fetchFn={() => drawingMasterDataService.getContractVolumes(selectedProjectId)}
|
||||
createFn={(data: Record<string, unknown>) => drawingMasterDataService.createContractVolume({ ...(data as unknown as Parameters<typeof drawingMasterDataService.createContractVolume>[0]), projectId: selectedProjectId })}
|
||||
createFn={(data: Record<string, unknown>) =>
|
||||
drawingMasterDataService.createContractVolume({
|
||||
...(data as unknown as Parameters<typeof drawingMasterDataService.createContractVolume>[0]),
|
||||
projectId: selectedProjectId,
|
||||
})
|
||||
}
|
||||
updateFn={(id, data) => drawingMasterDataService.updateContractVolume(id, data)}
|
||||
deleteFn={(id) => drawingMasterDataService.deleteContractVolume(id)}
|
||||
columns={columns}
|
||||
fields={[
|
||||
{ name: "volumeCode", label: "Volume Code", type: "text", required: true },
|
||||
{ name: "volumeName", label: "Volume Name", type: "text", required: true },
|
||||
{ name: "description", label: "Description", type: "textarea" },
|
||||
{ name: "sortOrder", label: "Sort Order", type: "text", required: true },
|
||||
{ name: 'volumeCode', label: 'Volume Code', type: 'text', required: true },
|
||||
{ name: 'volumeName', label: 'Volume Name', type: 'text', required: true },
|
||||
{ name: 'description', label: 'Description', type: 'textarea' },
|
||||
{ name: 'sortOrder', label: 'Sort Order', type: 'text', required: true },
|
||||
]}
|
||||
filters={projectFilter}
|
||||
/>
|
||||
|
||||
@@ -1,47 +1,41 @@
|
||||
"use client";
|
||||
'use client';
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
FileStack,
|
||||
FolderTree,
|
||||
Layers,
|
||||
BookOpen,
|
||||
FileBox
|
||||
} from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { FileStack, FolderTree, Layers, BookOpen, FileBox } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
|
||||
const contractDrawingMenu = [
|
||||
{
|
||||
title: "Volumes",
|
||||
description: "Manage contract drawing volumes (เล่ม)",
|
||||
href: "/admin/drawings/contract/volumes",
|
||||
title: 'Volumes',
|
||||
description: 'Manage contract drawing volumes (เล่ม)',
|
||||
href: '/admin/drawings/contract/volumes',
|
||||
icon: BookOpen,
|
||||
},
|
||||
{
|
||||
title: "Categories",
|
||||
description: "Manage main categories (หมวดหมู่หลัก)",
|
||||
href: "/admin/drawings/contract/categories",
|
||||
title: 'Categories',
|
||||
description: 'Manage main categories (หมวดหมู่หลัก)',
|
||||
href: '/admin/drawings/contract/categories',
|
||||
icon: FolderTree,
|
||||
},
|
||||
{
|
||||
title: "Sub-categories",
|
||||
description: "Manage sub-categories (หมวดหมู่ย่อย)",
|
||||
href: "/admin/drawings/contract/sub-categories",
|
||||
title: 'Sub-categories',
|
||||
description: 'Manage sub-categories (หมวดหมู่ย่อย)',
|
||||
href: '/admin/drawings/contract/sub-categories',
|
||||
icon: Layers,
|
||||
},
|
||||
];
|
||||
|
||||
const shopDrawingMenu = [
|
||||
{
|
||||
title: "Main Categories",
|
||||
description: "Manage main categories (หมวดหมู่หลัก)",
|
||||
href: "/admin/drawings/shop/main-categories",
|
||||
title: 'Main Categories',
|
||||
description: 'Manage main categories (หมวดหมู่หลัก)',
|
||||
href: '/admin/drawings/shop/main-categories',
|
||||
icon: FolderTree,
|
||||
},
|
||||
{
|
||||
title: "Sub-categories",
|
||||
description: "Manage sub-categories (หมวดหมู่ย่อย)",
|
||||
href: "/admin/drawings/shop/sub-categories",
|
||||
title: 'Sub-categories',
|
||||
description: 'Manage sub-categories (หมวดหมู่ย่อย)',
|
||||
href: '/admin/drawings/shop/sub-categories',
|
||||
icon: Layers,
|
||||
},
|
||||
];
|
||||
@@ -51,9 +45,7 @@ export default function DrawingsAdminPage() {
|
||||
<div className="p-6 space-y-8">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">Drawing Master Data</h1>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
Manage categories and volumes for Contract and Shop Drawings
|
||||
</p>
|
||||
<p className="text-muted-foreground mt-1">Manage categories and volumes for Contract and Shop Drawings</p>
|
||||
</div>
|
||||
|
||||
{/* Contract Drawings Section */}
|
||||
@@ -67,15 +59,11 @@ export default function DrawingsAdminPage() {
|
||||
<Link key={item.href} href={item.href}>
|
||||
<Card className="hover:shadow-md transition-shadow cursor-pointer h-full border-blue-200 hover:border-blue-400">
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">
|
||||
{item.title}
|
||||
</CardTitle>
|
||||
<CardTitle className="text-sm font-medium">{item.title}</CardTitle>
|
||||
<item.icon className="h-4 w-4 text-blue-600" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{item.description}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">{item.description}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Link>
|
||||
@@ -94,15 +82,11 @@ export default function DrawingsAdminPage() {
|
||||
<Link key={item.href} href={item.href}>
|
||||
<Card className="hover:shadow-md transition-shadow cursor-pointer h-full border-green-200 hover:border-green-400">
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">
|
||||
{item.title}
|
||||
</CardTitle>
|
||||
<CardTitle className="text-sm font-medium">{item.title}</CardTitle>
|
||||
<item.icon className="h-4 w-4 text-green-600" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{item.description}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">{item.description}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Link>
|
||||
|
||||
@@ -61,10 +61,7 @@ export default function ShopMainCategoriesPage() {
|
||||
const projectFilter = (
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-sm font-medium">Project:</span>
|
||||
<Select
|
||||
value={selectedProjectId ?? ''}
|
||||
onValueChange={(v) => setSelectedProjectId(v || undefined)}
|
||||
>
|
||||
<Select value={selectedProjectId ?? ''} onValueChange={(v) => setSelectedProjectId(v || undefined)}>
|
||||
<SelectTrigger className="w-[300px]">
|
||||
{isLoadingProjects ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
|
||||
@@ -61,10 +61,7 @@ export default function ShopSubCategoriesPage() {
|
||||
const projectFilter = (
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-sm font-medium">Project:</span>
|
||||
<Select
|
||||
value={selectedProjectId ?? ''}
|
||||
onValueChange={(v) => setSelectedProjectId(v || undefined)}
|
||||
>
|
||||
<Select value={selectedProjectId ?? ''} onValueChange={(v) => setSelectedProjectId(v || undefined)}>
|
||||
<SelectTrigger className="w-[300px]">
|
||||
{isLoadingProjects ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
|
||||
Reference in New Issue
Block a user