@extends('layouts.frontend.app')

@section('title', 'Shopping Now')

@section('content')
    @php
        Session::forget('link');
        if(route('home').'/register'==url()->previous()){
            Session::put(['link' => route('home')]);
        }elseif(route('home').'/join'==url()->previous()){
            Session::put(['link' => route('home')]);
        }elseif(route('home').'/login'==url()->previous()){
            Session::put(['link' => route('home')]);
        }elseif(route('home').'/seller'==url()->previous()){
            Session::put(['link' => route('home')]);
        }
        elseif(route('home').'/password/reset'==url()->previous()){
            Session::put(['link' => route('home')]);
        }
        else{
            Session::put(['link' => url()->previous()]);
        }
    @endphp
    <div class="container">
        <div class="row">
            <div class="col-md-4 offset-md-4 bg-white rounded-3 mt-5 py-4 px-3">
                @if(session('error'))
                    <div class="alert alert-danger">
                        {{ session('error') }}
                    </div>
                @endif
                
                {{-- @include('auth.login_part.logo') --}}
                <h4 class="pb-3" style="color:#002f5f;"><b>Sign in</b></h4>

                @if(setting('user_login_with') == 1)
                    @include('auth.login_part.login_with_otp')
                @elseif(setting('user_login_with') == 2)
                    @include('auth.login_part.login_with_pass_otp')
                @else
                    @include('auth.login_part.login_with_pass')
                @endif
            </div>
        
            <div class="col-md-4 offset-md-4 mb-5">
                <br>
                @include('auth.login_part.login_with_google')
                <br>
                @include('auth.login_part.forgot_pass')
                <span style="display: block;text-align: center;">Create a new Account <a href="{{route('register')}}" style="color:blue">Sign Up</a></span>
            </div>
        </div>

    </div>

    @push('js')
    <script>
        $(document).ready(function () {
            var showPassIcon = $('#show_pass');
            var passwordInput = $('#password');
            var confirmPasswordInput = $('#confirm-password');

            showPassIcon.on('click', function () {
                if (passwordInput.attr('type') === 'password') {
                    passwordInput.attr('type', 'text');
                    confirmPasswordInput.attr('type', 'text');
                    showPassIcon.removeClass('fa-eye').addClass('fa-eye-slash');
                } else {
                    passwordInput.attr('type', 'password');
                    confirmPasswordInput.attr('type', 'password');
                    showPassIcon.removeClass('fa-eye-slash').addClass('fa-eye');
                }
            });
        });
    </script>
    @endpush
    @push('css')
        <style>
            form .form2 {
                box-shadow: 0px 0px 5px gainsboro;
                padding: 20px;
                border-radius: 5px;
                margin-top: 50px;
                background: white
            }
            #show_pass {
                cursor: pointer;
            }
        </style>
    @endpush
    @include('auth.partial.demo_auth_credintial_inject')
@endsection