@extends('layouts.app')

@section('content')

<div class="container-fluid">
  <div class="row">
    <div class="col-xl-10 offset-xl-1">
        <div class="row mx-0">
          <div class="shadow p-lg-5 p-4 border-rounded col-lg-6 offset-lg-3 col-md-8 offset-md-2 my-xl-5 my-4">
            <div id="loginComponent">
                <h4 class="header mb-4 text-center w-100">Welcome! Log In</h4>
                <div>
                    <div class="text-center">

                    </div>
                    <div class="social-login">
                      <a href="{{route('log-in-with-google')}}" class="btn btn-outline-social w-100 border btn-rounded">Continue with Google <img class="ms-2" src="{{asset('img/google.svg')}}" alt=""></a>
                      <a href="{{route('log-in-with-facebook')}}" class="btn btn-outline-social w-100 border btn-rounded">Continue with Facebook <img class="ms-2" src="{{asset('img/facebook.svg')}}" alt=""></a>
                    </div>
                    <div class="auth-divider">
                        <span class="text-muted text-nowrap">or continue below</span>
                    </div>
                    <form  action="{{route('process-log-in')}}" method="post">
                        @csrf
                        <div class="mt-3">
                            <label for="" class="form-label">Email <span class="text-danger">*</span></label>
                            <input type="email" class="form-control" required name="email" value="{{old('email')}}">
                        </div>
                        <div class="mt-3">
                            <div class="d-flex align-items-start justify-content-between">
                              <label for="" class="form-label">Password <span class="text-danger">*</span></label>
                              <a href="{{route('forgot-password')}}">Forgot password?</a>
                            </div>
                            <div class="password d-flex align-items-center">
                              <input :type="showPassword ? 'text' : 'password'" required class="border-0" name="password">
                              <a href="javascript:;" @click="toggleField" class="d-block text-pry me-2"><i :class="showPassword ? 'far fa-eye' : 'far fa-eye-slash'"></i></a>
                            </div>
                        </div>
                        @if(session('message'))
                        <div class="alert alert-info mt-3 py-1 px-2">{{session('message')}}</div>
                        @endif
                        @if(session('success'))
                          <div class="alert alert-success mt-3 py-1 px-2">{{ session('success') }}</div>
                        @endif
                        @if(session('error'))
                          <div class="alert alert-danger mt-3 py-1 px-2">{{ session('error') }}</div>
                        @endif
                        <div class="mt-4 d-flex align-items-baseline justify-content-around">
                            <button class="btn btn-pry py-3 w-100">Log In</button>
                        </div>
                    </form>
                </div>
            </div>
          </div>
        </div>
      </div>
  </div>
</div>

<script type="text/javascript">
  var loginComponent = new Vue({
    el: '#loginComponent',
    data: {
      showPassword: false
    },
    methods: {
      toggleField: function() {
        var self = this;
        self.showPassword = !self.showPassword;
      }
    }
  });
</script>

@endsection
