SẢN PHẨM MỚI

339,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
470,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
420,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
435,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
339,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
435,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
339,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
435,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
310,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
310,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
360,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
360,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
360,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
360,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
430,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
400,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
430,000VNĐ
Sản phẩm này có nhiều biến thể. Các tùy chọn có thể được chọn trên trang sản phẩm
const menh_gia_500k = document.querySelector("#number-menh-gia-500k"); const menh_gia_1000k = document.querySelector("#number-menh-gia-1000k"); const result_500k = document.querySelector(".result-500k"); const result_1000k = document.querySelector(".result-1000k"); const wpcf_voucher_total = document.querySelector(".wpcf-voucher-total"); const total_voucher_amount = document.querySelector("#total_voucher_amount"); const total_voucher_500k_amount = document.querySelector("#total_voucher_500k_amount"); const total_voucher_1000k_amount = document.querySelector("#total_voucher_1000k_amount"); const is_receipt = document.querySelector("input[name='wpcf_is_receipt[]']"); const is_use_buyer_info = document.querySelector("input[name='wpcf_use_buyer_info[]']"); const tax_billing_form = document.querySelector("#tax-billing-form"); const customer_name = document.querySelector("input[name='your-name']"); const customer_phone = document.querySelector("input[name='tel-216']"); const receiver_name = document.querySelector("input[name='receiver-name']"); const receiver_phone = document.querySelector("input[name='receiver-phone']"); const wpcf_submit_btn = document.querySelector('#wpcf_voucher_submit'); const wpcf_company_name = document.querySelector('#wpcf_company_name'); const wpcf_company_address = document.querySelector('#wpcf_company_address'); const wpcf_company_email = document.querySelector('#wpcf_company_email'); const wpcf_company_tax= document.querySelector('#wpcf_company_tax'); function use_customer_name_for_buyer() { receiver_name.value = customer_name.value; } function use_customer_phone_for_buyer() { receiver_phone.value = customer_phone.value; } function toggle_use_buyer_info (is_check) { if(is_check){ use_customer_name_for_buyer() use_customer_phone_for_buyer() customer_name.addEventListener('change', use_customer_name_for_buyer) customer_phone.addEventListener('change', use_customer_phone_for_buyer) } else { customer_name.removeEventListener('change', use_customer_name_for_buyer) customer_phone.removeEventListener('change', use_customer_phone_for_buyer) } receiver_name.readOnly = is_check; receiver_phone.readOnly = is_check; } function toggle_receipt() { if (is_receipt.checked) { tax_billing_form.style.display = "block"; document.querySelector('#wpcf_company_name').value = ''; document.querySelector('#wpcf_company_address').value = ''; document.querySelector('#wpcf_company_email').value = ''; document.querySelector('#wpcf_company_tax').value = ''; } else { document.querySelector('#wpcf_company_name').value = 'N A'; document.querySelector('#wpcf_company_address').value = 'N_A'; document.querySelector('#wpcf_company_email').value = 'not_filled@email.com'; document.querySelector('#wpcf_company_tax').value = '0000000000'; tax_billing_form.style.display = "none"; } } function currency_format(value) { let vnd = new Intl.NumberFormat('vi-VN', { style: 'currency', currency: 'vnd', }); return vnd.format(value) } function calculate_500k() { let result = 500000 * menh_gia_500k.value; result_500k.textContent = currency_format( result) total_voucher_500k_amount.value = result return result } function calculate_1000k() { let result = 1000000 * menh_gia_1000k.value; result_1000k.textContent = currency_format( result) total_voucher_1000k_amount.value = result return result } function calculate_total_voucher() { let total = ( calculate_500k() + calculate_1000k() ) total_voucher_amount.value = isNaN(total) ? 0 : total; if(total_voucher_amount.value == 0){ wpcf_submit_btn.disabled = true } else { wpcf_submit_btn.disabled = false } wpcf_voucher_total.textContent = currency_format(total); } function decrease(id) { let input = document.querySelector("#" + id); let count = parseInt(input.value || 0) - 1; count = count < 1 ? 0 : count; input.value = count calculate_total_voucher() }; function increase(id) { let input = document.querySelector("#" + id); let count = parseInt(input.value || 0) + 1; input.value = count calculate_total_voucher() } function wpcf_voucher_register() { toggle_receipt(); calculate_total_voucher(); menh_gia_500k.addEventListener("change", (event) => { calculate_total_voucher(); }); menh_gia_1000k.addEventListener("change", (event) => { calculate_total_voucher(); }); wpcf_is_receipt.addEventListener("change", (event) => { calculate_total_voucher(); }); is_receipt.addEventListener('change',(event) => { toggle_receipt() }); is_use_buyer_info.addEventListener('change', () => { toggle_use_buyer_info(is_use_buyer_info.checked??false) }) if(wpcf_submit_btn) { wpcf_submit_btn.disabled = true } }