@extends('layouts.app')
@section('contentSection')
    <main class="site-main">
        <div class="columns container">
            <ol class="breadcrumb no-hide">
                <li><a href="/">Home </a></li>
                <li class="active">Login / Register</li>
            </ol>
        </div>
        <section class="mt-5 about">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <div class="section-title">
                            <h2>Login</h2>
                            <hr>
                        </div>
                        <form action="{{route('doLogin')}}" method="POST">
                            @csrf
                            <div class="form-group">
                                <label>Email *</label>
                                <input value="{{old('email')}}" type="email" class="form-control" name="email" maxlength="30" required/>
                            </div>

                            <div class="form-group">
                                <label>Password *</label>
                                <input value="{{old('password')}}" type="password" class="form-control" name="password" maxlength="20" required/>
                            </div>
                            <button type="submit" class="btn btn-primary">Login</button>
                            <a style="color:#666666;font-size: 14px;
    margin-left: 10px;" href="/forgot-password">Forgot Password?</a>
                        </form>
                    </div>
                    <div class="col-lg-6">
                        <div class="section-title">
                            <h2>Register</h2>
                            <hr>
                        </div>
                        <form action="{{route('doRegister')}}" method="POST">
                            @csrf
                            <div class="form-group">
                                <label>Full Name *</label>
                                <input class="form-control" type="text" name="name" maxlength="50" required/>
                            </div>
                            <div class="form-group">
                                <label>Email *</label>
                                <input class="form-control" type="email" name="email" maxlength="30" required/>
                            </div>
                            <div class="form-group">
                                <label>Password *</label>
                                <input class="form-control" type="password" name="password" minlength="6" maxlength="20"
                                       required/>
                            </div>
                            <div class="form-group">
                                <div class="g-recaptcha" data-sitekey="{{ env('RECAPTCHA_SITE_KEY') }}"></div>
                            </div>
                            <button class="btn btn-primary" type="submit" style="cursor: pointer">Register</button>
                            <br>
                            <br>
                        </form>
                    </div>
                </div>
            </div>
        </section>
    </main>
@endsection
@section('pageSpecificScripts')
    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
    <script src="{{ asset('assets/js/sweetalert2.all.js') }}"></script>
    @if (Session::has('success'))
        <script type="text/javascript">
            Swal.fire({
                icon: 'success',
                text: "{{Session::get('success')}}",
            });
        </script>
    @endif
    @if (Session::has('errors'))
        <script type="text/javascript">
            Swal.fire({
                icon: 'error',
                html: "<ul style='list-style: none'>@foreach(Session::get('errors') as $error) <li>{{$error}}</li> @endforeach</ul>",
            });
        </script>
    @endif
    @if (Session::has('rsuccess'))
        <script type="text/javascript">
            Swal.fire({
                icon: 'success',
                text: "{{Session::get('rsuccess')}}",
            });
        </script>
    @endif
    @if (Session::has('rerrors'))
        <script type="text/javascript">
            Swal.fire({
                icon: 'error',
                html: "<ul style='list-style: none'>@foreach(Session::get('rerrors') as $error) <li>{{$error}}</li> @endforeach</ul>",
            });
        </script>
    @endif
@endsection
