<div class="modal fade" id="detail-dialog" tabindex="-1" role="dialog" aria-labelledby="product-detail-dialog">
	<div class="modal-dialog modal-lg" >
		<div class="modal-content">
			<div class="modal-header" style="border-bottom:none;">
				<button type="button" class="close" data-dismiss="modal" id='custom-close' aria-label="Close"><span aria-hidden="true">&times;</span></button>
			</div>
			<div class="modal-body">
				<form id='formUpdateImun'>
					<label class="control-label col-lg-12 col-md-12 col-sm-12 col-xs-12 t-a-center" id='label-input' style="font-size: 22px;margin-bottom: 0px;">Imunisasi <?php echo e($imun->nama_imunisasi); ?></label>
					<label class="control-label col-lg-12 col-md-12 col-sm-12 col-xs-12 t-a-center" id='label-input' style="font-size: 18px;font-weight: 500;">Tanggal Pemberian Imunisasi</label>
					<input type="hidden" name="id_imunisasi_hpk" value="<?php echo e($imun->id_imunisasi_hpk); ?>" id="periodeId">
					<div class="form-group">
						<div class="col-lg-8 col-md-8 col-sm-10 col-xs-10 input-group col-lg-offset-2 col-md-offset-2 col-sm-offset-1 col-xs-offset-1">
							<div class="input-group-addon" style="background:#49a4ec;color:#fff;font-size: 24px;">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" name='tgl_imunisasi' value="<?php if($imun->tgl_imunisasi != '0000-00-00'){ echo date('d-m-Y', strtotime($imun->tgl_imunisasi));} ?>" autocomplete='off' placeholder='dd-mm-yyyy' class="form-control pull-right"  id='form_datetime_imun' data-date-format="dd-mm-yyyy" required='required' style="height: 40px;font-size: 24px">
						</div>
					</div>
				</form>
				<div class="clearfix"></div>
			</div>
			<div class="modal-footer t-a-center" style="border-bottom:solid 20px #ff86ff">
				<button type="button" id='btn-simpanImun' class="btn btn-lg btn-info" style="width: 100px;font-weight: 800;font-size: 18px;">OK</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	var onLoad = (function() {
		$('#detail-dialog').find('.modal-dialog').css({
			'width'     : '50%'
		});
		$('#detail-dialog').modal('show');
	})();
	$('#detail-dialog').on('hidden.bs.modal', function () {
		$('.modal-dialog').html('');
	})

	$('#form_datetime_imun').datetimepicker({
        weekStart: 2,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0,
    });

	$('#btn-simpanImun').click(function(e){
    	e.preventDefault();
    	var data  = new FormData($('#formUpdateImun')[0]);
    	swal(
			{
				title: "Apa anda yakin dengan informasi Tanggal Pemberian Imunisasi <?php echo e($imun->nama_imunisasi); ?> ini?",
				text: "Data Tanggal Pemberian Imunisasi akan di Simpan dan hanya bisa di edit selama 3 hari sejak tanggal penyimpanan!",
				type: "warning",
				showCancelButton: true,
				confirmButtonColor: "#DD6B55",
				confirmButtonText: "Saya yakin!",
				cancelButtonText: "Batal!",
				closeOnConfirm: false
			},
			function(){
			    $.ajax({
			        url: "<?php echo e(route('UpdateImun')); ?>",
			        type: 'POST',
			        data: data,
			        enctype: 'multipart/form-data',
			        async: true,
			        cache: false,
			        contentType: false,
			        processData: false
			     }).done(function(data){
		    		if(data.status == 'success'){
		    			$('#detail-dialog').modal('hide');
						swal({
							title : "Berhasil",
							text : data.messages,
							type : "success",
							timer: 2000,
							showConfirmButton: false
						});
				        e.preventDefault();
				        reloadImunAnak();
		    		} else if(data.status == 'failed'){
		    			swal("Maaf !!!", data.messages, "warning");
		    		} else {
		    			swal("Maaf !!!", "Silahkan periksa inputan Anda !!", "warning");
		    			$('#btn-simpanImun').animateCss('shake', function(){
		    				swal('Perhatian', 'Mohon periksa inputan anda', 'warning');
		    			});
		    		}
		    	});
			}
		);
    });
</script>