{"id":14634,"date":"2024-11-25T07:07:32","date_gmt":"2024-11-25T07:07:32","guid":{"rendered":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/?page_id=14634"},"modified":"2025-05-22T04:46:08","modified_gmt":"2025-05-22T04:46:08","slug":"news-updateall","status":"publish","type":"page","link":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/news-updateall\/","title":{"rendered":"News Update"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"14634\" class=\"elementor elementor-14634\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a25dbc9 e-flex e-con-boxed parallax_section_no qode_elementor_container_no e-con e-parent\" data-id=\"a25dbc9\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-16e0b2f elementor-widget elementor-widget-heading\" data-id=\"16e0b2f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">News Update\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-d74ad5b e-flex e-con-boxed parallax_section_no qode_elementor_container_no e-con e-parent\" data-id=\"d74ad5b\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-217913f elementor-widget elementor-widget-html\" data-id=\"217913f\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t     <style>\n      #table-newsupdate{\n          border-bottom: none;\n      }\n    <\/style> \n    <div class=\"news-section\">\n \n        <div class=\"news-item\" id=\"table-newsupdate\">\n            \n        <\/div>\n        \n    <\/div>\n    \n     <div id=\"pagination-controls\" ><\/div>\n    <\/div>\n    \t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-135e581 elementor-widget elementor-widget-shortcode\" data-id=\"135e581\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><script>\r\n    const baseURL = \"https:\/\/www.irplus.in.th\/api\/NewsUpdateAll?share=LDC&listed_id=1198&lang=\";\r\n    const headers = {\r\n        \"Authorization\": \"f0d32684a89fb255fa8bc51b3df9d5f7f1bccf2a19e190fbd39988aa67c06ef6\"\r\n    };\r\n\r\n    const pathname = window.location.pathname;\r\n    const extractedLang = pathname.split('\/')[1];\r\n    const lang = (extractedLang === \"en\") ? \"en\" : \"th\";\r\n\r\n    let parsedData = [];\r\n    let currentPage = 1;\r\n    const itemsPerPage = 10;\r\n\r\n    function fetchData(language) {\r\n        const url = `${baseURL}${language}`;\r\n        fetch(url, { method: \"GET\", headers: headers })\r\n            .then(response => {\r\n                if (!response.ok) throw new Error('Network response was not ok ' + response.statusText);\r\n                return response.json();\r\n            })\r\n            .then(data => {\r\n               if (data.status === \"success\" && data.data) {\r\n\t\t\t\t\tparsedData = JSON.parse(data.data);\r\n\t\t\t\t\tif (parsedData.length > 0) {\r\n\t\t\t\t\t\tpopulateTable(parsedData, language);\r\n\t\t\t\t\t\tupdatePagination();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocument.querySelector(\"#table-newsupdate\").innerHTML = \"<div class='no-data'>\u0e44\u0e21\u0e48\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e08\u0e30\u0e41\u0e2a\u0e14\u0e07<\/div>\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n            })\r\n            .catch(error => {\r\n                console.error('Fetch error:', error);\r\n                document.querySelector(\"#table-newsupdate\").innerHTML = `<div class='error-message'>Error: ${error.message}<\/div>`;\r\n            });\r\n    }\r\n\r\n    function populateTable(data, language) {\r\n        const container = document.querySelector(\"#table-newsupdate\");\r\n        container.innerHTML = \"\";\r\n\r\n        const start = (currentPage - 1) * itemsPerPage;\r\n        const end = start + itemsPerPage;\r\n        const paginatedData = data.slice(start, end);\r\n\r\n        paginatedData.forEach(item => {\r\n            const timestamp = formatDate(item.timestamp, language);\r\n            const title = item.title;\r\n\r\n            const path = item.link;\r\n            const queryString = path.split('?')[1];\r\n            const formattedString = queryString.replace(\/y=|m=|id=\/g, '').replace(\/&\/g, '\/');\r\n            const parts = formattedString.split('\/');\r\n            const year = parts[0];\r\n            const month = parts[1];\r\n            const decodedValue = parts[2];\r\n            const reEncodedValue = btoa(decodedValue);\r\n            const getlang = language === 'en' ? 'E' : 'T';\r\n            const newFormattedString = `${year}\/${month}\/${decodedValue}\/${getlang}`;\r\n\r\n            const newsItemHTML = `\r\n                <div class=\"news-item\">\r\n                    <div class=\"news-date\">\r\n                        <i class=\"fa-regular fa-calendar\"><\/i>\r\n                        <span class=\"news-date-detail\">${timestamp}<\/span>\r\n                    <\/div>\r\n                    <div class=\"news-content\">\r\n                        <a href=\"..\/news-detail\/${newFormattedString}\" target=\"_blank\"><p>${title}<\/p><\/a>\r\n                    <\/div>\r\n                <\/div>\r\n            `;\r\n            container.insertAdjacentHTML('beforeend', newsItemHTML);\r\n        });\r\n    }\r\n\r\n    function formatDate(timestamp, language) {\r\n        const date = new Date(timestamp);\r\n        const options = { day: 'numeric', month: 'short', year: 'numeric' };\r\n        if (language === \"th\") {\r\n            const buddhistYear = date.getFullYear() + 543;\r\n            return date.toLocaleDateString('th-TH', options).replace(date.getFullYear(), buddhistYear);\r\n        }\r\n        return date.toLocaleDateString('en-US', options);\r\n    }\r\n\r\n    function updatePagination() {\r\n        const totalPages = Math.ceil(parsedData.length \/ itemsPerPage);\r\n\t\tconst container = document.getElementById(\"pagination-controls\");\r\n\t\tcontainer.innerHTML = \"\";\r\n\r\n\t\t\/\/ \ud83d\udc49 \u0e16\u0e49\u0e32\u0e44\u0e21\u0e48\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 \u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e41\u0e2a\u0e14\u0e07 pagination\r\n\t\tif (totalPages === 0) return;\r\n\r\n\t\tconst createButton = (label, page, disabled = false) => {\r\n\t\t\tconst btn = document.createElement(\"button\");\r\n\t\t\tbtn.textContent = label;\r\n\t\t\tbtn.style.margin = \"2px\";\r\n\t\t\tbtn.style.padding = \"4px 8px\";\r\n\t\t\tif (disabled) btn.disabled = true;\r\n\t\t\tbtn.addEventListener(\"click\", () => {\r\n\t\t\t\tcurrentPage = page;\r\n\t\t\t\tpopulateTable(parsedData, lang);\r\n\t\t\t\tupdatePagination();\r\n\t\t\t});\r\n\t\t\treturn btn;\r\n\t\t};\r\n\r\n        \/\/ \u00ab Button\r\n        container.appendChild(createButton(\"\u00ab\", currentPage - 1, currentPage === 1));\r\n\r\n        \/\/ Page Numbers\r\n        let maxVisibleButtons = 5;\r\n        let startPage = Math.max(1, currentPage - Math.floor(maxVisibleButtons \/ 2));\r\n        let endPage = Math.min(totalPages, startPage + maxVisibleButtons - 1);\r\n\r\n        if (endPage - startPage < maxVisibleButtons - 1) {\r\n            startPage = Math.max(1, endPage - maxVisibleButtons + 1);\r\n        }\r\n\r\n        if (startPage > 1) {\r\n            container.appendChild(createButton(\"1\", 1, currentPage === 1));\r\n            if (startPage > 2) {\r\n                const dots = document.createElement(\"span\");\r\n                dots.textContent = \"\u2026\";\r\n                dots.style.margin = \"2px\";\r\n                container.appendChild(dots);\r\n            }\r\n        }\r\n\r\n        for (let i = startPage; i <= endPage; i++) {\r\n            const isCurrent = i === currentPage;\r\n            const btn = createButton(i, i, isCurrent);\r\n            if (isCurrent) btn.disabled = true;\r\n            container.appendChild(btn);\r\n        }\r\n\r\n        if (endPage < totalPages) {\r\n            if (endPage < totalPages - 1) {\r\n                const dots = document.createElement(\"span\");\r\n                dots.textContent = \"\u2026\";\r\n                dots.style.margin = \"2px\";\r\n                container.appendChild(dots);\r\n            }\r\n            container.appendChild(createButton(totalPages, totalPages, currentPage === totalPages));\r\n        }\r\n\r\n        \/\/ \u00bb Button\r\n        container.appendChild(createButton(\"\u00bb\", currentPage + 1, currentPage === totalPages));\r\n    }\r\n\r\n    \/\/ Fetch data on load\r\n    fetchData(lang);\r\n<\/script>\r\n<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>News Update<\/p>","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-14634","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14 - LDC Dental PCL<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14 - LDC Dental PCL\" \/>\n<meta property=\"og:description\" content=\"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14\" \/>\n<meta property=\"og:url\" content=\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/news-updateall\/\" \/>\n<meta property=\"og:site_name\" content=\"LDC Dental PCL\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/LDCDental\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-22T04:46:08+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@LDC_Dental\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/\",\"url\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/\",\"name\":\"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14 - LDC Dental PCL\",\"isPartOf\":{\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#website\"},\"datePublished\":\"2024-11-25T07:07:32+00:00\",\"dateModified\":\"2025-05-22T04:46:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#website\",\"url\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/\",\"name\":\"My WordPress\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#organization\",\"name\":\"My WordPress\",\"url\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/wp-content\/uploads\/2025\/04\/logo-LDC-02.webp\",\"contentUrl\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/wp-content\/uploads\/2025\/04\/logo-LDC-02.webp\",\"width\":150,\"height\":39,\"caption\":\"My WordPress\"},\"image\":{\"@id\":\"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/LDCDental\",\"https:\/\/x.com\/LDC_Dental\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14 - LDC Dental PCL","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14 - LDC Dental PCL","og_description":"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14","og_url":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/news-updateall\/","og_site_name":"LDC Dental PCL","article_publisher":"https:\/\/www.facebook.com\/LDCDental","article_modified_time":"2025-05-22T04:46:08+00:00","twitter_card":"summary_large_image","twitter_site":"@LDC_Dental","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/","url":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/","name":"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14 - LDC Dental PCL","isPartOf":{"@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#website"},"datePublished":"2024-11-25T07:07:32+00:00","dateModified":"2025-05-22T04:46:08+00:00","breadcrumb":{"@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/news-updateall\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/"},{"@type":"ListItem","position":2,"name":"\u0e02\u0e48\u0e32\u0e27\u0e2a\u0e32\u0e23\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14"}]},{"@type":"WebSite","@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#website","url":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/","name":"My WordPress","description":"","publisher":{"@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#organization","name":"My WordPress","url":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#\/schema\/logo\/image\/","url":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/wp-content\/uploads\/2025\/04\/logo-LDC-02.webp","contentUrl":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/wp-content\/uploads\/2025\/04\/logo-LDC-02.webp","width":150,"height":39,"caption":"My WordPress"},"image":{"@id":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/LDCDental","https:\/\/x.com\/LDC_Dental"]}]}},"_links":{"self":[{"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/pages\/14634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/comments?post=14634"}],"version-history":[{"count":24,"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/pages\/14634\/revisions"}],"predecessor-version":[{"id":21223,"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/pages\/14634\/revisions\/21223"}],"wp:attachment":[{"href":"https:\/\/aliceblue-flamingo-311157-clone.irpluscontent.com\/en\/wp-json\/wp\/v2\/media?parent=14634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}