<?php
// ====================================================================================================================== //
session_start();
$_V_IP = $_SERVER['REMOTE_ADDR'];
$_EVENT_ID = md5($_V_IP . strtotime(date("Y-m-d H:i:s")));
// ====================================================================================================================== //

// Ganti kode pixel dibawah ini
$_PIXEL_ID = "5774118669323625";

// Ganti link loops dibawah ini
$_LOOP_EMAIL = "https://app.loops.id/save-order/promo-spesial-etawalin-form-0-3-2-3-2";
// ====================================================================================================================== //
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Site Icon -->
    <link rel="shortcut icon" href="icon.png" type="image/x-icon" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
    <!-- Script CDN icon -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- Scrip CSS CDN Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <!-- Script memanggil file css -->
    <link rel="stylesheet" href="src/styles/style.css" />
    <!-- Site Title -->
    <title>Toko Etawalin Resmi - INDONESIA</title>

    <!-- Meta Pixel Code -->
    <script>
        !function (f, b, e, v, n, t, s) {
            if (f.fbq) return; n = f.fbq = function () {
                n.callMethod ?
                    n.callMethod.apply(n, arguments) : n.queue.push(arguments)
            };
            if (!f._fbq) f._fbq = n; n.push = n; n.loaded = !0; n.version = '2.0';
            n.queue = []; t = b.createElement(e); t.async = !0;
            t.src = v; s = b.getElementsByTagName(e)[0];

            s.parentNode.insertBefore(t, s)
        }(window, document, 'script',
            'https://connect.facebook.net/en_US/fbevents.js');
        fbq('init', '<?php echo $_PIXEL_ID; ?>');
        fbq('track', 'PageView', {}, { eventID: "ePV-<?php echo $_EVENT_ID; ?>" });
    </script>
    <noscript>
        <img height="1" width="1" style="display:none"
            src="https://www.facebook.com/tr?id=<?php echo $_PIXEL_ID; ?>&ev=PageView&noscript=1" />
    </noscript>
    <!-- End Meta Pixel Code -->
</head>

<!-- ====================================================================================================================== -->
<!-- ## Copy dan paste kode dibawah ini di dalam tag <body> ##-->
<!-- Button Untuk Trigger Modal (Pilih Salah Satu Saja Antara Manual Atau Gambar) -->

<!-- ====================================================================================================================== -->
<!-- ## Copy dan paste kode dibawah ini di dalam tag <body> ##-->
<center>
    <!-- Kode dibawah ini jika ingin menggunakan button dengan gambar -->
    <button class="floating-btn">
    <a href="#alert">
    <img src="src/assets/wapesan.gif" alt="Floating Button" />
        <!-- Sesuaikan dengan gambar/gif yang akan dipakai -->
    </button>
</center>
<!-- ====================================================================================================================== -->
<!-- ## Copy dan paste kode dibawah ini di bagian bawah namun tetap dalam tag <body> ##-->
<script>
  function redirect1() {
    window.location = "<?php echo $_LOOP_EMAIL; ?>"; // sesuaikan redirect, contoh ini adalah floating button untuk memanggil link loop wa
  }
</script>
<!-- ====================================================================================================================== -->

<!-- ====================================================================================================================== -->

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/hdsrf.webp" class="img" /></span>
</div>

<div class="section">
    <span><img src="src/assets/hdsrf2.webp" class="img" /></span>
</div>

<div class="section">
    <span><img src="src/assets/manfaat2.webp" class="img" /></span>
</div>

<div class="section">
    <span><img src="src/assets/terlambat.webp" class="img" /></span>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/disini.webp" class="img" /></span>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/untung.webp" class="img" /></span>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/4.webp" class="img" /></span>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/5.gif" class="img" /></span>
</div>



<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/box3.webp" class="img" /></span>
</div>

<!-- Button 1 box-->
<div style="display:  flex; justify-content: center;">
    <a href="#alert" class="btn-promo buttons-pesan"><span><i class="fa fa-shopping-cart" aria-hidden="true"></i>
        </span>Pesan Paket Sembuh (3 BOX)</a>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/box2.webp" class="img" /></span>
</div>

<!-- Button 2 box -->
<div style="display: flex; justify-content: center;">
    <a href="#alert" class="btn-promo buttons-pesan"><span><i class="fa fa-shopping-cart" aria-hidden="true"></i>
        </span>Pesan Paket Terapi (2 BOX)</a>
</div>

<!-- Gambar -->
<div class="section" id="harga">
    <span><img src="src/assets/box1.webp" class="img" /></span>
</div>

<!-- Button 3 box -->
<div style="display: flex; justify-content: center;">
    <a href="#alert" class="btn-promo buttons-pesan"><span><i class="fa fa-shopping-cart" aria-hidden="true"></i>
        </span>Pesan Paket Ringan (1 BOX)</a>
</div>

<!-- Gambar -->
<div class="section" id="harga">
    <span><img src="src/assets/4-box.webp" class="img" /></span>
</div>

<!-- Button 3 box -->
<div style="display: flex; justify-content: center;">
    <a href="#alert" class="btn-promo buttons-pesan"><span><i class="fa fa-shopping-cart" aria-hidden="true"></i>
        </span>Pesan Paket Spesial (5 BOX)</a>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/5.gif" class="img" /></span>
</div>

<!-- Gambar -->
<center>
    <span><img src="src/assets/ribuan-paket2.webp" class="img" /></span>
</center>

<!-- Promo Text -->
<div style="text-align: center;">
    <div id="value" style="font: 700 60px system-ui; color: #000;">26</div>
    <p style="text-transform: uppercase; color: #000; font-weight: 600; font-size: 15px;">
        Stok Promo Tersisa Hari Ini</p>
