@extends('layouts.contentLayoutMaster')

@section('title','Tambah SKL')

@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')}}">
<link rel="stylesheet" type="text/css" href="{{asset('vendors/css/pickers/daterange/daterangepicker.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">
<form method="post" action="{{ route('skl.store') }}" autocomplete="off" class="form" enctype="multipart/form-data">
    @csrf
    @method('post')
    <div class="card">
        <div class="card-content">
        <div class="card-body">
            <div class="row">
                <div class="col-12 col-sm-6">
                    <div class="form-group">
                        <div class="controls">
                            <label>NIK Pemohon</label>
                            <input id="pemohon_nik" type="number" class="form-control @error('pemohon_nik') is-invalid @enderror" class="form-control" name="pemohon_nik" 
                                value="{{ auth()->user()->nik, old('pemohon_nik') }}" readonly 
                                autofocus placeholder="Nomor KTP">
                                @if ($errors->has('pemohon_nik'))
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $errors->first('pemohon_nik') }}</strong>
                                </span>
                                @endif
                        </div>
                    </div>
                </div>
                <div class="col-12 col-sm-6">
                    <div class="form-group">
                        <div class="controls">
                            <label>Nama Pemohon</label>
                            <input type="text" name="pemohon_nama" minlength="3" id="pemohon_nama" class="form-control" placeholder="Nama"
                                value="{{ auth()->user()->name, old('pemohon_nama') }}" readonly>
                                @if ($errors->has('pemohon_nama'))
                                <div class="help-block text-danger">
                                    <ul role="alert">
                                        <li>{{ $errors->first('pemohon_nama') }}</li>
                                    </ul>
                                </div>
                                @endif
                        </div>
                    </div>
                </div>
            </div> 
        </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
        <div class="card-body">
            <div class="row">
                <div class="col-12">
                    <div class="border rounded px-1 mb-1">
                        <h6 class="border-bottom py-1 mb-1 font-medium-2"><i
                        class="bx bxs-user mr-50 "></i>Biodata Anak</h6>
                        <div class="form-group">
                            <div class="controls">
                                <label>Nama Bayi/Anak</label>
                                <input type="text" name="nama_bayi" minlength="3" id="nama_bayi" class="form-control @error('nama_bayi') is-invalid @enderror" placeholder="Nama Bayi/Anak"
                                        value="{{ old('nama_bayi') }}" required
                                        data-validation-required-message="Nama Bayi/Anak wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('nama_bayi'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('nama_bayi') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </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" class="form-control  @error('jenis_kelamin') is-invalid @enderror" value="Laki-Laki" required>
                                        <label for="radio1">Laki-Laki</label>
                                    </div>
                                    <div class="radio">
                                        <input type="radio" name="jenis_kelamin" id="radio2" class="form-control  @error('jenis_kelamin') is-invalid @enderror" value="Perempuan" required>
                                        <label for="radio2">Perempuan</label>
                                    </div>
                                    @if ($errors->has('jenis_kelamin'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('jenis_kelamin') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                                </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  @error('tempat_lahir') is-invalid @enderror" placeholder="Tempat Lahir" required
                                    value="{{ old('tempat_lahir') }}" 
                                    data-validation-required-message="Tempat Lahir wajib diisi."
                                    data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('tempat_lahir'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('tempat_lahir') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </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 @error('tanggal_lahir') is-invalid @enderror pickadate" placeholder="Pilih Tanggal">
                                <div class="form-control-position">
                                    <i class='bx bx-calendar' style="top: 24px"></i>
                                </div>
                                @if ($errors->has('tanggal_lahir'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('tanggal_lahir') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Anak ke</label>
                                <input type="number" name="anak_ke" id="anak_ke" class="form-control @error('anak_ke') is-invalid @enderror" placeholder="Anak Ke"
                                        value="{{ old('anak_ke') }}" required
                                        data-validation-required-message="Anak Ke wajib diisi.">
                                    @if ($errors->has('anak_ke'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('anak_ke') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Jenis Kelahiran</label>
                                <input type="text" name="jenis_kelahiran" minlength="3" id="jenis_kelahiran" class="form-control @error('jenis_kelahiran') is-invalid @enderror" placeholder="Jenis Kelahiran"
                                        value="{{ old('jenis_kelahiran') }}" required
                                        data-validation-required-message="Jenis Kelahiran wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('jenis_kelahiran'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('jenis_kelahiran') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-12">
                    <div class="border rounded px-1 mb-1">
                        <h6 class="border-bottom py-1 mb-1 font-medium-2"><i
                        class="bx bx-male mr-50 "></i>Biodata Ayah Kandung</h6>   
                        <div class="form-group">
                            <div class="controls">
                                <label>NIK Ayah Kandung</label>
                                <input id="ayah_nik" type="number" minlength="16" maxlength="16" class="form-control @error('ayah_nik') is-invalid @enderror" class="form-control" name="ayah_nik" value="{{ old('ayah_nik') }}" required 
                                    autocomplete="ayah_nik" autofocus placeholder="NIK Ayah Kandung"
                                    data-validation-required-message="NIK Ayah Kandung wajib diisi."
                                    data-validation-minlength-message="Harus terdiri dari minimal 16 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari minimal 16 karakter.">
                                    @if ($errors->has('ayah_nik'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_nik') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>KK Ayah Kandung</label>
                                <input id="ayah_kk" type="number" minlength="16" maxlength="16" class="form-control @error('ayah_kk') is-invalid @enderror" class="form-control" name="ayah_kk" value="{{ old('ayah_kk') }}" required 
                                    autocomplete="nik" autofocus placeholder="KK Ayah Kandung"
                                    data-validation-required-message="KK Ayah Kandung Kandung wajib diisi."
                                    data-validation-minlength-message="Harus terdiri dari minimal 16 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari minimal 16 karakter.">
                                    @if ($errors->has('ayah_kk'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_kk') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Nama Ayah Kandung</label>
                                <input type="text" name="ayah_nama" minlength="3" id="ayah_nama" class="form-control @error('ayah_nama') is-invalid @enderror" placeholder="Nama Ayah"
                                        value="{{ old('ayah_nama') }}" required
                                        data-validation-required-message="Nama Ayah wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('ayah_nama'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_nama') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Pekerjaan Ayah Kandung</label>
                                <input type="text" name="ayah_pekerjaan" minlength="3" id="ayah_pekerjaan" class="form-control @error('ayah_pekerjaan') is-invalid @enderror" placeholder="Pekerjaan Ayah Kandung"
                                        value="{{ old('ayah_pekerjaan') }}" required
                                        data-validation-required-message="Pekerjaan Ayah Kandung wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('ayah_pekerjaan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_pekerjaan') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Alamat Ayah Kandung</label>
                                <input type="text" name="ayah_alamat" minlength="3" id="ayah_alamat" class="form-control @error('ayah_alamat') is-invalid @enderror" placeholder="Alamat Ayah Kandung"
                                        value="{{ old('ayah_alamat') }}" required
                                        data-validation-required-message="Alamat Ayah Kandung wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('ayah_alamat'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_alamat') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>RT</label>
                                <input type="number" id="ayah_rt" minlength="1" maxlength="4" class="form-control @error('ayah_rt') is-invalid @enderror" name="ayah_rt" placeholder="RT" 
                                    value="{{ old('ayah_rt') }}" required
                                    data-validation-required-message="RT wajib diisi."
                                    data-validation-containsnumber-regex="(\d)+"
                                    data-validation-containsnumber-message="Masukkan RT yang valid."
                                    data-validation-minlength-message="Harus terdiri dari minimal 1 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari maksimal 4 karakter.">
                                    @if ($errors->has('ayah_rt'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_rt') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>RW</label>
                                <input type="number" id="ayah_rw" minlength="1" maxlength="4" class="form-control @error('ayah_rw') is-invalid @enderror" name="ayah_rw" placeholder="RW" 
                                    value="{{ old('ayah_rw') }}" required
                                    data-validation-required-message="RW wajib diisi."
                                    data-validation-containsnumber-regex="(\d)+"
                                    data-validation-containsnumber-message="Masukkan RW yang valid."
                                    data-validation-minlength-message="Harus terdiri dari minimal 1 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari maksimal 4 karakter.">
                                    @if ($errors->has('ayah_rw'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_rw') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Provinsi</label>
                                <select class="select2 form-control @error('ayah_provinsi') is-invalid @enderror" id="ayah_provinsi" name="ayah_provinsi" required>
                                    <option value="" selected disabled>Pilih Provinsi</option>
                                    @foreach ($provinces as $item)
                                        <option value="{{ $item->id ?? '' }}">{{ $item->name ?? '' }}</option>
                                    @endforeach
                                </select>
                                @if ($errors->has('ayah_provinsi'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_provinsi') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Kabupaten / Kota</label>
                                <select class="select2 form-control @error('ayah_kabupaten_kota') is-invalid @enderror" id="ayah_kabupaten_kota" name="ayah_kabupaten_kota" required>
                                    <option value="" selected disabled>Pilih Kabupaten / Kota</option>
                                </select>
                                @if ($errors->has('ayah_kabupaten_kota'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_kabupaten_kota') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Kecamatan</label>
                                <select class="select2 form-control @error('ayah_kecamatan') is-invalid @enderror" id="ayah_kecamatan" name="ayah_kecamatan" required>
                                    <option value="" selected disabled>Pilih Kecamatan</option>
                                </select>
                                @if ($errors->has('ayah_kecamatan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_kecamatan') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Desa / Kelurahan</label>
                                <select class="select2 form-control @error('ayah_desa_kelurahan') is-invalid @enderror" id="ayah_desa_kelurahan" name="ayah_desa_kelurahan" required>
                                    <option value="" selected disabled>Pilih Desa / Kelurahan</option>
                                </select>
                                @if ($errors->has('ayah_desa_kelurahan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_desa_kelurahan') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Kode Pos</label>
                                <input type="text" id="ayah_kode_pos" minlength="4" maxlength="6" class="form-control @error('ayah_kode_pos') is-invalid @enderror" name="ayah_kode_pos" placeholder="Kode Pos" 
                                    value="{{ old('ayah_kode_pos') }}" required
                                    data-validation-required-message="Kode Pos wajib diisi."
                                    data-validation-containsnumber-regex="(\d)+"
                                    data-validation-containsnumber-message="Masukkan Kode Pos yang valid."
                                    data-validation-minlength-message="Harus terdiri dari minimal 4 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari maksimal 6 karakter.">
                                    @if ($errors->has('ayah_kode_pos'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ayah_kode_pos') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-12">
                    <div class="border rounded px-1 mb-1">
                        <h6 class="border-bottom py-1 mb-1 font-medium-2"><i
                        class="bx bx-female mr-50 "></i>Biodata Ibu Kandung</h6>  
                        <div class="form-group">
                            <div class="controls">
                                <label>NIK Ibu Kandung</label>
                                <input id="ibu_nik" type="number" minlength="16" maxlength="16" class="form-control @error('ibu_nik') is-invalid @enderror" class="form-control" name="ibu_nik" value="{{ old('ibu_nik') }}" required 
                                    autocomplete="nik" autofocus placeholder="NIK Ibu Kandung"
                                    data-validation-required-message="NIK Ibu Kandung wajib diisi."
                                    data-validation-minlength-message="Harus terdiri dari minimal 16 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari minimal 16 karakter.">
                                    @if ($errors->has('ibu_nik'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_nik') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>KK Ibu Kandung</label>
                                <input id="ibu_kk" type="number" minlength="16" maxlength="16" class="form-control @error('ibu_kk') is-invalid @enderror" class="form-control" name="ibu_kk" value="{{ old('ibu_kk') }}" required 
                                    autocomplete="ibu_kk" autofocus placeholder="NIK Ibu Kandung"
                                    data-validation-required-message="NIK Ibu Kandung wajib diisi."
                                    data-validation-minlength-message="Harus terdiri dari minimal 16 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari minimal 16 karakter.">
                                    @if ($errors->has('ibu_kk'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_kk') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Nama Ibu Kandung</label>
                                <input type="text" name="ibu_nama" minlength="3" id="ibu_nama" class="form-control @error('ibu_nama') is-invalid @enderror" placeholder="Nama Ibu"
                                        value="{{ old('ibu_nama') }}" required
                                        data-validation-required-message="Nama Ibu wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('ibu_nama'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_nama') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Pekerjaan Ibu Kandung</label>
                                <input type="text" name="ibu_pekerjaan" minlength="3" id="ibu_pekerjaan" class="form-control @error('ibu_pekerjaan') is-invalid @enderror" placeholder="Pekerjaan Ibu Kandung"
                                        value="{{ old('ibu_pekerjaan') }}" required
                                        data-validation-required-message="Pekerjaan Ibu Kandung wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('ibu_pekerjaan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_pekerjaan') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Alamat Ibu Kandung</label>
                                <input type="text" name="ibu_alamat" minlength="3" id="ibu_alamat" class="form-control @error('ibu_alamat') is-invalid @enderror" placeholder="Alamat Ibu Kandung"
                                        value="{{ old('ibu_alamat') }}" required
                                        data-validation-required-message="Alamat Ibu Kandung wajib diisi."
                                        data-validation-minlength-message="Harus terdiri dari minimal 3 karakter.">
                                    @if ($errors->has('ibu_alamat'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_alamat') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>RT</label>
                                <input type="number" id="ibu_rt" minlength="1" maxlength="4" class="form-control @error('ibu_rt') is-invalid @enderror" name="ibu_rt" placeholder="RT" 
                                    value="{{ old('ibu_rt') }}" required
                                    data-validation-required-message="RT wajib diisi."
                                    data-validation-containsnumber-regex="(\d)+"
                                    data-validation-containsnumber-message="Masukkan RT yang valid."
                                    data-validation-minlength-message="Harus terdiri dari minimal 1 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari maksimal 4 karakter.">
                                    @if ($errors->has('ibu_rt'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_rt') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>RW</label>
                                <input type="number" id="ibu_rw" minlength="1" maxlength="4" class="form-control @error('ibu_rw') is-invalid @enderror" name="ibu_rw" placeholder="RW" 
                                    value="{{ old('ibu_rw') }}" required
                                    data-validation-required-message="RW wajib diisi."
                                    data-validation-containsnumber-regex="(\d)+"
                                    data-validation-containsnumber-message="Masukkan RW yang valid."
                                    data-validation-minlength-message="Harus terdiri dari minimal 1 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari maksimal 4 karakter.">
                                    @if ($errors->has('ibu_rw'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_rw') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Provinsi</label>
                                <select class="select2 form-control @error('ibu_provinsi') is-invalid @enderror" id="ibu_provinsi" name="ibu_provinsi" required>
                                    <option value="" selected disabled>Pilih Provinsi</option>
                                    @foreach ($provinces as $item)
                                        <option value="{{ $item->id ?? '' }}">{{ $item->name ?? '' }}</option>
                                    @endforeach
                                </select>
                                @if ($errors->has('ibu_provinsi'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_provinsi') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Kabupaten / Kota</label>
                                <select class="select2 form-control @error('ibu_kabupaten_kota') is-invalid @enderror" id="ibu_kabupaten_kota" name="ibu_kabupaten_kota" required>
                                    <option value="" selected disabled>Pilih Kabupaten / Kota</option>
                                </select>
                                @if ($errors->has('ibu_kabupaten_kota'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_kabupaten_kota') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Kecamatan</label>
                                <select class="select2 form-control @error('ibu_kecamatan') is-invalid @enderror" id="ibu_kecamatan" name="ibu_kecamatan" required>
                                    <option value="" selected disabled>Pilih Kecamatan</option>
                                </select>
                                @if ($errors->has('ibu_kecamatan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_kecamatan') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Desa / Kelurahan</label>
                                <select class="select2 form-control @error('ibu_desa_kelurahan') is-invalid @enderror" id="ibu_desa_kelurahan" name="ibu_desa_kelurahan" required>
                                    <option value="" selected disabled>Pilih Desa / Kelurahan</option>
                                </select>
                                @if ($errors->has('ibu_desa_kelurahan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_desa_kelurahan') }}</li>
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <label>Kode Pos</label>
                                <input type="text" id="ibu_kode_pos" minlength="4" maxlength="6" class="form-control @error('ibu_kode_pos') is-invalid @enderror" name="ibu_kode_pos" placeholder="Kode Pos" 
                                    value="{{ old('ibu_kode_pos') }}" required
                                    data-validation-required-message="Kode Pos wajib diisi."
                                    data-validation-containsnumber-regex="(\d)+"
                                    data-validation-containsnumber-message="Masukkan Kode Pos yang valid."
                                    data-validation-minlength-message="Harus terdiri dari minimal 4 karakter."
                                    data-validation-maxlength-message="Harus terdiri dari maksimal 6 karakter.">
                                    @if ($errors->has('ibu_kode_pos'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('ibu_kode_pos') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                            </div>
                        </div>
                        <div class="form-group">
                            <label>Scan KTP Ibu Kandung</label>
                            <div class="form-group">
                                <div class="controls">
                                    <div class="custom-file">
                                        <input type="file" class="form-controll @error('scan_ktp') is-invalid @enderror custom-file-input" id="scan_ktp" name="scan_ktp">
                                        <label class="custom-file-label" for="scan_ktp">Pilih foto</label>
                                        <small class="text-warning">Foto KTP diusakan jelas dan tidak terpotong.</small>
                                    </div>
                                    @if ($errors->has('scan_ktp'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('scan_ktp') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                                </div>
                            </div>    
                        </div>
                        <div class="form-group">
                            <label>Scan KK</label>
                            <div class="form-group">
                                <div class="controls">
                                    <div class="custom-file">
                                        <input type="file" class="form control @error('scan_kk') is-invalid @enderror custom-file-input" id="scan_kk" name="scan_kk">
                                        <label class="custom-file-label" for="scan_kk">Pilih foto</label>
                                        <small class="text-warning">Foto KK diusakan jelas dan tidak terpotong.</small>
                                    </div>
                                    @if ($errors->has('scan_kk'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('scan_kk') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                                </div>
                            </div>    
                        </div>
                        <div class="form-group">
                            <label>Scan Keterangan Kelahiran</label>
                            <div class="form-group">
                                <div class="controls">
                                    <div class="custom-file">
                                        <input type="file" class="form control @error('scan_keterangan') is-invalid @enderror custom-file-input" id="scan_keterangan" name="scan_keterangan">
                                        <label class="custom-file-label" for="scan_keterangan">Pilih foto</label>
                                        <small class="text-warning">Foto keterangan kelahiran diusakan jelas dan tidak terpotong.</small>
                                    </div>
                                    @if ($errors->has('scan_keterangan'))
                                    <div class="help-block text-danger">
                                        <ul role="alert">
                                            <li>{{ $errors->first('scan_keterangan') }}</li>
                                        </ul>
                                    </div>
                                    @endif
                                </div>
                            </div>    
                        </div>
                    </div>
                </div>
                <div class="col-12 d-flex flex-sm-row flex-column justify-content-start mt-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> 
        </div>
        </div>
    </div>
</form>
</section>
<!-- users edit ends -->
@endsection

{{-- vendor scripts --}}
@section('vendor-scripts')
<script>
    function onChangeSelect(url, id, name) {
        // send ajax request to get the cities of the selected province and append to the select tag
        $.ajax({
            url: url,
            type: 'GET',
            data: {
                id: id
            },
            success: function (data) {
                $('#' + name).empty();
                $('#' + name).append('<option>Pilih Salah Satu</option>');

                $.each(data, function (key, value) {
                    $('#' + name).append('<option value="' + key + '">' + value + '</option>');
                });
            }
        });
    }
    $(function () {
        $('#ayah_provinsi').on('change', function () {
            onChangeSelect('{{ route("cities") }}', $(this).val(), 'ayah_kabupaten_kota');
        });
        $('#ayah_kabupaten_kota').on('change', function () {
            onChangeSelect('{{ route("districts") }}', $(this).val(), 'ayah_kecamatan');
        })
        $('#ayah_kecamatan').on('change', function () {
            onChangeSelect('{{ route("villages") }}', $(this).val(), 'ayah_desa_kelurahan');
        })
    });
</script>
<script>
    function onChangeSelect(url, id, name) {
        // send ajax request to get the cities of the selected province and append to the select tag
        $.ajax({
            url: url,
            type: 'GET',
            data: {
                id: id
            },
            success: function (data) {
                $('#' + name).empty();
                $('#' + name).append('<option>Pilih Salah Satu</option>');

                $.each(data, function (key, value) {
                    $('#' + name).append('<option value="' + key + '">' + value + '</option>');
                });
            }
        });
    }
    $(function () {
        $('#ibu_provinsi').on('change', function () {
            onChangeSelect('{{ route("cities") }}', $(this).val(), 'ibu_kabupaten_kota');
        });
        $('#ibu_kabupaten_kota').on('change', function () {
            onChangeSelect('{{ route("districts") }}', $(this).val(), 'ibu_kecamatan');
        })
        $('#ibu_kecamatan').on('change', function () {
            onChangeSelect('{{ route("villages") }}', $(this).val(), 'ibu_desa_kelurahan');
        })
    });
</script>
<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>
<script src="{{asset('js/scripts/forms/validation/form-validation.js')}}"></script>
<script src="{{asset('js/scripts/pickers/dateTime/pick-a-datetime.js')}}"></script>   
@endsection