<!-- First, extends to the CRUDBooster Layout -->
<?php
setlocale(LC_ALL, 'IND');

//var_dump($usaha);
?>

@extends('crudbooster::admin_template_no_side_bar')
@section('content')
  <form method='post' action='{{ $next }}'>
        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
        <input type="hidden" name="warga_bjb_id" value="{{ $warga_bjb_id }}"/>
        <input type="hidden" name="pemilik_id" value="{{ $pemilik_id }}"/>

    		 <div class="form-group">
                <label for="nama_usaha">Nama usaha</label>
                <input type="text" class="form-control" id="nama_usaha" name="nama_usaha" value="{{ $usaha->nama_usaha }}" required>
                @if (\Session::has('pemilikreq'))
                    <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                @endif
    		</div>
            <div class="form-group">
                <label>Bidang Usaha</label>
                @foreach($bidang_usaha as $bu)
                  <div class="form-check">
                    <input class="form-check-input" type="checkbox" id="{{ 'bidang_usaha'.$bu->id }}" name="bidang_usaha[]" value="{{ $bu->bidang }}" {{ in_array( $bu->bidang,explode(";",$usaha->bidang_usaha)) ? "checked" : "" }} required>
                    <label class="form-check-label" for="{{ 'bidang_usaha'.$bu->id }}">
                       {!! $bu->bidang !!} 
                    </label>
                </div>
                 @endforeach
            </div>
            <div class="form-group">
                <label>Sub Bidang Usaha</label>
                @foreach($sub_bidang_usaha as $sbu)
                  <div class="form-check">
                    <input class="form-check-input" type="checkbox" id="{{ 'sub_bidang_usaha'.$sbu->id }}" name="sub_bidang_usaha[]" value="{{ $sbu->bidang }}" {{ in_array( $sbu->bidang,explode(";",$usaha->sub_bidang_usaha)) ? "checked" : "" }}>
                    <label class="form-check-label" for="{{ 'sub_bidang_usaha'.$sbu->id }}">
                       {!! $sbu->bidang !!} 
                    </label>
                </div>
                 @endforeach
            </div>
            <div class="form-group">
                <label for="nama_usaha">Brand</label>
                <input type="text" class="form-control" id="brand" name="brand" value="{{ $usaha->brand }}" required>
                @if (\Session::has('pemilikreq'))
                    <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                @endif
    		</div>
    		
    		<div class="form-group">
                <label for="nama_usaha">Alamat Usaha</label>
                <input type="text" class="form-control" id="alamat_usaha" name="alamat_usaha" value="{{ $usaha->alamat_usaha }}" required>
                @if (\Session::has('pemilikreq'))
                    <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                @endif
    		</div>
    		
    		@if(CRUDBooster::myPrivilegeId()==5)
    		    <div class="form-group" >
                <label for="district_id">Kecamatan</label>
                <select class="form-control" id="district_id" name="district_id" required disabled>
                   <?php foreach ($kecamatan as $kec):?>
                        <option value="<?=CRUDBooster::me()->district_id?>"<? if($kec->id == CRUDBooster::me()->district_id) echo " selected"?>><?=$kec->name?></option>
                    <?php endforeach;?>
                </select>
              </div>
  
            <div class="form-group" disabled>
                <label for="village_id">Kelurahan</label>
                <select class="form-control" id="village_id" name="village_id" required disabled>
                    @foreach($kelurahan as $kel)
                        <option value="{{ CRUDBooster::me()->village_id }}" {{ CRUDBooster::me()->village_id==$kel->id ? "selected" : "" }}>{{  $kel->name }}</option>
                     @endforeach
                </select>
              </div>
    		@else
    		<div class="form-group">
                <label for="district_id">Kecamatan</label>
                <select class="form-control" id="district_id" name="district_id" required>
                   <?php foreach ($kecamatan as $kec):?>
                        <option value="<?=$kec->id?>"<? if($kec->id == $usaha->district_id) echo " selected"?>><?=$kec->name?></option>
                    <?php endforeach;?>
                </select>
              </div>
  
            <div class="form-group">
                <label for="village_id">Kelurahan</label>
                <select class="form-control" id="village_id" name="village_id" required>
                    @foreach($kelurahan as $kel)
                        <option value="{{ $kel->id }}" {{ $usaha->village_id==$kel->id ? "selected" : "" }}>{{  $kel->name }}</option>
                     @endforeach
                </select>
              </div>
            @endif
              
            <div class="form-group">
                <label>Status Usaha</label>
                @foreach($umkm_status_tempat as $usu)
                  <div class="form-check">
                    <input class="form-check-input" type="checkbox" id="{{ 'status_usaha_id'.$usu->id }}" name="status_usaha_id[]" value="{{ $usu->status }}" {{ in_array( $usu->status,explode(";",$usaha->status_usaha_id)) ? "checked" : "" ? "checked" : "" }}>
                    <label class="form-check-label" for="{{ 'status_usaha_id'.$usu->id }}">
                       {!! $usu->status !!} 
                    </label>
                </div>
                 @endforeach
            </div>
            
            <div class="form-group">
                <label>Perizinan yang dimiliki</label>
                @foreach($umkm_perizinan as $uzin)
                  <div class="form-check">
                    <input class="form-check-input" type="checkbox" id="{{ 'perizinan'.$uzin->id }}" name="perizinan[]" value="{{ $uzin->perizinan }}" {{ in_array( $uzin->perizinan,explode(";",$usaha->perizinan)) ? "checked" : "" }}>
                    <label class="form-check-label" for="{{ 'perizinan'.$uzin->id }}">
                       {!! $uzin->perizinan !!} 
                    </label>
                </div>
                 @endforeach
            </div>
            
            <div class="form-group">
                <label>Fasilitas Pembiayaan/Permodalan</label>
                @foreach($umkm_permodalan as $umod)
                  <div class="form-check">
                    <input class="form-check-input" type="checkbox" id="{{ 'permodalan_id'.$umod->id }}" name="permodalan_id[]" value="{{ $umod->permodalan }}" {{ in_array( $umod->permodalan,explode(";",$usaha->permodalan_id)) ? "checked" : "" }}>
                    <label class="form-check-label" for="{{ 'permodalan_id'.$umod->id }}">
                       {!! $umod->permodalan !!} 
                    </label>
                </div>
                 @endforeach
            </div>
            


                    <div class="form-group row">
                        <div class="col-sm-4">
                            <label for="j_kary_l">Karyawan Laki-laki</label>
                            <input type="number" class="form-control" id="j_kary_l" name="j_kary_l" value="{{ $usaha->j_kary_l }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
                        <div class="col-sm-4">
                            <label for="j_kary_p">Karyawan Perempuan</label>
                            <input type="number" class="form-control" id="j_kary_p" name="j_kary_p" value="{{ $usaha->j_kary_p }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
                        <div class="col-sm-4">
                            <label for="j_kary">Total Karyawan</label>
                            <input type="number" class="form-control" id="j_kary" name="j_kary" value="{{ $usaha->j_kary }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
            		</div>
            		
            		<div class="form-group row">
                        <div class="col-sm-4">
                            <label for="modal_awal">Modal Awal</label>
                            <input type="number" class="form-control" id="modal_awal" name="modal_awal" value="{{ $usaha->modal_awal }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
                        <div class="col-sm-4">
                            <label for="modal_saat_ini">Modal Saat Ini</label>
                            <input type="number" class="form-control" id="modal_saat_ini" name="modal_saat_ini" value="{{ $usaha->modal_saat_ini }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
            		</div>
                    
                    <div class="form-group row">
                        <div class="col-sm-4">
                            <label for="aset_tetap">Aset Tetap</label>
                            <input type="number" class="form-control" id="aset_tetap" name="aset_tetap" value="{{ $usaha->aset_tetap }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
                        <div class="col-sm-4">
                            <label for="omset">Omset</label>
                            <input type="number" class="form-control" id="omset" name="omset" value="{{ $usaha->omset }}">
                            @if (\Session::has('pemilikreq'))
                                <div class="text-danger">{!! \Session::get('pemilikreq') !!}</div>
                            @endif
                        </div>
            		</div>

   

		<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('by-admin/'.$id)}}" class="btn btn-info">Ulangi</a> 
		</div>
	</form>

		

@endsection