<!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="{{asset('picture/favicon.png')}}" type="image/x-icon">
    <link rel="icon" href="{{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="{{ asset('') }}css/custom.css" />
    <link rel="stylesheet" href="{{ asset('') }}vendor/sweetalert-master/dist/sweetalert.css" />
    <title>Tambah Member</title>
    <style>
        .invalid-feedback {
            display: block;
        }
        label{
            color : var(--colorGreen);
        }
    </style>
</head>

<body>
    <div class="container custom">
        <div class="row justify-content-center align-items-center">
            <div class="col-md-12">
                <img src="{{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 method="post" action="{{ url('store-new-member').'?url='.$selectedCategory->url }}" id="cek-poin">
                        @csrf
                        <h3 class="color-green font-weight-bold">Hi! Yuk, Join {{ $pageTitle }}
                            <br>
                            di Coffee Toffee
                        </h3>
                        <p style="font-size:14px">Dapatkan berbagai benefit promo menarik yang bisa kamu nikmati. Yuk! Lengkapi data dibawah ini dan jadilah bagian dari Coffee Toffee</p>
                        <br>
                        <label for="">Nama Lengkap</label>
                        <div class="input">
                            <span class="fa fa-user mr-2"></span>
                            <input type="text" class="form-control @error('nama') is-invalid @enderror" id="nama"
                                name="nama" value="{{ old('nama') }}" placeholder="Nama Lengkap">
                        </div>
                        @error('nama')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                        <br>
                        <label for="">Email</label>
                        <div class="input">
                            <span class="fa fa-envelope mr-2"></span>
                            <input type="email" class="form-control @error('email') is-invalid @enderror"
                                id="email" name="email" value="{{ old('email') }}" placeholder="Email">
                        </div>
                        @error('email')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                        <br>
                        <label for="">No Telepon</label>
                        <div class="input">
                            <span class="fa fa-phone mr-2"></span>
                            <input type="number" class="form-control @error('phone') is-invalid @enderror"
                                id="phone" name="phone" value="{{ old('phone') }}"
                                placeholder="No Telepon">
                        </div>
                        @error('phone')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                        <br>
                        <label for="">Tanggal Lahir</label>
                        <div class="input">
                            <span class="fa fa-calendar mr-2"></span>
                            <input type="date" class="form-control @error('tgl_lahir') is-invalid @enderror"
                                id="tgl_lahir" name="tgl_lahir" value="{{ old('tgl_lahir') }}"
                                placeholder="No Telepon">
                        </div>
                        @error('tgl_lahir')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                        <br>
                        <label for="">Gerai</label>
                        <div class="input">
                            <span class="fa fa-store mr-2"></span>
                            <select class="form-control @error('id_branch') is-invalid @enderror" name="id_branch">
                                <option value=''>---Pilih Gerai---</option>
                                @foreach($branch as $item)
                                    <option value='{{$item->id}}' {{old('id_branch') == $item->id ? 'selected' : ''}}>{{$item->cabang}}</option>
                                @endforeach
                            </select>
                        </div>
                        @error('id_branch')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                        <br>
                        <label for="">Kategori Member</label>
                        <div class="input">
                            <span class="fa fa-users mr-2"></span>
                            <select class="form-control @error('category_id') is-invalid @enderror" name="category_id">
                                <option value='{{$selectedCategory->id}}'>
                                    {{$selectedCategory->category}}
                                </option>
                            </select>
                        </div>
                        @error('category_id')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                        <br>
                        <button class="btn btn-primary px-4"><span class="fas fa-save"></span> Simpan</button>
                        <a class="btn btn-green px-4" href="{{url('cek-poin-pelanggan')}}"><span class='fa fa-search'></span> Cek Point</a>
                    </form>
                        </div>
                        <div class="col-md-6 d-none d-md-block">
                            <img src="{{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="{{ 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>
@if (session('status'))
<script>
    swal({
        title: 'Selamat',
        text: 'Data berhasil disimpan. Periksa email member',
        type: 'success',
        showCancelButton: false,
        confirmButtonColor: "#92BA92",
        confirmButtonText: 'Kembali',
        closeOnConfirm: false,
    });
</script>
@endif

@if(session('confirm'))
<script>
    swal({
        title: 'Selamat',
        text: 'Email anda sudah terkonfirmasi!',
        type: 'success',
        showCancelButton: false,
        confirmButtonColor: "#92BA92",
        confirmButtonText: 'Ok',
        closeOnConfirm: false,
    });
</script>
@endif

@if(session('confirm'))
<script>
    swal({
        title: 'Selamat',
        text: 'Email anda sudah terkonfirmasi!',
        type: 'success',
        showCancelButton: false,
        confirmButtonColor: "#92BA92",
        confirmButtonText: 'Ok',
        closeOnConfirm: false,
    });
</script>
@endif

@if(session('confirm-error'))
<script>
    swal({
        title: 'Kesalahan',
        text: 'Konfirmasi email salah',
        type: 'error',
        showCancelButton: false,
        confirmButtonColor: "#92BA92",
        confirmButtonText: 'Kembali',
        closeOnConfirm: false,
    });
</script>
@endif