@extends('Dashboard.master_page')



@section('content')
    <div class="bg-image" style="background-image: url('assets/media/photos/photo10@2x.jpg');">
        <div class="bg-primary-dark-op">
            <div class="content content-full text-center">
                <div class="my-3">
                    <img class="img-avatar img-avatar-thumb" src="assets/media/avatars/avatar13.jpg" alt="">
                </div>
                <h1 class="h2 text-white mb-0">Edit Account</h1>
                <h2 class="h4 fw-normal text-white-75">
                    {{ Auth::user()->name }} {{ Auth::user()->lastname }}
                </h2>
            </div>
        </div>
    </div>



    <div class="content content-boxed">
        <div class="block block-rounded">
            <div class="block-header block-header-default">

                <h3 class="block-title">Profile</h3>


            </div>

            @if (Session::has('error_message'))
                <div class="alert alert-danger d-flex align-items-center justify-content-between" role="alert">
                    <div class="flex-grow-1 me-3">
                        <p class="mb-0">
                            {{ Session::get('error_message') }}
                        </p>
                    </div>

                </div>
            @endif

            @if (Session::has('success_message'))
                <div class="alert alert-success d-flex align-items-center justify-content-between" role="alert">
                    <div class="flex-grow-1 me-3">
                        <p class="mb-0">
                            {{ Session::get('success_message') }}
                        </p>
                    </div>

                </div>
            @endif

            <div class="block-content block-content-full">
                <form action="{{ route('UserProfileUpdate') }}" method="POST">
                    @csrf
                    <div class="row">
                        <div class="col-lg-4">
                            <p class="fs-sm text-muted">

                            </p>
                        </div>
                        <div class="col-lg-12 col-xl-5">
                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" id="example-text-input-readonly-floating"
                                    name="name" placeholder="Name"
                                    value="{{ Auth::user()->name }}" readonly="" disabled>
                                <label for="example-text-input-readonly-floating">First Name</label>

                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" id="example-text-input-readonly-floating"
                                    name="lastname" placeholder="Name"
                                    value="{{ Auth::user()->lastname }}" readonly="" disabled>
                                <label for="example-text-input-readonly-floating">Last Name</label>

                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" id="example-text-input-readonly-floating"
                                    name="email" placeholder="Email"
                                    value="{{ Auth::user()->email }}" readonly="" disabled>
                                <label for="example-text-input-readonly-floating">Email</label>

                            </div>

                            <div class="form-floating mb-4">
                                <select class="form-select" id="example-select-floating" name="country"
                                    aria-label="Floating label select example">
                                    <option selected="">Select an option</option>
                                    @foreach ($countries as $key => $country)
                                        <option value="{{ $key }}"
                                            @if ($key == Auth::user()->country) selected @endif>
                                            {{ $country }}</option>
                                    @endforeach
                                </select>
                                <label for="example-select-floating">Country</label>
                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" value="{{ Auth::user()->address }}"
                                    name="address" placeholder="Address">
                                <label for="example-password-input-floating">Address</label>
                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" value="{{ Auth::user()->city }}"
                                    name="city" placeholder="City">
                                <label for="example-password-input-floating">City</label>
                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" value="{{ Auth::user()->state }}"
                                    name="state" placeholder="State">
                                <label for="example-password-input-floating">State</label>
                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" value="{{ Auth::user()->post_code }}"
                                    name="post_code" placeholder="Post Code">
                                <label for="example-password-input-floating">Post Code</label>
                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" value="{{ Auth::user()->phone_number }}"
                                    name="phone_number" placeholder="Phone Number">
                                <label for="example-password-input-floating">Phone Number</label>
                            </div>

                            <div class="form-floating mb-4">
                                <input type="text" class="form-control" value="{{ Auth::user()->company }}"
                                    name="company" placeholder="Company">
                                <label for="example-password-input-floating">Company</label>
                            </div>
                            <button type="submit" class="btn btn-alt-primary">Update</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div class="block block-rounded">
            <div class="block-header block-header-default">
                <h3 class="block-title">Change Password</h3>
            </div>
            <div class="block-content">
                <form action="{{ route('ChangePasswordSave') }}" method="POST">
                    @csrf
                    <div class="row push">
                        <div class="col-lg-4">
                            <p class="fs-sm text-muted">
                                Changing your sign in password is an easy way to keep your account secure.
                            </p>
                        </div>
                        <div class="col-lg-8 col-xl-5">
                            <div class="mb-4">
                                <label class="form-label" for="one-profile-edit-password">Current Password</label>
                                <input type="password"
                                    class="form-control @error('current_password') is-invalid @enderror"
                                    name="current_password">
                                @error('current_password')
                                    <div class="invalid-feedback animated fadeIn">{{ $message }}</div>
                                @enderror

                            </div>
                            <div class="row mb-4">
                                <div class="col-12">
                                    <label class="form-label" for="one-profile-edit-password-new">New Password</label>
                                    <input type="password" class="form-control  @error('password') is-invalid @enderror"
                                        id="one-profile-edit-password-new" name="password">
                                    @error('password')
                                        <div class="invalid-feedback animated fadeIn">{{ $message }}</div>
                                    @enderror
                                </div>
                            </div>
                            <div class="row mb-4">
                                <div class="col-12">
                                    <label class="form-label" for="one-profile-edit-password-new-confirm">Confirm New
                                        Password</label>
                                    <input type="password" class="form-control @error('confirm') is-invalid @enderror"
                                        id="one-profile-edit-password-new-confirm" name="confirm">
                                    @error('confirm')
                                        <div class="invalid-feedback animated fadeIn">{{ $message }}</div>
                                    @enderror
                                </div>
                            </div>
                            <div class="mb-4">
                                <button type="submit" class="btn btn-alt-primary">
                                    Update
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>


        <div class="block block-rounded">
            <div class="block-header block-header-default">
                <h3 class="block-title">Two Factor Authentication</h3>
            </div>
            <div class="block-content">
                <div class="row push">
                    <div class="col-lg-4">
                        <p class="fs-sm text-muted">
                            Add an extra layer of security to your myLEAP account for FREE.
                        </p>
                    </div>
                    <div class="col-lg-8 col-xl-7">
                        <div class="row mb-4">
                            <div class="col-sm-10 col-md-8 col-xl-6">
                                {{-- <form method="post" action="{{ route('GoogleFactorUpdate') }}">
                                    @csrf
                                    <input type="hidden" name="email"
                                        value="{{ \Illuminate\Support\Facades\Auth::user()->email }}">
                                    <button type="submit" class="btn w-100 btn-alt-danger text-start">
                                        <i class="fa-solid fa-shield opacity-50 me-1"></i>2FA Configure
                                    </button>
                                </form> --}}

                                <a href="{{route('profile.google2fa.page')}}" class="btn w-100 btn-alt-danger text-start">
                                    <i class="fa-solid fa-shield opacity-50 me-1"></i>2FA Configure
                                </a>
                            </div>

                        </div>


                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
