<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='formKelahiran'>
					<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;">Kelahiran ke - </label>
					<div class="form-group">
						<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
							<input type="hidden" name="id_bumil" value="{{ $bumil->id_bumil }}" id="periodeId">
							<input type="number" name="kelahiran" min='0' autocomplete='off' required="required" class="form-control input-sm customInput col-md-7 col-xs-12" style="font-size: 28px;height: 50px;border-radius: 5px;text-align: center;">
						</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-simpan' 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('');
	})

	$('#btn-simpan').click(function(e){
    	e.preventDefault();
    	var data  = new FormData($('#formKelahiran')[0]);
    	swal(
			{
				title: "Apa anda yakin dengan informasi Kelahiran Anda?",
				text: "Informasi Kelahiran akan di Simpan dan tidak dapat di Perbaharui!",
				type: "warning",
				showCancelButton: true,
				confirmButtonColor: "#DD6B55",
				confirmButtonText: "Saya yakin!",
				cancelButtonText: "Batal!",
				closeOnConfirm: false
			},
			function(){
			    $.ajax({
			        url: "{{ route('addKelahiran') }}",
			        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 : "Kelahiran Berhasil Dibuat !",
							type : "success",
							timer: 2000,
							showConfirmButton: false
						});
				        reloadResult();
		    		} else if(data.status == 'failed'){
		    			swal("Maaf !!!", "Kelahiran Gagal ditambahkan !", "warning");
		    		} else {
		    			swal("Maaf !!!", "Angka Kelahiran Harus Di isi !!", "warning");
		    		}
		    	});
			}
		);
    });
</script>