{"id":1088,"date":"2025-08-17T08:01:33","date_gmt":"2025-08-17T01:01:33","guid":{"rendered":"https:\/\/www.pongtakam.ac.th\/?p=1088"},"modified":"2025-08-17T08:21:43","modified_gmt":"2025-08-17T01:21:43","slug":"%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a%e0%b9%80%e0%b8%81%e0%b8%a9%e0%b8%b5%e0%b8%a2%e0%b8%99%e0%b8%ab%e0%b8%99%e0%b8%b1%e0%b8%87%e0%b8%aa%e0%b8%b7%e0%b8%ad%e0%b8%ad%e0%b8%ad%e0%b8%99%e0%b9%84%e0%b8%a5","status":"publish","type":"post","link":"https:\/\/www.pongtakam.ac.th\/?p=1088","title":{"rendered":"\u0e23\u0e30\u0e1a\u0e1a\u0e40\u0e01\u0e29\u0e35\u0e22\u0e19\u0e2b\u0e19\u0e31\u0e07\u0e2a\u0e37\u0e2d\u0e2d\u0e2d\u0e19\u0e44\u0e25\u0e19\u0e4c"},"content":{"rendered":"\n<style>\n.e-stamp-container { max-width: 650px; margin: 48px auto; background: #fff; border-radius: 16px; box-shadow: 0 4px 16px #8882; padding: 32px; }\n.e-stamp-container h1, .e-stamp-container h2 { text-align: center;}\n.e-stamp-container input, .e-stamp-container select, .e-stamp-container button, .e-stamp-container textarea { font-family: inherit; margin-top: 2px; margin-bottom: 12px; width: 100%; padding: 0.5em; font-size: 15px; }\n.e-stamp-container label { font-weight: 500; margin-top: 8px; display: block;}\n.e-stamp-container ul {padding-left: 18px;}\n.e-stamp-container li {margin-bottom: 7px;}\n.e-stamp-status {font-size: 0.9em; border-radius:6px; padding: 2px 12px; display:inline-block; margin-left:10px;}\n.e-stamp-new {background:#ddd;}\n.e-stamp-pending {background:#ffe066;}\n.e-stamp-approved {background:#a1e99b;}\n.e-stamp-finished {background:#b5f5fc;}\n.e-stamp-filelink {color:#2772da;}\n.e-stamp-docbox {background:#f7fafc; padding:14px; margin-bottom:8px;border-radius:8px;border:1px solid #e0e6f4;}\n@media (max-width:700px) {\n  .e-stamp-container { max-width: 96vw; padding:10px;}\n}\n<\/style>\n\n<div class=\"e-stamp-container\">\n  <h1>\u0e23\u0e30\u0e1a\u0e1a\u0e1b\u0e23\u0e30\u0e17\u0e31\u0e1a\u0e15\u0e23\u0e32\u0e2d\u0e34\u0e40\u0e25\u0e47\u0e01\u0e17\u0e23\u0e2d\u0e19\u0e34\u0e01\u0e2a\u0e4c (E-Stamping)<\/h1>\n  <h2>\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e43\u0e2b\u0e21\u0e48<\/h2>\n  <form id=\"e-stamp-addForm\">\n    <label>\u0e40\u0e25\u0e02\u0e17\u0e35\u0e48\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23 <input type=\"text\" id=\"e-stamp-docId\" required><\/label>\n    <label>\u0e0a\u0e37\u0e48\u0e2d\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07 <input type=\"text\" id=\"e-stamp-title\" required><\/label>\n    <label>\u0e0a\u0e37\u0e48\u0e2d\u0e1c\u0e39\u0e49\u0e2a\u0e48\u0e07 <input type=\"text\" id=\"e-stamp-uploader\" required><\/label>\n    <label>\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e44\u0e1f\u0e25\u0e4c (PDF\/JPG\/PNG\/Word)\n      <input type=\"file\" id=\"e-stamp-fileInput\" accept=\".pdf,.jpg,.jpeg,.png,.doc,.docx\" required>\n    <\/label>\n    <button type=\"submit\">\ud83d\udce4 \u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23<\/button>\n  <\/form>\n  <hr>\n  <h2>\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23<\/h2>\n  <div id=\"e-stamp-doc-list\"><\/div>\n<\/div>\n\n<script>\nconst GAS_URL = 'https:\/\/script.google.com\/macros\/s\/AKfycbxPAehCIWZJEPQqxDAsSvn3_mQaKxgZxozN5SOOKr1hK4GdsXlPwopK4DuZGgum2k\/exec'; \/\/ \ud83d\udc48 \u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e15\u0e23\u0e07\u0e19\u0e35\u0e49\nlet eStamp_uploadedFileURL = '';\n\nfunction eStamp_statusText(status) {\n  if (!status) return '';\n  if (status === 'new') return '<span class=\"e-stamp-status e-stamp-new\">\u0e43\u0e2b\u0e21\u0e48<\/span>';\n  if (status === 'pending_approval') return '<span class=\"e-stamp-status e-stamp-pending\">\u0e23\u0e2d\u0e1c\u0e39\u0e49\u0e1a\u0e23\u0e34\u0e2b\u0e32\u0e23<\/span>';\n  if (status === 'pending_ack') return '<span class=\"e-stamp-status e-stamp-pending\">\u0e23\u0e2d\u0e23\u0e31\u0e1a\u0e17\u0e23\u0e32\u0e1a<\/span>';\n  if (status === 'finished') return '<span class=\"e-stamp-status e-stamp-finished\">\u0e40\u0e2a\u0e23\u0e47\u0e08\u0e2a\u0e34\u0e49\u0e19<\/span>';\n  return '<span class=\"e-stamp-status\">'+status+'<\/span>';\n}\n\nasync function eStamp_fetchDocs() {\n  try {\n    const res = await fetch(`${GAS_URL}?action=getDocuments`);\n    const docs = await res.json();\n    eStamp_renderDocList(docs);\n  } catch (e) {\n    document.getElementById('e-stamp-doc-list').innerHTML = '\u0e40\u0e01\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e1c\u0e34\u0e14\u0e1e\u0e25\u0e32\u0e14\u0e43\u0e19\u0e01\u0e32\u0e23\u0e42\u0e2b\u0e25\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25';\n  }\n}\n\nfunction eStamp_renderDocList(docs) {\n  const listDiv = document.getElementById('e-stamp-doc-list');\n  if (!docs || docs.length === 0) {\n    listDiv.innerHTML = '<i>\u0e22\u0e31\u0e07\u0e44\u0e21\u0e48\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e43\u0e19\u0e23\u0e30\u0e1a\u0e1a<\/i>';\n    return;\n  }\n  let html = '';\n  docs.reverse().forEach(d => {\n    html += `<div class=\"e-stamp-docbox\">\n      <div>\n        <b>\u0e40\u0e25\u0e02\u0e17\u0e35\u0e48:<\/b> ${d.DocID} <b>\u0e0a\u0e37\u0e48\u0e2d\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07:<\/b> ${d.Title} ${eStamp_statusText(d.Status)}\n      <\/div>\n      <div>\n        <small>\u0e42\u0e14\u0e22: ${d.Uploader} | \u0e27\u0e31\u0e19\u0e17\u0e35\u0e48: ${d.UploadDate ? (new Date(d.UploadDate)).toLocaleString('th-TH') : '-'}<\/small>\n      <\/div>\n      <div>\n        ${d.FileURL ? `<a class=\"e-stamp-filelink\" href=\"${d.FileURL}\" target=\"_blank\">\ud83d\udcce \u0e14\u0e39\/\u0e14\u0e32\u0e27\u0e19\u0e4c\u0e42\u0e2b\u0e25\u0e14\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23<\/a>` : ''}\n      <\/div>\n      ${d.AdminComment ? `<div><b>\u0e04\u0e27\u0e32\u0e21\u0e40\u0e2b\u0e47\u0e19\u0e18\u0e38\u0e23\u0e01\u0e32\u0e23:<\/b> ${d.AdminComment}<\/div>` : ''}\n      ${d.ExecComment ? `<div><b>\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e1c\u0e39\u0e49\u0e1a\u0e23\u0e34\u0e2b\u0e32\u0e23:<\/b> ${d.ExecComment}<\/div>` : ''}\n      ${d.StaffName ? `<div><b>\u0e1c\u0e39\u0e49\u0e23\u0e31\u0e1a\u0e1c\u0e34\u0e14\u0e0a\u0e2d\u0e1a\u0e23\u0e31\u0e1a\u0e17\u0e23\u0e32\u0e1a:<\/b> ${d.StaffName} (${d.StaffAckDate})<\/div>` : ''}\n    <\/div>`;\n  });\n  listDiv.innerHTML = html;\n}\n\ndocument.addEventListener('DOMContentLoaded', function() {\n  document.getElementById('e-stamp-fileInput').addEventListener('change', async function(e) {\n    const file = e.target.files[0];\n    eStamp_uploadedFileURL = '';\n    if (!file) return;\n    const reader = new FileReader();\n    reader.onload = async function(evt) {\n      const base64 = evt.target.result.split(',')[1];\n      document.getElementById('e-stamp-fileInput').disabled = true;\n      document.getElementById('e-stamp-fileInput').style.opacity = '0.5';\n      try {\n        const resp = await fetch(GAS_URL, {\n          method: 'POST',\n          headers: {'Content-Type': 'application\/json'},\n          body: JSON.stringify({\n            action: 'upload',\n            filename: file.name,\n            base64: base64,\n            mimeType: file.type\n          })\n        });\n        eStamp_uploadedFileURL = await resp.text();\n      } catch {\n        alert('\u0e40\u0e01\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e1c\u0e34\u0e14\u0e1e\u0e25\u0e32\u0e14\u0e43\u0e19\u0e01\u0e32\u0e23\u0e2d\u0e31\u0e1b\u0e42\u0e2b\u0e25\u0e14\u0e44\u0e1f\u0e25\u0e4c \u0e01\u0e23\u0e38\u0e13\u0e32\u0e25\u0e2d\u0e07\u0e43\u0e2b\u0e21\u0e48');\n      }\n      document.getElementById('e-stamp-fileInput').disabled = false;\n      document.getElementById('e-stamp-fileInput').style.opacity = '1';\n    };\n    reader.readAsDataURL(file);\n  });\n\n  document.getElementById('e-stamp-addForm').addEventListener('submit', async function(e) {\n    e.preventDefault();\n    if (!eStamp_uploadedFileURL) return alert('\u0e01\u0e23\u0e38\u0e13\u0e32\u0e2d\u0e31\u0e1b\u0e42\u0e2b\u0e25\u0e14\u0e44\u0e1f\u0e25\u0e4c\u0e43\u0e2b\u0e49\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08\u0e01\u0e48\u0e2d\u0e19!');\n    const docId = document.getElementById('e-stamp-docId').value.trim();\n    const title = document.getElementById('e-stamp-title').value.trim();\n    const uploader = document.getElementById('e-stamp-uploader').value.trim();\n    if (!docId || !title || !uploader) return alert('\u0e01\u0e23\u0e38\u0e13\u0e32\u0e01\u0e23\u0e2d\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e2b\u0e49\u0e04\u0e23\u0e1a');\n    const res = await fetch(GAS_URL, {\n      method: 'POST',\n      headers: {'Content-Type': 'application\/json'},\n      body: JSON.stringify({\n        action: 'add',\n        DocID: docId,\n        Title: title,\n        Uploader: uploader,\n        UploadDate: new Date().toISOString(),\n        FileURL: eStamp_uploadedFileURL\n      })\n    });\n    if ((await res.text()) === \"OK\") {\n      alert('\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08');\n      this.reset();\n      eStamp_uploadedFileURL = '';\n      eStamp_fetchDocs();\n    } else {\n      alert('\u0e40\u0e01\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e1c\u0e34\u0e14\u0e1e\u0e25\u0e32\u0e14\u0e43\u0e19\u0e01\u0e32\u0e23\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01');\n    }\n  });\n\n  eStamp_fetchDocs();\n});\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>\u0e23\u0e30\u0e1a\u0e1a\u0e1b\u0e23\u0e30\u0e17\u0e31\u0e1a\u0e15\u0e23\u0e32\u0e2d\u0e34\u0e40\u0e25\u0e47\u0e01\u0e17\u0e23\u0e2d\u0e19\u0e34\u0e01\u0e2a\u0e4c (E-Stamping) \u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e43\u0e2b\u0e21\u0e48 \u0e40\u0e25\u0e02\u0e17\u0e35\u0e48\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23 \u0e0a\u0e37\u0e48\u0e2d\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07 \u0e0a\u0e37\u0e48\u0e2d\u0e1c\u0e39\u0e49\u0e2a\u0e48\u0e07 \u0e40\u0e25\u0e37\u0e2d\u0e01\u0e44\u0e1f\u0e25\u0e4c (PDF\/JPG\/PNG\/Word) \ud83d\udce4 \u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23 \u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1088","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=\/wp\/v2\/posts\/1088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1088"}],"version-history":[{"count":2,"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=\/wp\/v2\/posts\/1088\/revisions"}],"predecessor-version":[{"id":1091,"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=\/wp\/v2\/posts\/1088\/revisions\/1091"}],"wp:attachment":[{"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pongtakam.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}