488 lines
18 KiB
PHP
488 lines
18 KiB
PHP
<?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>
|
|
<?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">Patient Management</li>
|
|
<li class="active">Hazard Report Form</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
<div class="page-content">
|
|
<div class="card-header bg-white text-primary" style="text-align: left;">
|
|
<h4 class="card-title" style="font-size: 18px; margin-left: 2%;">Hazard Observation Entry</h4>
|
|
</div>
|
|
|
|
|
|
<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_hira_form" action="hira_excel.php">
|
|
<div id="flex1" style="width:100%">
|
|
<input type="hidden" name="flex_hira_id" id="flex_hira_id" />
|
|
</div>
|
|
</form>
|
|
<form name="export_form" method="post" id="export_form" action="">
|
|
<input type="hidden" name="pdf_actions" id="pdf_actions" value="hira_pdf.php" />
|
|
<input type="hidden" name="excel_actions" id="excel_actions" value="hira_excel.php" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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: 'update_pending_hazard_form_script\.php?status=pending',
|
|
dataType: 'json',
|
|
colModel: [{
|
|
display: '',
|
|
name: '',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Sr',
|
|
name: 'id',
|
|
width: w * .04,
|
|
sortable: false,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Reference ID',
|
|
name: 'ref_id',
|
|
width: w * .1,
|
|
sortable: false,
|
|
align: 'left'
|
|
},
|
|
|
|
{
|
|
display: 'Activity/Situation',
|
|
name: 'activity_situation',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Hazard Category',
|
|
name: 'hazard_category',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Hazard Identified',
|
|
name: 'hazard_identified',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Activity Type',
|
|
name: 'activity_type',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Hazard Condition',
|
|
name: 'hazard_condition',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Risk Exposure',
|
|
name: 'risk_exposure',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Date and Time',
|
|
name: 'date_time',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Department',
|
|
name: 'department',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Location',
|
|
name: 'location',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Identified By',
|
|
name: 'identified_by',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Remarks',
|
|
name: 'remarks',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Status',
|
|
name: 'status',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Reviewed by',
|
|
name: 'reviewed_by',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Reviewed Date Time',
|
|
name: 'reviewed_date_time',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Reviewed remarks',
|
|
name: 'review_remarks',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
],
|
|
buttons: [
|
|
|
|
{
|
|
name: 'PDF',
|
|
bclass: 'print',
|
|
onpress: pdf
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
{
|
|
name: 'Excel',
|
|
bclass: 'print_excel',
|
|
onpress: excel
|
|
},
|
|
{
|
|
separator: true
|
|
}
|
|
],
|
|
searchitems: [{
|
|
display: 'Hazard Category',
|
|
name: 'hazard_category',
|
|
isdefault: true
|
|
},
|
|
{
|
|
display: 'Identified By',
|
|
name: 'identified_by'
|
|
},
|
|
{
|
|
display: 'Location',
|
|
name: 'location'
|
|
},
|
|
],
|
|
sortname: "id",
|
|
sortorder: "asc",
|
|
usepager: true, //pagination
|
|
useRp: true,
|
|
rp: 50, //records per page
|
|
showTableToggleBtn: false, //toggle button for the whole table
|
|
resizable: true,
|
|
height: h,
|
|
singleSelect: true
|
|
});
|
|
});
|
|
function addDirect() {
|
|
hazard_identified.href = "add_hira.php";
|
|
|
|
|
|
}
|
|
|
|
|
|
function add() {
|
|
hazard_identified.href = "add_hira.php";
|
|
}
|
|
|
|
|
|
|
|
function delete_hazard(id) {
|
|
$("#flex_hira_id").val(id);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete the Hazard?', function(result) {
|
|
if (result) {
|
|
$.ajax({
|
|
url: 'delete_hazard_form.php',
|
|
type: "POST",
|
|
data: {
|
|
id: id
|
|
}, // Directly sending the id as POST data
|
|
success: function(data) {
|
|
if (data.indexOf("SUCCESS") != -1) {
|
|
BootstrapDialog.alert('Hazard Deleted Successfully.');
|
|
$("#flex1").flexReload();
|
|
} else {
|
|
BootstrapDialog.alert('Error Deleting Hazard');
|
|
}
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Deleting Hazard');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
function open_hazard(flex_hira_id, action) {
|
|
if (action == "V") {
|
|
$("#flex_hira_id").val(flex_hira_id);
|
|
$("#flex_hira_form").attr('method', 'POST');
|
|
$("#flex_hira_form").attr('action', 'hazard_risk_assesment_form.php');
|
|
$("#flex_hira_form").submit();
|
|
} else {
|
|
$("#flex_hira_id").val(flex_hira_id);
|
|
$("#flex_hira_form").attr('method', 'POST');
|
|
$("#flex_hira_form").attr('action', 'risk_assessment.php');
|
|
$("#flex_hira_form").submit();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
function pdf() {
|
|
window.open('hira_pdf.php', 'Report List');
|
|
}
|
|
|
|
function excel() {
|
|
window.open('hira_excel.php', 'Report List');
|
|
}
|
|
|
|
$("#new_button").on("click", function() {
|
|
$("id").val("");
|
|
});
|
|
</script>
|
|
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- End of page-content -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
// Function to generate a random alphanumeric reference ID
|
|
function generateReferenceId() {
|
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
let result = '';
|
|
|
|
for (let i = 0; i < 8; i++) {
|
|
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// Set the generated reference ID into the input field
|
|
document.getElementById('ref_id').value = generateReferenceId();
|
|
</script>
|
|
|
|
<script>
|
|
$("#new_button").on("click", function() {
|
|
$("id").val("");
|
|
});
|
|
|
|
function validate() {
|
|
var ref_id = $('#ref_id').val();
|
|
if (ref_id == '') {
|
|
BootstrapDialog.alert('Please Enter Reference id');
|
|
return false;
|
|
}
|
|
var activity_situation = $('#activity_situation').val();
|
|
if (activity_situation == '') {
|
|
BootstrapDialog.alert('Please Enter Activity/Situation.');
|
|
return false;
|
|
}
|
|
|
|
var hazard_identified = $('#hazard_identified').val();
|
|
if (hazard_identified == '') {
|
|
BootstrapDialog.alert('Please Enter Hazard Identified.');
|
|
return false;
|
|
}
|
|
|
|
var activity_situation = $('#activity_situation').val();
|
|
if (activity_situation == '') {
|
|
BootstrapDialog.alert('Please Select Hazard Category.');
|
|
return false;
|
|
}
|
|
|
|
var activity_type = $('#activity_type').val();
|
|
if (activity_type == '') {
|
|
BootstrapDialog.alert('Please Select Activity Type.');
|
|
return false;
|
|
}
|
|
|
|
var hazard_condition = $('#hazard_condition').val();
|
|
if (hazard_condition == '') {
|
|
BootstrapDialog.alert('Please Select Hazard Condition.');
|
|
return false;
|
|
}
|
|
|
|
var date_time = $('#date_time').val();
|
|
if (date_time == '') {
|
|
BootstrapDialog.alert('Please Enter Date and Time.');
|
|
return false;
|
|
}
|
|
|
|
var department = $('#department').val();
|
|
if (department == '') {
|
|
BootstrapDialog.alert('Please Select Department.');
|
|
return false;
|
|
}
|
|
|
|
var hazard_identified = $('#hazard_identified').val();
|
|
if (hazard_identified == '') {
|
|
BootstrapDialog.alert('Please Enter Location.');
|
|
return false;
|
|
}
|
|
|
|
var identified_by = $('#identified_by').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Select Identified By.');
|
|
return false;
|
|
}
|
|
|
|
save_hazard();
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<style>
|
|
#modal-add-hazard {
|
|
overflow-y: scroll;
|
|
}
|
|
</style>
|
|
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<script type="text/javascript">
|
|
|
|
function save_hazard() {
|
|
$.ajax({
|
|
url: 'save_hazard_form.php',
|
|
type: 'POST',
|
|
data: $("#hazard_form").serialize(),
|
|
success: function(data) {
|
|
BootstrapDialog.alert('Hazard Saved Successfully');
|
|
$("#flex1").flexReload(); // Reload data in flex grid, if applicable
|
|
window.location.href = 'flex_hira_form.php';
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Saving Hazard');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
</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>
|