1084 lines
44 KiB
PHP
1084 lines
44 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"> Risk Assessment </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: 20px; margin-left: 2%;"> Hazard Risk Assessment</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: 25%;">Reference ID</th>
|
|
<th style="width: 20%;">Activity/Situation</th>
|
|
<th style="width: 25%;">Hazard Category</th>
|
|
<th style="width: 25%;">Hazard Identified</th>
|
|
</tr>
|
|
<tr id="main-form">
|
|
<td style="width:25%">
|
|
<input type="text" class="form-control form-control-lg" name="ref_id" id="ref_id" style="font-size: 10px; border: none; background-color: white;"readonly required />
|
|
|
|
</td>
|
|
|
|
<td style="width:20%">
|
|
<input type="text" class="form-control form-control-lg" name="activity_situation" id="activity_situation" style="font-size: 10px; border: none; background-color: white; pointer-events: none;" readonly required />
|
|
</td>
|
|
<td style="width:25%">
|
|
<select class="form-control form-control-lg" name="hazard_category" id="hazard_category" required>
|
|
<option value="">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:25%">
|
|
<select class="chosen-select form-control" multiple="" name="hazard_identified" id="hazard_identified" rows="3" data-placeholder=" Hazard Indentified" >
|
|
<option value=""> </option>
|
|
<?php echo generateOption('hazard_identified', 'hazard_description', 'hazard_description', '', '') ?>
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
|
|
<th style="width: 20%;">Activity Type</th>
|
|
<th style="width: 20%;">Hazard Condition</th>
|
|
<th style="width: 20%;">Risk Exposure</th>
|
|
<th style="width: 20%;">Date and Time</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=""> 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=""> 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:25%">
|
|
<select class="chosen-select form-control" multiple="" name="risk_exposure" id="risk_exposure" rows="3" data-placeholder="Risk Exposure" >
|
|
<option value=""> </option>
|
|
<?php echo generateOption('risk_exposure', 'risk_description', 'risk_description', '', '') ?>
|
|
</select>
|
|
|
|
</td>
|
|
<td style="width:20%">
|
|
<input type="datetime-local" style="font-size:10px; border: none;" class="form-control form-control-lg" name="date_time" id="date_time" readonly required>
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th style="width: 20%;">Department</th>
|
|
<th style="width: 25%;">Location</th>
|
|
<th style="width: 20%;">Identified By</th>
|
|
<th style="width: 20%;">Remarks</th>
|
|
|
|
|
|
</tr>
|
|
<tr id="main-form">
|
|
|
|
<td style="width:20%">
|
|
<input type="text" class="form-control form-control-lg" name="department" id="department" style="font-size:10px; border: none;"readonly required>
|
|
</td>
|
|
<td style="width:25%">
|
|
<input type="text" class="form-control form-control-lg" name="location" id="location" style="font-size:10px;" placeholder="Enter Location">
|
|
</td>
|
|
<td style="width:20%">
|
|
|
|
<input type="text" class="form-control form-control-lg" name="identified_by" id="identified_by" style="font-size:10px; border: none;" readonly required>
|
|
</td>
|
|
<td style="width:20%">
|
|
<textarea class="form-control form-control-lg" name="remarks" style="font-size:10px; border: none;" id="remarks" rows="3" readonly></textarea>
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<th style="width: 20%;">Reviewed by</th>
|
|
<th style="width: 20%;">Reviewed Date Time</th>
|
|
|
|
</tr>
|
|
<tr id="main-form">
|
|
|
|
<td style="width:20%">
|
|
<select class="form-control form-control-lg" name="reviewed_by" id="reviewed_by" required>
|
|
<option value="">Select Reviewed By</option>
|
|
<?php
|
|
// Fetch employees from database
|
|
$sql = "SELECT id, name FROM SecurityExperts";
|
|
$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="datetime-local" style="font-size:10px;" class="form-control form-control-lg" name="reviewed_date_time" id="reviewed_date_time" required>
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
} while ($row = @mysqli_fetch_array($result)) //end of while
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
</tr>
|
|
</tfoot>
|
|
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div class="box-body" style ="margin-left: 0.5%; margin-right : -0.5%;">
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<table id="myTable" class="table table-bordered order-list" style="margin: -5px -5px -10px -7px; width: 100%;">
|
|
<thead>
|
|
<tr>
|
|
|
|
<th colspan="3" style="text-align: center;">Risk Assessment</th>
|
|
<th colspan="1" style="text-align: left;">Legal:</th>
|
|
<th colspan="1" style="text-align: left;">Risk Acceptable</th>
|
|
<th colspan="1" style="text-align: left;">Risk Significant</th>
|
|
|
|
<th colspan="4" style="text-align: center;">Risk Control </th>
|
|
</tr>
|
|
<tr>
|
|
|
|
<th style="width: 5.5%;">S/5</th>
|
|
<th style="width: 5.5%;">O/5</th>
|
|
<th style="width: 5.5%;">S*O</th>
|
|
|
|
|
|
<th style="width: 9%;">Yes/No</th>
|
|
<th style="width: 9%;">Yes/No</th>
|
|
|
|
<th style="width: 9%;">Yes/No</th>
|
|
<th style="width: 15%;">Risk Control Measures</th>
|
|
|
|
<th style="width: 10%;">Target Date</th>
|
|
<th style="width: 10%;">Status</th>
|
|
<th style="width: 15%;">Reviewed Remarks</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
|
|
<td>
|
|
<input type="text" class="form-control" name="severity" id="severity" placeholder="Select" required />
|
|
<select id="severity_dropdown" class="form-control" style="display:none">
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
<option value="3">3</option>
|
|
<option value="4">4</option>
|
|
<option value="5">5</option>
|
|
</select>
|
|
</td>
|
|
<td>
|
|
<input type="text" class="form-control" name="occurrence" id="occurrence" placeholder="Select" required />
|
|
<select id="occurrence_dropdown" class="form-control" style="display:none">
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
<option value="3">3</option>
|
|
<option value="4">4</option>
|
|
<option value="5">5</option>
|
|
</select>
|
|
</td>
|
|
<td>
|
|
<input type="text" class="form-control" name="calculate_SO" id="calculate_SO" placeholder="Value" readonly required />
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<td>
|
|
<select class="form-control" name="legal" id="legal">
|
|
<option value="">Select </option>
|
|
<option value="Yes">Yes</option>
|
|
<option value="No">No</option>
|
|
</select>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" name="acceptable" id="acceptable">
|
|
<option value="">Select </option>
|
|
<option value="Yes">Acceptable</option>
|
|
<option value="No">Not Acceptable</option>
|
|
</select>
|
|
</td>
|
|
|
|
<td>
|
|
<select class="form-control" name="significant" id="significant">
|
|
<option value="">Select </option>
|
|
<option value="Yes">Significant</option>
|
|
<option value="No">Not Significant</option>
|
|
</select>
|
|
</td>
|
|
<td >
|
|
<select class="chosen-select form-control" multiple="" name="risk_control_measures" id="risk_control_measures" rows="3" data-placeholder="Enter risk control measures" >
|
|
<option value=""> </option>
|
|
<?php echo generateOption('Risk_Control_Measures', 'control_description', 'control_description', '', '') ?>
|
|
</select>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
<input type="date" class="form-control" name="target_date" id="target_date" />
|
|
</td>
|
|
<td>
|
|
<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>
|
|
<td>
|
|
<textarea class="form-control" name="reviewed_remarks" id="reviewed_remarks" ></textarea>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- End box-body-->
|
|
<!--box-footer-->
|
|
<div class="box-footer" style="text-align: center; margin-top: 20px">
|
|
<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: 'hazard_risk_assesment_form_script.php',
|
|
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: 'reviewed_remarks',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
|
|
{
|
|
display: 'S/5',
|
|
name: 'severity',
|
|
width: w * .04,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'O/5',
|
|
name: 'occurrence',
|
|
width: w * .05,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'S*O',
|
|
name: 'calculate_SO',
|
|
width: w * .05,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Legal',
|
|
name: 'legal',
|
|
width: w * .05,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Acceptable',
|
|
name: 'acceptable',
|
|
width: w * .05,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Significant',
|
|
name: 'significant',
|
|
width: w * .05,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Risk Control Measures',
|
|
name: 'risk_control_measures',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left',
|
|
|
|
},
|
|
{
|
|
display: 'Target Date',
|
|
name: 'target_date',
|
|
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 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);
|
|
$("#ref_id").val(data.ref_id);
|
|
$("#activity_situation").val(data.activity_situation);
|
|
$("#hazard_category").val(data.hazard_category);
|
|
|
|
if (data.hazard_identified != null) {
|
|
var hazard_identified = data.hazard_identified
|
|
dataarray = hazard_identified.split(",");
|
|
$("#hazard_identified").val(dataarray);
|
|
$('#hazard_identified').trigger('chosen:updated');
|
|
}
|
|
$("#activity_type").val(data.activity_type);
|
|
$("#hazard_condition").val(data.hazard_condition);
|
|
|
|
if (data.risk_exposure != null) {
|
|
var risk_exposure = data.risk_exposure
|
|
dataarray = risk_exposure.split(",");
|
|
$("#risk_exposure").val(dataarray);
|
|
$('#risk_exposure').trigger('chosen:updated');
|
|
}
|
|
$("#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);
|
|
$("#reviewed_by").val(data.reviewed_by);
|
|
$("#reviewed_date_time").val(data.reviewed_date_time);
|
|
$("#reviewed_remarks").val(data.reviewed_remarks);
|
|
$("#severity").val(data.severity);
|
|
$("#occurrence").val(data.occurrence);
|
|
$("#calculate_SO").val(data.calculate_SO);
|
|
$("#legal").val(data.legal);
|
|
$("#acceptable").val(data.acceptable);
|
|
$("#significant").val(data.significant);
|
|
$("#target_date").val(data.target_date);
|
|
if (data.risk_control_measures != null) {
|
|
var risk_control_measures = data.risk_control_measures
|
|
dataarray = risk_control_measures.split(",");
|
|
$("#risk_control_measures").val(dataarray);
|
|
$('#risk_control_measures').trigger('chosen:updated');
|
|
}
|
|
$('#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 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;
|
|
}
|
|
|
|
var identified_by = $('#reviewed_by').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Select Reviewed By.');
|
|
return false;
|
|
}
|
|
|
|
var identified_by = $('#reviewed_date_time').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Select Reviewed Date Time.');
|
|
return false;
|
|
}
|
|
|
|
var identified_by = $('#reviewed_remarks').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Enter Review Remarks.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#severity').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Enter Severity.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#occurrence').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Enter Occurrence.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#calculate_SO').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please Enter Resulted SO value.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#legal').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please choose legal or not.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#acceptable').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please choose acceptable or not.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#significant').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please choose significant or not.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#target_date').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please choose target date.');
|
|
return false;
|
|
}
|
|
var identified_by = $('#risk_control_measures').val();
|
|
if (identified_by == '') {
|
|
BootstrapDialog.alert('Please choose risk control measures.');
|
|
return false;
|
|
}
|
|
save_hazard();
|
|
}
|
|
|
|
|
|
</script>
|
|
<!-- Place this script at the bottom of your HTML body -->
|
|
<script>
|
|
// Get the select element
|
|
var selectElement = document.getElementById('significant');
|
|
|
|
// Check the conditions and update the select option dynamically
|
|
if (severity >= 4 || calculate_SO >= 15 || legal === 'Yes' || hazard_condition === 'Emergency') {
|
|
selectElement.value = 'Yes'; // Set selection to 'Significant'
|
|
} else {
|
|
selectElement.value = 'No'; // Set selection to 'Not Significant'
|
|
}
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#severity').click(function() {
|
|
$('#severity').hide();
|
|
$('#severity_dropdown').show().focus();
|
|
});
|
|
|
|
$('#severity_dropdown').change(function() {
|
|
$('#severity').val($('#severity_dropdown').val());
|
|
$('#severity_dropdown').hide();
|
|
$('#severity').show();
|
|
});
|
|
|
|
$('#occurrence').click(function() {
|
|
$('#occurrence').hide();
|
|
$('#occurrence_dropdown').show().focus();
|
|
});
|
|
|
|
$('#occurrence_dropdown').change(function() {
|
|
$('#occurrence').val($('#occurrence_dropdown').val());
|
|
$('#occurrence_dropdown').hide();
|
|
$('#occurrence').show();
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#severity_dropdown, #occurrence_dropdown').on('change', function() {
|
|
var severity = parseInt($('#severity_dropdown').val());
|
|
var occurrence = parseInt($('#occurrence_dropdown').val());
|
|
var result = severity * occurrence;
|
|
|
|
$('#calculate_SO').val(result);
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
// Get a reference to the input field
|
|
var calculateSOInput = document.getElementById('calculate_SO');
|
|
|
|
// Add an event listener to detect changes in the input value
|
|
calculateSOInput.addEventListener('input', function() {
|
|
var value = parseInt(this.value); // Parse the input value as an integer
|
|
|
|
// Reset background color
|
|
this.style.backgroundColor = '';
|
|
|
|
// Apply color based on value ranges
|
|
if (value <= 4) {
|
|
this.style.backgroundColor = 'green';
|
|
} else if (value <= 12) {
|
|
this.style.backgroundColor = 'yellow';
|
|
} else if (value <= 25) {
|
|
this.style.backgroundColor = 'red';
|
|
} else {
|
|
// Handle values greater than 25 (if needed)
|
|
this.style.backgroundColor = 'red'; // Default to red if > 25
|
|
}
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
// Get the current date and time
|
|
const now = new Date();
|
|
const year = now.getFullYear();
|
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
const day = String(now.getDate()).padStart(2, '0');
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
// Format the date and time as required by the datetime-local input
|
|
const currentDateTime = `${year}-${month}-${day}T${hours}:${minutes}`;
|
|
|
|
// Set the value of the input field to the current date and time
|
|
document.getElementById('date_time').value = currentDateTime;
|
|
</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_risk_assessment_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>
|