COLLAGEN CHIA
COFFEE MIX
Slim Body
Bright
Skin
FREE GIFTS
01 CHIA SEEDS PACKS
01 COZY DIET SUGAR
ROSMAR 14 DAYS SLIM
DOWN PLAN
00
00
00
00
ORDER NOW
Promotion period
BUY 1 TAKE 1 FREE
AED 199
AED 199
AED 159
BUY 2 GET 2
BUY 1 GET 1
AED 119
BUY NOW
B1G1 FreeShip 119 AED
B2G2 FreeShip 𝟭𝟱𝟵 AED
B3G3 FreeShip 199 AED
BUY 1 GET 1 FREE : 119 AED
BUY 3 GET 3 FREE : 199 AED
BUY 2 GET 2 FREE : 159 AED
SALE 50% | ORDER NOW
Days
Hours
Min
Sec
Days
Hours
Min
Sec
00
00
00
00
(function () { // ========================= // HELPERS // ========================= // Lấy value của 1 input/textarea/select theo từ khóa (so khớp name/id/placeholder/data-name) function getFieldByKeywords(keywords = []) { const inputs = document.querySelectorAll("input, textarea, select"); for (const inp of inputs) { const type = (inp.type || "").toLowerCase(); if (type === "checkbox" || type === "radio" || type === "submit" || type === "button") continue; const attrs = ( (inp.name || "") + " " + (inp.id || "") + " " + (inp.placeholder || "") + " " + (inp.getAttribute("data-name") || "") ).toLowerCase(); if (keywords.some(k => attrs.includes(String(k).toLowerCase()))) { return (inp.value || "").trim(); } } return ""; } // Lấy text option đang chọn của 1
theo từ khóa function getSelectTextByKeywords(keywords = []) { const selects = document.querySelectorAll("select"); for (const sel of selects) { const attrs = ( (sel.name || "") + " " + (sel.id || "") + " " + (sel.getAttribute("data-name") || "") ).toLowerCase(); if (keywords.some(k => attrs.includes(String(k).toLowerCase()))) { const opt = sel.options[sel.selectedIndex]; if (opt && opt.text) return opt.text.trim(); } } return ""; } // Lấy text nhãn (label) của 1 radio/checkbox — hỗ trợ nhiều kiểu cấu trúc LadiPage function getLabelText(input) { if (!input) return ""; if (input.id) { const lab = document.querySelector('label[for="' + input.id + '"]'); if (lab && lab.textContent.trim()) return lab.textContent.trim(); } if (input.closest) { const wrapLab = input.closest("label"); if (wrapLab && wrapLab.textContent.trim()) return wrapLab.textContent.trim(); } if (input.nextElementSibling && input.nextElementSibling.textContent.trim()) { return input.nextElementSibling.textContent.trim(); } if (input.parentElement && input.parentElement.textContent.trim()) { return input.parentElement.textContent.trim(); } return (input.value || "").trim(); } // Lấy nhãn của tất cả radio/checkbox đang được chọn function getCheckedLabels() { const inputs = document.querySelectorAll("input[type=checkbox]:checked, input[type=radio]:checked"); const out = []; inputs.forEach(inp => { const t = getLabelText(inp); if (t) out.push(t); }); return out; } // ========================= // THU THẬP DỮ LIỆU FORM (theo form Dubai mới) // ========================= function collectFields() { const name = getFieldByKeywords(["name", "fullname", "nume"]); const phone = getFieldByKeywords(["phone", "tel", "mobile", "sdt", "whatsapp", "telefon"]); // Address / Building / Street const address = getFieldByKeywords(["address", "building", "street", "adresa", "strada"]); // Apartment / Villa / Room Number const apartment = getFieldByKeywords(["apartment", "villa", "room", "apt", "unit", "flat"]); // Lungsod / Emirate (Dubai, Abu Dhabi, Sharjah...) let emirate = getFieldByKeywords(["emirate", "lungsod", "emirat"]); if (!emirate) emirate = getSelectTextByKeywords(["emirate", "lungsod", "emirat", "city", "state"]); // Offer / Combo (radio: Buy 1 get 1 free / Buy 2 get 2 free) — lấy theo nhãn let offer = ""; const checked = getCheckedLabels(); offer = checked.find(t => /buy|get|free|aed|deliver|combo|set|offer/i.test(t)) || checked[0] || ""; return { name, phone, address, apartment, emirate, offer, ts: Date.now() }; } // ========================= // CONFIG // ========================= // VN 038 2916873 -> bỏ số 0 đầu, thêm mã nước 84 -> 84382916873 (KHÔNG dấu +) const WA_NUMBER = "84382916873"; const THANK_YOU_URL = "https://www.aureliawear.website/thanku-fashion"; function buildWA(data) { const msg = "Confirm your order – Get your offer now!\n\n" + `Name: ${data.name || "-"}\n` + `Phone: ${data.phone || "-"}\n` + `Address/Building/Street: ${data.address || "-"}\n` + `Apartment/Villa/Room: ${data.apartment || "-"}\n` + `Emirate: ${data.emirate || "-"}\n` + `Offer: ${data.offer || "-"}`; return `https://wa.me/${WA_NUMBER}?text=${encodeURIComponent(msg)}`; } // ========================= // SUBMIT FAST PATH // ========================= const form = document.querySelector("form"); if (!form) return; form.addEventListener("submit", function () { try { const data = collectFields(); // 1) Lưu fallback vào sessionStorage sessionStorage.setItem("lp_order_data", JSON.stringify(data)); // 2) Mở WhatsApp NGAY (mở tab trắng trước để tránh bị chặn popup) const waTab = window.open("about:blank", "_blank"); setTimeout(() => { if (waTab) waTab.location.href = buildWA(data); }, 0); // 3) Meta Pixel Lead (tuỳ chọn) try { if (typeof fbq === "function") { fbq("track", "Lead", { content_name: data.offer || "Unknown", value: 0, currency: "AED", phone: data.phone || "", city: data.emirate || "" }); } } catch (_) {} // KHÔNG preventDefault -> form vẫn submit bình thường về LadiPage. // Nếu muốn tự redirect sang trang cảm ơn, bỏ comment dòng dưới: // setTimeout(() => { window.location.href = THANK_YOU_URL; }, 400); } catch (err) {} }, true); })();