680 lines
32 KiB
PHP
680 lines
32 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="box box-primary center" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
|
|
<form id="hazard_form" method="post">
|
|
<!-- box-body-->
|
|
<div class="box-body">
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12">
|
|
<table id="myTable top" class="table table-bordered order-list" style= " margin: -5px -5px -10px -7px; width: 100%;">
|
|
|
|
|
|
<?php
|
|
$row = null;
|
|
if (isset($_REQUEST['flex_id'])) {
|
|
$sql = "select * from hazard_observation where id='" . $_REQUEST['flex_id'] . "'";
|
|
$result = @mysqli_query($conn, $sql);
|
|
$num_rows = @mysqli_num_rows($result);
|
|
$row = @mysqli_fetch_array($result);
|
|
}
|
|
do {
|
|
?>
|
|
<tbody>
|
|
<style>
|
|
.table th {
|
|
background-color: #f0f0f0; /* Light gray background */
|
|
color: #666666; /* Lighter shade of black text */
|
|
font-weight: bold; /* Make the text bold */
|
|
font-size: 11px; /* Set the font size to 14 pixels */
|
|
padding: 10px;
|
|
}
|
|
</style>
|
|
|
|
<table class="table table-bordered">
|
|
<tr>
|
|
|
|
<th style="width: 20%;">Activity/Situation</th>
|
|
<th style="width: 30%;">Hazard Category</th>
|
|
<th style="width: 20%;">Hazard Identified</th>
|
|
</tr>
|
|
<tr id="main-form">
|
|
|
|
<td style="width:20%">
|
|
<input class="form-control form-control-lg" name="activity_situation" id="activity_situation" placeholder="Enter Activity/Situation" style="font-size:10px;" required />
|
|
</td>
|
|
<td style="width:30%">
|
|
<select class="form-control form-control-lg" name="hazard_category" id="hazard_category" required>
|
|
<option value="">Select Hazard Category</option>
|
|
<?php
|
|
// Fetch hazard categories from database
|
|
$sql = "SELECT id, category_name FROM hazard_category";
|
|
$result = mysqli_query($conn, $sql);
|
|
if ($result && mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<option value='" . $row['category_name'] . "'>" . $row['category_name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td style="width:20%">
|
|
<input class="form-control form-control-lg" name="hazard_identified" id="hazard_identified" placeholder="Enter Hazard Identified" style="font-size:10px;" required />
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
|
|
<th style="width: 20%;">Activity Type</th>
|
|
<th style="width: 20%;">Hazard Condition</th>
|
|
<th style="width: 20%;">Risk Exposure</th>
|
|
|
|
</tr>
|
|
<tr id="main-form">
|
|
|
|
<td style="width:20%">
|
|
<select class="form-control form-control-lg" name="activity_type" id="activity_type" required>
|
|
<option value="">Select Activity Type</option>
|
|
<?php
|
|
// Fetch activity types from database
|
|
$sql = "SELECT id, Name FROM activity_type";
|
|
$result = mysqli_query($conn, $sql);
|
|
if ($result && mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<option value='" . $row['Name'] . "'>" . $row['Name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td style="width:20%">
|
|
<select class="form-control form-control-lg" name="hazard_condition" id="hazard_condition" required>
|
|
<option value="">Select Hazard Condition</option>
|
|
<?php
|
|
// Fetch hazard conditions from database
|
|
$sql = "SELECT id, Name FROM hazard_condition";
|
|
$result = mysqli_query($conn, $sql);
|
|
if ($result && mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<option value='" . $row['Name'] . "'>" . $row['Name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td style="width:20%">
|
|
<input type="text" class="form-control form-control-lg" name="risk_exposure" id="risk_exposure" style="font-size:10px;" placeholder="Enter Risk Exposure">
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
<th style="width: 20%;">Date and Time</th>
|
|
<th style="width: 20%;">Department</th>
|
|
<th style="width: 30%;">Location</th>
|
|
|
|
|
|
</tr>
|
|
<tr id="main-form">
|
|
<td style="width:20%">
|
|
<input type="datetime-local" style="font-size:10px;" class="form-control form-control-lg" name="date_time" id="date_time" required>
|
|
</td>
|
|
<td style="width:20%">
|
|
<select class="form-control form-control-lg" name="department" id="department" required>
|
|
<option value="">Select Department</option>
|
|
<?php
|
|
// Fetch departments from database
|
|
$sql = "SELECT id, name FROM departments";
|
|
$result = mysqli_query($conn, $sql);
|
|
if ($result && mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td style="width:30%">
|
|
<input type="text" class="form-control form-control-lg" name="location" id="location" style="font-size:10px;" placeholder="Enter Location">
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<th style="width: 20%;">Identified By</th>
|
|
<th style="width: 20%;">Remarks</th>
|
|
<th style="width: 20%;">Status</th>
|
|
</tr>
|
|
<tr id="main-form">
|
|
<td style="width:20%">
|
|
<select class="form-control form-control-lg" name="identified_by" id="identified_by" required>
|
|
<option value="">Select Identified By</option>
|
|
<?php
|
|
// Fetch employees from database
|
|
$sql = "SELECT id, name FROM employees";
|
|
$result = mysqli_query($conn, $sql);
|
|
if ($result && mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>";
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td style="width:20%">
|
|
<textarea class="form-control form-control-lg" name="remarks" style="font-size:10px;" id="remarks" rows="3" placeholder="Enter Remarks"></textarea>
|
|
</td>
|
|
<td style="width:20%">
|
|
<select class="form-control" name="status" id="status" required>
|
|
<option value="">Select Status</option>
|
|
<option value="approved" <?= $row['status'] == 'Approved' ? 'selected' : '' ?>>Approved</option>
|
|
<option value="Pending" <?= $row['status'] == 'pending' ? 'selected' : '' ?>>Pending</option>
|
|
<option value="in progress" <?= $row['status'] == 'in progress' ? 'selected' : '' ?>>In Progress</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
} while ($row = @mysqli_fetch_array($result)) //end of while
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
</tr>
|
|
</tfoot>
|
|
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- End box-body-->
|
|
<!--box-footer-->
|
|
<div class="box-footer" style="text-align: center; margin-top: -10px">
|
|
<button class="btn btn-success new_button" id="new_button" type="reset" onclick="show_save_button();">
|
|
<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
|
|
New
|
|
</button>
|
|
|
|
|
|
|
|
<button class="btn btn-info save_button" id="save_button" type="button" onclick="validate();">
|
|
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
|
|
Save
|
|
</button>
|
|
|
|
|
|
<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>
|
|
|
|
<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: '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 * .1,
|
|
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 * .1,
|
|
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',
|
|
|
|
},
|
|
],
|
|
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(id, action) {
|
|
if (action == "V") {
|
|
$("#save_button").hide();
|
|
} else {
|
|
$("#save_button").show();
|
|
}
|
|
$.ajax({
|
|
url: 'select_hazard_form.php?id=' + id,
|
|
type: 'POST',
|
|
success: function(data) {
|
|
var data = $.parseJSON(data);
|
|
$("#id").val(data.id);
|
|
$("#activity_situation").val(data.activity_situation);
|
|
$("#hazard_category").val(data.hazard_category);
|
|
$("#hazard_identified").val(data.hazard_identified);
|
|
$("#activity_type").val(data.activity_type);
|
|
$("#hazard_condition").val(data.hazard_condition);
|
|
$("#risk_exposure").val(data.risk_exposure);
|
|
$("#date_time").val(data.date_time);
|
|
$("#department").val(data.department);
|
|
$("#location").val(data.location);
|
|
$("#identified_by").val(data.identified_by);
|
|
$("#remarks").val(data.remarks);
|
|
$("#status").val(data.status);
|
|
$('#modal-add-hazard').modal("show");
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Populating Hazard');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
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>
|
|
$("#new_button").on("click", function() {
|
|
$("id").val("");
|
|
});
|
|
|
|
function validate() {
|
|
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
|
|
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>
|