@extends('employee.layouts.app')
@section('title', 'Pengaturan | Career Development and Consultation (CDC)')
@section('navigation')
    <h1 class="my-1 d-flex align-items-center text-dark fw-bolder fs-3">Profil
        <span class="mx-2 border-gray-200 h-20px border-start ms-3"></span>
        <small class="my-1 text-muted fs-7 fw-bold ms-1">Pengaturan</small>
    </h1>
@endsection
@section('content')
    @once
        @if (session()->has('success'))
            <div class="p-6 mb-12 border border-dashed rounded notice d-flex bg-light-success border-success">
                <span class="svg-icon svg-icon-2tx svg-icon-success me-4">
                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
                        <rect opacity="0.3" x="2" y="2" width="20" height="20" rx="10" fill="black" />
                        <rect x="11" y="14" width="7" height="2" rx="1" transform="rotate(-90 11 14)"
                            fill="black" />
                        <rect x="11" y="17" width="2" height="2" rx="1" transform="rotate(-90 11 17)"
                            fill="black" />
                    </svg>
                </span>
                <div class="d-flex flex-stack flex-grow-1">
                    <div class="fw-bold">
                        <div class="text-gray-700 fs-6">{{ session()->get('success') }}</div>
                    </div>
                </div>
            </div>
        @endif
    @endonce
    <div class="mb-5 card mb-xl-10">
        <div class="border-0 cursor-pointer card-header">
            <div class="m-0 card-title">
                <h3 class="m-0 fw-bolder">Ubah Email</h3>
            </div>
        </div>
        <div>
            <div class="card-body border-top p-9">
                <div class="flex-wrap d-flex align-items-center">
                    <div class="flex-row-fluid">
                        <form action="{{ route('employee.profile.email.update') }}" method="POST" class="form">
                            @csrf
                            @method('patch')
                            <div class="mb-6 row">
                                <div class="mb-4 col-lg-6 mb-lg-0">
                                    <div class="mb-0 fv-row">
                                        <label for="emailaddress" class="mb-3 form-label fs-6 fw-bolder">Email
                                            Baru</label>
                                        <input type="email" class="form-control form-control-lg form-control-solid"
                                            id="emailaddress" placeholder="Email" name="email"
                                            value="{{ $user->email }}" />
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="mb-0 fv-row">
                                        <label for="password" class="mb-3 form-label fs-6 fw-bolder">Konfirmasi
                                            Password</label>
                                        <input type="password" class="form-control form-control-lg form-control-solid"
                                            name="confirmation_password" id="password" />
                                    </div>
                                    @error('confirmation_password')
                                        <div class="fv-plugins-message-container invalid-feedback">
                                            <span>{{ $message }}</span>
                                        </div>
                                    @enderror
                                </div>
                            </div>
                            <div class="d-flex">
                                <button type="submit" class="px-6 btn btn-primary me-2">Perbarui Email</button>
                                <button type="reset"
                                    class="px-6 btn btn-color-gray-400 btn-active-light-primary">Reset</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="mb-5 card mb-xl-10">
        <div class="border-0 cursor-pointer card-header">
            <div class="m-0 card-title">
                <h3 class="m-0 fw-bolder">Ubah Password</h3>
            </div>
        </div>
        <div>
            <div class="card-body border-top p-9">
                <div class="flex-wrap mb-10 d-flex align-items-center">
                    <div class="flex-row-fluid">
                        <form action="{{ route('employee.profile.password.update') }}" method="POST" class="form">
                            @csrf
                            @method('put')
                            <div class="mb-1 row">
                                <div class="col-lg-4">
                                    <div class="mb-0 fv-row">
                                        <label for="currentpassword" class="mb-3 form-label fs-6 fw-bolder">Password
                                            Saat Ini</label>
                                        <input type="password" class="form-control form-control-lg form-control-solid"
                                            name="current_password" id="currentpassword" />
                                    </div>
                                    @error('current_password')
                                        <div class="fv-plugins-message-container invalid-feedback">
                                            <span>{{ $message }}</span>
                                        </div>
                                    @enderror
                                </div>
                                <div class="col-lg-4">
                                    <div class="mb-0 fv-row">
                                        <label for="newpassword" class="mb-3 form-label fs-6 fw-bolder">Password
                                            Baru</label>
                                        <input type="password" class="form-control form-control-lg form-control-solid"
                                            name="password" id="newpassword" />
                                    </div>
                                    @error('password')
                                        <div class="fv-plugins-message-container invalid-feedback">
                                            <span>{{ $message }}</span>
                                        </div>
                                    @enderror
                                </div>
                                <div class="col-lg-4">
                                    <div class="mb-0 fv-row">
                                        <label for="confirmpassword" class="mb-3 form-label fs-6 fw-bolder">Konfirmasi
                                            Password Baru</label>
                                        <input type="password" class="form-control form-control-lg form-control-solid"
                                            name="password_confirmation" id="confirmpassword" />
                                    </div>
                                    @error('password_confirmation')
                                        <div class="fv-plugins-message-container invalid-feedback">
                                            <span>{{ $message }}</span>
                                        </div>
                                    @enderror
                                </div>
                            </div>
                            <div class="mb-5 form-text">Password minimal harus terdiri dari 8 karakter dan mengandung
                                simbol</div>
                            <div class="d-flex">
                                <button type="submit" class="px-6 btn btn-primary me-2">Perbarui Password</button>
                                <button type="reset"
                                    class="px-6 btn btn-color-gray-400 btn-active-light-primary">Reset</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
