{"id":27235,"date":"2025-04-12T02:55:30","date_gmt":"2025-04-12T02:55:30","guid":{"rendered":"https:\/\/myphamaumy.com\/?page_id=27235"},"modified":"2025-04-12T08:36:03","modified_gmt":"2025-04-12T08:36:03","slug":"bao-gia-si","status":"publish","type":"page","link":"https:\/\/myphamaumy.com\/en\/bao-gia-si\/","title":{"rendered":"B\u00e1o gi\u00e1 s\u1ec9"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"27235\" class=\"elementor elementor-27235\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"wd-negative-gap elementor-element elementor-element-edac1d9 e-flex e-con-boxed e-con e-parent\" data-id=\"edac1d9\" 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-b649994 elementor-widget elementor-widget-html\" data-id=\"b649994\" 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\n<?php\n\/**\n * Shortcode: [bao_gia_si_table]\n * Hi\u1ec3n th\u1ecb danh s\u00e1ch s\u1ea3n ph\u1ea9m t\u1eeb localStorage b\u1eb1ng JavaScript\n *\/\nfunction shortcode_bao_gia_si_table() {\n    ob_start();\n    ?>\n    <div id=\"baoGiaSiContainer\">\n        <h2>Danh s\u00e1ch s\u1ea3n ph\u1ea9m b\u00e1o gi\u00e1 s\u1ec9<\/h2>\n        <div id=\"baoGiaSiTableContainer\">\n            <!-- B\u1ea3ng s\u1ebd \u0111\u01b0\u1ee3c render b\u1eb1ng JS -->\n        <\/div>\n    <\/div>\n\n    <script>\n    document.addEventListener(\"DOMContentLoaded\", function () {\n        const container = document.getElementById(\"baoGiaSiTableContainer\");\n        const list = JSON.parse(localStorage.getItem(\"baoGiaSiList\")) || [];\n\n        if (list.length === 0) {\n            container.innerHTML = '<p>???? Ch\u01b0a c\u00f3 s\u1ea3n ph\u1ea9m n\u00e0o trong danh s\u00e1ch.<\/p>';\n            return;\n        }\n\n        let html = `<div style=\"overflow-x:auto\"><table style=\"width:100%; border-collapse:collapse;\">\n            <thead>\n                <tr>\n                    <th style='padding:8px; border-bottom:1px solid #ddd;'>#<\/th>\n                    <th style='padding:8px; border-bottom:1px solid #ddd;'>H\u00ecnh \u1ea3nh<\/th>\n                    <th style='padding:8px; border-bottom:1px solid #ddd;'>T\u00ean s\u1ea3n ph\u1ea9m<\/th>\n                    <th style='padding:8px; border-bottom:1px solid #ddd;'>S\u1ed1 l\u01b0\u1ee3ng<\/th>\n                    <th style='padding:8px; border-bottom:1px solid #ddd;'>Thao t\u00e1c<\/th>\n                <\/tr>\n            <\/thead>\n            <tbody>`;\n\n        list.forEach((item, index) => {\n            const imageTag = item.image ? `<img decoding=\"async\" src=\"${item.image}\" alt=\"${item.name}\" style=\"height:50px;\">` : '<span style=\"color: #999\">(kh\u00f4ng c\u00f3 \u1ea3nh)<\/span>';\n            const urlTag = item.url || \"#\";\n            const quantity = item.quantity || 1;\n\n            html += `\n                <tr>\n                    <td style='padding:8px;'>${index + 1}<\/td>\n                    <td style='padding:8px;'>${imageTag}<\/td>\n                    <td style='padding:8px;'><a href=\"${urlTag}\" target=\"_blank\">${item.name}<\/a><\/td>\n                    <td style='padding:8px;'>\n                        <input type=\"number\" min=\"1\" value=\"${quantity}\" onchange=\"capNhatSoLuong('${item.id}', this.value)\" style=\"width:60px; text-align:center;\">\n                    <\/td>\n                    <td style='padding:8px;'><button onclick=\"xoaSanPham('${item.id}')\">\u274c Xo\u00e1<\/button><\/td>\n                <\/tr>`;\n        });\n\n        html += `<\/tbody><\/table><\/div>`;\n        container.innerHTML = html;\n    });\n\n    function xoaSanPham(id) {\n        let list = JSON.parse(localStorage.getItem(\"baoGiaSiList\")) || [];\n        list = list.filter(item => item.id !== id);\n        localStorage.setItem(\"baoGiaSiList\", JSON.stringify(list));\n        location.reload();\n    }\n\n    function capNhatSoLuong(id, newQty) {\n        let list = JSON.parse(localStorage.getItem(\"baoGiaSiList\")) || [];\n        const index = list.findIndex(item => item.id === id);\n        if (index !== -1) {\n            list[index].quantity = parseInt(newQty);\n            localStorage.setItem(\"baoGiaSiList\", JSON.stringify(list));\n        }\n    }\n    <\/script>\n    <?php\n    return ob_get_clean();\n}\nadd_shortcode('bao_gia_si_table', 'shortcode_bao_gia_si_table');\n\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<section class=\"wd-negative-gap elementor-section elementor-top-section elementor-element elementor-element-2638cf77 elementor-section-content-middle wd-section-stretch elementor-reverse-mobile elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2638cf77\" data-element_type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-extended\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-4792286\" data-id=\"4792286\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5ad635dc elementor-widget elementor-widget-wd_image_or_svg\" data-id=\"5ad635dc\" data-element_type=\"widget\" data-widget_type=\"wd_image_or_svg.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\n\t\t<div class=\"wd-image text-left\">\n\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"580\" height=\"660\" src=\"https:\/\/myphamaumy.com\/wp-content\/uploads\/2025\/04\/nha-phan-phoi.webp\" class=\"attachment-full size-full\" alt=\"\" srcset=\"https:\/\/myphamaumy.com\/wp-content\/uploads\/2025\/04\/nha-phan-phoi.webp 580w, https:\/\/myphamaumy.com\/wp-content\/uploads\/2025\/04\/nha-phan-phoi-264x300.webp 264w, https:\/\/myphamaumy.com\/wp-content\/uploads\/2025\/04\/nha-phan-phoi-430x489.webp 430w, https:\/\/myphamaumy.com\/wp-content\/uploads\/2025\/04\/nha-phan-phoi-150x171.webp 150w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/>\t\t\t\t\t<\/div>\n\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-6e9e5cad\" data-id=\"6e9e5cad\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t<div class=\"elementor-element elementor-element-32f679f e-con-full e-flex e-con e-parent\" data-id=\"32f679f\" data-element_type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e430edc elementor-button-align-stretch elementor-widget elementor-widget-form\" data-id=\"e430edc\" data-element_type=\"widget\" data-settings=\"{&quot;step_next_label&quot;:&quot;Next&quot;,&quot;step_previous_label&quot;:&quot;Previous&quot;,&quot;button_width&quot;:&quot;100&quot;,&quot;step_type&quot;:&quot;number_text&quot;,&quot;step_icon_shape&quot;:&quot;circle&quot;}\" data-widget_type=\"form.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<form class=\"elementor-form\" method=\"post\" id=\"bao_gia_form\" name=\"New Form\" aria-label=\"New Form\" action=\"\">\n\t\t\t<input type=\"hidden\" name=\"post_id\" value=\"27235\"\/>\n\t\t\t<input type=\"hidden\" name=\"form_id\" value=\"e430edc\"\/>\n\t\t\t<input type=\"hidden\" name=\"referer_title\" value=\"myphamaumy.com\" \/>\n\n\t\t\t\n\t\t\t<div class=\"elementor-form-fields-wrapper elementor-labels-above\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-hidden elementor-field-group elementor-column elementor-field-group-danh_sach_san_pham elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"hidden\" name=\"form_fields[danh_sach_san_pham]\" id=\"form-field-danh_sach_san_pham\" class=\"elementor-field elementor-size-sm  elementor-field-textual\" value=\"danh_sach_san_pham\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-text elementor-field-group elementor-column elementor-field-group-hoten elementor-col-100 elementor-field-required elementor-mark-required\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"form-field-hoten\" class=\"elementor-field-label\">\n\t\t\t\t\t\t\t\tH\u1ecd v\u00e0 t\u00ean\t\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"text\" name=\"form_fields[hoten]\" id=\"form-field-hoten\" class=\"elementor-field elementor-size-sm  elementor-field-textual\" placeholder=\"H\u1ecd v\u00e0 t\u00ean\" required=\"required\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-number elementor-field-group elementor-column elementor-field-group-sdt elementor-col-50 elementor-field-required elementor-mark-required\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"form-field-sdt\" class=\"elementor-field-label\">\n\t\t\t\t\t\t\t\tS\u1ed1 \u0111i\u1ec7n tho\u1ea1i\t\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t\t\t<input type=\"number\" name=\"form_fields[sdt]\" id=\"form-field-sdt\" class=\"elementor-field elementor-size-sm  elementor-field-textual\" placeholder=\"S\u1ed1 \u0111i\u1ec7n tho\u1ea1i\" required=\"required\" min=\"\" max=\"\" >\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-email elementor-field-group elementor-column elementor-field-group-email elementor-col-50 elementor-field-required elementor-mark-required\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"form-field-email\" class=\"elementor-field-label\">\n\t\t\t\t\t\t\t\tEmail\t\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"email\" name=\"form_fields[email]\" id=\"form-field-email\" class=\"elementor-field elementor-size-sm  elementor-field-textual\" placeholder=\"Email\" required=\"required\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-textarea elementor-field-group elementor-column elementor-field-group-ghichu elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"form-field-ghichu\" class=\"elementor-field-label\">\n\t\t\t\t\t\t\t\tGhi ch\u00fa th\u00eam\t\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t<textarea class=\"elementor-field-textual elementor-field  elementor-size-sm\" name=\"form_fields[ghichu]\" id=\"form-field-ghichu\" rows=\"4\"><\/textarea>\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-group elementor-column elementor-field-type-submit elementor-col-100 e-form__buttons\">\n\t\t\t\t\t<button class=\"elementor-button elementor-size-sm\" type=\"submit\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">G\u1eedi B\u00e1o Gi\u00e1<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/button>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<input type=\"hidden\" name=\"trp-form-language\" value=\"en\"\/><\/form>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-31f643c elementor-widget elementor-widget-button\" data-id=\"31f643c\" data-element_type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"#\" id=\"back-to-product\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">\u2190 Quay l\u1ea1i trang s\u1ea3n ph\u1ea9m<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e1684b elementor-widget elementor-widget-html\" data-id=\"8e1684b\" 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<script>\r\ndocument.addEventListener(\"DOMContentLoaded\", function () {\r\n    const form = document.getElementById(\"bao_gia_form\");\r\n    if (!form) return;\r\n\r\n    form.addEventListener(\"submit\", function () {\r\n        const list = JSON.parse(localStorage.getItem(\"baoGiaSiList\")) || [];\r\n        const field = form.querySelector(\"input[name='danh_sach_san_pham']\");\r\n        if (field) {\r\n            field.value = list.map((item, index) => {\r\n                return `${index + 1}. ${item.name} - ${item.price} - ${item.url}`;\r\n            }).join(\"\\\\n\");\r\n        }\r\n    });\r\n\r\n    \/\/ Theo d\u00f5i s\u1ef1 ki\u1ec7n submit th\u00e0nh c\u00f4ng\r\n    const observer = new MutationObserver(() => {\r\n        if (form.classList.contains(\"elementor-message-success\")) {\r\n            \/\/ Xo\u00e1 danh s\u00e1ch b\u00e1o gi\u00e1 s\u1ec9\r\n            localStorage.removeItem(\"baoGiaSiList\");\r\n            \/\/ Reload l\u1ea1i b\u1ea3ng n\u1ebfu c\u00f3 (t\u00f9y b\u1ea1n)\r\n            if (typeof location !== 'undefined') location.reload();\r\n        }\r\n    });\r\n\r\n    observer.observe(form, { attributes: true, attributeFilter: ['class'] });\r\n});\r\n<\/script>\r\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>\u2190 Quay l\u1ea1i trang s\u1ea3n ph\u1ea9m<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-27235","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/pages\/27235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/comments?post=27235"}],"version-history":[{"count":0,"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/pages\/27235\/revisions"}],"wp:attachment":[{"href":"https:\/\/myphamaumy.com\/en\/wp-json\/wp\/v2\/media?parent=27235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}