@extends('layouts.admin')
@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('assets/admin/css/vendors/flatpickr/flatpickr.min.css') }}">
    <link rel="stylesheet" href="{{ asset('assets/admin/css/vendors/select2.css') }}">
@endsection
@section('app')
    <div class="container-fluid">
        <div class="list-product-header">
            <div>
                <a class="btn btn-dark" href="{{ route('master.users') }}">Kembali</a>
            </div>
        </div>
        <div class="alert alert-light-info light alert-dismissible fade show border-left-info" role="alert">
            <p>Kata sandi bawaan untuk akun Anda adalah <b>Minimal</b>. Demi menjaga keamanan dan kerahasiaan akun, kami
                sangat
                menyarankan Anda untuk segera mengganti kata sandi tersebut dengan yang lebih kuat dan unik. </p>
        </div>
        <div class="card">
            <div class="card-body">
                <form class="row g-3 custom-input" action="{{ route('master.user.store') }}" method="post"
                    enctype="multipart/form-data">
                    @csrf
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="full_name">Nama Lengkap</label>
                        <input name="full_name" class="form-control @error('full_name') is-invalid @enderror" id="full_name"
                            type="text" placeholder="Masukan Nama Lengkap" value="{{ old('full_name') }}">
                        @error('full_name')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="username">Nama Pengguna</label>
                        <input name="username" class="form-control @error('username') is-invalid @enderror" id="username"
                            type="text" placeholder="Masukan Nama Pengguna" value="{{ old('username') }}">
                        @error('username')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="email">Email</label>
                        <input name="email" class="form-control @error('email') is-invalid @enderror" id="email"
                            type="text" placeholder="Masukan Email" value="{{ old('email') }}">
                        @error('email')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="contact_number">Kontak
                            <span class="form-span"><i>(format : 08xxxxxxxx)</i></span>
                        </label>
                        <input name="contact_number" class="form-control @error('contact_number') is-invalid @enderror"
                            id="contact_number" type="number" placeholder="Masukan Kontak"
                            value="{{ old('contact_number') }}">
                        @error('contact_number')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="pob">Tempat Lahir</label>
                        <input name="pob" class="form-control @error('pob') is-invalid @enderror" id="pob"
                            type="text" placeholder="Masukan Tempat Lahir" value="{{ old('pob') }}">
                        @error('pob')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="dob">Tanggal Lahir</label>
                        <div class="input-group flatpicker-calender">
                            <input name="dob" class="form-control @error('dob') is-invalid @enderror human-friendly"
                                id="dob" type="date" placeholder="Masukan Tanggal Lahir"
                                value="{{ old('dob') }}">
                        </div>
                        @error('dob')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="entry_date">Tanggal Bekerja</label>
                        <div class="input-group flatpicker-calender">
                            <input name="entry_date"
                                class="form-control @error('entry_date') is-invalid @enderror human-friendly"
                                id="entry_date" type="date" placeholder="Masukan Tanggal Bekerja"
                                value="{{ old('entry_date') }}">
                        </div>
                        @error('entry_date')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="base_salary">Gaji Pokok</label>
                        <input name="base_salary"
                            class="form-control rupiah-format @error('base_salary') is-invalid @enderror" id="base_salary"
                            type="text" placeholder="Masukan Gaji Pokok" value="{{ old('base_salary') }}"
                            inputmode="numeric">
                        @error('base_salary')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="sop">SOP
                            <span class="form-span"><i>(Opsional)</i></span>
                        </label>
                        <textarea name="sop" class="form-control @error('sop') is-invalid @enderror" id="sop" rows="3"
                            placeholder="Masukan SOP">{{ old('sop') }}</textarea>
                        @error('sop')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="address">Alamat</label>
                        <textarea name="address" class="form-control @error('address') is-invalid @enderror" id="address" rows="3"
                            placeholder="Masukan Alamat">{{ old('address') }}</textarea>
                        @error('address')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="avatar">Avatar
                            <span class="form-span"><i>(.jpeg,.png,.jpg,.gif,.svg)</i></span>
                        </label>
                        <input name="avatar" class="form-control @error('avatar') is-invalid @enderror" id="avatar"
                            type="file" value="{{ old('avatar') }}"
                            accept="image/jpeg,image/png,image/jpg,image/gif,image/svg">
                        @error('avatar')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="ktp">KTP
                            <span class="form-span"><i>(.jpeg,.png,.jpg,.gif,.svg)</i></span>
                        </label>
                        <input name="ktp" class="form-control @error('ktp') is-invalid @enderror" id="ktp"
                            type="file" value="{{ old('ktp') }}"
                            accept="image/jpeg,image/png,image/jpg,image/gif,image/svg">
                        @error('ktp')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-4 position-relative">
                        <label class="form-label" for="gender">Jenis Kelamin
                        </label>
                        <select name="gender" class="form-control @error('gender') is-invalid @enderror select2"
                            id="gender">
                            <option value=""></option>
                            <option value="1" @selected(old('gender') == '1')>Laki-laki</option>
                            <option value="2" @selected(old('gender') == '2')>Perempuan</option>
                        </select>
                        @error('gender')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-4 position-relative">
                        <label class="form-label" for="barbershop">Barbershop
                        </label>
                        <select name="barbershop" class="form-control @error('barbershop') is-invalid @enderror select2"
                            id="barbershop">
                            <option value=""></option>
                            @foreach ($barbershop as $item)
                                <option value="{{ $item->id }}" @selected(old('barbershop') == $item->id)>
                                    {{ $item->name }}
                                </option>
                            @endforeach
                        </select>
                        @error('barbershop')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-4 position-relative">
                        <label class="form-label" for="role">Role
                        </label>
                        <select name="role" class="form-control @error('role') is-invalid @enderror select2"
                            id="role">
                            <option value=""></option>
                            @foreach ($roles as $role)
                                <option value="{{ $role->id }}" @selected(old('role') == $role->id)>
                                    {{ $role->name }}
                                </option>
                            @endforeach
                        </select>
                        @error('role')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-12">
                        <button class="btn btn-primary button-disable" type="submit">Simpan</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
@section('beforeScripts')
    <script src="{{ asset('assets/admin/js/flat-pickr/flatpickr.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/admin/js/flat-pickr/custom-flatpickr.js?ver=1.0.0') }}"></script>
@endsection
@section('afterScripts')
    <script src="{{ asset('assets/js/forms/button-disable.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/js/forms/rupiah-format.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/admin/js/select2/select2.js') }}"></script>
    <script src="{{ asset('assets/admin/js/select2/select2-config.js?ver=1.0.0') }}"></script>
@endsection
