@extends('layouts.front.masterapp')

@section('content')
<div class="content-wrapper container"> 
    <div class="page-heading">        
    <div class="page-title">
            <div class="row">
                <div class="col-12 col-md-6 order-md-1 order-last">
                    <h3>Ubah Password</h3>
                   
                </div>
                <div class="col-12 col-md-6 order-md-2 order-first">
                    <nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
                        <ol class="breadcrumb">
                          
                            <li class="breadcrumb-item active" aria-current="page">Ubah Password</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>                   
                  
        <!-- // Basic multiple Column Form section start -->
    <section id="multiple-column-form">
        <div class="row match-height"> 
                   
                        <form action="{{route('changePasswordPost')}}" method="post" class="needs-validation" novalidate enctype="multipart/form-data">
                                @csrf         
                                
                                    <div class="col-md-12">
                                        <div class="main-card mb-3  card">
                                            <div class="card-body">
                                           
                                                <div class="row">
                                                @if (session('error'))
                                                    <div class="alert alert-danger">
                                                        {{ session('error') }}
                                                    </div>
                                                @endif
                                                @if (session('success'))
                                                    <div class="alert alert-success">
                                                        {{ session('success') }}
                                                    </div>
                                                @endif
                                                @if($errors)
                                                    @foreach ($errors->all() as $error)
                                                        <div class="alert alert-danger">{{ $error }}</div>
                                                    @endforeach
                                                @endif
                              
                                                    
                                                    <div class="col-md-12 col-12">
                                                        <div class="form-group">
                                                            <label for="first-name-column">Email</label>
                                                            <input type="text" class="form-control"
                                                               value="{{Auth::user()->email}}" readonly>
                                                        </div>
                                                       
                                                    </div>
                                                    <div class="col-md-4">
                                                        <div class="form-group mt-3">
                                                            <label for="current_password">Password Lama</label>
                                                            <input type="password" name="current_password" class="form-control @error('current_password') is-invalid @enderror" required
                                                                placeholder="Password Lama">
                                                            @error('current_password')
                                                                <span class="invalid-feedback" role="alert">
                                                                    <strong>{{ $message }}</strong>
                                                                </span>
                                                        
                                                            @enderror
                                                        </div>
                                                    </div>
                                                    <div class="col-md-4">
                                                        <div class="form-group mt-3">
                                                            <label for="new_password ">Password Baru</label>
                                                            <input type="password" name="password" class="form-control @error('password') is-invalid @enderror" required
                                                                placeholder="Password Baru">
                                                            @error('password')
                                                                <span class="invalid-feedback" role="alert">
                                                                    <strong>{{ $message }}</strong>
                                                                </span>
                                                        
                                                            @enderror
                                                        </div>
                                                    </div>
                                                    <div class="col-md-4">
                                                        <div class="form-group mt-3">
                                                            <label for="confirm_password">Ulangi Password Baru</label>
                                                            <input type="password" name="confirm_password" class="form-control @error('confirm_password') is-invalid @enderror"required placeholder="Ulangi Password Baru">
                                                            @error('confirm_password')
                                                                <span class="invalid-feedback" role="alert">
                                                                    <strong>{{ $message }}</strong>
                                                                </span>
                                                        
                                                            @enderror
                                                        </div>
                                                    </div>
                                                    <div class="d-flex justify-content-first mt-4 ml-2">
                                                        <button type="submit" class="btn btn-primary"
                                                            id="formSubmit">Submit</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                      
                            </form>
            
        </div>
    </section>
    
   
    </div>
</div>

@endsection
