// app/page.tsx (ระบบ B) 'use client'; import Link from "next/link"; import type { ChangeEvent } from 'react'; // import { createDownloadFormAction } from './actions'; import DependentDropdown, { DropdownData } from '@/components/utils/DependentDropdown'; export default function HomePage() { const templateData: DropdownData = { T_X: ['T_no_warning', 'TF_no_warning_P2', 'TS_P2_IN'], T12_X: ['T12_b2_IN', 'T12_FD155_3s-long'], }; const handleTmplSelect = (template: string, data: string) => { //console.log('Location Selected:', { template, data }); }; const handleInput = (e: ChangeEvent)=>{ // console.log(e.target) return true; } return (

ตัวอย่างการใช้ สร้างเอกสารจาก Template

ตัวอย่าง Frontend ส่งข้อมูลผ่าน <form>(POST) หรือ <a>(GET) เพื่อรองรับ Vanilla JavaScript และ Classic Framework ใช้การเปลี่ยนหน้าเพื่อดาว์นโหลดไฟล์ ตัวอย่างหน้าแบบ Plain HTML

Form POST

uid:
uname:

A Link Get(new)

T_no_warning_john_xxx.docx
TF_no_warning_P2_john_xxx.docx
TS_P2_IN_john_xxx.docx
T12_b2_IN_john_xxx.docx
T12_FD155_3s-long_john_xxx.docx

Template & Data

Template: T_X.docx,   T12_X.docx
Data: TF_no_warning_P2.json,   T_no_warning.json,   TS_P2_IN.json
T12_b2_IN.json,   T12_FD155_3s-long.json

Flow

หน้านี้(เลือกไฟล์)
↓
download-docx(ตรวจสิทธิ์,ส่งเทมเพลต ID,ส่งข้อมูล)
↓
generate(เปิดเทมเพลต,สร้าง docx)
↓
ดาว์นโหลด docx เปิด MS Word อัตโนมัติ
↓
Add-ins ตรวจสอบไฟล์, ผู้ใช้แก้ไข docx
↓
Versioning(คุมเวอร์ชั่น)
↓
ecourt(อัปเดตฐานข้อมูลและไฟล์)
); }