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

<!--=====================================
                    USER FORM PART START
        =======================================-->
        <section class="user-form-part login">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-sm-10 col-md-12 col-lg-12 col-xl-5">
                        <!--
						<div class="user-form-logo">
                            <a href="index.html"><img src="images/logo.png" alt="logo"></a>
                        </div>
						-->
                        <div class="user-form-card">
                            <div class="user-form-title">
                                <h2>로그인</h2>
                                <p>가입하신 정보로 로그인해 주세요.</p>
                            </div>

                            @php
                                if ($member = unserialize(Cookie::get('dabory_member_info'))) {
                                  $email = $member['Email'];
                                  $password  = $member['Password'];
                                  $isRemember = "checked='checked'";
                                }
                                else {
                                  $email = '';
                                  $password = '';
                                  $isRemember = '';
                                }
                            @endphp

                            <div class="user-form-group">
                                <form class="user-form form-prevent-multiple-submits" method="POST" action="{{ route('member-login.store') }}">
                                    @csrf
                                    <input type="hidden" name="previous_url" value="{{ session('url.intended') }}">
                                    <div class="form-group">
                                        @empty(request('email'))
                                            <input type="email" name="email" id="email-txt" class="form-control" value="{{ $develLoginInfo['MemberEmail'] ?? $email }}" placeholder="이메일을 입력해 주세요.">
                                        @else
                                            <input type="email" name="email" id="email-txt" class="form-control" value="{{ request('email') }}" placeholder="이메일을 입력해 주세요.">
                                        @endempty
                                        @error('email')
                                            <div>
                                                <span class="text-danger">{{ $message }}</span>
                                            </div>
                                        @enderror
                                    </div>
                                    <div class="form-group">
                                        @empty(request('email'))
                                            <input type="password" class="form-control" id="password-txt" name="password" value="{{ $develLoginInfo['MemberPasswd'] ?? '' }}" placeholder="비밀번호를 입력해 주세요.">
                                        @else
                                            <input type="password" class="form-control" id="password-txt" name="password" placeholder="비밀번호를 입력해 주세요.">
                                        @endempty
                                        @error('password')
                                            <div>
                                                <span class="text-danger">{{ $message }}</span>
                                            </div>
                                        @enderror
                                    </div>
                                    <div class="form-check mb-3">
                                        <input class="form-check-input" type="checkbox" name="remember" value="1" id="check" {{ $isRemember }}>
                                        <label class="form-check-label" for="check">아이디 기억</label>
                                    </div>
									<div class="page_link">
										<a href="{{ route('find-member-id-verify.index') }}">아이디 찾기</a>
										<a href="{{ route('find-member-pw-memcheck.index') }}">비밀번호 찾기</a>
										<a href="{{ route('member-signup-verify.index') }}">회원가입</a>
									</div>
                                    <div class="form-button">
                                        <button type="submit" class="button-prevent-multiple-submits">
                                            <i class="spinner fa fa-spinner fa-spin"></i>
                                            로그인
                                        </button>

                                        <div class="form-button">
                                            @foreach ($oauth2InfoList as $provider => $oauth2)
                                                <button type="button" class="login_naver w-100 mt-2 bg-white text-dark sso-login-btn"
                                                        onclick="window.location.href = '{{ route('social.redirectToProvider', [ 'oauth2Info' => $oauth2, 'provider' => $provider, 'target' => 'member' ]) }}'">
                                                    <img src="{{ asset('themes/pro/point2u/resources/images/login_' . $provider . '.svg') }}">
                                                    {{ $oauth2['LoginButtonString'] }}
                                                </button>
                                            @endforeach
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <!--
						<div class="user-form-footer">
                            <p>Greeny | &COPY; Copyright by <a href="#">Mironcoder</a></p>
                        </div>
						-->
                    </div>
                </div>
            </div>
        </section>
        <!--=====================================
                    USER FORM PART END
        =======================================-->
@endsection
