@extends('layouts.app')

@section('content')
<div class="row mx-0" id="resetComponent">
    <div class="col-lg-4 offset-lg-4 col-md-6 offset-md-3 p-4 bg-white my-5 shadow p-lg-5">
        @if(session('success'))
          <div class="alert alert-success">{{ session('success') }}</div>
        @endif
        @if(session('error'))
          <div class="alert alert-danger">{{ session('error') }}</div>
        @endif

        <div class="text-center">
            <h5 class="header w-100 mt-2 mb-4">Reset password</h5>
        </div>

        <form action="{{route('process-reset-password')}}" method="post">
            @csrf
            <input type="hidden" name="passwordResetToken" value="{{$passwordResetToken}}">
            <div class="mt-3">
                <label for="" class="form-label">New Password <span class="text-danger">*</span></label>
                <div class="password d-flex align-items-center">
                  <input :type="showPassword ? 'text' : 'password'" required class="border-0" name="newPassword">
                  <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>

            <div class="mt-3">
                <label for="" class="form-label">Confirm Password <span class="text-danger">*</span></label>
                <input type="password" class="form-control" name="newPasswordConfirmation" required>
            </div>

            <div class="mt-4 d-flex align-items-baseline justify-content-around">
                <button class="btn btn-pry py-3 w-100">Reset Password</button>
            </div>
        </form>
        <p class="mt-4 text-center">Back to <a href="{{route('log-in')}}">Login</a></p>
    </div>
</div>
<script type="text/javascript">
  var resetComponent = new Vue({
    el: '#resetComponent',
    data: {
      showPassword: false
    },
    methods: {
      toggleField: function() {
        var self = this;
        self.showPassword = !self.showPassword;
      }
    }
  });
</script>

@endsection