<!DOCTYPE html>
<html lang="en">
	<head>
		<!--meta http-equiv="refresh" content="15" /-->
		<meta http-equiv="" content="">
		<?php $this->load->view('main/head');?>
		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="dek/assets/css/bootstrap.css" />
		<link rel="stylesheet" href="dek/assets/css/font-awesome.css" />

		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="dek/assets/css/jquery-ui.custom.css" />
		<link rel="stylesheet" href="dek/assets/css/chosen.css" />
		<link rel="stylesheet" href="dek/assets/css/datepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/bootstrap-timepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/daterangepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/bootstrap-datetimepicker.css" />
		<link rel="stylesheet" href="dek/assets/css/colorpicker.css" />

		<!-- text fonts -->
		<link rel="stylesheet" href="dek/assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="dek/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		
		<!-- ace settings handler -->
		<script src="dek/assets/js/ace-extra.js"></script>
	</head>

	<body class="no-skin">
		<!-- #section:basics/navbar.layout -->
		<?php $this->load->view('main/menu_ndhuwur');?>

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<!-- #section:basics/sidebar.horizontal -->
			<?php $this->load->view('main/top_menu');?>

			<!-- /section:basics/sidebar.horizontal -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
						<!-- #section:settings.box -->
						
						<!-- /section:settings.box -->
						<div class="page-header">
							<h1>
								Keuangan
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									Jurnal
								</small>
							</h1>
						</div><!-- /.page-header -->

						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<?php if($this->session->flashdata('error')!=''):?>
								<div class="alert alert-danger">
									<button type="button" class="close" data-dismiss="alert">
										<i class="ace-icon fa fa-times"></i>
									</button>
									<strong>
										<i class="ace-icon fa fa-times"></i>
										Pesan Kesalahan, 
									</strong>
									<?php echo $this->session->flashdata('error');?>
									<br />
								</div>
								<?php endif;?>
								<?php if($this->session->flashdata('pesan')!=''):?>
								<div class="alert alert-success">
									<button type="button" class="close" data-dismiss="alert">
										<i class="ace-icon fa fa-times"></i>
									</button>
									<strong>
										<i class="ace-icon fa fa-times"></i>
										Pesan,
									</strong>
									<?php echo $this->session->flashdata('pesan');?>
									<br />
								</div>
								<?php endif;?>
								<form class="form-horizontal" action="cek-tanggal-jurnal-bp.html" method="post" role="form">
									<!-- #section:elements.form -->
									
									<!--div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1-1"> Bulan </label>

										<div class="col-sm-3">
											<div class="input-group">												 
												<input name="tglawal" class="form-control date-picker" id="id-date-picker-1" type="text" data-date-format="yyyy-mm-dd" />
												<span class="input-group-addon">
													<i class="fa fa-calendar bigger-110"></i>
												</span>
											</div>
										</div>
										<div class="col-sm-1 text-center"><span>s/d</span></div>
										<div class="col-sm-3">
											<div class="input-group">
												<input name="tglakhir"class="form-control date-picker" id="id-date-picker-1" type="text" data-date-format="yyyy-mm-dd" />
												<span class="input-group-addon">
													<i class="fa fa-calendar bigger-110"></i>
												</span>
											</div>
										</div>
										<!--button class="btn btn-info btn-sm" type="submit" name="bProses">
												<i class="ace-icon fa fa-gear bigger-110"></i>
												Proses
											</button-->
									<!--/div-->
									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1-1"> Tahun </label>
										<div class="col-sm-2">
											<div class="input-group">												 
												<input name="tahun" class="form-control" id="datepicker-tahun" type="text" data-date-format="yyyy" />
												<span class="input-group-addon">
													<i class="fa fa-calendar bigger-110"></i>
												</span>
											</div>
										</div>
										
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Bulan </label>

										<div class="col-sm-2">
											<select name="bulan" class=" form-control" data-placeholder="Choose a Country...">
											<option value="01"> Januari</option>
											<option value="02"> Februari</option>
											<option value="03"> Maret</option>
											<option value="04"> April</option>
											<option value="05"> Mei</option>
											<option value="06"> Juni</option>
											<option value="07"> Juli</option>
											<option value="08"> Agustus</option>
											<option value="09"> September</option>
											<option value="10"> Oktober</option>
											<option value="11"> November</option>
											<option value="12"> Desember</option>
											</select>
										</div>
										<button class="btn btn-insan btn-sm" type="submit" name="bProses">
											<i class="ace-icon fa fa-gear bigger-110"></i>
											Proses
										</button>
									</div>
														
									<hr>

									<!---div class="clearfix ">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info btn-sm" type="submit" name="bProses">
												<i class="ace-icon fa fa-gear bigger-110"></i>
												Proses
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn btn-sm btn-warning" type="reset">
												<i class="ace-icon fa fa-undo bigger-110"></i>
												Reset
											</button>
										</div>
									</div-->
								</form>
						<?php //if(isset($_POST['bProses'])){ ?>		
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								
								<div class="row">
									<div class="col-xs-12">
										<!--h3 class="header smaller lighter blue text-center">Data Registrasi Pasien <?php //echo $poliklinik;?>
										<br>
										<small style="color:#8c0000;">Tgl Masuk : <?php //echo tgl_id($tanggal);?>  <?php //echo tgl_id($tglakhir);?></small></h3-->
											
										<!--div class="clearfix">											
											<div class="pull-right" style="margin-right:20px; padding-bottom:20px;"> 
												<form action="exptoexcel-rekap-kunjungan.html" method="post" >
												<input type="hidden" value="<?php //echo $_POST['statusx'];?>" name="statusx">
												<input type="hidden" value="<?php //echo $_POST['followup'];?>" name="followup">
												<input type="hidden" value="<?php //echo $_POST['tglawal'];?>" name="tglawal">
												<input type="hidden" value="<?php //echo $_POST['tglakhir'];?>" name="tglakhir">
												<button class="btn btn-xs btn-success"> Exsport to Excel</button>
												</form>
											</div>
										</div-->
										<?php if($this->session->flashdata('error')!=''):?>
										<div class="alert alert-danger">
											<button type="button" class="close" data-dismiss="alert">
												<i class="ace-icon fa fa-times"></i>
											</button>
											<strong>
												<i class="ace-icon fa fa-times"></i>
												Pesan Kesalahan, 
											</strong>
											<?php echo $this->session->flashdata('error');?>
											<br />
										</div>
										<?php endif;?>
										<?php if($this->session->flashdata('pesan')!=''):?>
										<div class="alert alert-success">
											<button type="button" class="close" data-dismiss="alert">
												<i class="ace-icon fa fa-times"></i>
											</button>
											<strong>
												<i class="ace-icon fa fa-times"></i>
												Pesan,
											</strong>
											<?php echo $this->session->flashdata('pesan');?>
											<br />
										</div>
										<?php endif;?>
										<br>
										<div class="table-header-orange">
											Jurnal-Bayar Piutang <?php //echo $poliklinik;?>
										</div>

										<!-- div.table-responsive -->

										<!-- div.dataTables_borderWrap -->
										<div>
										<form class="form-horizontal" action="ubah-tgl-jurnal.html" method="post" role="form">
											<table id="dynamic-table" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														<th class="hidden-480 center">No</th>
														<th class="center">No Jurnal</th>
														<th class="center">No Bukti</th>
														<th class="center">Tgl Jurnal</th>
														<th class="hidden-480 center">Tgl Bayar</th>
														<th class="hidden-480 center">Keterangan</th>
														<th class="">Detail</th>
														<th class="center">
														<button class="btn btn-insan btn-xs" type="submit" name="bProses">
											<i class="ace-icon fa fa-gear bigger-110"></i>
											Proses
										</button><br><label class="pos-rel">
										<input type="hidden" name="cek" value="bp">
																<input type="checkbox" class="ace" />
																<span class="lbl"></span>
															</label></th>
														
													</tr>
												</thead>

												<tbody>
												<?php $no=1;
													foreach($hasile as $dtk){
												?>
													<tr>
														<td><?php echo $no;?></td>
														<td class="hidden-480"><?php echo $dtk->no_jurnal;?><input type="hidden" name="nojurnal[<?php echo $dtk->no_jurnal;?>]" value="<?php echo $dtk->no_jurnal;?>"></td>
														<td align="" class=""><?php echo $dtk->no_bukti;?></td>
														<td class=""><?php echo $dtk->tgl_jurnal;?>
														<input type="hidden" name="tgljurnal[<?php echo $dtk->no_jurnal;?>]" value="<?php echo $dtk->tgl_jurnal;?>"></td></td>
														<td class=""><?php echo $dtk->tgl_ph;?><input type="hidden" name="tglup[<?php echo $dtk->no_jurnal;?>]" value="<?php echo $dtk->tgl_ph;?>"></td>
														<td class="hidden-480"><?php echo $dtk->keterangan;?></td>
														<td align=""><?php echo $dtk->detail;?></td>
													
														<td class="center">
															<label class="pos-rel">
																<input type="checkbox" name="chkup[<?php echo $dtk->no_jurnal;?>]"  value="1" class="ace" />
																<span class="lbl"></span>
															</label>
														</td>
													</tr>
												<?php $no++; } ?>
													
												</tbody>
											</table>
										</form>
										</div>
									</div>
									
								</div>
							</div>
						</div>
						<?php //} ?>

								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

			<?php $this->load->view('main/footer');?>

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='dek/assets/js/jquery.js'>"+"<"+"/script>");
		</script>

		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='dek/assets/js/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
		<script src="dek/assets/js/bootstrap.js"></script>
		
		<script src="dek/assets/js/dataTables/jquery.dataTables.js"></script>
		<script src="dek/assets/js/dataTables/jquery.dataTables.bootstrap.js"></script>
		<script src="dek/assets/js/dataTables/extensions/TableTools/js/dataTables.tableTools.js"></script>
		<script src="dek/assets/js/dataTables/extensions/ColVis/js/dataTables.colVis.js"></script>

		<script src="dek/assets/js/jquery-ui.custom.js"></script>
		<script src="dek/assets/js/jquery.ui.touch-punch.js"></script>
		<script src="dek/assets/js/chosen.jquery.js"></script>
		<script src="dek/assets/js/fuelux/fuelux.spinner.js"></script>
		<script src="dek/assets/js/date-time/bootstrap-datepicker.js"></script>
		<script src="dek/assets/js/date-time/bootstrap-timepicker.js"></script>
		<script src="dek/assets/js/date-time/moment.js"></script>
		<script src="dek/assets/js/date-time/daterangepicker.js"></script>
		<script src="dek/assets/js/date-time/bootstrap-datetimepicker.js"></script>
		<script src="dek/assets/js/bootstrap-colorpicker.js"></script>
		<script src="dek/assets/js/jquery.knob.js"></script>
		<script src="dek/assets/js/jquery.autosize.js"></script>
		<script src="dek/assets/js/jquery.inputlimiter.1.3.1.js"></script>
		<script src="dek/assets/js/jquery.maskedinput.js"></script>
		<script src="dek/assets/js/bootstrap-tag.js"></script>

		<!-- ace scripts -->
		<script src="dek/assets/js/ace/elements.scroller.js"></script>
		<script src="dek/assets/js/ace/elements.colorpicker.js"></script>
		<script src="dek/assets/js/ace/elements.fileinput.js"></script>
		<script src="dek/assets/js/ace/elements.typeahead.js"></script>
		<script src="dek/assets/js/ace/elements.wysiwyg.js"></script>
		<script src="dek/assets/js/ace/elements.spinner.js"></script>
		<script src="dek/assets/js/ace/elements.treeview.js"></script>
		<script src="dek/assets/js/ace/elements.wizard.js"></script>
		<script src="dek/assets/js/ace/elements.aside.js"></script>
		<script src="dek/assets/js/ace/ace.js"></script>
		<script src="dek/assets/js/ace/ace.ajax-content.js"></script>
		<script src="dek/assets/js/ace/ace.touch-drag.js"></script>
		<script src="dek/assets/js/ace/ace.sidebar.js"></script>
		<script src="dek/assets/js/ace/ace.sidebar-scroll-1.js"></script>
		<script src="dek/assets/js/ace/ace.submenu-hover.js"></script>
		<script src="dek/assets/js/ace/ace.widget-box.js"></script>
		<script src="dek/assets/js/ace/ace.settings.js"></script>
		<script src="dek/assets/js/ace/ace.settings-rtl.js"></script>
		<script src="dek/assets/js/ace/ace.settings-skin.js"></script>
		<script src="dek/assets/js/ace/ace.widget-on-reload.js"></script>
		<script src="dek/assets/js/ace/ace.searchbox-autocomplete.js"></script>

		<!-- inline scripts related to this page -->
		
		<script>
		  $(function () {
			 var date = new Date();
			 var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
			 var tahunini = new Date(date.getFullYear());

			//Date picker
			$('#datepicker').datepicker({
				defaultDate: new Date(),
				autoclose: true,
				format:'yyyy-mm-dd',
				todayHighlight: true,
			
			})
			$('#dp1').datepicker({
			  autoclose: true,
			  format:'yyyy-mm-dd',
			  todayHighlight: true,
			})
			$('#datepicker-tahun').datepicker({
							//format: "MM",
				//viewMode: "months", 
				//minViewMode: "months",
				defaultDate: new Date(),
				format: "yyyy",
				viewMode: "years", 
				minViewMode: "years",
				autoclose: true,
				todayHighlight: true,
				
			})

			$( '#datepicker, #dp1,#datepicker-tahun').datepicker( 'setDate', today )

		  })
		</script>
		
		<script type="text/javascript">
			jQuery(function($) {
				$('#id-disable-check').on('click', function() {
					var inp = $('#form-input-readonly').get(0);
					if(inp.hasAttribute('disabled')) {
						inp.setAttribute('readonly' , 'true');
						inp.removeAttribute('disabled');
						inp.value="This text field is readonly!";
					}
					else {
						inp.setAttribute('disabled' , 'disabled');
						inp.removeAttribute('readonly');
						inp.value="This text field is disabled!";
					}
				});
			
			
				if(!ace.vars['touch']) {
					$('.chosen-select').chosen({allow_single_deselect:true}); 
					//resize the chosen on window resize
			
					$(window)
					.off('resize.chosen')
					.on('resize.chosen', function() {
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					}).trigger('resize.chosen');
					//resize chosen on sidebar collapse/expand
					$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
						if(event_name != 'sidebar_collapsed') return;
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					});
			
			
					$('#chosen-multiple-style .btn').on('click', function(e){
						var target = $(this).find('input[type=radio]');
						var which = parseInt(target.val());
						if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
						 else $('#form-field-select-4').removeClass('tag-input-style');
					});
				}
			
			
				$('[data-rel=tooltip]').tooltip({container:'body'});
				$('[data-rel=popover]').popover({container:'body'});
				
				$('textarea[class*=autosize]').autosize({append: "\n"});
				$('textarea.limited').inputlimiter({
					remText: '%n character%s remaining...',
					limitText: 'max allowed : %n.'
				});
			
				$.mask.definitions['~']='[+-]';
				$('.input-mask-date').mask('99/99/9999');
				$('.input-mask-phone').mask('(999) 999-9999');
				$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
				$(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
			
			
			
				$( "#input-size-slider" ).css('width','200px').slider({
					value:1,
					range: "min",
					min: 1,
					max: 8,
					step: 1,
					slide: function( event, ui ) {
						var sizing = ['', 'input-sm', 'input-lg', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
						var val = parseInt(ui.value);
						$('#form-field-4').attr('class', sizing[val]).val('.'+sizing[val]);
					}
				});
			
				$( "#input-span-slider" ).slider({
					value:1,
					range: "min",
					min: 1,
					max: 12,
					step: 1,
					slide: function( event, ui ) {
						var val = parseInt(ui.value);
						$('#form-field-5').attr('class', 'col-xs-'+val).val('.col-xs-'+val);
					}
				});
			
			
				
				//"jQuery UI Slider"
				//range slider tooltip example
				$( "#slider-range" ).css('height','200px').slider({
					orientation: "vertical",
					range: true,
					min: 0,
					max: 100,
					values: [ 17, 67 ],
					slide: function( event, ui ) {
						var val = ui.values[$(ui.handle).index()-1] + "";
			
						if( !ui.handle.firstChild ) {
							$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
							.prependTo(ui.handle);
						}
						$(ui.handle.firstChild).show().children().eq(1).text(val);
					}
				}).find('span.ui-slider-handle').on('blur', function(){
					$(this.firstChild).hide();
				});
				
				
				$( "#slider-range-max" ).slider({
					range: "max",
					min: 1,
					max: 10,
					value: 2
				});
				
				$( "#slider-eq > span" ).css({width:'90%', 'float':'left', margin:'15px'}).each(function() {
					// read initial values from markup and remove that
					var value = parseInt( $( this ).text(), 10 );
					$( this ).empty().slider({
						value: value,
						range: "min",
						animate: true
						
					});
				});
				
				$("#slider-eq > span.ui-slider-purple").slider('disable');//disable third item
			
				
				$('#id-input-file-1 , #id-input-file-2').ace_file_input({
					no_file:'No File ...',
					btn_choose:'Choose',
					btn_change:'Change',
					droppable:false,
					onchange:null,
					thumbnail:false //| true | large
					//whitelist:'gif|png|jpg|jpeg'
					//blacklist:'exe|php'
					//onchange:''
					//
				});
				//pre-show a file name, for example a previously selected file
				//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
			
			
				$('#id-input-file-3').ace_file_input({
					style:'well',
					btn_choose:'Drop files here or click to choose',
					btn_change:null,
					no_icon:'ace-icon fa fa-cloud-upload',
					droppable:true,
					thumbnail:'small'//large | fit
					//,icon_remove:null//set null, to hide remove/reset button
					/**,before_change:function(files, dropped) {
						//Check an example below
						//or examples/file-upload.html
						return true;
					}*/
					/**,before_remove : function() {
						return true;
					}*/
					,
					preview_error : function(filename, error_code) {
						//name of the file that failed
						//error_code values
						//1 = 'FILE_LOAD_FAILED',
						//2 = 'IMAGE_LOAD_FAILED',
						//3 = 'THUMBNAIL_FAILED'
						//alert(error_code);
					}
			
				}).on('change', function(){
					//console.log($(this).data('ace_input_files'));
					//console.log($(this).data('ace_input_method'));
				});
				
				
				//$('#id-input-file-3')
				//.ace_file_input('show_file_list', [
					//{type: 'image', name: 'name of image', path: 'http://path/to/image/for/preview'},
					//{type: 'file', name: 'hello.txt'}
				//]);
			
				
				
			
				//dynamically change allowed formats by changing allowExt && allowMime function
				$('#id-file-format').removeAttr('checked').on('change', function() {
					var whitelist_ext, whitelist_mime;
					var btn_choose
					var no_icon
					if(this.checked) {
						btn_choose = "Drop images here or click to choose";
						no_icon = "ace-icon fa fa-picture-o";
			
						whitelist_ext = ["jpeg", "jpg", "png", "gif" , "bmp"];
						whitelist_mime = ["image/jpg", "image/jpeg", "image/png", "image/gif", "image/bmp"];
					}
					else {
						btn_choose = "Drop files here or click to choose";
						no_icon = "ace-icon fa fa-cloud-upload";
						
						whitelist_ext = null;//all extensions are acceptable
						whitelist_mime = null;//all mimes are acceptable
					}
					var file_input = $('#id-input-file-3');
					file_input
					.ace_file_input('update_settings',
					{
						'btn_choose': btn_choose,
						'no_icon': no_icon,
						'allowExt': whitelist_ext,
						'allowMime': whitelist_mime
					})
					file_input.ace_file_input('reset_input');
					
					file_input
					.off('file.error.ace')
					.on('file.error.ace', function(e, info) {
						//console.log(info.file_count);//number of selected files
						//console.log(info.invalid_count);//number of invalid files
						//console.log(info.error_list);//a list of errors in the following format
						
						//info.error_count['ext']
						//info.error_count['mime']
						//info.error_count['size']
						
						//info.error_list['ext']  = [list of file names with invalid extension]
						//info.error_list['mime'] = [list of file names with invalid mimetype]
						//info.error_list['size'] = [list of file names with invalid size]
						
						
						/**
						if( !info.dropped ) {
							//perhapse reset file field if files have been selected, and there are invalid files among them
							//when files are dropped, only valid files will be added to our file array
							e.preventDefault();//it will rest input
						}
						*/
						
						
						//if files have been selected (not dropped), you can choose to reset input
						//because browser keeps all selected files anyway and this cannot be changed
						//we can only reset file field to become empty again
						//on any case you still should check files with your server side script
						//because any arbitrary file can be uploaded by user and it's not safe to rely on browser-side measures
					});
				
				});
			
				$('#spinner1').ace_spinner({value:0,min:0,max:200,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
				.closest('.ace-spinner')
				.on('changed.fu.spinbox', function(){
					//alert($('#spinner1').val())
				}); 
				$('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, touch_spinner: true, icon_up:'ace-icon fa fa-caret-up bigger-110', icon_down:'ace-icon fa fa-caret-down bigger-110'});
				$('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus bigger-110', icon_down:'ace-icon fa fa-minus bigger-110', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
				$('#spinner4').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus', icon_down:'ace-icon fa fa-minus', btn_up_class:'btn-purple' , btn_down_class:'btn-purple'});
			
				//$('#spinner1').ace_spinner('disable').ace_spinner('value', 11);
				//or
				//$('#spinner1').closest('.ace-spinner').spinner('disable').spinner('enable').spinner('value', 11);//disable, enable or change value
				//$('#spinner1').closest('.ace-spinner').spinner('value', 0);//reset to 0
			
			
				//datepicker plugin
				//link
				$('.date-picker').datepicker({
					autoclose: true,
					todayHighlight: true,
					
				})
				//show datepicker when clicking on the icon
				.next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
			
				//or change it into a date range picker
				$('.input-daterange').datepicker({autoclose:true});
			
			
				//to translate the daterange picker, please copy the "examples/daterange-fr.js" contents here before initialization
				$('input[name=date-range-picker]').daterangepicker({
					'applyClass' : 'btn-sm btn-success',
					'cancelClass' : 'btn-sm btn-default',
					locale: {
						applyLabel: 'Apply',
						cancelLabel: 'Cancel',
					}
				})
				.prev().on(ace.click_event, function(){
					$(this).next().focus();
				});
			
			
				$('#timepicker1').timepicker({
					minuteStep: 1,
					showSeconds: true,
					showMeridian: false
				}).next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
				
				$('#date-timepicker1').datetimepicker().next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
				
			
				$('#colorpicker1').colorpicker();
			
				$('#simple-colorpicker-1').ace_colorpicker();
				//$('#simple-colorpicker-1').ace_colorpicker('pick', 2);//select 2nd color
				//$('#simple-colorpicker-1').ace_colorpicker('pick', '#fbe983');//select #fbe983 color
				//var picker = $('#simple-colorpicker-1').data('ace_colorpicker')
				//picker.pick('red', true);//insert the color if it doesn't exist
			
			
				$(".knob").knob();
				
				
				var tag_input = $('#form-field-tags');
				try{
					tag_input.tag(
					  {
						placeholder:tag_input.attr('placeholder'),
						//enable typeahead by specifying the source array
						source: ace.vars['US_STATES'],//defined in ace.js >> ace.enable_search_ahead
						/**
						//or fetch data from database, fetch those that match "query"
						source: function(query, process) {
						  $.ajax({url: 'remote_source.php?q='+encodeURIComponent(query)})
						  .done(function(result_items){
							process(result_items);
						  });
						}
						*/
					  }
					)
			
					//programmatically add a new
					var $tag_obj = $('#form-field-tags').data('tag');
					$tag_obj.add('Programmatically Added');
				}
				catch(e) {
					//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
					tag_input.after('<textarea id="'+tag_input.attr('id')+'" name="'+tag_input.attr('name')+'" rows="3">'+tag_input.val()+'</textarea>').remove();
					//$('#form-field-tags').autosize({append: "\n"});
				}
				
				
				/////////
				$('#modal-form input[type=file]').ace_file_input({
					style:'well',
					btn_choose:'Drop files here or click to choose',
					btn_change:null,
					no_icon:'ace-icon fa fa-cloud-upload',
					droppable:true,
					thumbnail:'large'
				})
				
				//chosen plugin inside a modal will have a zero width because the select element is originally hidden
				//and its width cannot be determined.
				//so we set the width after modal is show
				$('#modal-form').on('shown.bs.modal', function () {
					if(!ace.vars['touch']) {
						$(this).find('.chosen-container').each(function(){
							$(this).find('a:first-child').css('width' , '210px');
							$(this).find('.chosen-drop').css('width' , '210px');
							$(this).find('.chosen-search input').css('width' , '200px');
						});
					}
				})
				/**
				//or you can activate the chosen plugin after modal is shown
				//this way select element becomes visible with dimensions and chosen works as expected
				$('#modal-form').on('shown', function () {
					$(this).find('.modal-chosen').chosen();
				})
				*/
			
				
				
				$(document).one('ajaxloadstart.page', function(e) {
					$('textarea[class*=autosize]').trigger('autosize.destroy');
					$('.limiterBox,.autosizejs').remove();
					$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu').remove();
				});
			
			});
		</script>
		
		<script type="text/javascript">
			jQuery(function($) {
				//initiate dataTables plugin
				var oTable1 = 
				$('#dynamic-table')
				//.wrap("<div class='dataTables_borderWrap' />")   //if you are applying horizontal scrolling (sScrollX)
				.dataTable( {
					bAutoWidth: false,
					"aoColumns": [
					  { "bSortable": false },
					  null, null,null,null,null,null,
					{ "bSortable": false }],
					"aaSorting": [],
			
					//,
					//"sScrollY": "200px",
					//"bPaginate": false,
			
					//"sScrollX": "100%",
					//"sScrollXInner": "120%",
					//"bScrollCollapse": true,
					//Note: if you are applying horizontal scrolling (sScrollX) on a ".table-bordered"
					//you may want to wrap the table inside a "div.dataTables_borderWrap" element
			
					"iDisplayLength": 30
			    } );
				//oTable1.fnAdjustColumnSizing();
			
			
				//TableTools settings
				TableTools.classes.container = "btn-group btn-overlap";
				TableTools.classes.print = {
					"body": "DTTT_Print",
					"info": "tableTools-alert gritter-item-wrapper gritter-info gritter-center white",
					"message": "tableTools-print-navbar"
				}
			
				//initiate TableTools extension
				var tableTools_obj = new $.fn.dataTable.TableTools( oTable1, {
					"sSwfPath": "dek/assets/js/dataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf", //in Ace demo dek/assets will be replaced by correct assets path
					
					"sRowSelector": "td:not(:last-child)",
					"sRowSelect": "multi",
					"fnRowSelected": function(row) {
						//check checkbox when row is selected
						try { $(row).find('input[type=checkbox]').get(0).checked = true }
						catch(e) {}
					},
					"fnRowDeselected": function(row) {
						//uncheck checkbox
						try { $(row).find('input[type=checkbox]').get(0).checked = false }
						catch(e) {}
					},
			
					"sSelectedClass": "success",
			        "aButtons": [
						{
							"sExtends": "copy",
							"sToolTip": "Copy to clipboard",
							"sButtonClass": "btn btn-white btn-primary btn-bold",
							"sButtonText": "<i class='fa fa-copy bigger-110 pink'></i>",
							"fnComplete": function() {
								this.fnInfo( '<h3 class="no-margin-top smaller">Table copied</h3>\
									<p>Copied '+(oTable1.fnSettings().fnRecordsTotal())+' row(s) to the clipboard.</p>',
									1500
								);
							}
						},
						
						{
							"sExtends": "csv",
							"sToolTip": "Export to CSV",
							"sButtonClass": "btn btn-white btn-primary  btn-bold",
							"sButtonText": "<i class='fa fa-file-excel-o bigger-110 green'></i>"
						},
						
						{
							"sExtends": "pdf",
							"sToolTip": "Export to PDF",
							"sButtonClass": "btn btn-white btn-primary  btn-bold",
							"sButtonText": "<i class='fa fa-file-pdf-o bigger-110 red'></i>"
						},
						
						{
							"sExtends": "print",
							"sToolTip": "Print view",
							"sButtonClass": "btn btn-white btn-primary  btn-bold",
							"sButtonText": "<i class='fa fa-print bigger-110 grey'></i>",
							
							"sMessage": "<div class='navbar navbar-default'><div class='navbar-header pull-left'><a class='navbar-brand' href='#'><small>Optional Navbar &amp; Text</small></a></div></div>",
							
							"sInfo": "<h3 class='no-margin-top'>Print view</h3>\
									  <p>Please use your browser's print function to\
									  print this table.\
									  <br />Press <b>escape</b> when finished.</p>",
						}
			        ]
			    } );
				//we put a container before our table and append TableTools element to it
			    $(tableTools_obj.fnContainer()).appendTo($('.tableTools-container'));
				
				//also add tooltips to table tools buttons
				//addding tooltips directly to "A" buttons results in buttons disappearing (weired! don't know why!)
				//so we add tooltips to the "DIV" child after it becomes inserted
				//flash objects inside table tools buttons are inserted with some delay (100ms) (for some reason)
				setTimeout(function() {
					$(tableTools_obj.fnContainer()).find('a.DTTT_button').each(function() {
						var div = $(this).find('> div');
						if(div.length > 0) div.tooltip({container: 'body'});
						else $(this).tooltip({container: 'body'});
					});
				}, 200);
				
				
				
				//ColVis extension
				var colvis = new $.fn.dataTable.ColVis( oTable1, {
					"buttonText": "<i class='fa fa-search'></i>",
					"aiExclude": [0, 6],
					"bShowAll": true,
					//"bRestore": true,
					"sAlign": "right",
					"fnLabel": function(i, title, th) {
						return $(th).text();//remove icons, etc
					}
					
				}); 
				
				//style it
				$(colvis.button()).addClass('btn-group').find('button').addClass('btn btn-white btn-info btn-bold')
				
				//and append it to our table tools btn-group, also add tooltip
				$(colvis.button())
				.prependTo('.tableTools-container .btn-group')
				.attr('title', 'Show/hide columns').tooltip({container: 'body'});
				
				//and make the list, buttons and checkboxed Ace-like
				$(colvis.dom.collection)
				.addClass('dropdown-menu dropdown-light dropdown-caret dropdown-caret-right')
				.find('li').wrapInner('<a href="javascript:void(0)" />') //'A' tag is required for better styling
				.find('input[type=checkbox]').addClass('ace').next().addClass('lbl padding-8');
			
			
				
				/////////////////////////////////
				//table checkboxes
				$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
				
				//select/deselect all rows according to table header checkbox
				$('#dynamic-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
					var th_checked = this.checked;//checkbox inside "TH" table header
					
					$(this).closest('table').find('tbody > tr').each(function(){
						var row = this;
						if(th_checked) tableTools_obj.fnSelect(row);
						else tableTools_obj.fnDeselect(row);
					});
				});
				
				//select/deselect a row when the checkbox is checked/unchecked
				$('#dynamic-table').on('click', 'td input[type=checkbox]' , function(){
					var row = $(this).closest('tr').get(7);
					if(!this.checked) tableTools_obj.fnSelect(row);
					else tableTools_obj.fnDeselect($(this).closest('tr').get(7));
				});
				
			
				
				
					$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
					e.stopImmediatePropagation();
					e.stopPropagation();
					e.preventDefault();
				});
				
				
				//And for the first simple table, which doesn't have TableTools or dataTables
				//select/deselect all rows according to table header checkbox
				var active_class = 'active';
				$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
					var th_checked = this.checked;//checkbox inside "TH" table header
					
					$(this).closest('table').find('tbody > tr').each(function(){
						var row = this;
						if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
						else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
					});
				});
				
				//select/deselect a row when the checkbox is checked/unchecked
				$('#simple-table').on('click', 'td input[type=checkbox]' , function(){
					var $row = $(this).closest('tr');
					if(this.checked) $row.addClass(active_class);
					else $row.removeClass(active_class);
				});
			
				
			
				/********************************/
				//add tooltip for small view action buttons in dropdown menu
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				
				//tooltip placement on right or left
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					//var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			
			})
		</script>
		

		<!-- the following scripts are used in demo only for onpage help and you don't need them -->
		<link rel="stylesheet" href="dek/assets/css/ace.onpage-help.css" />
		<link rel="stylesheet" href="dek/docs/assets/js/themes/sunburst.css" />

		<script type="text/javascript"> ace.vars['base'] = '..'; </script>
		<script src="dek/assets/js/ace/elements.onpage-help.js"></script>
		<script src="dek/assets/js/ace/ace.onpage-help.js"></script>
		<script src="dek/docs/assets/js/rainbow.js"></script>
		<script src="dek/docs/assets/js/language/generic.js"></script>
		<script src="dek/docs/assets/js/language/html.js"></script>
		<script src="dek/docs/assets/js/language/css.js"></script>
		<script src="dek/docs/assets/js/language/javascript.js"></script>
	</body>
</html>
