<div class="box box-success b-t-non" id='detail1000hpk'>
	<h4 class="labelGreen">
		<i class="fa fa-heartbeat m-r-15"></i> Perkembangan 1000 HPK
	</h4>
	<hr class="m-t-0">
	<div class="box-body p-0">
		<div class="col-lg-12" style="position: relative;top: -45px;">
			<div class="board">
				<div class="board-inner">
					<ul class="nav nav-tabs" id="myTab">
						<div class="liner"></div>
						<li class="active">
							<a href="#dataGrafik" data-toggle="tab" title="Grafik Pertumbuhan">
								<span class="round-tabs three">
									<i class="fa fa-line-chart" style="font-size: 35px;"></i>
								</span>
							</a>
						</li>
						<li>
							<a href="#dataBayi" data-toggle="tab" title="Data Anak">
								<span class="round-tabs one">
									<i class="fa fa-child" style="font-size: 35px;"></i>
								</span>
							</a>
						</li>
						<li>
							<a href="#dataImunisasi" data-toggle="tab" title="Jenis Imunisasi">
								<span class="round-tabs two">
									<i class="fa fa-eyedropper" style="font-size: 35px;"></i>
								</span>
							</a>
						</li>
						<li>
							<a href="#dataPerkembangan" data-toggle="tab" title="Pertumbuhan Anak">
								<span class="round-tabs three">
									<i class="fa fa-calendar" style="font-size: 35px;"></i>
								</span>
							</a>
						</li>
					</ul>
				</div>

				<div class="tab-content">
				    <div class="tab-pane fade in active" id="dataGrafik">
						<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 p-0">
							<h4 class="labelGreen m-0 m-b-15"><i class="fa fa-line-chart m-r-15"></i> Grafik Pertumbuhan BB/U</h4>
							<div id="resultChart"></div>
							<h4 class="labelGreen m-0 m-b-15"><i class="fa fa-line-chart m-r-15"></i> Grafik Pertumbuhan PB/U</h4>
							<div id="resultChartPbU"></div>
							<h4 class="labelGreen m-0 m-b-15"><i class="fa fa-line-chart m-r-15"></i> Grafik Pertumbuhan PB/BB</h4>
							<div id="resultChartPbBb"></div>
						</div>
						<div class="clearfix m-b-10"></div>
					</div>
					<div class="tab-pane fade" id="dataBayi">
						<h4 class="labelGreen m-0 m-b-15"><i class="fa fa-child m-r-15"></i> Data Anak</h4>
						<form id='formBayi'>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Nama Anak</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="hidden" name="id_perkembangan_anak" value="{{ $perkembangan->id_perkembangan_anak }}" autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12">
										<input type="text" id="nmBayi" name="nama_bayi" value="{{ $perkembangan->nama_bayi }}" autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if ($hakEdit != '1') { echo "readonly";} ?>>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Nama Orang Tua</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="text" name="nama_ortu" value="{{ $perkembangan->bumil->nama_bumil }}" autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" readonly>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Alamat, RT/RW</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="text" name="alamat_ortu" value="{{ $perkembangan->bumil->alamat_ktp }}" autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" readonly>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group m-0">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Tanggal Lahir</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 input-group p-t-0 p-b-0 p-l-15 p-r-15">
										<div class="input-group-addon" style="background:#49a4ec;color:#fff">
											<i class="fa fa-calendar"></i>
										</div>
										<input type="text" name='tgl_lahir' value="<?php if($perkembangan->tgl_lahir != '0000-00-00'){ echo date('d-m-Y', strtotime($perkembangan->tgl_lahir));} ?>" autocomplete='off' placeholder='dd-mm-yyyy' class="form-control pull-right"  id='form_datetime_lahir' data-date-format="dd-mm-yyyy" required='required' style="height: 30px" <?php if($hakEdit != '1'){echo "disabled";} ?>>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Laki-Laki / Perempuan</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<select name="jenis_kelamin" id="jkBayi" required="required" class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($hakEdit != '1'){echo "disabled";} ?>>
											<option value='' disabled selected> .:: Pilih Jenis Kelamin ::. </option>
											<option value='Laki-Laki' <?php if($perkembangan->jenis_kelamin == 'Laki-Laki'){echo "selected";} ?>>Laki-Laki</option>
											<option value='Perempuan' <?php if($perkembangan->jenis_kelamin == 'Perempuan'){echo "selected";} ?>>Perempuan</option>
										</select>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Berat Lahir Anak</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id='berBayLah' name="berat_bayi_lahir" value="{{ $perkembangan->berat_bayi_lahir }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($hakEdit != '1'){echo "readonly";} ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Kg</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Panjang Lahir Anak</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id="panBayLah" name="panjang_bayi_lahir" value="{{ $perkembangan->panjang_bayi_lahir }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($hakEdit != '1'){echo "readonly";} ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Cm</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Inisiasi Menyusu Dini</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="radio" class="customCheck" id="menyusuiDini1" value='1' name="menyusui_dini" required="required" <?php if($perkembangan->menyusui_dini == '1'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
											<label class="labelRadio" for="menyusuiDini1">Ya</label>
										<input type="radio" class="customCheck" id="menyusuiDini2" value='2' name="menyusui_dini" required="required" <?php if($perkembangan->menyusui_dini == '2'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
											<label class="labelRadio" for="menyusuiDini2">Tidak</label>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Pemberian susu formula setelah lahir</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="radio" class="customCheck" id="susuFormula1" value='1' name="susu_formula" required="required" <?php if($perkembangan->susu_formula == '1'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="susuFormula1">Ya</label>
										<input type="radio" class="customCheck" id="susuFormula2" value='2' name="susu_formula" required="required" <?php if($perkembangan->susu_formula == '2'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="susuFormula2">Tidak</label>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Melahirkan di</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="radio" class="customCheck" id="melahirkanDi1" value='BPM' name="melahirkan_di" required="required" <?php if($perkembangan->melahirkan_di == 'BPM'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="melahirkanDi1">BPM</label>

										<input type="radio" class="customCheck" id="melahirkanDi2" value='Rumah' name="melahirkan_di" required="required" <?php if($perkembangan->melahirkan_di == 'Rumah'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="melahirkanDi2">Rumah</label>

										<input type="radio" class="customCheck" id="melahirkanDi3" value='Puskesmas' name="melahirkan_di" required="required" <?php if($perkembangan->melahirkan_di == 'Puskesmas'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="melahirkanDi3">Puskesmas</label>

										<input type="radio" class="customCheck" id="melahirkanDi4" value='Rumah Sakit' name="melahirkan_di" required="required" <?php if($perkembangan->melahirkan_di == 'Rumah Sakit'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="melahirkanDi4">Rumah Sakit</label>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Penolong</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="radio" class="customCheck" id="penolong1" value='Bidan' name="penolong" required="required" <?php if($perkembangan->penolong == 'Bidan'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="penolong1">Bidan</label>

										<input type="radio" class="customCheck" id="penolong2" value='Dokter' name="penolong" required="required" <?php if($perkembangan->penolong == 'Dokter'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="penolong2">Dokter</label>

										<input type="radio" class="customCheck" id="penolong3" value='Opjin' name="penolong" required="required" <?php if($perkembangan->penolong == 'Opjin'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="penolong3">Opjin</label>

										<input type="radio" class="customCheck" id="penolong4" value='Dukun' name="penolong" required="required" <?php if($perkembangan->penolong == 'Dukun'){echo "checked";} ?> <?php if($hakEdit != '1'){echo "disabled";} ?>>
										<label class="labelRadio" for="penolong4">Dukun</label>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Kapan pertama kali memberikan makanan/minuman selain ASI</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id='makSelAsi' name="makanan_selain_asi" value="{{ $perkembangan->makanan_selain_asi }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($idLogin != $perkembangan->users_id){ echo "readonly"; }else{ if ($hakEdit == 0 && $perkembangan->makanan_selain_asi != '') { echo "readonly"; } } ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Bulan</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Jenis MP ASI yang diberikan pertama</label>
									<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
										<input type="text" id="mpAsi" name="mp_asi" value="{{ $perkembangan->mp_asi }}" autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($idLogin != $perkembangan->users_id){ echo "readonly"; }else{ if ($hakEdit == 0 && $perkembangan->mp_asi != '') { echo "readonly"; } } ?>>
									</div>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Vitamin A</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id="vitA" name="vitamin_a" value="{{ $perkembangan->vitamin_a }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($idLogin != $perkembangan->users_id){ echo "readonly"; }else{ if ($hakEdit == 0 && $perkembangan->vitamin_a != '0') { echo "readonly"; } } ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Bulan</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Vitamin A</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id="vitA2" name="vitamin_a2" value="{{ $perkembangan->vitamin_a2 }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($idLogin != $perkembangan->users_id){ echo "readonly"; }else{ if ($hakEdit == 0 && $perkembangan->vitamin_a2 != '0') { echo "readonly"; } } ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Bulan</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Vitamin A</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id="vitA3" name="vitamin_a3" value="{{ $perkembangan->vitamin_a3 }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($idLogin != $perkembangan->users_id){ echo "readonly"; }else{ if ($hakEdit == 0 && $perkembangan->vitamin_a3 != '0') { echo "readonly"; } } ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Bulan</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='clearfix'></div>
							<div class='col-lg-8 col-md-8 col-sm-12 col-xs-12 p-0'>
								<div class="form-group">
									<label class="control-label col-lg-4 col-md-4 col-sm-12 col-xs-12" id='label-input'>Vitamin A</label>
									<div class="col-lg-7 col-md-7 col-sm-11 col-xs-11">
										<input type="number" id="vitA4" name="vitamin_a4" value="{{ $perkembangan->vitamin_a4 }}" min='0' autocomplete='off' class="form-control input-sm customInput col-md-7 col-xs-12" <?php if($idLogin != $perkembangan->users_id){ echo "readonly"; }else{ if ($hakEdit == 0 && $perkembangan->vitamin_a4 != '0') { echo "readonly"; } } ?>>
									</div>
									<label class="control-label col-lg-1 col-md-1 col-sm-1 col-xs-1 p-l-0" id='label-input'>Bulan</label>
								</div>
								<div class='clearfix p-b-5'></div>
							</div>
							<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12 p-0 pull-right' id="tombolBayi" <?php if($idLogin != $perkembangan->users_id){ echo "style='display:none'"; }else{ if($hakEdit == '0' && $perkembangan->makanan_selain_asi != '' && $perkembangan->mp_asi != '' && $perkembangan->vitamin_a != '0' && $perkembangan->vitamin_a2 != '0' && $perkembangan->vitamin_a3 != '0' && $perkembangan->vitamin_a4 != '0'){ echo "style='display:none'"; } } ?>>
								<button type="submit" class="btn btn-primary pull-right m-r-0" id='btn-simpanBayi'>Simpan <span class="fa fa-save"></span></button>
							</div>
						</form>
					</div>
					<div class="tab-pane fade" id="dataImunisasi">
						<h4 class="labelGreen m-0 m-b-15"><i class="fa fa-eyedropper m-r-15"></i> Jenis Imunisasi</h4>
						<div class="loadingImun" align="center" style="display: none;">
							<img src="{!! url('dist/img/loading.gif') !!}" width="40%">
						</div>
						<span class="resultImun"></span>
					</div>
					<div class="tab-pane fade" id="dataPerkembangan">
						<h4 class="labelGreen m-0 m-b-15"><i class="fa fa-calendar m-r-15"></i> Pertumbuhan Anak</h4>
						<div class="loadingBulanan" align="center" style="display: none;">
							<img src="{!! url('dist/img/loading.gif') !!}" width="40%">
						</div>
						<span class="resultBulanan">
<!-- 
							<label class="m-b-0 p-l-15" style="font-size: 18px;">Tahun Pertama</label>
							<hr class="lineTopGreen">
							<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
								<div class="col-lg-12" style="background: #d4dfff;border-bottom: solid 10px #00bff3;">
									<label class="p-t-20 p-b-5" style="font-size: 22px;">Bulan 1</label>
									<div style="padding-top: 14px;position: absolute;top: 0;right: 35px;">
										<div style="font-size: 20px;background: #00a65a;color: #fff;padding: 3px 7px;border-radius: 50%;">
											<i class='fa fa-check'></i>
										</div>
									</div>
									<div class="btn-group pull-right">
										<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" style="color: #333;font-size: 28px">
											<i class="fa fa-ellipsis-v" style="padding-top: 18px;"></i>
										</a>
										<ul class="dropdown-menu pull-right">
											<li onclick="Kosong()"><a href="javascript:void(0);"><i class="fa fa-eye"></i> Detail</a></li>
											<li onclick="Kosong()"><a href="javascript:void(0);"><i class="fa fa-pencil"></i> Edit</a></li>
										</ul>
									</div>
								</div>
							</div> -->

						</span>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>
		</div>
	</div>
	<div class="box-footer">
		<button type="button" class="btn btn-warning btn-cancel pull-right"><span class="fa fa-chevron-left"></span> Kembali</button>
	</div>
</div>
<div class="other-detail-1000hpk"></div>
<div class="modal-detail-1000hpk"></div>
<script type="text/javascript">
	$('.btn-cancel').click(function(e){
    	e.preventDefault();
    	$('#detail1000hpk').animateCss('bounceOutDown');
    	$('.other-1000hpk').fadeOut(function(){
    		$('.other-1000hpk').empty();
            $('#main1000hpk').fadeIn();
        });
    });
    $('#form_datetime_lahir').datetimepicker({
        weekStart: 2,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0,
    });

    reloadImunAnak();
    reloadbulanan();
    reloadChart();

    $('#btn-simpanBayi').click(function(e){
    	e.preventDefault();
    	var data  = new FormData($('#formBayi')[0]);
	    $.ajax({
	        url: "{{ route('updateInfoAnak') }}",
	        type: 'POST',
	        data: data,
	        enctype: 'multipart/form-data',
	        async: true,
	        cache: false,
	        contentType: false,
	        processData: false
	     }).done(function(data){
    		if(data.status == 'success'){
				swal({
					title : "Berhasil",
					text : data.messages,
					type : "success",
					timer: 2000,
					showConfirmButton: false
				});
		        e.preventDefault();
		        if (data.hakEdit == 0) {
			        $('#nmBayi').attr('readonly',true);
			        $('#form_datetime_lahir').attr('disabled',true);
			        $('#jkBayi').attr('disabled',true);
			        $('#berBayLah').attr('readonly',true);
			        $('#panBayLah').attr('readonly',true);
			        $('#menyusuiDini1').attr('disabled',true);
			        $('#menyusuiDini2').attr('disabled',true);
			        $('#susuFormula1').attr('disabled',true);
			        $('#susuFormula2').attr('disabled',true);
			        $('#melahirkanDi1').attr('disabled',true);
			        $('#melahirkanDi2').attr('disabled',true);
			        $('#melahirkanDi3').attr('disabled',true);
			        if (data.data.makanan_selain_asi != 0) {
			        	$('#makSelAsi').attr('readonly',true);
			        }
			        if (data.data.mp_asi != "") {
			        	$('#mpAsi').attr('readonly',true);
			    	}
			        if (data.data.vitamin_a != 0) {
			        	$('#vitA').attr('readonly',true);
			    	}
			        if (data.data.vitamin_a2 != 0) {
			        	$('#vitA2').attr('readonly',true);
			    	}
			        if (data.data.vitamin_a3 != 0) {
			        	$('#vitA3').attr('readonly',true);
			    	}
			        if (data.data.vitamin_a4 != 0) {
			        	$('#vitA4').attr('readonly',true);
			    	}
			    	if (data.data.makanan_selain_asi != 0 && data.data.mp_asi != "" && data.data.vitamin_a != 0 && data.data.vitamin_a2 != 0 && data.data.vitamin_a3 != 0 && data.data.vitamin_a4 != 0) {
			        	$('#tombolBayi').hide();
			    	}
		        }
		        reloadAnak();
		    } else if(data.status == 'required'){
    			swal("Maaf !!!", data.messages, "warning");
    		} else if(data.status == 'failed'){
    			swal("Maaf !!!", "Kunjungan Pemeriksaan Gagal ditambahkan !", "warning");
    		} else {
    			swal("Maaf !!!", "Silahkan periksa inputan Anda !!", "warning");
    			$('#btn-simpan').animateCss('shake', function(){
    				swal('Perhatian', 'Mohon periksa inputan anda', 'warning');
    			});
    		}
    	});
    });

    function reloadImunAnak() {
    	$('.loadingImun').show();
    	var userID = {{ Sentinel::getUser()->id }};
    	var id_perkembangan = {{ $perkembangan->id_perkembangan_anak }};
    	$.post("{!! route('searchImunAnak') !!}", {id:id_perkembangan}).done(function(data){
    		if (data.status == 'success') {
    			var resultImunAnak = '';
    			var no = 1;
    			if (data.imun.length > 0) {
    				$.each(data.imun, function(k,v){
    					if (no == 1 || no == 8) {
    						resultImunAnak += '<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 p-0">';
    					}
    					resultImunAnak += '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 p-0">';
    					resultImunAnak += '<div class="form-group m-0">';
    					resultImunAnak += '<label class="control-label col-lg-5 col-md-5 col-sm-12 col-xs-12" id="label-input">'+v.nama_imunisasi+'</label>';
    					resultImunAnak += '<div class="col-lg-5 col-md-5 col-sm-9 col-xs-9 input-group p-t-0 p-b-0 p-l-15 p-r-15">';
    					resultImunAnak += '<div class="input-group-addon" style="background:#49a4ec;color:#fff">';
    					resultImunAnak += '<i class="fa fa-calendar"></i>';
    					resultImunAnak += '</div>';
    					var tglOnDB = v.tgl_imunisasi;
    					var tglUtuh = tglOnDB.split("-");
    					var tglShow = "";
    					if(tglOnDB != "0000-00-00"){ tglShow = tglUtuh[2]+"-"+tglUtuh[1]+"-"+tglUtuh[0];}
    					resultImunAnak += '<input type="text" name="tgl_imunisasi" value="'+tglShow+'" autocomplete="off" placeholder="dd-mm-yyyy" class="form-control pull-right"  id="form_datetime_lahir" data-date-format="dd-mm-yyyy" required="required" style="height: 30px;background:#fff" readonly>';
    					resultImunAnak += '<div class="" style="position: absolute;right: -40px;top: 3px;">';
    					if ((v.hak_edit == 1 && userID == v.users_id) || v.users_id == 0) {
    						resultImunAnak += '<a href="javascript:void(0)" onclick="updateImun('+v.id_imunisasi_hpk+')" class="btn btn-xs btn-warning"><i class="fa fa-pencil"></i> Edit</a>';
    					}
    					resultImunAnak += '</div>';
    					resultImunAnak += '</div>';
    					resultImunAnak += '</div>';
    					resultImunAnak += '<div class="clearfix p-b-5"></div>';
    					resultImunAnak += '</div>';
    					if (no == 7 || no == 14) {
    						resultImunAnak += '</div>';
    					}
    					
    					no = no + 1;
    				});
    			}else{
    				resultImunAnak += '<label class="labelNoResult"><i> - = Daftar Imunisasi Anak Tidak Ditemukan = - </i></label>';
    			}
    			$('.loadingImun').hide();
				$('.resultImun').html(resultImunAnak);
    		}else{
    			$('.loadingImun').hide();
    		}
    	});
    }

    function updateImun(id) {
    	$.post("{!! route('formUpdateImun') !!}", {id:id}).done(function(data){
			if(data.status == 'success'){
				$('.modal-detail-1000hpk').html(data.content);
			}
		});
    }

    function reloadbulanan() {
    	$('.loadingBulanan').show();
    	var userID = {{ Sentinel::getUser()->id }};
    	var id_perkembangan = {{ $perkembangan->id_perkembangan_anak }};
    	$.post("{!! route('searchPerkemBulan') !!}", {id:id_perkembangan}).done(function(data){
    		if (data.status == 'success') {
    			var resultBulananAnak = '';
    			var no = 1;
    			if (data.periksaHpk.length > 0) {
    				$.each(data.periksaHpk, function(k,v){
    					if (no == 1) {
    						resultBulananAnak += '<label class="m-b-0 p-l-15" style="font-size: 18px;">Tahun Pertama</label>';
    						resultBulananAnak += '<hr class="lineTopGreen">';
    					}else if(no == 13){
    						resultBulananAnak += '<label class="m-b-0 p-l-15" style="font-size: 18px;">Tahun Kedua</label>';
    						resultBulananAnak += '<hr class="lineTopGreen">';
    					}
    					resultBulananAnak += '<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 m-b-20">';
    					resultBulananAnak += '<div class="col-lg-12" style="background: #d4dfff;border-bottom: solid 10px #00bff3;">';
    					resultBulananAnak += '<label class="p-t-20 p-b-5" style="font-size: 22px;">Bulan '+v.bulan+'</label>';
    					if(v.tgl_pemeriksaan_hpk != "0000-00-00"){
	    					resultBulananAnak += '<div style="padding-top: 14px;position: absolute;top: 0;right: 35px;">';
	    					resultBulananAnak += '<div style="font-size: 20px;background: #00a65a;color: #fff;padding: 3px 7px;border-radius: 50%;">';
	    					resultBulananAnak += '<i class="fa fa-check"></i>';
	    					resultBulananAnak += '</div>';
	    					resultBulananAnak += '</div>';
    					}
    					resultBulananAnak += '<div class="btn-group pull-right">';
    					resultBulananAnak += '<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" style="color: #333;font-size: 28px">';
    					resultBulananAnak += '<i class="fa fa-ellipsis-v" style="padding-top: 18px;"></i>';
    					resultBulananAnak += '</a>';
    					resultBulananAnak += '<ul class="dropdown-menu pull-right">';
    					if(v.tgl_pemeriksaan_hpk != "0000-00-00"){
    						resultBulananAnak += '<li onclick="DetailBulananAnak('+v.id_pemeriksaan_hpk+')"><a href="javascript:void(0);"><i class="fa fa-eye"></i> Detail</a></li>';
    					}
    					if ((v.hak_edit == 1 && userID == v.users_id) || v.users_id == 0) {
    						resultBulananAnak += '<li onclick="UpdateBulananAnak('+v.id_pemeriksaan_hpk+')"><a href="javascript:void(0);"><i class="fa fa-pencil"></i> Edit</a></li>';
    					}
    					resultBulananAnak += '</ul>';
    					resultBulananAnak += '</div>';
    					resultBulananAnak += '</div>';
    					resultBulananAnak += '</div>';
    					no = no + 1;
    				});
    			}else{
    				resultBulananAnak += '<label class="labelNoResult"><i> - = Daftar Pemeriksaan Perkembangan Anak Tidak Ditemukan = - </i></label>';
    			}
    			$('.loadingBulanan').hide();
				$('.resultBulanan').html(resultBulananAnak);
    		}else{
    			$('.loadingBulanan').hide();
    		}
    	});
    }

    function UpdateBulananAnak(id) {
    	$.post("{!! route('formPerkemBulan') !!}", {id:id}).done(function(data){
			if(data.status == 'success'){
				$('.modal-detail-1000hpk').html(data.content);
			}
		});
    }
    function DetailBulananAnak(id) {
    	$.post("{!! route('detailPerkemBulan') !!}", {id:id}).done(function(data){
			if(data.status == 'success'){
				$('.modal-detail-1000hpk').html(data.content);
			}
		});
    }
    
    function reloadChart() {
    	var idPerkem = {{ $id_perkembangan }};
	    $.post("{!!route('getGrafikBBU')!!}", {id:idPerkem}).done(function(vals){
	    	var bb_M3 = vals.bb_M3;
	    	var bb_M2 = vals.bb_M2;
		    var bb_Med = vals.bb_Med;
		    var bb_P2 = vals.bb_P2;
		    var bb_P3 = vals.bb_P3;
	    	var dtBB_Us = [];
	    	for (var i = 0; i < vals.dtBB_U.length; i++) {
	    		dtBB_Us[i] = [ vals.dtBB_U[i].usia, vals.dtBB_U[i].berat ];
	    	}
	    	Highcharts.chart('resultChart', {
			    chart: { type: 'spline' },
			    title: { text: 'Pertumbuhan Anak' },
			    subtitle: { text: 'Berat Badan Berdasarkan Umur'},
			    xAxis: {
			        title: { text: 'Usia (Bulan)' }
			    },
			    yAxis: {
			        title: { text: 'Berat Badan (Kg)' },
			        min: 0
			    },
			    tooltip: {
			        headerFormat: '<b>{series.name}</b><br>',
			        pointFormat: '{point.x:0f} Bulan: {point.y:.2f} Kg'
			    },

			    legend: {
			    	layout: 'vertical',
			    	align: 'right',
			    	verticalAlign: 'middle'
			    },

			    plotOptions: {
			        spline: {
			            marker: {enabled: true}
			        }
			    },

			    series: [{
			        name: '+3 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: bb_P3
			    }, {
			        name: '+2 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: bb_P2
			    }, {
			        name: 'Median',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: bb_Med
			    }, {
			        name: '-2 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: bb_M2
			    }, {
			        name: '-3 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: bb_M3
			    }, {
			        name: 'Pertumbuhan Anak',
			        marker: {enabled: true},
			        data: dtBB_Us
			    }]
			});
	    });

	    $.post("{!!route('getGrafikPBU')!!}", {id:idPerkem}).done(function(vals){
	    	var pb_M3 = vals.pb_M3;
	    	var pb_M2 = vals.pb_M2;
		    var pb_Med = vals.pb_Med;
		    var pb_P2 = vals.pb_P2;
		    var pb_P3 = vals.pb_P3;
	    	var dtPB_Us = [];
	    	for (var i = 0; i < vals.dtPB_U.length; i++) {
	    		dtPB_Us[i] = [ vals.dtPB_U[i].usia, vals.dtPB_U[i].panjang ];
	    	}
	    	Highcharts.chart('resultChartPbU', {
			    chart: { type: 'spline' },
			    title: { text: 'Pertumbuhan Anak' },
			    subtitle: { text: 'Panjang Badan Berdasarkan Umur'},
			    xAxis: {
			        title: { text: 'Usia (Bulan)' }
			    },
			    yAxis: {
			        title: { text: 'Pankang Badan (Cm)' }
			    },
			    tooltip: {
			        headerFormat: '<b>{series.name}</b><br>',
			        pointFormat: '{point.x:0f} Bulan: {point.y:.2f} Cm'
			    },

			    legend: {
			    	layout: 'vertical',
			    	align: 'right',
			    	verticalAlign: 'middle'
			    },

			    plotOptions: {
			        spline: {
			            marker: {enabled: true}
			        }
			    },

			    series: [{
			        name: '+3 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pb_P3
			    }, {
			        name: '+2 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pb_P2
			    }, {
			        name: 'Median',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pb_Med
			    }, {
			        name: '-2 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pb_M2
			    }, {
			        name: '-3 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pb_M3
			    }, {
			        name: 'Pertumbuhan Anak',
			        marker: {enabled: true},
			        data: dtPB_Us
			    }]
			});
	    });

	    $.post("{!!route('getGrafikPBBB')!!}", {id:idPerkem}).done(function(vals){
	    	var pbbb_M3 = vals.pbbb_M3;
	    	var pbbb_M2 = vals.pbbb_M2;
	    	var pbbb_M1 = vals.pbbb_M1;
		    var pbbb_Med = vals.pbbb_Med;
		    var pbbb_P1 = vals.pbbb_P1;
		    var pbbb_P2 = vals.pbbb_P2;
		    var pbbb_P3 = vals.pbbb_P3;
	    	var dtPB_BBs = [];
	    	for (var i = 0; i < vals.dtPB_BB.length; i++) {
	    		dtPB_BBs[i] = [ vals.dtPB_BB[i].panjang, vals.dtPB_BB[i].berat ];
	    	}
	    	Highcharts.chart('resultChartPbBb', {
			    chart: { type: 'spline' },
			    title: { text: 'Pertumbuhan Anak' },
			    subtitle: { text: 'Panjang Badan Berdasarkan Berat Badan'},
			    xAxis: {
			        title: { text: 'Panjang Badan (Cm)' }
			    },
			    yAxis: {
			        title: { text: 'Berat Badan (Kg)' }
			    },
			    tooltip: {
			        headerFormat: '<b>{series.name}</b><br>',
			        pointFormat: '{point.x:.2f} Cm: {point.y:.2f} Kg'
			    },

			    // legend: {
			    // 	layout: 'vertical',
			    // 	align: 'right',
			    // 	verticalAlign: 'middle'
			    // },

			    plotOptions: {
			        spline: {
			            marker: {enabled: true}
			        }
			    },

			    series: [{
			        name: '+3 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_P3
			    }, {
			        name: '+2 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_P2
			    }, {
			        name: '+1 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_P1
			    }, {
			        name: 'Median',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_Med
			    }, {
			        name: '-1 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_M1
			    }, {
			        name: '-2 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_M2
			    }, {
			        name: '-3 SD',
			        marker: {
			        	enabled: false,
			        	states: {
			        		hover: {enabled: false}
			        	}
			        },
			        data: pbbb_M3
			    }, {
			        name: 'Pertumbuhan Anak',
			        marker: {enabled: true},
			        data: dtPB_BBs
			    }]
			});
	    });
    }
</script>