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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="shortcut icon" href="<?php echo e(asset('picture/favicon.png')); ?>" type="image/x-icon">
    <link rel="icon" href="<?php echo e(asset('picture/favicon.png')); ?>" type="image/x-icon">    
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
        integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
        integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />

    <link rel="stylesheet" href="<?php echo e(asset('')); ?>css/custom.css" />
    <title>Cek Poin Member</title>
    <style>
        label{
            color : var(--colorGreen);
        }
    </style>
    <link rel="stylesheet" href="<?php echo e(asset('')); ?>vendor/sweetalert-master/dist/sweetalert.css" />
</head>

<body>
    <div class="container custom">
        <div class="row justify-content-center align-items-center">
            <div class="col-md-12">
                <img src="<?php echo e(asset('picture/logo.PNG')); ?>" class="logo-top">
                <div class="card p-5 d-block b-radius-3 card-relative">
                    <div class="row align-items-center">
                        <div class="col-md-6">
                            <form>
                                <div id="cek-poin">
                                    <!--<img src="<?php echo e(asset('')); ?>picture/icon.png" alt="logo.png" style="height:50px"-->
                                        <!--class="img-responsive mb-2">-->
                                    <h3 class="font-weight-bold color-green">Cek Poinmu!</h6>
                                    <p style="font-size:14px">Cek pointmu sekarang dan dapatkan berbagai benefit lainnya</p>
                                    <br>
                                    <label for="">No Telepon</label>
                                    <div class="input">
                                        <span class="fas fa-mobile mr-2"></span>
                                        <input type="number" class="form-control" id="phone" name="no_hp"
                                            value="<?php echo e(old('no_hp')); ?>" placeholder="No Telepon">
                                    </div>
                                    <br>
                                    <button class="btn btn-green px-4 cekPoin" type='button' onclick="cekPoin()"> <span
                                            class="fa fa-filter"></span> Cek</button>
                                    <a href="<?php echo e(route('pelanggan-baru')); ?>" class="btn btn-primary px-4"><span
                                            class="fa fa-user"></span> Member Baru</a>
                                </div>
                            </form>
                        </div>
                        <div class="col-md-6 d-none d-md-block">
                            <img src="<?php echo e(asset('picture/card.PNG')); ?>" class="img-fluid">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer py-4">
        <div class="yes-drink  d-none d-md-flex">
            <p class="mt-5">YES I DRINK INDONESIAN COFFEE</p>
        </div>
        <div class="container d-none d-md-flex  mt-2">
            <h5 class="font-weight-bold mb-0 ml-4 mr-5">Follow Us</h5>
            <span class="mr-3"><span class="fab fa-tiktok"></span> coffeetoffeeidn</span>
            <span><span class="fab fa-instagram"></span> coffeetoffeeidn</span>
        </div>        
        <div class="container py-2 pl-4 d-flex d-md-none mt-2 flex-column">
            <h5 class="font-weight-bold mb-1">Follow Us</h5>
            <div>
                <span class="mr-3"><span class="fab fa-tiktok"></span> coffeetoffeeidn</span>
                <span><span class="fab fa-instagram"></span> coffeetoffeeidn</span>
                
            </div>
        </div>        
        
    </div>
</body>

</html>
<script src="<?php echo e(asset('')); ?>vendor/sweetalert-master/dist/sweetalert.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
    function cekPoin() {
        var phone = $('#phone').val();
        $.ajax({
            type: "GET",
            url: "<?php echo e(url('get-by-phone')); ?>?phone=" + phone,
            dataType: "json",
            success: function(response) {
                var title = "Data Kosong"
                var text = "No Hp Tidak ditemukan"
                var type = "warning"
                if (response.length == 1) {
                    title = 'Hello ' + response[0].nama+"!";
                    text = 'Poin anda sebanyak ' + response[0].poin;
                    type = 'success'
                }
                swal({
                    title: title,
                    text: text,
                    type: type,
                    showCancelButton: false,
                    confirmButtonColor: "#92BA92",
                    confirmButtonText: 'Kembali',
                    closeOnConfirm: false,
                });
            },
            error: function (request, status, error) {
                errorEmail();
            }
        });
    }

    function errorEmail() {
        swal({
            title: "Kesalahan",
            text: "Email member belum terverifikasi",
            type: "error",
            showCancelButton: true,
            confirmButtonColor: "#92BA92",
            confirmButtonText: "Kirim Ulang Verifikasi",
            cancelButtonText: "Kembali",
            closeOnConfirm: false,
            closeOnCancel: true
        },
        function(isConfirm){
            if (isConfirm) {
                resendEmail();
            }
        });
    }

    function resendEmail() {
        const phone = $('#phone');
        $.ajax({
            type: "POST",
            url: "<?php echo e(url('resendmail')); ?>",
            data: {
                '_token': '<?php echo e(csrf_token()); ?>',
                'phone': phone.val(),
            },
            success: function (response) {
                swal("Berhasil", "Email verfikasi berhasil dikirim, silahkan cek inbox email anda", "success");
            },
            error: function (data) {
                swal("Kesalahan", "Ops ada sesuatu yang salah!", "error");
            }
        });
    }
    
    <?php if(session('confirm')): ?>
        swal({
            title: 'Selamat',
            text: 'Email anda sudah terkonfirmasi!',
            type: 'success',
            showCancelButton: false,
            confirmButtonColor: "#92BA92",
            confirmButtonText: 'Ok',
            closeOnConfirm: false,
        });
    <?php endif; ?>
</script>

<?php /**PATH /home/coffeeto/public_html/member/resources/views/customer/cek-poin-pelanggan.blade.php ENDPATH**/ ?>