@extends('layouts.admin') @section('content')
<div class="row mb-3">
    <div class="col-10">
        <div class="card mb-3">
            <div class="card-header">
                <div class="row flex-between-end">
                    <div class="col-auto align-self-center">
                        <h5 class="mb-0" data-anchor="data-anchor">Profile Update</h5>
                    </div>
                </div>
            </div>
            <div class="card-body bg-light">
                <form class="form-material" method="POST" action="{{ url ('/personalinfo')}}/{{$user->id}}">
                    @csrf
                    @method('PUT')
                    @if(count($errors->all()))
                    @foreach ($errors->all() as $error)
                    <div class="alert alert-danger alert-dismissable"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <strong>Alert!</strong> {{ $error }} </div> @endforeach @endif
                    <div class="row">
                        <div class="col-sm-6">
                            <input type="text" required class="form-control" id="name" name="name" value="{{$user->name}}" placeholder="Name">
                        </div>
                        <div class="col-sm-6">
                            <input type="text" required class="form-control" id="surname" name="surname" value="{{$user->surname}}" placeholder="Surname">
                            <br>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-4">
                            <input type="number" required class="form-control" id="national_id" name="national_id" value="{{$user->national_id}}" placeholder="National ID">
                        </div>
                        <div class="col-sm-4">
                            <input type="date" required class="form-control" id="dob" name="dob" value="{{$user->dob}}"><br>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <select name="gender" class="form-control">
                                <option>{{$user->gender}}</option>
                                <option>Female</option>
                                <option>Male</option>
                            </select>
                        </div>
                        <div class="col-sm-6">
                            <input type="email" disabled required class="form-control" id="email" name="email" value="{{$user->email}}" placeholder="Email">
                            <br>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <input type="text" required class="form-control" id="cell" name="cell" value="{{$user->cell}}" placeholder="Cell Number">

                        </div>
                        <div class="col-sm-6">
                            <input type="text" required class="form-control" id="position" name="position" value="{{$user->position}}" placeholder="Position">
                            <br>
                        </div>
                    </div>

                    <div class="text-center">
                        <br><button type="submit" class="btn btn-primary btn-sm"><i class="far fa-edit"></i> Update Profile</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="col-10">
        <div class="card mb-3">
            <div class="card-header">
                <div class="row flex-between-end">
                    <div class="col-auto align-self-center">
                        <h5 class="mb-0" data-anchor="data-anchor">Password reset</h5>
                    </div>
                </div>
            </div>
            <div class="card-body bg-light">
                <form class="form-material" method="POST" action="{{ url ('/passwordreset')}}/{{$user->id}}">
                    @csrf
                    @method('PUT')
                    @if(count($errors->all()))
                    @foreach ($errors->all() as $error)
                    <div class="alert alert-danger alert-dismissable"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <strong>Alert!</strong> {{ $error }} </div> @endforeach @endif
                    <div class="row">
                        <div class="col-sm-6">
                            <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required placeholder="New passoword" autocomplete="new-password">
                            @error('password')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                            @enderror
                        </div>
                        <div class="col-sm-6">
                            <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required placeholder="Password confirmation" autocomplete="new-password">
                            <br>
                        </div>
                    </div>


                    <div class="text-center">
                        <br><button type="submit" class="btn btn-primary btn-sm"><i class="far fa-edit"></i> Change Password</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection