@extends('layouts.app')

@section('content')

<div class="container">
    <div class="row">
       
        <div class="col-md-12 col-lg-12 col-sm-12">
            <h2 class="mt-4 text-center" style="color: red;"><b>Account Information</b></h2>
            @if (session('success'))
                <div class="alert alert-success">
                    {!! session('success') !!}
                </div>
            @endif
            <form method="post" action="{{route('account-update')}}">
                @csrf
                <div class="form-group mt-5">
                    <label for="exampleInputEmail1">Name:</label>
                    <input name="name" type="text" class="form-control @error('name') is-invalid @enderror" id="exampleInputEmail1" aria-describedby="emailHelp" value="{{ Auth::user()->name}}">
                    @error('name')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">Email:</label>
                    <input name="email" type="email" class="form-control @error('email') is-invalid @enderror" id="exampleInputPassword1" value="{{ Auth::user()->email}}">
                    @error('email')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
                
                <button type="submit" class="btn btn-success btn-block">Update Information</button>

                <hr>
            </form>

            <form method="post" action="{{route('password-update')}}">
            @csrf
                <div class="form-group mt-5">
                    <label for="exampleInputEmail1">Old Password:</label>
                    <input type="password" class="form-control @error('old_password') is-invalid @enderror" id="exampleInputEmail1" name="old_password" aria-describedby="emailHelp" >
                    @error('old_password')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">New Password:</label>
                    <input type="text" class="form-control  @error('password') is-invalid @enderror" id="exampleInputPassword1" name="password">
                    @error('password')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">Confirm Password:</label>
                    <input type="text" class="form-control @error('password_confirmation') is-invalid @enderror" id="exampleInputPassword1" name="password_confirmation">
                    @error('password_confirmation')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
                <button type="submit" class="btn btn-success btn-block mb-5">Update Password</button>
               
            </form>
        </div>
    </div>
</div>



@endsection