ESH/form/add_work_area_sample.php
2024-10-23 18:28:06 +05:30

266 lines
6.4 KiB
PHP

<script>
function validate_work_area_sample(){
var sampleDate = $('#sampleDate').val();
if(sampleDate == ''){
BootstrapDialog.alert('Please Enter Sample Date.!!!');
return false;
}
var department = $('#department').val();
if(department == ''){
BootstrapDialog.alert('Please Enter Ddepartment.!!!');
return false;
}
var commentsAndRecommendations = $('#commentsAndRecommendations').val();
if(commentsAndRecommendations == ''){
BootstrapDialog.alert('Please Enter Comments And Recommendations.!!!');
return false;
}
var hygieneParameter = $('#hygieneParameter').val();
if(hygieneParameter == ''){
BootstrapDialog.alert('Please Enter Hygiene Parameter.!!!');
return false;
}
var currentValue = $('#currentValue').val();
if(currentValue == ''){
BootstrapDialog.alert('Please Enter Current Value.!!!');
return false;
}
$("#work-area-sample_form").submit();
//save_employee();
}
</script>
<script>
$(document).ready(function(e){
$("#work-area-sample_form").on('submit', function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: 'save_work_area_sample.php',
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
beforeSend: function(){
// $('.submitBtn').attr("disabled","disabled");
//$('#fupForm').css("opacity",".5");
},
success: function(msg){
BootstrapDialog.alert('Work Area Sample Saved Successfully.');
$("#flex1").flexReload();
$('.close').click();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving Work Area Sample');
$('.close').click();
return;
}
});
});
});
</script>
<style>
#modal-add-hygiene{
overflow-y:scroll;
}
.modal-dialog {
padding: 15px;
width:50%;
}
</style>
<div class="modal fade" id="modal-add-work-area-sample" name="modal-add-work-area-sample" role="dialog" aria-hidden="true">
<form role="form" id="work-area-sample_form" name="work-area-sample_form" action="#" method="post">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="widget-header">
<h5 class="widget-title">Add Work Area Sample</h5>
<div class="widget-toolbar">
<div class="widget-menu">
<a href="#" class="close" data-action="close" data-dismiss="modal">
<i class="ace-icon fa fa-times"></i>
</a>
</div>
</div>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group col-sm-4">
<label for="sample">Sample</label>
<select style=" height:30px" class="chosen-select form-control" name="sample"
id="sample" autofocus="autofocus" data-placeholder="Select Sample" required>
<option value=""></option>
<?php echo generateOption('hygiene_sample','sample_name','hyg_sample_id'); ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="currentValue">Sample Date</label>
<div class="input-group"><input id="sampleDate" name="sampleDate" type="text" class="form-control" style="height:30px" />
<span class="input-group-addon">
<i style="height:5px" class="fa fa-clock-o bigger-110"></i>
</span></div>
</div>
<div class="form-group col-sm-4">
<label for="hygieneParameter">Department</label>
<select multiple="" style=" height:30px" class="chosen-select form-control" name="department[]"
id="department" autofocus="autofocus" data-placeholder="Select Depart" required>
<?php echo generateOption('sub_business_unit','sbu_name','sbu_id'); ?>
</select>
<input type="hidden" class="form-control" name="sample_id"
id="sample_id" required/>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="height:40px">
Hygiene Parameter Of Sample
<div class="btn-group" style="float: right" >
<button type="button" class="btn btn-default btn-sm" onclick="addRowForHygieneParameter()" id="addButtonForRawMaterial">
<span class="glyphicon glyphicon-plus"></span>
</button>
</div>
</div>
<input type="hidden" name="parameterRow" id="parameterRow" value="0">
<div class="panel-body" style="padding: 0px;">
<table class="table table-bordered table-hover" id="hygieneParameterTable">
<tr class="active">
<th width="10%">Sr</th>
<th width="40%">Hygiene Parameter</th>
<th width="45%">Current Value</th>
<th width="5%"></th>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="form-group col-sm-8">
<label for="commentsAndRecommendations">Comments And Recommendations</label>
<textarea style=" height:60px" type="text" class="form-control" name="commentsAndRecommendations"
id="commentsAndRecommendations" placeholder="Comments And Recommendations" required></textarea>
</div>
</div>
<div class="widget-toolbox padding-8 clearfix" >
<button type="button" class="btn btn-info btn-sm save_button" onclick="validate_work_area_sample();"><i class="ace-icon fa fa-floppy-o bigger-110"></i>Save </button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal"><i class="ace-icon fa fa-times bigger-110"></i>Cancel</button>
</div>
</div>
</div>
</div>
</form>
</div>
<script>
jQuery(function($) {
if(!ace.vars['old_ie']) $('#sampleDate').datetimepicker({
format: 'DD/MM/YYYY h:mm A',//use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
//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'
}
}).next().on(ace.click_event, function(){
$(this).prev().focus();
});
});
</script>