<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
	<script type="text/javascript">
		try {
			ace.settings.loadState('main-container')
		} catch (e) {}
	</script>
	<script>
		$(document).on('change', '#oxygen_cylinder_id', function() {
			let client_id = $("#oxygen_cylinder_id").val();
			$('#location').html(" ");
			$('#location').append('<option value=""> </option>');
			$.ajax({
				type: 'post',
				url: 'get_oxy_location.php',
				data: {
					client_id: client_id
				},
				dataType: 'json',
				success: function(data) {
					if (data != '' && data != null) {
						// alert(data);
						$("#location").append(data);
					}

				},
				error: function(data) {

				}
			})
		});
	</script>
	<?php include('techsyn_sidebar.php'); ?>
	<!--breadcrumb-->
	<div class="main-content">
		<div class="main-content-inner">
			<div class="breadcrumbs ace-save-state" id="breadcrumbs">
				<ul class="breadcrumb">
					<li>
						<i class="ace-icon fa fa-home home-icon"></i>
						<a href="#">Home</a>
					</li>
					<li class="active"><a href="task_list.php">Oxygen Cylinder Checklist</a></li>
				</ul>

			</div>
			<!-- End of breadcrumb -->



			<div class="page-content">
				<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
					<form id="oxygen_form" method="post">
						<!-- box-body-->
						<div class="box-body" id="reload_amb">


							<div class="row">
								<div class="col-sm-12">
									<table id="myTable" class="table table-bordered order-list">
										<thead>
											<tr>
												<th width="18.5%">Oxygen Cylinder No</th>
												<th width="18.5%">Date Of Refilling</th>
												<th width="18.5%">Date of Refilling validity</th>
												<!-- <th width="18.5%">Issued date</th> -->
												<th width="25%">Location</th>
											</tr>
										</thead>



										<tbody>

											<tr>

												<td>
													<?php
													$ohc_type = $_SESSION['current_ohcttype'];
													$primary_ohc_type = getFieldFromTable('primary_ohc_id', 'ohc_type', 'ohc_type_id', $ohc_type);


													if ($primary_ohc_type) {
														$ohc_type = $primary_ohc_type;
													} else {

														$ohc_type = $_SESSION['current_ohcttype'];
													}
													// $lote = getFieldFromTable('ohc_type_id','ohc_type','ohc_code','LOTE');
													$child_ohcs = "SELECT ohc_type_id From ohc_type where primary_ohc_id = '$ohc_type'";

													error_log("sql" . $child_ohcs);

													$child_ohcs_quiry = mysqli_query($conn, $child_ohcs);
													$child_ids = array();
													while ($childs_ohcs = mysqli_fetch_array($child_ohcs_quiry)) {
														// $child_ids[] = $childs_ohcs['ohc_type_id'];
														array_push($child_ids, $childs_ohcs['ohc_type_id']);
													}

													$all_ohc_ids = array_push($child_ids, $ohc_type);

													$comma_separated_string = implode(",", $child_ids);
													?>

													<select class="form-control select2" name="oxygen_cylinder_id" id="oxygen_cylinder_id">
														<option value="" disabled selected>Please select a Oxygen Cylinder No</option>
														<?php $sql_emp_1 = "SELECT id, CONCAT(oxygen_kit_no, '-', type) AS kit_details FROM oxygen_cylinder where ohc_type_id in($comma_separated_string) order by oxygen_kit_no"; ?><?php echo generate_options($sql_emp_1, '', 'id', 'kit_details', 'id', ''); ?>
													</select>

												</td>

												<td>
													<input type="text" name="date_receive" id="date_receive" onchange="getvalidatyDate(this.value)" class="form-control datepicker">
												</td>


												<td style="width:8%">
													<input type="text" name="date_validity" id="date_validity" class="form-control datepicker">
												</td>

												<!-- <td>
													<input type="text" name="issue_date" id="issue_date" class="form-control datepicker">
												</td> -->

												<td>
													<select class="form-control select2" name="location" id="location">
														<option disabled selected>Please
															select option</option>

													</select>
													<!-- <input type="text" name="location" id="location" class="form-control"> -->
												</td>



											</tr>

										</tbody>

									</table>

									<table id="myTable1" width="100%" class="table table-bordered order-list">
										<thead>
											<tr>

												<th width="25%">Date</th>
												<th width="25%">Pressure Reading (Kg/cm<sup>2</sup>)</th>
												<th width="25%">Any leakage(Y/n)</th>
												<th width="25%">GAS Mask Clean</th>

											</tr>
										</thead>



										<tbody>

											<tr>

												<td width="25%">
													<input type="text" name="date_check" id="date_check" class="form-control datepicker">
												</td>

												<td width="25%">
													<input type="text" name="pressure_reading" id="pressure_reading" class="form-control datepicker">

													<input type="hidden" name="cylinder_id" id="cylinder_id">
												</td>

												<td>
													<select id="any_leakage" name="any_leakage" class="form-control">
														<option value="" disabled selected>Please select an option</option>
														<option value="Y">YES</option>
														<option value="N">NO</option>
													</select>
												</td>

												<td>
													<select id="valve_closed" name="valve_closed" class="form-control">
														<option value="" disabled selected>Please select an option</option>
														<option value="Y">YES</option>
														<option value="N">NO</option>
													</select>
												</td>


											</tr>






										</tbody>

										<tfoot>


										</tfoot>


									</table>

									<table id="myTable1" width="100%" class="table table-bordered order-list">
										<thead>
											<tr>

												<th width="25%">Status(empty/full/In use)</th>
												<th width="25%">Water of humidifier replaced</th>
												<th width="25%">Remarks</th>
												<th width="25%">Checked By</th>

											</tr>
										</thead>



										<tbody>

											<tr>

												<td width="25%">
													<select class="form-control" name="status" id="status">
														<option disabled selected>Please Select Option</option>
														<option value="empty">Empty</option>
														<option value="full">Full</option>
														<option value="in_use">In Use</option>
													</select>
													<!-- <input type="text" name="status" id="status" class="form-control" > -->
												</td>

												<td width="25%">
													<select class="form-control select2" name="water_humidifier_date" id="water_humidifier_date">
														<option disabled selected>Please Select Option</option>
														<option value="Yes">Yes</option>
														<option value="No">No</option>

													</select>
													<!-- <input type="text" name="water_humidifier_date" id="water_humidifier_date" class="form-control datepicker" > -->
												</td>

												<td>
													<input type="text" name="remarks" id="remarks" class="form-control">
												</td>

												<td>
													<select name="checked_by" id="checked_by" class="form-control select2">
														<option value="">Choose any name</option>
														<?php $sql_emp_1 = "SELECT id, CONCAT(patient_name, '-', emp_code) AS emp_details FROM patient_master order by patient_name"; ?><?php echo generate_options($sql_emp_1, '', 'id', 'emp_details', 'id', ''); ?>
													</select>
												</td>


											</tr>






										</tbody>

										<tfoot>


										</tfoot>


									</table>

									<!-- <table id="myTable1" width="100%" class="table table-bordered order-list" >
									<thead>
										<tr>
											
											<th width="25%">Hydro Testing</th>
											<th width="25%">Hydro Testing Date</th>
											<th width="75%">Remarks</th>
											

										</tr>
									</thead>
									<tbody>
										<td>
											<select class="form-control" name="hydro_test" id="hydro_test">
												<option selected disabled>Please Select Option</option>
												<option value="Y">Yes</option>
												<option value="N">No</option>
												<option value="Required Hydrotest">Required hydro test</option>
											</select>
										</td>
										<td>
											<input type="text" name="hydro_test_date" id="hydro_test_date" class="form-control datepicker">
										</td>
										<td>
											<textarea class="form-control" name="remarks_t" id="remarks_t" cols="30" rows="2"></textarea>
										</td>
									
									</tbody>
								</table> -->



								</div>

							</div>

							<!-- <div class="row">
					    	<div class="col-sm-12">
					    		 <table id="myTable3" width="100%" class="table table-bordered order-list">
					    		 	<thead>
					    		 		<tr>
					    		 			<th>Sl.No.</th>
					    		 			<th>Questionaries</th>
					    		 			<th>Answer</th>
					    		 			
					    		 			<th>Remarks</th>
					    		 		</tr>
					    		 	</thead>

					    		 	<tbody>
					    		 		<?php $i = 0;

											$sql = "select * from oxygen_cylinder_questionnaire";

											$result = mysqli_query($conn, $sql);
											$row = @mysqli_fetch_array($result);


											$sql_oxy = "select * from oxygen_cylinder_questionnaire";

											$result_oxy = mysqli_query($conn, $sql_oxy);





											do {
												$count = 0; ?>

					    		 		<tr>
					    		 			<td><?php echo $i + 1 ?></td>
					    		 			<td>
					    		 				<?php echo $row['question'] ?>
					    		 				 <input type="hidden"  name="question_id<?php echo $i ?>" id="question_id<?php echo $i ?>" value="<?php echo $row['question_id'] ?>" />	
					    		 			</td>
					    		 			<?php
												$new_sqll = "SELECT * from  oxygen_cylinder_checklist_details where oxygen_cylinder_id='" . $_REQUEST['cylinder_id'] . "'";

												error_log("SELECTION QUERY:" . $new_sqll);
												$resultl = mysqli_query($conn, $new_sqll);
												if (mysqli_num_rows($resultl) > 0) {
													$rowl = @mysqli_fetch_array($resultl);
													$param_present = (explode(',', $rowl['question_id']));
												}
												?>
					    		 			<td style="width: 10%">
												<select name="answer<?php echo $i ?>" value="<?php if (mysqli_num_rows($resultl) > 0) {
																									foreach ($param_present as $x => $val) {
																										if ($val == $rowl['question_id']) {
																											echo 'Yes';
																											$count = 1;
																										}
																									}
																									if ($count == 0) {
																										echo 'No';
																									}
																								}
																								?>" id="answer<?php echo $i ?>" class="form-control">
											<option value='N' >No</option>
																					<option value='Y' <?php if (mysqli_num_rows($resultl) > 0) {
																											foreach ($param_present as $x => $val) {
																												if ($val == $rowl['question_id']) {
																													echo 'selected';
																													$count = 1;
																												}
																											}
																											if ($count == 0) {
																												echo 'No';
																											}
																										}
																										?>>Yes</option>
												
												</select>
											
											</td>
					    		 			<td><input type="text" name="qremarks<?php echo $i ?>" id="qremarks<?php echo $i ?>"></td>
					    		 		</tr>
					    		 		<?php $i++;
											} while ($row = @mysqli_fetch_array($result)) ?>
					    		 	</tbody>

					    		 	<tfoot>
					    		 		<td><input type="hidden" name="count_qstn" id="count_qstn" value="<?php echo $i ?>"></td>
					    		 	</tfoot>
					    		 </table>
					    	</div>
					    </div> -->

						</div>
						<!-- End box-body-->
						<!--box-footer-->

						<div class="box-footer" style="text-align: center;">
							<button class="btn btn-info save_button" type="button" id="save_button" onclick="validate();">
								<i class="ace-icon fa fa-floppy-o bigger-110"></i>
								Save
							</button>

							&nbsp; &nbsp; &nbsp;
							<button class="btn btn-warning" type="reset">
								<i class="ace-icon fa fa-undo bigger-110"></i>
								Reset
							</button>
						</div>

						<!--End box-footer-->

					</form>
				</div>
				<!-- Main Content Container for side bar and body-->
				<div class="main-container ace-save-state" id="main-container">
					<script type="text/javascript">
						try {
							ace.settings.loadState('main-container')
						} catch (e) {}
					</script>





					<!--breadcrumb-->
					<div class="main-content">
						<div class="main-content-inner">

							<!-- End of breadcrumb -->

							<div class="page-content" style="margin-top: -47px">
								<div id="flexigridDiv" class="table-responsive">

									<form name="f1" method="post" id="flex_appointment_form" action="bio_medical_waste_generation_excel.php">
										<div id="flex1" style="width:100%">
											<input type="hidden" name="flex_ambulance_id" id="flex_ambulance_id" />
										</div>

									</form>

									<form name="export_form" method="post" id="export_form" action="">

										<input type="hidden" name="pdf_actions" id="pdf_actions" value="bio_medical_waste_generation_pdf.php" />
										<input type="hidden" name="excel_actions" id="excel_actions" value="bio_medical_waste_generation_excel.php" />
										<input type="hidden" name="pdf_action" id="pdf_action" value="biowaste_pdf.php" />
										<input type="hidden" name="excel_action" id="excel_action" value="excel_ambulance.php" />
									</form>


								</div>
							</div>



						</div><!-- /.page-content -->
					</div>
				</div><!-- /.main-content -->


				<script type="text/javascript">
					$(function() {
						var w = screen.width * .90;
						var h = 0;
						h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
						$("#flex1").flexigrid({
							url: 'oxygen_cylinder_issue_checklist_script.php',
							dataType: 'json',
							colModel: [{
									display: 'Sr',
									name: 'count',
									width: w * .05,
									sortable: false,
									align: 'left'
								},
								{
									display: 'Oxygen Cylinder No',
									name: 'oxygenk_it_no',
									width: w * .15,
									sortable: true,
									align: 'left'
								},
								{
									display: 'Type Of Cylinder',
									name: 'type',
									width: w * .10,
									sortable: true,
									align: 'left'
								},
								{
									display: 'Date Of Refilling',
									name: 'date_of_refilling',
									width: w * .10,
									sortable: true,
									align: 'left'
								},
								
								{
									display: 'Check Date',
									name: 'issued_date',
									width: w * .10,
									sortable: true,
									align: 'left'
								},
								{
									display: 'Pressure Reading',
									name: 'poressure_reading',
									width: w * .10,
									sortable: true,
									align: 'left'
								},
								
								{
									display: 'Remarks',
									name: 'remarks',
									width: w * .20,
									sortable: true,
									align: 'left'
								},
								{
									display: '',
									name: 'link',
									width: w * .1,
									sortable: false,
									align: 'left'
								}
							],
							buttons: [

								// {name: 'Add', bclass: 'add', onpress : add},
								//{separator: true},
								//{name: 'PDFReport', bclass: 'print', onpress : pdfReport},
								// {separator: true},
								// {
								// 	name: 'PDF',
								// 	bclass: 'print',
								// 	onpress: pdf
								// },
								// {
								// 	separator: true
								// },
								// {
								// 	name: 'Excel',
								// 	bclass: 'print_excel',
								// 	onpress: excel
								// },
								// {
								// 	separator: true
								// }
							],
							searchitems: [
								//{display: 'Appointment Id', name : 'appointment_id',isdefault: true},
								{
									display: 'Name',
									name: 'vaccine_name'
								},
								{
									display: 'Company',
									name: 'vaccine_company'
								},
								{
									display: 'Description',
									name: 'vaccine_desc'
								},

							],
							sortname: "id",
							// sortorder: "type_description",
							usepager: true, //pagination
							//title:"Employee OPD",
							useRp: true,
							rp: 50, //records per page
							showTableToggleBtn: false, //toggle button for the whole table
							resizable: true,
							//	width: w, 
							height: h,
							singleSelect: true
						});
					});




					function DeleteCylenderChecklist(id) {

$.ajax({
	url: 'delete_cylender_checklist.php',
	data: {
		id: id
	},
	type: 'POST',
	dataType: 'json',
	success: function(data) {

		if (data == 'SUCCESS') {

			BootstrapDialog.alert('Oxygen Cylinder Deleted Successfully!');
			$("#flex1").flexReload();
			return;
		}




	},
	error: function(data) {
		BootstrapDialog.alert('Error: Oxygen Cylinder Not Deleted!');
		return;
	}
});

}

					// }
					function delete_vaccine(id) {

						$.ajax({
							url: 'delete_vaccine.php',
							data: {
								id: id
							},
							type: 'POST',
							dataType: 'json',
							success: function(data) {

								if (data == 'SUCCESS') {

									BootstrapDialog.alert('Oxygen Cylinder Deleted Successfully!');
									$("#flex1").flexReload();
									return;
								}




							},
							error: function(data) {
								BootstrapDialog.alert('Error: Oxygen Cylinder Not Deleted!');
								return;
							}
						});

					}


					function show_save_button() {
						$("#save_button").show()
						$("#id").val("");
					}

					function getvalidatyDate(date) {
					
						var DateOfTo = date; 

					
						var parts = DateOfTo.split('/');
						var day = parseInt(parts[0], 10);
						var month = parseInt(parts[1], 10) - 1; 
						var year = parseInt(parts[2], 10);

					
						var currentDate = new Date(year, month, day);

					
						currentDate.setFullYear(currentDate.getFullYear() + 1);

				
						var nextYearDate = currentDate.getDate() + '/' + (currentDate.getMonth() + 1) + '/' + currentDate.getFullYear();

						$('#date_validity').val(nextYearDate);



					}



					function open_vaccine(id, access) {
						if (access == 'V') {
							$("#save_button").hide()
						} else if (access == 'E')
							$("#save_button").show()

						$.ajax({
							url: 'select_oxy_chk.php',
							data: {
								id: id
							},
							type: 'POST',
							dataType: 'json',
							success: function(data) {
								$("#cylinder_id").val(data.id);
								$("#oxygen_cylinder_id").val(data.oxygen_cylinder_id);
								$("#oxygen_cylinder_id").select2();
								$('#date_receive').val(data.date_receiving)
								$("#date_validity").val(data.date_validity);
								$("#issue_date").val(data.issue_date);
								$("#location").val(data.location);
								$("#date_check").val(data.check_date);
								$("#water_humidifier_date").val(data.water_humidifier_date);
								$("#water_humidifier_date").select2();

								$("#pressure_reading").val(data.pressure_reading);
								$("#any_leakage").val(data.any_leakage);
								$("#checked_by").val(data.checked_by);
								$("#checked_by").select2();
								$("#valve_closed").val(data.valve_closed);
								$("#status").val(data.status);
								$("#remarks").val(data.remarks);
								$("#hydro_test").val(data.hydro_test);
								$("#hydro_test_date").val(data.hydro_test_date);
								$("#remarks_t").val(data.remarks_t);




								// $('#modal-add-ambulance-form').modal("show");				
							},
							error: function(data) {
								BootstrapDialog.alert('Error Populating Task Details');
								return;
							}
						});



					}

					function pdf() {
						window.open('oxy_list_pdf.php', 'Vaccine List');
					}

					function excel() {
						window.open('oxy_list_excel.php', 'Task List');
					}

					$("#new_button").on("click", function() {
						$("id").val("");
					});
				</script>

				<?php include('techsyn_footer.php'); ?>



			</div>


			<!-- End of page-content -->
		</div>
	</div>
