<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery.simplePagination.js"></script>
<div id="popup_pengacara_list" class="centering" style="width:100%;margin-top: 1%;background:white;height:95%;">
	<div id="pageTitle">REFERENSI PENGACARA</div>
	<div id="right" style="margin-top: 4px;margin-right: 6px;"><input type="button" id='close_form_2nd' value="Kembali" class="btn"></div>
	<div style="margin:3px;clear:both;"></div>
	<hr class="thick-line" style="clear:both;">
	<div id="left">
		<?php
		$attributes = array('id' => 'form_search_pengacara');
		echo form_open(base_url().'pengacara_list/searchPage',$attributes);
		?>
		<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
			<select name="search_field" id="search_field" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
					<option value="0">Semua Kolom</option>
					<option value="1">Nama</option>
					<option value="2">Alamat</option>
					<option value="3">Tempat Lahir</option>
					<option value="4">Tanggal Lahir</option>
					<option value="5">Pekerjaan</option>
			</select>
		</span>
		<?php
		$attributes = array('name' => 'keyword_pengacara', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
		echo form_input($attributes);
		$data = array(
			'enc' => "enc"
		);
		echo form_hidden($data);
		echo "<span>  </span>";
		$attributes = array('value' => 'Search', 'class' => 'btn', 'id' => 'search-btn1', 'type' => 'submit');
		echo form_submit($attributes);
		echo form_close('');
		?>
	</div>
	<div id="right" style="margin-top: 0px;margin-right: 6px;"><input type="button" id='addpengacara' value="Tambah" class="btn"></div>
	<div id="pages" >
    	<div id="selector" style="padding: 4px 5px 5px 0;"></div>
    </div>
	<div class="cssTable">
		<table id="tablePerkaraAll">
			<col  width="4%" />
			<col  width="4%" />
			<col  width="3%" />
			<col  width="23%" />
			<col  width="30%" />
			<col  width="13%" />
			<col  width="10%" />
			<col  width="13%" />
        	<tbody>
				<tr>
					<td></td>
					<td></td>
					<td>No</td>
					<td onclick="sorting(1)">Nama</td>
					<td onclick="sorting(2)">Alamat</td>
					<td onclick="sorting(7)">Tempat/Tanggal Lahir</td>
					<td onclick="sorting(5)">Jenis Kelamin</td>
					<td onclick="sorting(6)">Pekerjaan</td>
				</tr>
				<?php
				if($pengacara!=''){
					$i=$counter+1;
					if($pengacara->num_rows>0){
						foreach ($pengacara->result() as $row) {
							if($row->jenis_kelamin=='L'){
								$sex = 'Laki-Laki';
							}elseif ($row->jenis_kelamin=='P') {
								$sex = 'Perempuan';
							}else{
								$sex='';
							}
							$ttl = $row->tempat_lahir;
							if(!empty($row->tanggal_lahir)){
								$ttl .= ', ';
								$ttl .= $this->tanggalhelper->convertDate($row->tanggal_lahir);
							}							
							echo "<tr>";
							echo "<td style='text-align:center;'><a href='#' onClick='pilih(\"".base64_encode($this->encrypt->encode($row->id))."\")'>[Pilih]</a></td>";
							echo "<td style='text-align:center;'><a href='#' onClick='edit(\"".base64_encode($this->encrypt->encode($row->id))."\")'>[Edit]</a></td>";
							echo "<td>".$i."</td>";
							echo "<td style='text-overflow: ellipsis;white-space: nowrap;overflow: hidden;'>".$row->nama."</td>";
							echo "<td>".$row->alamat."</td>";
							echo "<td>".$ttl."</td>";
							echo "<td>".$sex."</td>";
							echo "<td>".$row->pekerjaan."</td>";
							echo "</tr>";
							$i++;
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    	<div id="selector_bottom"></div>
	</div>
	<div style="margin:bottom:5px;"></div>
</div>
<div id="popup_pengacara" class="popup">
	<div style="margin: 0 auto;top: 50%;margin-top: 1%;margin-bottom: 25px;">
		<div class="detil" style="background-color:white;border-color: white;font-size:14px;margin-top:25px;width: 40%;margin: 0 auto;">
			<div id="sub_title" style="padding:10px;color:#5FB85C;text-align:center;">TAMBAH REFERENSI DATA PENGACARA</div>
			<form id="frm_ref_pengacara" style="background:white;margin:0;" method="post" action="<?php echo base_url().'pengacara_list/validateInput';?>">
				<table id="tableDetilPerkara" style="font-size:14px;">
				<col width="40%">
				<col width="60%">
					<tbody>
						<tr>
							<td>Nama <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_fullname' name='pengacara_fullname' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Tempat Lahir <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_tempat_lahir' name='pengacara_tempat_lahir' value="" class="standard-input" maxlength="255">
							</td>
						</tr>
						<tr>
							<td>Tanggal Lahir <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input id="pengacara_tgl_lahir" name="pengacara_tgl_lahir" value="<?php echo date('d/m/Y');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Umur</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_umur' name='pengacara_umur' value="" class="standard-input" maxlength="2" style="width:50px;">
							</td>
						</tr>
						<tr>
							<td>Jenis Identitas</td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pengacara_jenis_identitas" id="pengacara_jenis_identitas" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Identitas</option>
										<option value="1">Kartu BPJS</option>
										<option value="2">Kartu Keluarga</option>
										<option value="3">Kartu Pelajar</option>
										<option value="4">KTP</option>
										<option value="5">Paspor</option>
										<option value="6">SIM</option>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>No Identitas</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_no_identitas' name='pengacara_no_identitas' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>No Telepon</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_no_tlp' name='pengacara_no_tlp' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Alamat Email</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_email' name='pengacara_email' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Jenis Kelamin <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pengacara_jenis_kelamin" id="pengacara_jenis_kelamin" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Jenis Kelamin</option>
										<option value="1">Laki Laki</option>
										<option value="2">Perempuan</option>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>Agama <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pengacara_agama" id="pengacara_agama" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Agama</option>
										<?php
										if($agama!=''){
											if($agama->num_rows()>0){
												foreach ($agama->result() as $row) {
													echo '<option value="'.$row->id.'" '.$select.'>'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>Warga Negara <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pengacara_warga_negara" id="pengacara_warga_negara" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<?php
										if($country!=''){
											if($country->num_rows()>0){
												foreach ($country->result() as $row) {
													$select = ($row->nama=='Indonesia')? 'selected':'';
													echo '<option value="'.$row->id.'" '.$select.'>'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>Alamat <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="pengacara_alamat" name="pengacara_alamat" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
							<td>Status Kawin <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pengacara_status_kawin" id="pengacara_status_kawin" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Status Kawin</option>
										<option value="1">Kawin</option>
										<option value="2">Belum Kawin</option>
										<option value="3">Duda</option>
										<option value="4">Janda</option>
									</select>
								</span>
							</td>
							<input type="hidden" id='keyword_pengacara' name="keyword_pengacara" value="<?php echo $keyword;?>">
							<input type="hidden" id='pengacara_id_frm_ref_pengacara' name="pengacara_id" value="">
						</tr>
						<tr>
							<td>Pendidikan <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pengacara_pendidikan" id="pengacara_pendidikan" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Pendidikan</option>
										<?php
										if($pendidikan!=''){
											if($pendidikan->num_rows()>0){
												foreach ($pendidikan->result() as $row) {
													echo '<option value="'.$row->id.'">'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
							</td>
							<input type="hidden" id="act_frm_ref_pengacara" name="act" value="">
						</tr>
						<tr>
							<td>Golongan Darah</td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:170px;'>
									<select name="pengacara_gol_darah" id="pengacara_gol_darah" style='width:170px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Golongan Darah</option>
										<option value="A">A</option>
										<option value="AB">AB</option>
										<option value="B">B</option>
										<option value="O">O</option>
									</select>
								</span>
							</td>
							<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
						</tr>
						<tr>
							<td>Nomor Induk</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pengacara_no_induk' name='pengacara_no_induk' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Nomor SK Menteri</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='no_sk_menteri' name='no_sk_menteri' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Tanggal SK Menteri</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_sk_menteri" name="tgl_sk_menteri" value="<?php echo date('d/m/Y');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Tanggal Penyumpahan PN</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_sumpah_pn" name="tgl_sumpah_pn" value="<?php echo date('d/m/Y');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Tanggal Penyumpahan PT</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_sumpah_pt" name="tgl_sumpah_pt" value="<?php echo date('d/m/Y');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Alamat Kantor<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="pengacara_alamat_kantor" name="pengacara_alamat_kantor" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
							<td>Keterangan</td>
							<td style="padding:0px;padding-left:5px;border:0px;">
								<textarea id="pengacara_keterangan" name="pengacara_keterangan" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
								<td colspan="2" style="background:white;" align="center">
								<input type="button" id='back_pengacara' value="Kembali" class="btn">
								<?php
								#if($this->authorization->isAuthorized('hakim_pn_edit',$AuthorizationForm)){
								?>
									<input type="submit" id="simpan_btn" value="Simpan" class="btn">
								<?php
								#}
								?>
							</td>
							</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
$('#close_form_2nd').closingForm2ndWin();

$("#pengacara_tgl_lahir").change(function() {
	var error = 0;
	var tmp = $(this).val().split("/");
	var tmp2 = $('#curr_date').val().split("/");
	dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
	var today = new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00");
	var age = Math.floor((today-dob) / (365.25 * 24 * 60 * 60 * 1000));
	if(age<5 || age >100){
		message = 'Tanggal Lahir Tidak Valid. Silahkan Periksa Kembali';
		error = 1
	}
	if(error==1){
		message_show(message);
		$(this).css("background-color", "red");
	}else{
		$('#pengacara_umur').val(age);
		$(this).css("background-color", "#dedbdb");
	}
	error = 0;
});

$("#pengacara_umur").change(function() {
	var age = $('#pengacara_umur').val();
	var error = 0;
	var tmp2 = $('#curr_date').val().split("/");
	var year = tmp2[2]-age;
	if(age<5 || age >100){
		message_show('Tanggal Lahir Tidak Valid. Silahkan Periksa Kembali');
		$(this).css("background-color", "red");
	}else{
		var tglLahir = tmp2[0]+'/'+tmp2[1]+'/'+year;
		$("#pengacara_tgl_lahir").val(tglLahir)
		$(this).css("background-color", "#dedbdb");
	}
});

$("#addpengacara").click(function() {
	clearAll();
	$('#popup_pengacara_list').fadeOut();
	$('#popup_pengacara').fadeIn();
	$('#edit_btn').hide();
	$('#act_frm_ref_pengacara').val('add');
    $("body").css({overflow: 'hidden'});
});

$("#back_pengacara").click(function() {
	$('#popup_pengacara_list').fadeIn();
	$('#popup_pengacara').fadeOut();
    $("body").css({overflow: 'hidden'});
    if($("#refresh").val()==1){
    	refreshPengacaraList();
    }
    $("#refresh").remove();
});


$('#frm_ref_pengacara').SubmitHandling({
	refresh:'1',
	clicked:1,
	btnClicked:'#back_pengacara',
	whenStatus:1
});

function clearAll(){
	$('#popup_pengacara :input').not('.btn').not('#curr_date').val('');
	$('#popup_pengacara .hidden').hide();
	$('#pengacara_jenis_pengacara').val(1);
	$('#pengacara_warga_negara').val(98);
}

function pilih(val){
	if(val==""){
		message_show("Error <br/> Refresh Browser Anda");
		return;
	}
	openLoadingDialog()
	$.post('<?php echo base_url()?>pengacara_list/fetchPengacara', {
		val:val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading();
		if(json.isLengkap==0){
			message_show("Data Pengacara Tidak Lengkap, Data "+json.notFill+" Tidak Ada. Silahkan Lengkapi terlebih dahulu. Klik Edit.");
			return;
		}else if(json.st==1){
			$('#enc_pengacara').val(json.enc_pengacara);
			$('#fullname').val(json.nama);
			$('#tempat_lahir').val(json.tempatLahir);
			$('#tgl_lahir').val(json.tglLahir);
			$('#umur').val(json.umur);
			$('#jenis_kelamin').val(json.sex);
			$('#warga_negara').val(json.wargaNegara);
			$('#alamat').val(json.alamat);
			$('#pekerjaan').val(json.pekerjaan);
			$('#pendidikan').val(json.pendidikan);
			$('#keterangan').val(json.keterangan);
			$('#statusKawin').val(json.statusKawin);
			if(json.enc_pengacara=="" || json.nama=="" || json.tempatLahir=="" || json.tglLahir=="" || json.umur=="" || json.sex=="" || json.wargaNegara=="" || json.alamat=="" || json.pekerjaan=="" || json.pendidikan=="" || json.statusKawin==""){
				message_show("Data Pengacara Tidak Lengkap, Data "+json.notFill+" Tidak Ada. Silahkan Lengkapi terlebih dahulu. Klik Edit.");
				return;
			}else{
				$('#close_form_2nd').click();
			}
		}else if(json.st==0){
			message_show(json.msg);
		}
	});
}

function edit(val){
	if(val==""){
		message_show("Error <br/> Refresh Browser Anda");
		return;
	}

	openLoadingDialog()
	$.post('<?php echo base_url()?>pengacara_list/fetchpengacara', {
		val:val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading()
		if(json.st==1){
			$('#pengacara_id_frm_ref_pengacara').val(json.enc_pengacara);
			$('#pengacara_jenis_pengacara').val(json.IDJenispengacara);
			$('#pengacara_fullname').val(json.nama);
			$('#pengacara_tempat_lahir').val(json.tempatLahir);
			$('#pengacara_tgl_lahir').val(json.tglLahir);
			$('#pengacara_umur').val(json.umur);
			$('#pengacara_jenis_kelamin').val(json.IDSex);
			$('#pengacara_warga_negara').val(json.IDWargaNegara);
			$('#pengacara_alamat').val(json.alamat);
			$('#pengacara_pekerjaan').val(json.pekerjaan);
			$('#pengacara_pendidikan').val(json.IDPendidikan);
			$('#pengacara_keterangan').val(json.keterangan);
			$('#pengacara_no_tlp').val(json.noTlp);
			$('#pengacara_jenis_identitas').val(json.jenisIdentitas);
			$('#pengacara_no_identitas').val(json.noIdentitas);
			$('#pengacara_gol_darah').val(json.golDarah);
			$('#pengacara_agama').val(json.IDAgama);
			$('#pengacara_email').val(json.email);
			$('#pengacara_status_kawin').val(json.IDStatusKawin);

			$('#pengacara_no_induk').val(json.no_induk);
			$('#no_sk_menteri').val(json.no_sk_menkeh);
			$('#tgl_sk_menteri').val(json.tgl_sk_menteri);
			$('#tgl_sumpah_pn').val(json.tgl_sumpah_pn);
			$('#tgl_sumpah_pt').val(json.tgl_sumpah_pt);
			$('#pengacara_alamat_kantor').val(json.alamat_kantor);

			$('#popup_pengacara_list').fadeOut();
			$('#popup_pengacara').fadeIn();
			$('#edit_btn').show();
			$('#act_frm_ref_pengacara').val('updt');
			$("body").css({overflow: 'hidden'});
		}else if(json.st==0){
			message_show(json.msg);
		}
	});
	
}
$('#form_search_pengacara').submit(function(event){
	openLoadingDialog()
    $.post($(this).attr('action'),$(this).serialize(), function(json){
    	closeLoading()
    	if(json.st==1){
    		refreshPengacaraList()
    	}else{
    		message_show("Error, Tutup Browser anda kemudian login kembali");
    	}
    	event.preventDefault()
	},'json');
	event.preventDefault()
});
</script>
<script language="javascript">
$(function() {
    var totalPage = '<?php echo $total_rows; ?>';
    var page = '<?php echo $page_number;?>';
    $('#selector').pagination({
        items: totalPage,
        itemsOnPage: 50,
        displayedPages: 3,
        cssStyle: 'light-theme',
        currentPage:page,
        onPageClick: function(pageNumber){
        	openLoadingDialog()
        	$.post('<?php echo base_url()?>pengacara_list/setPage', {
        		pageNumber:pageNumber,
        		keyword:$('#keyword_pengacara').val()
			}, function(response){
				var json = jQuery.parseJSON(response);
				closeLoading()
				if(json.st==1){
					refreshPengacaraList()
				}else{
					message_show("Error, Tutup Browser anda kemudian login kembali");
				}
			});
            
        	}
        });
    $('#selector_bottom').pagination({
        items: totalPage,
        itemsOnPage: 50,
        displayedPages: 3,
        cssStyle: 'light-theme',
        currentPage:page,
        onPageClick: function(pageNumber){
            openLoadingDialog()
        	$.post('<?php echo base_url()?>pengacara_list/setPage', {
        		pageNumber:pageNumber,
        		keyword:$('#keyword_pengacara').val()
			}, function(response){
				var json = jQuery.parseJSON(response);
				closeLoading()
				if(json.st==1){
					refreshPengacaraList()
				}else{
					message_show("Error, Tutup Browser anda kemudian login kembali");
				}
			});
            
        	}
        });
    $('#pengacara_tgl_lahir').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
            	var error = 0;
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					error = 1
				}
				dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
				var today = new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00");
				var age = Math.floor((today-dob) / (365.25 * 24 * 60 * 60 * 1000));
				if(age<5 || age >100){
					message = 'Tanggal Lahir Tidak Valid. Silahkan Periksa Kembali';
					error = 1
				}
				if(error==1){
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
				error = 0;
        	}
      	});
    
	$('#tgl_sk_menteri').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
      	});
	$('#tgl_sumpah_pn').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
      	});
	$('#tgl_sumpah_pt').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
      	});
    });

$('.datepicker').ValidateDateInput();

</script>
