@extends('crudbooster::admin_template_no_side_bar')

@section('content')
<?php
    use Carbon\Carbon;
    setlocale(LC_TIME, 'id');
   // var_dump($pelatihan_baru);
?>
<section class="data-pelatihan">
    <div class="box">
        <div class="box-header">
            <strong>Anda akan Mendaftar "{{ $row->nama_pelatihan }}"</strong>
        </div>
        <div class="card" >
            <!--<img class="card-img-top" src="{{ asset('vendor/crudbooster/avatar.jpg') }}" alt="Card image cap">-->
            <div class="card-body">
                    <table  class="table table-hover table-striped table-bordered w-auto">
                        <tr>
                            <td>
                                Penyelenggara
                            </td>
                            <td>
                                {{ $row->penyelenggara }}
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Pelaksanaan
                            </td>
                            <td>
                                {{ $hari[strftime( "%w", strtotime($row->tanggal_mulai))] . ', ' . strftime( "%d %B %Y jam %X %Z", strtotime($row->tanggal_mulai)) . ' sampai ' . strftime( "%X %Z", strtotime($row->tanggal_akhir))  }}
                            </td>
                        </tr>
                </table>
           </div>
        </div>
    </div>
</section>
                   <div >
                         @if( date($row->akhir_daftar) >= date("Y-m-d"))
                            <form method='post' action='{{CRUDBooster::mainpath("daftar-pelatihan")}}'>
                		        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
                		        <input type="hidden" name="id" value="{{ $row->id }}"/>
                		        <input type="hidden" name="warga_bjb_id" value="{{ $warga_bjb_id }}"/>
                		        <input type="hidden" name="owner_priv" value="{{ $row->updated_by_priv }}"/>
                		        @if($row->usaha_required == 1)
                		            <div class="form-group">
                                        <label for="no_iumk">Nomor IUMK/IMK</label>
                                        <input type="text" class="form-control" id="no_iumk" name="no_iumk" value="{{ $pemilik->no_iumk }}">
                                       @if (!$pemilik->no_iumk)
                                            <div class="text-danger">Harap Lengkapi Nomor IUMK/IMK</div>
                                        @endif
                                        @if (\Session::has('pemilikreq'))
                                            <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                                        @endif
                            		</div>
                            		
                            		<div class="form-group">
                                        <label for="no_iumk">NIB/SKU</label>
                                        <input type="text" class="form-control" id="nib_sku" name="nib_sku" value="{{ $pemilik->nib_sku }}">
                                       @if (!$pemilik->nib_sku)
                                            <div class="text-danger">Harap Lengkapi Nomor NIB/SKU</div>
                                        @endif
                                        @if (\Session::has('pemilikreq'))
                                            <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                                        @endif
                            		</div>
                            		    
                            		<div class="form-group">
                                        <label for="no_iumk">Nomor NPWP</label>
                                        <input type="text" class="form-control" id="no_npwp" name="no_npwp" value="{{ $pemilik->no_npwp }}">
                                        @if (!$pemilik->no_npwp)
                                            <div class="text-danger">Harap Lengkapi Nomor NPWP</div>
                                        @endif
                                        @if (\Session::has('pemilikreq'))
                                            <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                                        @endif
                                    </div>
                                    
                                    <div class="form-group">
                                        <label for="no_iumk">Telp Seluler</label>
                                        <input type="text" class="form-control" id="no_telp" name="no_telp" value="{{ $pemilik->no_telp }}">
                                       @if (!$pemilik->no_telp)
                                            <div class="text-danger">Harap Lengkapi Nomor Telepon Seluler</div>
                                        @endif
                                        @if (\Session::has('pemilikreq'))
                                            <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                                        @endif
                            		</div>
                            		@if(sizeof($usaha)>0)
                                		<div class="form-group row">
                                            <div class="col-xs-3">
                                                <input class="form-check-input" type="radio" name="usaha_baru" id="usaha_existing" value="0" checked>
                                                <label class="form-check-label" for="usaha_existing">
                                                    Usaha Eksisting
                                                 </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <label>Pilih Usaha</label>
                                                <select name='usaha_id' class='form-control'>
                                                    @if(sizeof($usaha)==1)
                                                        @foreach($usaha as $usa)
                                                            <option value={{ $usa->id }}>{{ $usa->nama_usaha  }}</option>
                                                        @endforeach
                                                    @elseif(sizeof($usaha)>1)
                                                        <option value=0>--Pilih Usaha--</option>
                                                        @foreach($usaha as $usa)
                                                            <option value={{ $usa->id }}>{{ $usa->nama_usaha  }}</option>
                                                        @endforeach
                                                    @endif
                                                </select>
                                            </div>
                                		</div>
                            		
                                		<div class="form-check">
                                          <input class="form-check-input" type="radio" name="usaha_baru" id="usaha_baru" value="1">
                                          <label class="form-check-label" for="usaha_baru">
                                                Daftarkan Usaha Baru
                                          </label>
                                        </div>
                                    @else
                                        <div class="form-check">
                                          <input class="form-check-input" type="radio" name="usaha_baru" id="usaha_baru" value="1" checked>
                                          <label class="form-check-label" for="usaha_baru">
                                                Daftarkan Usaha Baru
                                          </label>
                                        </div>
                                    @endif
                		        @elseif($row->usaha_required == 2)
                				
                				@endif
                    			<div class='form-group'>
                    			    <!--<input type="submit" class='btn btn-primary' value="VERIFIKASI" style="margin-left:15px"/>-->
                    			    
                					<input type="submit" class='btn btn-primary' value="LANJUTKAN" style="margin-left:15px"/>
                					<a href="{{ CRUDBooster::mainpath('sistem-pelatihan')}}" class="btn btn-info">Kembali</a> 
                				</div>
                				
                			</form>
                            
                        @else
                            <a href="#" class="btn btn-danger">Peserta</a> 
                        @endif
                        @if (\Session::has('pelatihan_exist'))
                                <div class="text-danger">{!! \Session::get('pelatihan_exist') !!}</div>
                        @endif
                    </div>
                
                <br>
        
@endsection