// components/TemplateFormClient.tsx 'use client'; import { useState, type ChangeEvent } from 'react'; import Link from "next/link"; import DependentDropdown, { type DropdownData } from '@/components/utils/DependentDropdown'; interface TemplateFormClientProps { templateData: DropdownData; } export default function TemplateFormClient({ templateData }: TemplateFormClientProps) { const handleTmplSelect = (template: string, data: string) => { // Handle selection if needed }; return (
{Object.entries(templateData).map(([tid, jsonList]) => {
// jsonList คืออาเรย์ของชื่อไฟล์ json (fid) ที่ผูกอยู่กับ template (tid) นี้
return jsonList.map((fid) => {
const linkHref = `/docedit/api/template/download-docx?tid=${tid}&fid=${fid}&uid=john&uname=John%20Doe`;
const displayLabel = `${fid}_john_xxx.docx`; // หรือปรับรูปแบบข้อความแสดงผลตามต้องการ
return (
{displayLabel}
);
});
})}