@extends('layouts/contentNavbarLayout')
@section('title', 'Change Password')
      
@section('content')
 
	@if(session()->get('success'))
		<div class="alert alert-success">
		  {{ session()->get('success') }}  
		</div>
	@endif
	
	@if(session()->get('error'))
		<div class="alert alert-danger">
		  {{ session()->get('error') }}  
		</div>
	@endif
	
	   @if ($errors->any())
    <div class="alert alert-danger">
        <!--<strong>Whoops!</strong> There were some problems with your input.<br><br>-->
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
	@endif
	 
    <div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
				<h5 class="card-title mb-0">Change Password</h5>
				</div>
   
                <div class="card-body">
                    <form class="needs-validation" novalidate method="POST" action="{{ route('updatepassword') }}" >
                        @csrf 
  
                        <div class="form-group row mb-3">
                            <label for="password" class="col-md-4 col-form-label text-md-right">Current Password</label>
  
                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control" name="current_password" autocomplete="current-password" required>
								<!--@error('password') <span class="text-danger alert-sm">{{ $message }}</span> @enderror-->
					      <div class="invalid-feedback">Password is required</div>
                            </div>
                        </div>
  
                        <div class="form-group row mb-3">
                            <label for="password" class="col-md-4 col-form-label text-md-right">New Password</label>
  
                            <div class="col-md-6">
                                <input id="new_password" type="password" class="form-control" name="new_password" autocomplete="current-password" required>
								<!--@error('new_password') <span class="text-danger alert-sm">{{ $message }}</span> @enderror-->
					      <div class="invalid-feedback">New password is required</div>
                            </div>
                        </div>
  
                        <div class="form-group row mb-3">
                            <label for="password" class="col-md-4 col-form-label text-md-right">Confirm New Password</label>
    
                            <div class="col-md-6">
                                <input id="new_confirm_password" type="password" class="form-control" name="new_confirm_password" autocomplete="current-password" required>
								<!--@error('new_confirm_password') <span class="text-danger alert-sm">{{ $message }}</span> @enderror-->
					      <div class="invalid-feedback">Confirm new password is required</div>
                            </div>
                        </div>
   
                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    Update Password
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
	
          	
@endsection
@section('page-script')
<script type="text/javascript">
(function () {
  'use strict';
  window.addEventListener('load', function () {
    // Fetch all the forms we want to apply custom Bootstrap validation styles to
    var forms = document.getElementsByClassName('needs-validation');
    // Loop over them and prevent submission
    var validation = Array.prototype.filter.call(forms, function (form) {
      form.addEventListener('submit', function (event) {
        if (form.checkValidity() === false) {
          event.preventDefault();
          event.stopPropagation();
        }
        form.classList.add('was-validated');
      }, false);
    });
  }, false);
})();
 
</script>
@endsection 