diff --git a/.env.example b/.env.example index 7ee4d24..d8250bd 100644 --- a/.env.example +++ b/.env.example @@ -23,7 +23,7 @@ DOCVER_API_KEY= DOCVER_TOKEN_SECRET= # ใช้ตอน migrate และ การใช้งาน DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:54322/ecourt-note -### สำหรับโค้ดตัวอย่างระบบนอกเรียกเข้ามาไม่ได้ใช้ในระบบนี้ +### สำหรับโค้ดตัวอย่างระบบนอกเรียกเข้ามาไม่ได้ใช้ในระบบนี้ ห้ามเอาไช้ DOCEDIT_BASE_URL=http://127.0.0.1:3000/docedit # Optional เวลาหมดอายุที่ฝังไว้ในข้อมูล (ticket_data), worker ควรเท่ากับจำนวน CPU core -1 TMPL_PATH='./public/tmpl' diff --git a/app/api/template/download-docx/route.ts b/app/api/template/download-docx/route.ts index d13ae96..d4dbc82 100644 --- a/app/api/template/download-docx/route.ts +++ b/app/api/template/download-docx/route.ts @@ -34,8 +34,7 @@ async function processRequest(fid: string, tid: string, uid: string, uname: stri try { //ตรวจสอบ docx เวอร์ชั่นล่าสุดก่อนถ้าไม่พบค่อยเอาจากฐานข้อมูลมาสร้าง raw Json const params = new URLSearchParams({ type: 'docx', ticket_data }); - console.log(`search ${DOCEDIT_BASE_URL}/api/document/latest?${params.toString()}`); - const lastestDocxResponse = await fetch(`${DOCEDIT_BASE_URL}/api/document/latest?${params.toString()}`, { + const lastestDocxResponse = await fetch(`${DOCEDIT_BASE_URL}/api/documents/latest?${params.toString()}`, { method: 'GET', headers: { 'Content-Type': 'application/json', @@ -44,7 +43,7 @@ async function processRequest(fid: string, tid: string, uid: string, uname: stri }); // เช็ค Content-Type และ Status ก่อน const contentType = lastestDocxResponse.headers.get('content-type') || ''; - if (lastestDocxResponse.ok && !!contentType.includes('text/html')) { + if (lastestDocxResponse.ok && !contentType.includes('text/html')) { console.log('Fund latest docx from docedit, returning stream to browser'); const stream = lastestDocxResponse.body; //ส่ง Binary Stream กลับไปยัง Browser พร้อม Header กำหนดประเภทไฟล์ diff --git a/app/tmpl/page.tsx b/app/tmpl/page.tsx index c394d9f..64b7b60 100644 --- a/app/tmpl/page.tsx +++ b/app/tmpl/page.tsx @@ -2,8 +2,15 @@ 'use client'; import Link from "next/link"; import type { ChangeEvent } from 'react'; -// import { createDownloadFormAction } from './actions'; import DependentDropdown, { DropdownData } from '@/components/utils/DependentDropdown'; +import { + Bookmark,ToyBrick,FilePenLine,BicepsFlexed,Rocket,Workflow, Files,Blocks,FileQuestionMark, + ExternalLink, + FileText, + Highlighter, + MessagesSquare, +} from "lucide-react"; + @@ -21,92 +28,242 @@ export default function HomePage() { } return (
+ ระบบสร้างเทมเพลตเอกสารแบบใหม่ MS Word จากไฟล์ JSON และ Template docx +
- T12_b2_IN_john_xxx.docxUnblock-File .\install-word-addins.ps1
-Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force
-.\install-word-addins.ps1 -Install
-+ {detail} +
+
+ 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: T_X.docx, + T12_X.docx+ +
+ + ++
+
+ แนะนำเทมเพลตของ Docedit เบื้องต้น
+
+ Sideload Office add-ins
+
+ ดาวน์โหลด
+
+ manifest.xml
+ ไว้ที่ SharePoint แชร์เน็ตเวิร์ก หรือดาวน์โหลดสคริปต์ PowerShell(Dev Install)
+
+ install-word-addins.ps1
+ แล้วใช้คำสั่ง PowerShell ด้านล่างเพื่อติดตั้ง Add-ins ใน Word
+
+
Unblock-File .\install-word-addins.ps1
+Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force
+.\install-word-addins.ps1 -Install
+ + +