</div>

<script>
	function validate() {



		save();
	}
</script>

<style>
	#modal-add-vaccine {
		overflow-y: scroll;
	}
</style>



<?php include('techsyn_footer.php'); ?>
<script type="text/javascript">
	if (!ace.vars['old_ie'])
		$('#issued_date').datepicker({
			format: 'dd/mm/yyyy', //use this option to display seconds
			//'setDate': new Date(),
			endDate: "+1d",
			//minDate:  new Date()-10,
			icons: {
				time: 'fa fa-clock-o',
				date: 'fa fa-calendar',
				up: 'fa fa-chevron-up',
				down: 'fa fa-chevron-down',
				previous: 'fa fa-chevron-left',
				next: 'fa fa-chevron-right',
				today: 'fa fa-arrows ',
				clear: 'fa fa-trash',
				close: 'fa fa-times'
			}
		}).datepicker("setDate", new Date());

	$('.select2').select2()
	jQuery(function($) {

		var myTable =
			$('#dynamic-table')

			.DataTable({
				bAutoWidth: false,
				"aoColumns": [{
						"bSortable": false
					},
					null, null, null, null, null,
					{
						"bSortable": false
					}
				],
				"aaSorting": [],





				select: {
					style: 'multi'
				}
			});




		var defaultCopyAction = myTable.button(1).action();
		myTable.button(1).action(function(e, dt, button, config) {
			defaultCopyAction(e, dt, button, config);
			$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
		});


		var defaultColvisAction = myTable.button(0).action();
		myTable.button(0).action(function(e, dt, button, config) {

			defaultColvisAction(e, dt, button, config);


			if ($('.dt-button-collection > .dropdown-menu').length == 0) {
				$('.dt-button-collection')
					.wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
					.find('a').attr('href', '#').wrap("<li />")
			}
			$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
		});



		setTimeout(function() {
			$($('.tableTools-container')).find('a.dt-button').each(function() {
				var div = $(this).find(' > div').first();
				if (div.length == 1) div.tooltip({
					container: 'body',
					title: div.parent().text()
				});
				else $(this).tooltip({
					container: 'body',
					title: $(this).text()
				});
			});
		}, 500);





		myTable.on('select', function(e, dt, type, index) {
			if (type === 'row') {
				$(myTable.row(index).node()).find('input:checkbox').prop('checked', true);
			}
		});
		myTable.on('deselect', function(e, dt, type, index) {
			if (type === 'row') {
				$(myTable.row(index).node()).find('input:checkbox').prop('checked', false);
			}
		});




		$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);


		$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(0).on('click', function() {
			var th_checked = this.checked;

			$('#dynamic-table').find('tbody > tr').each(function() {
				var row = this;
				if (th_checked) myTable.row(row).select();
				else myTable.row(row).deselect();
			});
		});


		$('#dynamic-table').on('click', 'td input[type=checkbox]', function() {
			var row = $(this).closest('tr').get(0);
			if (this.checked) myTable.row(row).deselect();
			else myTable.row(row).select();
		});



		$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
			e.stopImmediatePropagation();
			e.stopPropagation();
			e.preventDefault();
		});




		var active_class = 'active';
		$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
			var th_checked = this.checked;

			$(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);
			});
		});

		$('#simple-table').on('click', 'td input[type=checkbox]', function() {
			var $row = $(this).closest('tr');
			if ($row.is('.detail-row ')) return;
			if (this.checked) $row.addClass(active_class);
			else $row.removeClass(active_class);
		});




		$('[data-rel="tooltip"]').tooltip({
			placement: tooltip_placement
		});


		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();


			if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
			return 'left';
		}




		/***************/
		$('.show-details-btn').on('click', function(e) {
			e.preventDefault();
			$(this).closest('tr').next().toggleClass('open');
			$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass('fa-angle-double-up');
		});
		/***************/






	})

	function save() {
		$.ajax({
			url: 'save_oxygen_cylinder_checklist.php',
			type: "POST",
			data: $("#oxygen_form").serialize(),
			success: function(data) {
				//alert(data);
				var id = $("#oxygen_cylinder_id").val();

				BootstrapDialog.alert('Details Saved Successfully.');
				$("#oxygen_cylinder_id").val("");
				$("#issue_date").val("");
				$("#date_receive").val("");
				$("#date_validity").val("");
				$("#check_date").val("");
				$("#water_humidifier_date").val("");
				$('#pressure_reading').val("");
				$("#location").val("");
				$("#any_leakage").val("");
				$("#checked_by").val("");
				$("#valve_closed").val("");
				$("#status").val("");
				$("#remarks").val("");

				$("#cylinder_id").val("");

				$("#flex1").flexReload();

				return;
			},
			error: function(data) {
				BootstrapDialog.alert('Error Saving Details');
				return;
			}
		});
		$('.close').click();
		// location.href="procurement_list.php";
	}
	$('.date-picker').datepicker({
		autoclose: true,
		format: 'dd/mm/yyyy'
	}).next().on(ace.click_event, function() {
		$(this).prev().focus();
	});

	$('#issue_date').datepicker({
		format: 'dd/mm/yyyy', //use this option to display seconds
		//'setDate': new Date(),
		endDate: "+1d",
		//minDate:  new Date()-10,
		icons: {
			time: 'fa fa-clock-o',
			date: 'fa fa-calendar',
			up: 'fa fa-chevron-up',
			down: 'fa fa-chevron-down',
			previous: 'fa fa-chevron-left',
			next: 'fa fa-chevron-right',
			today: 'fa fa-arrows ',
			clear: 'fa fa-trash',
			close: 'fa fa-times'
		}
	}).datepicker("setDate", new Date());

	$('#date_receive').datepicker({
		format: 'dd/mm/yyyy', //use this option to display seconds
		//'setDate': new Date(),
		endDate: "+1d",
		//minDate:  new Date()-10,
		icons: {
			time: 'fa fa-clock-o',
			date: 'fa fa-calendar',
			up: 'fa fa-chevron-up',
			down: 'fa fa-chevron-down',
			previous: 'fa fa-chevron-left',
			next: 'fa fa-chevron-right',
			today: 'fa fa-arrows ',
			clear: 'fa fa-trash',
			close: 'fa fa-times'
		}
	}).datepicker("setDate", new Date());

	$('#date_validity').datetimepicker({
		format: 'DD/MM/YYYY',
		defaultDate: moment().add(1, 'years').toDate(),
		// maxDate: moment().add(1, 'years').toDate(),
		icons: {
			time: 'fa fa-clock-o',
			date: 'fa fa-calendar',
			up: 'fa fa-chevron-up',
			down: 'fa fa-chevron-down',
			previous: 'fa fa-chevron-left',
			next: 'fa fa-chevron-right',
			today: 'fa fa-arrows ',
			clear: 'fa fa-trash',
			close: 'fa fa-times'
		}
	}).next().on(ace.click_event, function() {
		$(this).prev().focus();
	});

	$('#date_check').datepicker({
		format: 'dd/mm/yyyy', //use this option to display seconds
		//'setDate': new Date(),
		endDate: "+1d",
		//minDate:  new Date()-10,
		icons: {
			time: 'fa fa-clock-o',
			date: 'fa fa-calendar',
			up: 'fa fa-chevron-up',
			down: 'fa fa-chevron-down',
			previous: 'fa fa-chevron-left',
			next: 'fa fa-chevron-right',
			today: 'fa fa-arrows ',
			clear: 'fa fa-trash',
			close: 'fa fa-times'
		}
	}).datepicker("setDate", new Date());

	//   $('#water_humidifier_date').datepicker({
	// 	 format: 'dd/mm/yyyy',//use this option to display seconds
	// 	 //'setDate': new Date(),
	// 	 endDate:  "+1d",
	// 	 //minDate:  new Date()-10,
	// 	 icons: {
	// 		time: 'fa fa-clock-o',
	// 		date: 'fa fa-calendar',
	// 		up: 'fa fa-chevron-up',
	// 		down: 'fa fa-chevron-down',
	// 		previous: 'fa fa-chevron-left',
	// 		next: 'fa fa-chevron-right',
	// 		today: 'fa fa-arrows ',
	// 		clear: 'fa fa-trash',
	// 		close: 'fa fa-times'
	// 	 }
	// 	}).datepicker("setDate", new Date());

	$('#hydro_test_date').datepicker({
		format: 'dd/mm/yyyy', //use this option to display seconds
		//'setDate': new Date(),
		endDate: "+1d",
		//minDate:  new Date()-10,
		icons: {
			time: 'fa fa-clock-o',
			date: 'fa fa-calendar',
			up: 'fa fa-chevron-up',
			down: 'fa fa-chevron-down',
			previous: 'fa fa-chevron-left',
			next: 'fa fa-chevron-right',
			today: 'fa fa-arrows ',
			clear: 'fa fa-trash',
			close: 'fa fa-times'
		}
	}).datepicker("setDate", new Date());
</script>
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />

<!-- page specific plugin styles -->
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="assets/css/chosen.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
<script src="assets/js/jquery-ui.custom.min.js"></script>
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/chosen.jquery.min.js"></script>
<script src="assets/js/spinbox.min.js"></script>
<script src="assets/js/bootstrap-datepicker.min.js"></script>
<script src="assets/js/bootstrap-timepicker.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
<script src="assets/js/dataTables.buttons.min.js"></script>
<script src="assets/js/buttons.flash.min.js"></script>
<script src="assets/js/buttons.html5.min.js"></script>
<script src="assets/js/buttons.print.min.js"></script>
<script src="assets/js/buttons.colVis.min.js"></script>
<script src="assets/js/dataTables.select.min.js"></script>


<script src="assets/js/moment.min.js"></script>
<script src="assets/js/daterangepicker.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
<script src="assets/js/jquery.knob.min.js"></script>
<script src="assets/js/autosize.min.js"></script>
<script src="assets/js/jquery.inputlimiter.min.js"></script>
<script src="assets/js/jquery.maskedinput.min.js"></script>
<script src="assets/js/bootstrap-tag.min.js"></script>
<script src="assets/js/ace-elements.min.js"></script>