<script type="text/javascript">

	var id_karyawan = "<?= md5($row->id_karyawan) ?>";
	function tab_datadiri(){
		$("#myTabContent").load("<?= route('master.karyawan.datadiri.detail') ?>"+"/"+id_karyawan);
    }
</script>
<?php
	if(in_array($this->session->userdata('level_user'), array("1")) || in_array($this->session->userdata('level_khusus'), array("1"))) {
?>
	<div class="row mb-2">
		<div class="col-md-12 text-right">
			<a href="<?= site_url('master/karyawan/export-pdf') ?>/<?= md5($row->id_karyawan) ?>" target="_blank" class="btn btn-outline-secondary round btn-min-width">
				<i class="fa fa-print"></i> Cetak Biodata
			</a>
			<?php if ($jml >=2) { ?>
				<a href="javascript:;" onclick="edit_informasi_datadiri('<?= md5($row->id_karyawan) ?>')" class="btn btn-outline-secondary round btn-min-width">
						<i class="fa fa-pencil"></i> Edit Data
				</a>
			<?php } else if($row->level_user != 1){ ?>
				<a href="javascript:;" onclick="edit_informasi_datadiri('<?= md5($row->id_karyawan) ?>')" class="btn btn-outline-secondary round btn-min-width">
						<i class="fa fa-pencil"></i> Edit Data
				</a>
			<?php } ?>
		</div>
	</div>
<?php
	}
