@extends('layouts.contentLayoutMaster')

@section('title','Edit Keterangan')

@section('vendor-styles')
<link rel="stylesheet" type="text/css" href="{{asset('css/plugins/forms/validation/form-validation.css')}}">
<link rel="stylesheet" type="text/css" href="{{asset('vendors/css/forms/select/select2.min.css')}}">
<link rel="stylesheet" type="text/css" href="{{asset('vendors/css/pickers/pickadate/pickadate.css')}}">
@endsection

@section('page-styles')
<link rel="stylesheet" type="text/css" href="{{asset('css/pages/page-users.css')}}">
@endsection

@section('content')
<!-- users edit start -->
<section class="users-edit">
    <div class="row">
        <div class="col-12 col-sm-8">
            <div class="card">
                <div class="card-content">
                    <div class="card-body">
                        <form method="post" action="{{ route('spk.update', [$spk->id]) }}" autocomplete="off" class="form" enctype="multipart/form-data">
                            @csrf
                            @method('PUT')
                            <div class="row">
                                <div class="col-12">
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>Keterangan</label>
                                            <input type="text" name="keterangan" minlength="3" id="keterangan" class="form-control" placeholder="Keterangan"
                                                value="{{ old('keterangan') }}" required
                                                data-validation-required-message="Keterangan wajib diisi."
                                                data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                                @error('keterangan')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                        </div>
                                    </div>
                                </div>
                                <div class="col-12 d-flex flex-sm-row flex-column justify-content-start border-bottom pb-1 mb-1">
                                    <button type="submit" class="btn btn-danger glow mb-1 mb-sm-0 mr-0 mr-sm-1">Simpan</button>
                                    <button type="reset" class="btn btn-light">Cancel</button>
                                </div>
                                <div class="col-12">
                                    <h5>Biodata Pemohon</h5>
                                </div>
                                <div class="col-12 col-sm-6">
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>NIK</label>
                                            <input type="text" name="nik" id="nik" class="form-control" placeholder="NIK"
                                                value="{{ $spk->user->nik }}" disabled>
                                                <small class="text-warning">Hubungi admin untuk mengubah NIK.</small>
                                                @error('nik')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>Nama</label>
                                            <input type="text" name="name" minlength="3" id="name" class="form-control" placeholder="Nama"
                                                value="{{ $spk->user->name, old('name') }}" disabled
                                                data-validation-required-message="Nama wajib diisi."
                                                data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                                @error('name')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="controls">
                                            <label class="d-block">Jenis Kelamin</label>
                                            <div class="custom-control-inline">
                                                <div class="radio mr-1">
                                                    <input type="radio" name="jenis_kelamin" id="radio1" value="Laki-Laki" disabled
                                                        {{ ($spk->user->profil->jenis_kelamin) == 'Laki-Laki' ? 'checked' : '' }} >
                                                    <label for="radio1">Laki-Laki</label>
                                                </div>
                                                <div class="radio">
                                                    <input type="radio" name="jenis_kelamin" id="radio2" value="Perempuan" disabled
                                                        {{ ($spk->user->profil->jenis_kelamin) == 'Perempuan' ? 'checked' : '' }}>
                                                    <label for="radio2">Perempuan</label>
                                                </div>
                                                @error('jenis_kelamin')
                                                    <span class="invalid-feedback" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>Tempat Lahir</label>
                                            <input type="text" name="tempat_lahir" minlength="3" id="tempat_lahir" class="form-control" placeholder="Tempat Lahir"
                                                value="{{ $spk->user->profil->tempat_lahir }}" disabled
                                                data-validation-required-message="Tempat Lahir wajib diisi."
                                                data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                                @error('tempat_lahir')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                        </div>
                                    </div>
                                    <div class="form-group position-relative has-icon-left">
                                        <div class="controls">
                                            <label>Tanggal Lahir</label>
                                            <input type="text" name="tanggal_lahir" class="form-control pickadate-profil" value="{{ $spk->user->profil->tanggal_lahir }}" placeholder="Pilih Tanggal" disabled>
                                            <div class="form-control-position">
                                                <i class='bx bx-calendar' style="top: 24px"></i>
                                            </div>
                                            @error('tanggal_lahir')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                            @enderror
                                        </div>
                                    </div>
                                </div>
                                <div class="col-12 col-sm-6">
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>Agama</label>
                                            <select class="select2 form-control" id="agama" name="agama" class="form-control" disabled>
                                                <option value="" selected disabled>Pilih Agama</option>
                                                <option {{ ($spk->user->profil->agama) == 'Islam' ? 'selected' : '' }} value="Islam">Islam</option>
                                                <option {{ ($spk->user->profil->agama) == 'Katolik' ? 'selected' : '' }} value="Katolik">Katolik</option>
                                                <option {{ ($spk->user->profil->agama) == 'Kristen' ? 'selected' : '' }} value="Kristen">Kristen</option>
                                                <option {{ ($spk->user->profil->agama) == 'Hindu' ? 'selected' : '' }} value="Hindu">Hindu</option>
                                                <option {{ ($spk->user->profil->agama) == 'Budha' ? 'selected' : '' }} value="Budha">Budha</option>
                                                <option {{ ($spk->user->profil->agama) == 'Konghucu' ? 'selected' : '' }} value="Konghucu">Konghucu</option>
                                                <option {{ ($spk->user->profil->agama) == 'ILainnyaslam' ? 'selected' : '' }} value="Lainnya">Lainnya</option>
                                            </select>
                                            @error('agama')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                            @enderror
                                        </div>
                                    </div>
                                    <fieldset class="form-group">
                                        <div class="controls">
                                            <label>Alamat</label>
                                            <textarea class="form-control" name="alamat" id="alamat" rows="4" disabled>{{ $spk->user->profil->alamat }}</textarea>                            
                                            @error('alamat')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                            @enderror
                                        </div>
                                    </fieldset>
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>No. Telepon</label>
                                            <input type="text" id="telepon" minlength="10" maxlength="15" class="form-control" name="telepon" placeholder="No. Telepon" 
                                                value="{{ $spk->user->profil->telepon, old('telepon') }}" disabled
                                                data-validation-required-message="Nomor Telepon wajib diisi."
                                                data-validation-containsnumber-regex="(\d)+"
                                                data-validation-containsnumber-message="Masukkan Nomor yang valid."
                                                data-validation-minlength-message="Harus terdiri dari minimal 10 karakter."
                                                data-validation-maxlength-message="Harus terdiri dari maksimal 15 karakter.">
                                                @error('telepon')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="controls">
                                            <label>Pekerjaan Anda</label>
                                            <input type="text" name="pekerjaan" minlength="3" id="pekerjaan" class="form-control" placeholder="Pekerjaan"
                                                value="{{ $spk->user->profil->pekerjaan }}" disabled
                                                data-validation-required-message="Pekerjaan wajib diisi."
                                                data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                                @error('pekerjaan')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-12 col-sm-4">
            <div class="card">
                <div class="card-header border-bottom pb-1 mb-2">
                    <h4>KTP</h4>
                </div>
                <div class="card-content">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12">
                                <img src="{{ asset('storage/'.$spk->scan_ktp) }}" alt="users avatar"
                                class="users-avatar-shadow" height="100%" width="100%">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card">
                <div class="card-header border-bottom mb-2">
                    <h4>KK</h4>
                </div>
                <div class="card-content">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12">
                                <img src="{{ asset('storage/'.$spk->scan_kk) }}" alt="users avatar"
                                class="users-avatar-shadow" height="100%" width="100%">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!-- users edit ends -->
@endsection

{{-- vendor scripts --}}
@section('vendor-scripts')
<script src="{{asset('vendors/js/forms/select/select2.full.min.js')}}"></script>
<script src="{{asset('vendors/js/forms/validation/jqBootstrapValidation.js')}}"></script>
<script src="{{asset('vendors/js/pickers/pickadate/picker.js')}}"></script>
<script src="{{asset('vendors/js/pickers/pickadate/picker.date.js')}}"></script>
@endsection

{{-- page scripts --}}
@section('page-scripts')
<script src="{{asset('js/scripts/pages/page-users.js')}}"></script>
<script src="{{asset('js/scripts/navs/navs.js')}}"></script>
@endsection