@extends('layouts.front.masterapp')

@section('content')
<div class="content-wrapper container"> 
    <div class="page-heading">
       

        <!-- // Basic multiple Column Form section start -->
    <section id="multiple-column-form">
        <div class="row match-height">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h4 class="card-title">Riwayat Pendidikan (edit)</h4>
                    </div>
                    <div class="card-content">
                        <div class="card-body">
                        <form action="{{route('pendidikan.update', $biodatapendidikan->id)}}"  method="POST" enctype="multipart/form-data" class="form">
                        @csrf @method('PATCH')
                      
                         <div class="row">

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                <label for="first-name-column">Pendidikan *</label>
                                    <select name="sms_id" class="form-select select2" required>
                                            <option value="">Pendidikan</option>
                                            @foreach ($MsRefSms as $key => $value)
                                                <option value="{{ $value->id }}"  {{ ( $value->id == $biodatapendidikan->sms_id) ? 'selected' : '' }}> {{ $value->jenjangPendidikan->nm_jenj_didik }} {{ $value->nama }}</option>
                                            @endforeach
                                    </select>
                                </div>
                                @if ($errors->has('lembaga'))
                                    <span class="text-danger">{{$errors->first('lembaga')}}</span>
                                @endif
                            </div>
      
                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                <label for="last-name-column">Akreditas Prodi (Saat Lulus) *</label>
                                <select class="form-select" name="akreditasi">
                                    <option value="A" {{ old('akreditasi') == "A" ? "selected" :""}}  @if (!empty($biodatapendidikan) && $biodatapendidikan->akreditasi == "A")){{ 'selected' }} @endif>A</option>
                                    <option value="B" {{ old('akreditasi') == "B" ? "selected" :""}} @if (!empty($biodatapendidikan) && $biodatapendidikan->akreditasi == "B")){{ 'selected' }} @endif>B</option>
                                    <option value="C" {{ old('akreditasi') == "C" ? "selected" :""}} @if (!empty($biodatapendidikan) && $biodatapendidikan->akreditasi == "C")){{ 'selected' }} @endif>C</option>
                                </select>
                                </div>
                                @if ($errors->has('akreditasi'))
                                    <span class="text-danger">{{$errors->first('akreditasi')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="last-name-column">Lembaga/Institusi *</label>
                                    <input type="text" class="form-control"
                                        placeholder="Lembaga/Institusi" name="lembaga" value="{{ old('lembaga').@$biodatapendidikan->lembaga }}">
                                </div>
                                @if ($errors->has('lembaga'))
                                    <span class="text-danger">{{$errors->first('lembaga')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="city-column">Tahun Masuk *</label>
                                    <input type="number" class="form-control" placeholder="Tahun Masuk"
                                        name="tahun_masuk" value="{{ old('tahun_masuk').@$biodatapendidikan->tahun_masuk }}">
                                </div>
                                @if ($errors->has('tahun_masuk'))
                                    <span class="text-danger">{{$errors->first('tahun_masuk')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="country-floating">Tahun Lulus *</label>
                                    <input type="number" class="form-control"
                                        name="tahun_lulus" placeholder="Tahun Lulus" value="{{ old('tahun_lulus').@$biodatapendidikan->tahun_lulus }}">
                                </div>
                                @if ($errors->has('tahun_lulus'))
                                    <span class="text-danger">{{$errors->first('tahun_lulus')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="company-column">IPK *</label>
                                    <input type="text" class="form-control decimal"
                                        name="ipk" placeholder="IPK"  value="{{ old('ipk').@$biodatapendidikan->ipk }}">
                                </div>
                                @if ($errors->has('ipk'))
                                    <span class="text-danger">{{$errors->first('ipk')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="email-id-column">Unggah Ijazah (ASLI) * <code>.pdf ukuran Maks. 500 kb</code></label>
                                    <input type="file" class="form-control"
                                        name="ijazah"  accept="application/pdf" >
                                </div>
                                @if (!empty($biodatapendidikan->ijazah))
                                    <a href="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/rekrutmen/ijazah/{!!$biodatapendidikan->ijazah!!}" target="_blank"><span class="badge bg-info">Ijazah</span></a>        
                                @endif
                                @if ($errors->has('ijazah'))
                                    <span class="text-danger">{{$errors->first('ijazah')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="email-id-column">Unggah Transkip (ASLI) * <code>.pdf ukuran Maks. 500 kb</code></label>
                                    <input type="file" class="form-control"
                                        name="transkrip"  accept="application/pdf">
                                </div>
                                @if (!empty($biodatapendidikan->transkrip))
                                    <a href="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/rekrutmen/transkrip/{!!$biodatapendidikan->transkrip!!}" target="_blank"><span class="badge bg-info">Transkip</span></a>        
                                @endif
                                @if ($errors->has('transkrip'))
                                    <span class="text-danger">{{$errors->first('foto')}}</span>
                                @endif
                            </div>

                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="email-id-column">Unggah Akreditasi Prodi (ASLI) *<code>.pdf ukuran Maks. 500 kb</code></label>
                                    <input type="file" class="form-control"
                                        name="akreditasi_file"  accept="application/pdf">
                                </div>
                                @if (!empty($biodatapendidikan->akreditasi_file))
                                    <a href="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/rekrutmen/akreditasi_file/{!!$biodatapendidikan->akreditasi_file!!}" target="_blank"><span class="badge bg-info">Akreditasi Prodi</span></a>        
                                @endif
                                @if ($errors->has('akreditasi_file'))
                                    <span class="text-danger">{{$errors->first('akreditasi_file')}}</span>
                                @endif
                            </div>

                           
                            <div class="col-md-6 col-12">
                                <div class="form-group">
                                    <label for="email-id-column">Unggah Dokumen Penyetaraan Untuk Lulusan Luar Negeri <code>.pdf ukuran Maks. 500 kb</code></label>
                                    <input type="file" class="form-control"
                                        name="dokumen_penyetaraan_luar_negeri"  accept="application/pdf">
                                </div>
                                @if (!empty($biodatapendidikan->dokumen_penyetaraan_luar_negeri))
                                    <a href="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/rekrutmen/dokumen_penyetaraan_luar_negeri/{!!$biodatapendidikan->dokumen_penyetaraan_luar_negeri!!}" target="_blank"><span class="badge bg-info">Dokumen Penyetaraan Untuk Lulusan Luar Negeri</span></a>        
                                @endif
                                @if ($errors->has('dokumen_penyetaraan_luar_negeri'))
                                    <span class="text-danger">{{$errors->first('dokumen_penyetaraan_luar_negeri')}}</span>
                                @endif
                            </div>



                            <div class="col-12 d-flex justify-content-end">
                                <button type="submit" class="btn btn-primary me-1 mb-1">Submit</button>
                                <button type="reset" class="btn btn-light-secondary me-1 mb-1">Reset</button>
                            </div>
</div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
   
    </div>
</div>
<script>
       $('.decimal').keyup(function(){
        var val = $(this).val();
        if(isNaN(val)){
        val = val.replace(/[^0-9\.]/g,'');
        if(val.split('.').length>2) 
        val =val.replace(/\.+$/,"");
     }
         $(this).val(val); 
     });
</script>
@endsection