?>
<div class="row form-detail-karyawan">
	<div class="col-md-8">
		<div class="row">
            <div class="col-md-12 text-primary"><h5>Data Diri</h5></div>
        </div>
		<hr>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Nomor Induk Karyawan</label>
					<p class="form-control-static" ><?= $row->nik ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Nama Lengkap</label>
					<p class="form-control-static" ><?= $row->nama_lengkap ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Pendidikan Terakhir</label>
					<p class="form-control-static" ><?= ((!empty($row->pendidikan_terakhir))?$row->pendidikan_terakhir:"-") ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Gelar Depan</label>
					<p class="form-control-static" ><?= ((!empty($row->gelar_depan))?$row->gelar_depan : '-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Gelar Belakang</label>
					<p class="form-control-static" ><?= ((!empty($row->gelar_belakang))? $row->gelar_belakang : '-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Jenis Kelamin</label>
					<p class="form-control-static"><?= ((!empty($row->jenis_kelamin))?$this->fungsi->jkel($row->jenis_kelamin):'-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Golongan Darah</label>
					<p class="form-control-static"><?= ((!empty($row->golongan_darah))? $row->golongan_darah : "-") ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Tempat Lahir</label>
					<p class="form-control-static" >
						<?= $row->tempat_lahir ?>
					</p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Tanggal Lahir</label>
					<p class="form-control-static"><?= ((!empty($row->tgl_lahir))?$this->fungsi->tgl_indo($row->tgl_lahir):'-') ?></p>
				</fieldset>
			</div>
		</div>

		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Nomor Telepon/Handphone</label>
					<p class="form-control-static" ><?= ((!empty($row->telepon))?$row->telepon:'-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Email</label>
					<p class="form-control-static"><?= ((!empty($row->email))?$row->email:'-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Agama</label>
					<p class="form-control-static"><?= ((!empty($row->agama))?$row->agama:'-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Nomor Induk Kependudukan(NIK)</label>
					<p class="form-control-static"><?= ((!empty($row->no_ktp))?$row->no_ktp:'-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<div class="form-group">
					<label class="form-label" for="no_bpjs_kes">Nomor BPJS Kesehatan</label>
					<p class="form-control-static"><?= $row->no_bpjs_kes != '' ? $row->no_bpjs_kes : '-' ?></p>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="form-label" for="no_bpjs_kes">Nomor BPJS Ketenagakerjaan</label>
					<p class="form-control-static"><?= $row->no_bpjs_tk != '' ? $row->no_bpjs_tk : '-' ?></p>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<label class="form-label" for="jml_anak">Jumlah Anak</label>
					<p class="form-control-static"><?= $row->jml_anak != '' ? $row->jml_anak : '-' ?></p>
			</div>
		</div>

		<div class="row mt-3">
            <div class="col-md-12 text-primary"><h5>Data Alamat</h5></div>
        </div>
		<hr>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Provinsi</label>
					<p class="form-control-static"><?= ((!empty($row->nama_prov))?$row->nama_prov:'-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Kota/Kabupaten</label>
					<p class="form-control-static"><?= ((!empty($row->nama_kota))?$row->nama_kota:'-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Kecamatan</label>
					<p class="form-control-static" ><?= ((!empty($row->nama_kec))?$row->nama_kec:'-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Kelurahan</label>
					<p class="form-control-static" ><?= ((!empty($row->nama_kel))?$row->nama_kel:'-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>RT</label>
					<p class="form-control-static" ><?= ((!empty($row->rt))?$row->rt:'-') ?></p>
				</fieldset>
			</div>
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>RW</label>
					<p class="form-control-static" ><?= ((!empty($row->rw))?$row->rw:'-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<fieldset class="form-group">
					<label>Alamat Domisili</label>
					<p class="form-control-static" ><?= ((!empty($row->alamat_domisili))?$row->alamat_domisili:'-') ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<fieldset class="form-group">
					<label>Kode Pos</label>
					<p class="form-control-static" ><?= ((!empty($row->kode_pos))?$row->kode_pos:'-') ?></p>
				</fieldset>
			</div>
		</div>

		<div class="row mt-3">
			<div class="col-md-12 text-primary"><h5>Data Kepegawaian</h5></div>
		</div>
		<hr>
		<?php
			$level_user = $row->level_user;
			if(in_array($level_user,array('1','6'))){ # Admin HR, Admin Finance
				$hidden_cabang = "d-none ";
				$hidden_departemen = "d-none ";
				$hidden_supervisi = "d-none ";
				$hidden_cuti = "d-none ";
				$hidden_status = "d-none ";
				$hidden_mulai_kerja = "d-none ";
				$hidden_berakhir_kerja = "d-none ";
			}else if($level_user == '4'){ #Direksi
				$hidden_departemen = "d-none ";
				$hidden_supervisi = "d-none ";
			}else if($level_user == '5'){ # Kepala Cabang
				$hidden_departemen = "d-none ";
				$hidden_supervisi = "d-none ";
			}else if($level_user == '2'){ # Kepala Departemen
				$hidden_departemen = " ";
				$hidden_supervisi = "d-none ";
			}else if($level_user == '7'){ # Supervisi
				$hidden_departemen = " ";
				$hidden_supervisi = "d-none ";
			}else{ # STaff
				$hidden_departemen = " ";
				$hidden_supervisi = " ";
			}
		?>
		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Jabatan</label>
					<p class="form-control-static" ><?= isset($row->nama_jabatan) ? $row->kode_jabatan." - ".$row->nama_jabatan : "" ?></p>
				</fieldset>
			</div>
			<div class="col-md-6 <?= $hidden_cabang ?>">
				<fieldset class="form-group">
					<label>Cabang</label>
					<p class="form-control-static" ><?= isset($row->nama_cabang) ? $row->kode_cabang." - ".$row->nama_cabang : "" ?></p>
				</fieldset>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6 <?= $hidden_departemen ?>">
				<fieldset class="form-group">
					<label>Departemen</label>
					<p class="form-control-static" ><?= isset($row->nama_departemen) ? $row->kode_departemen." - ".$row->nama_departemen : "-" ?></p>
				</fieldset>
			</div>
			<div class="col-md-6 <?= $hidden_supervisi ?>">
				<fieldset class="form-group">
					<label>Supervisi</label>
					<p class="form-control-static" ><?= isset($row->nama_supervisi) ? $row->nik_supervisi." - ".$row->nama_supervisi : "-" ?></p>
				</fieldset>
			</div>
		</div>

		<div class="row">
			<div class="col-md-6 <?= $hidden_cuti ?>">
				<fieldset class="form-group">
					<label>Jatah Cuti</label>
					<p class="form-control-static" ><?= $row->jatah_cuti ?></p>
				</fieldset>
			</div>
			<div class="col-md-6 <?= $hidden_status ?>">
				<fieldset class="form-group">
					<label>Status</label>
					<p class="form-control-static" ><?= $this->fungsi->status_karyawan($row->status) ?></p>
				</fieldset>
			</div>
		</div>

		<?php
			$status_karyawan = $row->status;
			if($status_karyawan == "1"){
				$label_aktif_bekerja 	= "Tanggal Mulai Kontrak";
				$label_berhenti_bekerja	= "Tanggal Berakhir Kontrak";
			}else if(in_array($status_karyawan,["2","3","4"])){
				$label_aktif_bekerja 	= "Tanggal Aktif";
				$label_berhenti_bekerja	= "";
			}else if($status_karyawan == "5"){
				$label_aktif_bekerja 	= "Tanggal Aktif";
				$label_berhenti_bekerja	= "Tanggal Resign";
			}else if($status_karyawan == "6"){
				$label_aktif_bekerja 	= "Tanggal Aktif";
				$label_berhenti_bekerja	= "Tanggal Dikeluarkan(PHK)";
			}else if($status_karyawan == "7"){
				$label_aktif_bekerja 	= "Tanggal Aktif";
				$label_berhenti_bekerja	= "Tanggal Pensiun";
			}
		?>
		<div class="row">
			<div class="col-md-6 <?= $hidden_mulai_kerja ?>">
				<fieldset class="form-group">
					<label><?= $label_aktif_bekerja ?></label>
					<p class="form-control-static" ><?= ((!empty($this->fungsi->tgl_indo($row->tgl_aktif_bekerja)))?$this->fungsi->tgl_indo($row->tgl_aktif_bekerja):'-') ?></p>
				</fieldset>
			</div>
			<?php
				if(in_array($row->status,["1","5","6","7"])){
			?>
					<div class="col-md-6 <?= $hidden_berakhir_kerja ?>">
						<fieldset class="form-group">
							<label><?= $label_berhenti_bekerja?></label>
							<p class="form-control-static" >
								<?php
									if ($row->tgl_berhenti_bekerja != '0000-00-00') {
										$periode = $this->fungsi->tgl_indo($row->tgl_berhenti_bekerja);
									}else{
										$periode = "-";
									}

									echo $periode;
								?>
							</p>
						</fieldset>
					</div>
			<?php
				}
			?>
		</div>

		<div class="row">
			<div class="col-md-6">
				<fieldset class="form-group">
					<label>Join Date</label>
					<p class="form-control-static" ><?= ((!empty($this->fungsi->tgl_indo($row->join_date)))?$this->fungsi->tgl_indo($row->join_date):'-') ?></p>
				</fieldset>
			</div>
		</div>
	</div>

	<div class="col-md-4 text-center">
		<div class="row">
			<div class="col-md-12 text-primary"><h5>Foto Profil</h5></div>
		</div>
		<hr>
		<div class="row">
			<div class="col-md-12 thumbnail">
				<?php
					$foto = $this->config->item('base_image').'imagebiodata?_t=photo&_d='.$row->foto;
				?>
				<img src="<?= $foto; ?>" class="portrait" style="max-height:200px">
			</div>
		</div>
	</div>
</div>

<!-- jQuery file upload -->
<script>
	$(document).ready(function() {
		$('.dropify').dropify();
	});
</script>