@extends('views.layouts.master')
<link rel="stylesheet" href="{{ csset('/themes/kbgolf/pro/resources/css/user-auth.css') }}">
@section('content')

<!--=====================================
                    USER FORM PART START
        =======================================-->
        <section class="user-form-part">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-sm-10 col-md-9 col-lg-6 col-xl-5">
                        <!--
						<div class="user-form-logo">
                            <a href="index.html"><img src="images/logo.png" alt="logo"></a>
                        </div>
						-->
                        <form class="user-form-card" id="withdrawal-form" action="{{ route('member-withdrawal.store') }}" method="POST">
                            @csrf
                            <div class="user-form-title">
								<img src="{{ asset('/themes/kbgolf/pro/resources/images/pass_img1.png') }}">
								<h2>회원 탈퇴</h2>

                                <p>
									탈퇴하시기 전, 꼭 확인해주세요!
								</p>

								<p>
									<strong class="txt_caution">
                                        - 탈퇴하시기 전 남은 포인트에 대해서 환불 요청 하시기 바랍니다.
                                        <br/>
                                        - 환불 받으신 후 탈퇴하시기 바랍니다.
                                        <br/>
                                        - 탈퇴 후 환불요청 시 포인트 환불은 불가합니다.
                                    </strong>
								</p>

                            </div>

                            <div class="form-group mb-2">
                                <input type="password" name="password" class="form-control certi-txt rounded-right-0"
                                       placeholder="현재 비밀번호를 입력해주세요" required>

                                @error('password')
                                    <span class="text-danger"><i class="icon-cancel-circle2 mr-2"></i>{{ $message }}</span>
                                @enderror
                            </div>

                            <div class="form-check all_agree mb-4">
                                <input class="form-check-input" type="checkbox" id="verifiy-ck">
                                <label class="form-check-label" for="verifiy-ck">안내사항은 모두 확인하였으며, 이에 동의합니다.</label>
                            </div>

							<div class="text-center">
								<button type="submit" class="btn btn_prime btn_round button-prevent-multiple-submits">
                                    <i class="spinner fa fa-spinner fa-spin"></i>
                                    탈퇴하기
                                </button>
							</div>
                        </form>

                    </div>
                </div>
            </div>
        </section>
        <!--=====================================
                    USER FORM PART END
        =======================================-->

@endsection

@push('js')
    <script>
        $('#withdrawal-form').on('submit', function (event) {
            event.preventDefault()

            if (! $('#verifiy-ck').is(':checked')) {
                iziToast.info({ title: 'Info', message: "@lang('이용약관에 동의하셔야 합니다')" });
                return false
            }

            const form = this

            iziToast.question({
                timeout: 20000,
                close: false,
                overlay: true,
                displayMode: 'once',
                id: 'question',
                title: $('#comfirm-delete').text(),
                message: $('#can-not-recover-after-delete').text(),
                position: 'center',
                buttons: [
                    [`<button><b>${$('#delete').text()}</b></button>`, async function (instance, toast) {
                        instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
                        click_submit_btn(form)
                        form.submit()

                    }, true],
                    [`<button>${$('#cancel').text()}</button>`, function (instance, toast) {
                        instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
                    }],
                ],
            });
        });
    </script>
@endpush
