Viewnya

 avatar
unknown
php_laravel_blade
3 years ago
23 kB
5
Indexable
@extends('layouts.app')

@section('content')


    {{-- <div class="row">
        <div class="col-xl-4">
            <div class="card border-top-success border-top-3 mb-3">
              <div class="card-header">Header</div>
              <div class="card-body text-success">
                <h5 class="card-title">Success card title</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
              </div>
            </div>
          </div>
        <div class="col-xl-4">
            <div class="card border-top-success border-top-3 mb-3">
              <div class="card-header">Header</div>
              <div class="card-body text-success">
                <h5 class="card-title">Success card title</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
              </div>
            </div>
          </div>
        <div class="col-xl-4">
            <div class="card border-top-success border-top-3 mb-3">
              <div class="card-header">Header</div>
              <div class="card-body text-success">
                <h5 class="card-title">Success card title</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
              </div>
            </div>
          </div>
    </div> --}}

    <div class="card border-top-success border-top-3 mb-3">
        <div class="card-header">
            <b>{{ __('Data Dasar') }}</b>
        </div>
        <div class="card-body">
            @include('flash-message')
            @if ($errors->any())
                    <div class="alert alert-danger">
                        <ul>
                            @foreach ($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                    </div>
                    @endif
            {{-- {{ __('You are logged in!') }} --}}
            <form  action="{{ route('home.update',$profil->id_nya) }}" method="POST" enctype="multipart/form-data" class="row g-3">
                @csrf
             @method('PUT')
                <div class="col-6">
                    <label class="form-label" for="inputAddress">NIK</label>
                    <input class="form-control" id="inputAddress" type="text" placeholder="NIK" maxlength="16" value="{{ Auth::user()->nik }}" readonly>
                </div>
                <div class="col-6">
                    <label class="form-label" for="inputAddress">Nama Lengkap</label>
                    <input class="form-control" id="inputAddress" type="text" placeholder="Nama Lengkap" readonly value="{{ Auth::user()->name }}">
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Tempat Lahir</label>
                    <input class="form-control" id="inputEmail4" type="text" name="tempat_lahir" value="{{ $profil->tempat_lahir ?? '' }}">
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Tanggal Lahir (Tahun/Bulan/Tanggal)</label>
                    <input class="form-control" id="inputEmail4" type="text" name="tanggal_lahir"  placeholder="1993-11-20" value="{{ $profil->tanggal_lahir ?? '' }}">
                </div>
                <div class="col-md-4">
                  <label class="form-label" for="inputState">Jenis Kelamin</label>
                  <select class="form-select" id="inputState" name="jenis_kelamin" >
                    <option>Pilih...</option>
                    <option {{ ($profil->jenis_kelamin) == 'Putra' ? 'selected' : '' }} value="Putra">Putra</option>
                    <option {{ ($profil->jenis_kelamin) == 'Putri' ? 'selected' : '' }}value="Putri">Putri</option>
                  </select>
                </div>
                <div class="col-8">
                    <label class="form-label" for="inputAddress">Alamat Rumah</label>
                    <input class="form-control" id="inputAddress" type="text" name="alamat_rumah"  placeholder="Alamat Lengkap"   value="{{ $profil->alamat_rumah ?? '' }}">
                </div>
                <div class="col-2">
                    <label class="form-label" for="inputAddress">RT</label>
                    <input class="form-control" id="inputAddress" type="text" name="rt"  placeholder="001" value="{{ $profil->rt ?? '' }}" maxlength="3">
                    @error('rt')
                    <span class="invalid-feedback">
                            {{ $message }}
                        </span>
                    @enderror
                </div>
                <div class="col-2">
                    <label class="form-label" for="inputAddress">RW</label>
                    <input class="form-control" id="inputAddress" type="text" name="rw"  placeholder="002" value="{{ $profil->rw ?? '' }}" maxlength="3">
                </div>
                <div class="col-md-3">
                    <label class="form-label" for="inputEmail4">Provinsi</label>
                    @php
                    $provinces = new App\Http\Controllers\DependentDropdownController;
                    $provinces= $provinces->provinces();
                @endphp
                <select class="form-control" name="provinsi" id="provinsi" required>
                    <option>==Pilih Salah Satu==</option>
                    @foreach ($provinces as $item)
                        <option value="{{ $item->id }}">{{ $item->name ?? '' }}</option>
                    @endforeach
                </select>
                  </div>
                <div class="col-md-3">
                    <label class="form-label" for="inputEmail4">Kab/Kota</label>
                    <select class="form-control" name="kota" id="kota" required>
                        <option>==Pilih Salah Satu==</option>
                    </select>
                    {{-- <input class="form-control" id="inputEmail4" type="text" name="desa"  placeholder="Cikuya" value="{{ $profil->desa ?? '' }}"> --}}
                  </div>
                  <div class="col-md-3">
                    <label class="form-label" for="inputPassword4">Kecamatan</label>
                    <select class="form-control" name="kecamatan" id="kecamatan" required>
                        <option>==Pilih Salah Satu==</option>
                    </select>
                    {{-- <input class="form-control" id="inputPassword4" type="text" name="kec"  placeholder="Cicalengka" value="{{ $profil->kec ?? '' }}"> --}}
                </div>
                <div class="col-md-3">
                    <label class="form-label" for="inputPassword4">Desa</label>
                    <select class="form-control" name="desa" id="desa" required>
                        <option>==Pilih Salah Satu==</option>
                    </select>
                    {{-- <input class="form-control" id="inputPassword4" type="text" name="kab"  placeholder="Kab. Bandung" value="{{ $profil->kab ?? '' }}"> --}}
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Agama</label>
                    <select class="form-select" id="inputState" name="agama" >
                        <option >Pilih...</option>
                        <option {{ ($profil->agama) == 'Islam' ? 'selected' : '' }} value="Islam">Islam</option>
                        <option {{ ($profil->agama) == 'Kristen' ? 'selected' : '' }} value="Kristen">Kristen</option>
                        <option {{ ($profil->agama) == 'Katholik' ? 'selected' : '' }} value="Katholik">Katholik</option>
                        <option {{ ($profil->agama) == 'Hindu' ? 'selected' : '' }} value="Hindu">Hindu</option>
                        <option {{ ($profil->agama) == 'Budha' ? 'selected' : '' }} value="Budha">Budha</option>
                        <option {{ ($profil->agama) == 'Khong Hucu' ? 'selected' : '' }} value="Khong Hucu">Khong Hucu</option>
                        <option {{ ($profil->agama) == 'Penghayat Kepercayaan' ? 'selected' : '' }} value="Penghayat Kepercayaan">Penghayat Kepercayaan</option>
                      </select>
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Golongan Darah</label>
                    <select class="form-select" id="inputState" name="goldar" >
                        <option >Pilih...</option>
                        <option {{ ($profil->goldar) == 'A' ? 'selected' : '' }}  value="A">A</option>
                        <option {{ ($profil->goldar) == 'B' ? 'selected' : '' }}  value="B">B</option>
                        <option {{ ($profil->goldar) == 'AB' ? 'selected' : '' }}  value="AB">AB</option>
                        <option {{ ($profil->goldar) == 'O' ? 'selected' : '' }}  value="O">O</option>
                        <option {{ ($profil->goldar) == 'Tidak Tahu' ? 'selected' : '' }}  value="Tidak Tahu">Tidak Tahu</option>
                      </select>
                </div>
                <div class="col-md-4">
                  <label class="form-label" for="inputState">No Telepon</label>
                  <input class="form-control" id="inputEmail4" type="text" name="notel"  value="{{ $profil->notel ?? '' }}">
                </div>
                <div class="col-md-12">
                  <label class="form-label" for="inputEmail4">Email</label>
                  <input class="form-control" id="inputEmail4" type="email" readonly value="{{ Auth::user()->email }}">
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Tingkat</label>
                    <select class="form-select" id="inputState" name="tingkat" >
                        <option >Pilih...</option>
                        <option {{ ($profil->tingkat) == 'Siaga' ? 'selected' : '' }} value="Siaga">Siaga</option>
                        <option {{ ($profil->tingkat) == 'Penggalang' ? 'selected' : '' }} value="Penggalang">Penggalang</option>
                        <option {{ ($profil->tingkat) == 'Penegak' ? 'selected' : '' }} value="Penegak">Penegak</option>
                        <option {{ ($profil->tingkat) == 'Pandega' ? 'selected' : '' }} value="Pandega">Pandega</option>
                        <option {{ ($profil->tingkat) == 'Pembina' ? 'selected' : '' }} value="Pembina">Pembina</option>
                        <option {{ ($profil->tingkat) == 'Pelatih' ? 'selected' : '' }} value="Pelatih">Pelatih</option>
                        <option {{ ($profil->tingkat) == '-' ? 'selected' : '' }} value="-">-</option>
                      </select>
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Golongan</label>
                    <select class="form-select" id="inputState" name="gol" >
                        <option >Pilih...</option>
                        <option {{ ($profil->gol) == 'Calon' ? 'selected' : '' }} value="Calon">Calon</option>
                        <option {{ ($profil->gol) == 'Mula' ? 'selected' : '' }} value="Mula">Mula</option>
                        <option {{ ($profil->gol) == 'Bantu' ? 'selected' : '' }} value="Bantu">Bantu</option>
                        <option {{ ($profil->gol) == 'Tata' ? 'selected' : '' }} value="Tata">Tata</option>
                        <option {{ ($profil->gol) == 'Ramu' ? 'selected' : '' }} value="Ramu">Ramu</option>
                        <option {{ ($profil->gol) == 'Rakit' ? 'selected' : '' }} value="Rakit">Rakit</option>
                        <option {{ ($profil->gol) == 'Terap' ? 'selected' : '' }} value="Terap">Terap</option>
                        <option {{ ($profil->gol) == 'Bantara' ? 'selected' : '' }} value="Bantara">Bantara</option>
                        <option {{ ($profil->gol) == 'Laksana' ? 'selected' : '' }} value="Laksana">Laksana</option>
                        <option {{ ($profil->gol) == 'Garuda' ? 'selected' : '' }} value="Garuda">Garuda</option>
                        <option {{ ($profil->gol) == 'Teladan' ? 'selected' : '' }} value="Teladan">Teladan</option>
                        <option {{ ($profil->gol) == '-' ? 'selected' : '' }} value="-">-</option>
                      </select>
                </div>
                <div class="col-md-4">
                    <label class="form-label" for="inputEmail4">Jabatan</label>
                    <select class="form-select" id="inputState" name="jab" >
                        <option>Pilih...</option>
                        <option {{ ($profil->jab) == 'MABICAB' ? 'selected' : '' }} value="MABICAB">MABICAB</option>
                        <option {{ ($profil->jab) == 'MABIRAN' ? 'selected' : '' }} value="MABIRAN">MABIRAN</option>
                        <option {{ ($profil->jab) == 'MABISAKA' ? 'selected' : '' }} value="MABISAKA">MABISAKA</option>
                        <option {{ ($profil->jab) == 'ANCAB' ? 'selected' : '' }} value="ANCAB">ANCAB</option>
                        <option {{ ($profil->jab) == 'ANRAN' ? 'selected' : '' }} value="ANRAN">ANRAN</option>
                        <option {{ ($profil->jab) == 'DKC' ? 'selected' : '' }} value="DKC">DKC</option>
                        <option {{ ($profil->jab) == 'PINCAB SAKA' ? 'selected' : '' }} value="PINCAB SAKA">PINCAB SAKA</option>
                        <option {{ ($profil->jab) == 'PINRAN SAKA' ? 'selected' : '' }} value="PINRAN SAKA">PINRAN SAKA</option>
                        <option {{ ($profil->jab) == 'DKR' ? 'selected' : '' }} value="DKR">DKR</option>
                        <option {{ ($profil->jab) == 'PAMONG SAKA CABANG' ? 'selected' : '' }} value="PAMONG SAKA CABANG">PAMONG SAKA CABANG</option>
                        <option {{ ($profil->jab) == 'PAMONG SAKA RANTING' ? 'selected' : '' }} value="PAMONG SAKA RANTING">PAMONG SAKA RANTING</option>
                        <option {{ ($profil->jab) == 'DEWAN AMBALAN' ? 'selected' : '' }} value="DEWAN AMBALAN">DEWAN AMBALAN</option>
                        <option {{ ($profil->jab) == 'INSTRUKTUR SAKA CABANG' ? 'selected' : '' }} value="INSTRUKTUR SAKA CABANG">INSTRUKTUR SAKA CABANG</option>
                        <option {{ ($profil->jab) == 'INSTRUKTUR SAKA CABANG' ? 'selected' : '' }} value="INSTRUKTUR SAKA CABANG">INSTRUKTUR SAKA CABANG</option>
                        <option {{ ($profil->jab) == 'DEWAN SAKA' ? 'selected' : '' }} value="DEWAN SAKA">DEWAN SAKA</option>
                        <option {{ ($profil->jab) == 'ANGGOTA' ? 'selected' : '' }} value="ANGGOTA">ANGGOTA</option>
                      </select>
                </div>
                <div class="col-md-2">
                    <label class="form-label" for="inputEmail4">No Gugus Depan</label>
                    <input class="form-control" id="inputEmail4" type="text" name="nogusdep"  maxlength="6" placeholder="01.001" value="{{ $profil->nogusdep ?? '' }}">
                </div>
                <div class="col-md-5">
                    <label class="form-label" for="inputEmail4">Nama Gugus Depan</label>
                    <input class="form-control" id="inputEmail4" type="text" name="gusdep"  value="{{ $profil->gusdep ?? '' }}">
                </div>
                <div class="col-md-5">
                    <label class="form-label" for="inputEmail4">Pangkalan</label>
                    <input class="form-control" id="inputEmail4" type="text" name="pangkalan"  value="{{ $profil->pangkalan ?? '' }}">
                </div>
                <div class="col-md-6">
                    <label class="form-label" for="inputEmail4">Kwarran</label>
                    <select class="form-select" id="inputState" name="kwarran" >
                        <option >Pilih...</option>
                        <option {{ ($profil->kwarran) == 'RANCABALI' ? 'selected' : '' }} value="RANCABALI">RANCABALI - 09.04.001</option>
                        <option {{ ($profil->kwarran) == 'CIWIDEY' ? 'selected' : '' }} value="CIWIDEY">CIWIDEY - 09.04.002</option>
                        <option {{ ($profil->kwarran) == 'PASIR JAMBU' ? 'selected' : '' }} value="PASIR JAMBU">PASIR JAMBU - 09.04.003</option>
                        <option {{ ($profil->kwarran) == 'SOREANG' ? 'selected' : '' }} value="SOREANG">SOREANG - 09.04.004</option>
                        <option {{ ($profil->kwarran) == 'CANGKUANG' ? 'selected' : '' }} value="CANGKUANG">CANGKUANG - 09.04.005</option>
                        <option {{ ($profil->kwarran) == 'PANGALENGAN' ? 'selected' : '' }} value="PANGALENGAN">PANGALENGAN - 09.04.006</option>
                        <option {{ ($profil->kwarran) == 'CIMAUNG' ? 'selected' : '' }} value="CIMAUNG">CIMAUNG - 09.04.007</option>
                        <option {{ ($profil->kwarran) == 'BANJARAN' ? 'selected' : '' }} value="BANJARAN">BANJARAN - 09.04.008</option>
                        <option {{ ($profil->kwarran) == 'ARJASARI' ? 'selected' : '' }} value="ARJASARI">ARJASARI - 09.04.009</option>
                        <option {{ ($profil->kwarran) == 'PAMEUNGPEUK' ? 'selected' : '' }} value="PAMEUNGPEUK">PAMEUNGPEUK - 09.04.010</option>
                        <option {{ ($profil->kwarran) == 'BALEENDAH' ? 'selected' : '' }} value="BALEENDAH">BALEENDAH - 09.04.011</option>
                        <option {{ ($profil->kwarran) == 'CIPARAY' ? 'selected' : '' }} value="CIPARAY">CIPARAY - 09.04.012</option>
                        <option {{ ($profil->kwarran) == 'PACET' ? 'selected' : '' }} value="PACET">PACET - 09.04.013</option>
                        <option {{ ($profil->kwarran) == 'KERTASARI' ? 'selected' : '' }} value="KERTASARI">KERTASARI - 09.04.014</option>
                        <option {{ ($profil->kwarran) == 'IBUN' ? 'selected' : '' }} value="IBUN">IBUN - 09.04.015</option>
                        <option {{ ($profil->kwarran) == 'MAJALAYA' ? 'selected' : '' }} value="MAJALAYA">MAJALAYA - 09.04.016</option>
                        <option {{ ($profil->kwarran) == 'PASEH' ? 'selected' : '' }} value="PASEH">PASEH - 09.04.017</option>
                        <option {{ ($profil->kwarran) == 'SOLOKANJERUK' ? 'selected' : '' }} value="SOLOKANJERUK">SOLOKANJERUK - 09.04.018</option>
                        <option {{ ($profil->kwarran) == 'CIKANCUNG' ? 'selected' : '' }} value="CIKANCUNG">CIKANCUNG - 09.04.019</option>
                        <option {{ ($profil->kwarran) == 'NAGREG' ? 'selected' : '' }} value="NAGREG">NAGREG - 09.04.020</option>
                        <option {{ ($profil->kwarran) == 'CICALENGKA' ? 'selected' : '' }} value="CICALENGKA">CICALENGKA - 09.04.021</option>
                        <option {{ ($profil->kwarran) == 'RANCAEKEK' ? 'selected' : '' }} value="RANCAEKEK">RANCAEKEK - 09.04.022</option>
                        <option {{ ($profil->kwarran) == 'CIELUNYI' ? 'selected' : '' }} value="CIELUNYI">CIELUNYI - 09.04.023</option>
                        <option {{ ($profil->kwarran) == 'CILENGKRANG' ? 'selected' : '' }} value="CILENGKRANG">CILENGKRANG - 09.04.024</option>
                        <option {{ ($profil->kwarran) == 'CIMENYAN' ? 'selected' : '' }} value="CIMENYAN">CIMENYAN - 09.04.025</option>
                        <option {{ ($profil->kwarran) == 'BOJONGSOANG' ? 'selected' : '' }} value="BOJONGSOANG">BOJONGSOANG - 09.04.026</option>
                        <option {{ ($profil->kwarran) == 'DAYEUHKOLOT' ? 'selected' : '' }} value="DAYEUHKOLOT">DAYEUHKOLOT - 09.04.027</option>
                        <option {{ ($profil->kwarran) == 'KATAPANG' ? 'selected' : '' }} value="KATAPANG">KATAPANG - 09.04.028</option>
                        <option {{ ($profil->kwarran) == 'MARGAHAYU' ? 'selected' : '' }} value="MARGAHAYU">MARGAHAYU - 09.04.029</option>
                        <option {{ ($profil->kwarran) == 'MARGAASIH' ? 'selected' : '' }} value="MARGAASIH">MARGAASIH - 09.04.030</option>
                        <option {{ ($profil->kwarran) == 'KUTAWARINGIN' ? 'selected' : '' }} value="KUTAWARINGIN">KUTAWARINGIN - 09.04.031</option>
                      </select>
                </div>
                <div class="col-md-6">
                    <label for="formFileSm" class="form-label">Foto</label>
                    <input class="form-control form-control-sm" id="formFileSm" type="file"  name="foto" >
                    <?php
                    if($profil->foto==''){
                        $a="";
                    }else{
                        $a="$profil->foto";
                    }
                    ?>
                    <br>
                     <img src="{{ url($a) ?? '' }}" height="140" width="100" alt="" />
                </div>

                <div class="col-12">
                  <button class="btn btn-primary" type="submit">Perbarui</button>
                </div>
              </form>
        </div>
    </div>
    @endsection
    <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 () {
            $('#provinsi').on('change', function () {
                onChangeSelect('{{ route("cities") }}', $(this).val(), 'kota');
            });
            $('#kota').on('change', function () {
                onChangeSelect('{{ route("districts") }}', $(this).val(), 'kecamatan');
            })
            $('#kecamatan').on('change', function () {
                onChangeSelect('{{ route("villages") }}', $(this).val(), 'desa');
            })
        });
    </script>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

Editor is loading...