-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeptgap.php
More file actions
102 lines (92 loc) · 4.67 KB
/
Copy pathdeptgap.php
File metadata and controls
102 lines (92 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php include("assets/head/h.php"); ?>
<div class="pcoded-main-container">
<div class="pcoded-content">
<div class="row">
<div class="col-sm-12">
<div class="card shadow-sm border-0 rounded-4">
<div class="card-header bg-primary text-white text-center rounded-top-4">
<h5 class="mb-0">📊 Facility Department-wise Assessment Analysis</h5>
</div>
<div class="card-body bg-light">
<div class="mb-4">
<h6 class="text-dark mb-3">🔍 Select Facility Type & Department</h6>
<div class="row g-3">
<div class="col-md-6">
<select class="form-control" id="facilityTypeDropdown" name="facilityTypeDropdown" required>
<option value="">-- Select Facility Type --</option>
<?php
$facTypeQuery = "SELECT fac_type_id, facilities_type FROM facilities_type ORDER BY facilities_type";
$facTypeResult = mysqli_query($con, $facTypeQuery);
while ($row = mysqli_fetch_assoc($facTypeResult)) {
echo '<option value="' . $row['fac_type_id'] . '">' . $row['facilities_type'] . '</option>';
}
?>
</select>
</div>
<div class="col-md-6">
<select class="form-control" id="departmentDropdown" name="departmentDropdown" required>
<option value="">-- Select Department --</option>
</select>
</div>
</div>
</div>
<div id="dataContainer" class="pt-3">
<div class="alert alert-info text-center" role="alert">
Please select Facility Type & Department !
</div>
</div>
<div id="topIndicatorsContainer" class="pt-4"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Scripts -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
// Load departments on facility type change
$('#facilityTypeDropdown').on('change', function () {
var facTypeId = $(this).val();
if (facTypeId !== '') {
$.post('assets/get/load_departments.php', {
fac_type_id: facTypeId
}, function (data) {
$('#departmentDropdown').html(data);
$('#dataContainer').html('<div class="alert alert-warning text-center">Select Department !</div>');
$('#topIndicatorsContainer').html('');
});
} else {
$('#departmentDropdown').html('<option value="">-- Select Department --</option>');
$('#dataContainer').html('<div class="alert alert-info text-center">Please select Facility Type & Department !</div>');
$('#topIndicatorsContainer').html('');
}
});
// Load data and top indicators when department is selected
$('#departmentDropdown').on('change', function () {
var deptId = $(this).val();
var facTypeId = $('#facilityTypeDropdown').val();
if (deptId && facTypeId) {
// Load main table
$.post('assets/get/load_facility_data.php', {
dept_id: deptId,
fac_type_id: facTypeId
}, function (data) {
$('#dataContainer').html(data);
// Load top indicators
$.post('assets/get/load_top_indicators.php', {
dept_id: deptId,
fac_type_id: facTypeId
}, function (cardHtml) {
$('#topIndicatorsContainer').html(cardHtml);
});
});
} else {
$('#dataContainer').html('<div class="alert alert-warning text-center">Please select Department </div>');
$('#topIndicatorsContainer').html('');
}
});
});
</script>
<?php include("assets/head/f.php"); ?>