// app/page.tsx import fs from 'fs'; import path from 'path'; import Link from "next/link"; import TmplHome from "@/components/TmplHome"; import { DropdownData } from '@/components/utils/DependentDropdown'; import { ToyBrick, FilePenLine, Rocket, Workflow, NotepadTextDashed, Files, Blocks, FileQuestionMark, ShieldLock, FileUp, GitMerge, ExternalLink, FileText } from "lucide-react"; export default function HomePage() { // อ่านไฟล์จากโฟลเดอร์ public/tmpl บน Server const tmplDirectory = path.join(process.cwd(), 'public/tmpl'); let filenames: string[] = []; try { filenames = fs.readdirSync(tmplDirectory); } catch (error) { console.error("ไม่พบโฟลเดอร์ public/tmpl", error); } // กรองเฉพาะไฟล์ .docx และ .json const docxFiles = filenames.filter(file => file.endsWith('.docx')); const jsonFiles = filenames.filter(file => file.endsWith('.json')); // สร้างโครงสร้างข้อมูลสำหรับ DependentDropdown แบบอัตโนมัติ (หรือปรับเงื่อนไขการจัดกลุ่มตามต้องการ) // ตัวอย่างนี้จัดกลุ่มตามชื่อไฟล์ตั้งต้น const templateData: DropdownData = {}; docxFiles.forEach(docx => { const key = docx.replace('.docx', ''); // หาไฟล์ json ที่ชื่อขึ้นต้นตรงกันมาใส่เป็นตัวเลือกย่อย const matchedJsons = jsonFiles .filter(json => json.startsWith(key)) .map(json => json.replace('.json', '')); templateData[key] = matchedJsons.length > 0 ? matchedJsons : ['default']; }); return (
ชุดพัฒนาระบบสร้างเอกสาร docx จากข้อมูลและเทมเพลต นำไปแก้ไขจัดหน้าต่อบน MS Word โดยที่ข้อมูลในฟอร์มเอกสารสามารถสะกัดออกมาใช้งานต่อได้ ควบคุมรุ่นของเอกสารด้วย Add-ins สามารถผสานกับระบบงานเดิมได้แบบไร้รอยต่อ
{/* ส่วนเนื้อหาคงที่ (Features, Flow, Add-ins) */}{detail}