</div>

<!-- Alert -->
<div class="alert" id="alert">
    <span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span>
    <strong>Promo Hanya Hari Ini.
    </strong>
    <p>Kami Mendahulukan Pemesanan Melalui Form.</p>
</div>

<!-- Promo Text -->
<!-- <div
        style="text-align: center; margin: 6% 8% 0 8%; text-transform: uppercase; background: #f8fc04; font-size: 28px; font-weight: 900; padding: 2px;">
        <p style="color: #000;">Gratis Ongkir</p>
        <p style="color: #FF1B1B;">Minimal Pemesanan 3 box</p>
    </div> -->

<!-- Gif -->
<div class="section">
    <span><img style="margin: 10% 1%;" src="src/assets/waform.gif" class="img" /></span>
</div>

<!-- Form -->
<div class="section" id="form" style="position: relative;">
    <div
        style="border-radius: 10px; margin: 2% 2%; width:96%; padding: 15px 10px; background: #ffe610; border: 3px solid black">

        <form id="form-order" class="loops-forms" action="<?php echo $_LOOP_EMAIL; ?>" method="POST">
            <div class="loops-group">
                <label for="name" style="color: #000">Nama Lengkap<span class="red">*</span></label>
                <input type="text" id="name" name="name" value="" placeholder="Tulis nama Anda" required>
            </div>
            <div class="loops-group">
                <label for="phone" style="color: #000">No. WhatsApp <span class="red">*</span></label>
                <input type="text" id="phone" name="phone" value=""
                    placeholder="Sebutkan nomor HP aktif Anda: contoh 081234567890" pattern="[0]{1}[0-9]{8,12}"
                    required>
            </div>
            <div class="loops-group">
                <input type="submit" value="Beli + Ambil Promo" class="loops-submit btn-add-to-cart">
            </div>
            <input type="hidden" id="current" name="current" value="">
            <input type="hidden" name="redirect" value="">
            <input type="hidden" name="_loops_nonce" value="">

            <!--CAPI EVENT-->
            <input type="hidden" name="event_id" id="event_id" value="eATC-<?php echo $_EVENT_ID; ?>">

            <div style="text-align: center;">
                <p style="background: #FFA432; color: #000; font-weight: 900; font-size: 18px; padding: 2px;">
                    PASTIKAN NOMOR WA KAMU BENAR, AGAR KAMI BISA MENGHUBUNGI KAMU</p>
            </div>
        </form>
        <script>
            var form = document.getElementById('form-order');
            form.addEventListener('submit', function (e) {
                setCookie('vip', '<?php echo $_V_IP; ?>', 7);
                fbq('track', 'AddToCart', { currency: 'IDR' }, { eventID: "eATC-<?php echo $_EVENT_ID; ?>" });
            });
        </script>
    </div>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/arrow-1.gif" class="img" /></span>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/keuntungan2.webp" class="img" /></span>
</div>

<!-- Button -->
<div style="display: flex; justify-content: center;">
    <a href="#harga" class="btn-promo buttons-cek-promo"><span><i class="fa fa-list-alt" aria-hidden="true"></i>
        </span>Cek Harga & Promo</a>
</div>

<!-- Button -->
<div style="display: flex; justify-content: center;">
    <a href="#alert" class="btn-promo buttons-ambil-promo"><span><i class="fa fa-shopping-cart" aria-hidden="true"></i>
        </span>PESAN SEKARANG + AMBIL PROMO</a>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/aman.webp" class="img" /></span>
</div>

<!-- Gambar -->
<div class="section">
    <span><img src="src/assets/ekspedisi2.webp" class="img" /></span>
</div>

<script src="src/scripts/jquery-3.6.0.min.js" language="javascript"></script>
<script src="src/scripts/jquery.lazyload.min.js" language="javascript"></script>
<script src="src/scripts/toasts-notification.js" language="javascript"></script>
<script src="src/scripts/slideshow.js" language="javascript"></script>
<script src="src/scripts/carousel.js" language="javascript"></script>
<script src="src/scripts/counter-titik.js" language="javascript"></script>
<script src="src/scripts/counter.js" language="javascript"></script>

<!-- Script CDN Bootstrap -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
    crossorigin="anonymous"></script>

<script>
    function redirect() {
        window.location = "<?php echo $_LOOP_WA; ?>";
    }
</script>

<!-- Script Kode CAPI -->
<script>

    function setCookie(cname, cvalue, exdays) {
        const d = new Date();
        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
        let expires = "expires=" + d.toUTCString();
        document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
    }

    function getCookie(cname) {
        let name = cname + "=";
        let decodedCookie = decodeURIComponent(document.cookie);
        let ca = decodedCookie.split(';');
        for (let i = 0; i < ca.length; i++) {
            let c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1);
            }
            if (c.indexOf(name) == 0) {
                return c.substring(name.length, c.length);
            }
        }
        return "";
    }

    $(document).ready(function (e) {
        // $("img.lazy").lazyload();

        if (getCookie('vip')) {
            //$('#form-order').hide();
            $('#thx_div').show();
        }

        <?php if (isset($_GET['reset']) && $_GET['reset'] == 1) { ?>
            document.cookie = "vip=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
        <?php } ?>

        fbq('track', 'ViewContent', {}, { eventID: "eVC-<?php echo $_EVENT_ID; ?>" });
    });

</script>
<!-- Paste Script Nakula Dibawah Sini -->
<script>var gbsid = "e392619a24d647d1af4202181a69ae72"</script>
<script src="https://xt.gbnkla.com/jx/v1/cakra.js"></script>;

</body>

</html>