-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgap.php
More file actions
271 lines (250 loc) · 8.84 KB
/
Copy pathgap.php
File metadata and controls
271 lines (250 loc) · 8.84 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<?php include("assets/head/h.php"); ?>
<style>
/* --- Global Styles --- */
.page-header h5 {
font-size: 1.3rem;
letter-spacing: 0.3px;
}
/* --- Card Enhancements --- */
.card {
border-radius: 10px !important;
overflow: hidden;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
transform: translateY(-3px);
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}
.card-header {
padding: 0.75rem 1.2rem;
font-weight: 600;
letter-spacing: 0.3px;
}
.card-body {
background-color: #fafafa;
}
/* --- Table Styling --- */
.table {
font-size: 0.88rem;
}
.table thead th {
text-align: center;
vertical-align: middle;
white-space: nowrap;
}
/* Fix for invisible table headers: make them bright and readable */
.table thead.table-dark th,
.table thead th {
background-color: #0d6efd !important; /* bright blue header for default tables */
color: #fff !important;
font-weight: 600;
border-bottom: 2px solid #e9ecef !important;
}
/* Zone-specific header colors (override default blue) */
#red_zone_table thead th { background-color: #dc3545 !important; } /* Red Zone */
#yellow_zone_table thead th { background-color: #ffc107 !important; color: #212529 !important; } /* Yellow */
#orange_zone_table thead th { background-color: #fd7e14 !important; } /* Orange */
#green_zone_table thead th { background-color: #198754 !important; } /* Green */
/* Hover & row effects */
.table tbody tr:hover {
background-color: #f1f8ff !important;
transition: 0.2s ease;
}
/* Notes style */
p.text-primary.small {
border-left: 3px solid #0d6efd;
padding-left: 8px;
margin-top: 10px;
background-color: #eef6ff;
border-radius: 4px;
}
/* Custom Colors */
.badge.bg-orange {
background-color: #fd7e14;
color: white;
}
.text-orange {
color: #fd7e14 !important;
}
/* Datatable Buttons */
.dt-button.buttons-excel {
background-color: #28a745 !important;
color: white !important;
border: none;
border-radius: 6px;
padding: 6px 12px;
font-size: 14px;
}
.dt-button.buttons-excel:hover {
background-color: #1e7e34 !important;
}
/* small responsive tweak to ensure header icons wrap nicely */
.card-header .btn {
white-space: nowrap;
}
</style>
<div class="pcoded-main-container">
<div class="pcoded-content">
<div class="page-header mb-3">
<h5 class="text-primary fw-bold"><i class="bi bi-graph-up-arrow me-1"></i> Gap Analysis Report</h5>
</div>
<!-- 🔹 Top Non-Compliant Concern + Standard Table -->
<div class="card mb-4 shadow-sm border">
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
<h6 class="mb-0"><i class="bi bi-exclamation-triangle-fill me-2"></i>Top Non-Compliant Area of Concern and Standard (By Facility Type)</h6>
</div>
<div class="card-body table-responsive">
<table id="withStandardTable" class="table table-bordered table-striped table-hover table-sm align-middle">
<thead class="table-dark">
<tr>
<th>Facility Type</th>
<th>Area of Concern</th>
<th>Standard</th>
<th>Non-Compliant Count</th>
</tr>
</thead>
</table>
<p class="text-primary small fst-italic mt-3">
* Highlights the standards under each facility type where the highest number of non-compliances were recorded, pinpointing key improvement areas.
</p>
</div>
</div>
<!-- 🔹 Top Non-Compliant Concern Table -->
<div class="card mb-4 shadow-sm border">
<div class="card-header bg-info text-white d-flex justify-content-between align-items-center">
<h6 class="mb-0"><i class="bi bi-activity me-2"></i>Top Non-Compliant Area of Concern (By Facility Type)</h6>
</div>
<div class="card-body table-responsive">
<table id="withoutStandardTable" class="table table-bordered table-striped table-hover table-sm align-middle">
<thead class="table-dark">
<tr>
<th>Facility Type</th>
<th>Area of Concern</th>
<th>Non-Compliant Count</th>
</tr>
</thead>
</table>
<p class="text-primary small fst-italic mt-3">
* Displays the areas of concern with the most non-compliances for each facility type — helping prioritize quality improvement efforts.
</p>
</div>
</div>
<!-- 🔹 Zone-wise Tables -->
<?php
$zones = [
'Red Zone' => 'danger',
'Yellow Zone' => 'warning',
'Orange Zone' => 'orange',
'Green Zone' => 'success'
];
foreach ($zones as $zoneName => $color) {
$tableId = strtolower(str_replace(' ', '_', $zoneName)) . '_table';
echo "
<div class='card mb-4 shadow-sm border'>
<div class='card-header bg-light'>
<h6 class='fw-bold text-$color mb-0'><i class=\"bi bi-bar-chart-line-fill me-2\"></i>$zoneName – Top Indicators</h6>
</div>
<div class='card-body table-responsive'>
<table id='$tableId' class='table table-bordered table-striped table-hover table-sm align-middle'>
<thead class='table-dark'>
<tr>
<th>Facility Type</th>
<th>Compliance</th>
<th>Concern</th>
<th>Sub Type</th>
<th>Standard</th>
<th>Reference ID</th>
<th>Measurable Element</th>
<th>Facility Count</th>
</tr>
</thead>
</table>
</div>
</div>";
}
?>
</div>
</div>
<script>
$(document).ready(function () {
// 🔹 Load Top Concern Tables
$.ajax({
url: 'assets/get/get_top_concerns.php',
method: 'GET',
dataType: 'json',
success: function (res) {
// With Standard Table
if (res.with_standard) {
$('#withStandardTable').DataTable({
data: res.with_standard,
columns: [
{ data: 'facilities_type' },
{ data: 'concern_name' },
{ data: 'standard' },
{
data: 'non_compliant_count',
render: function (data, type, row) {
const url = `assets/get/export_noncompliant_details.php?facility=${encodeURIComponent(row.facilities_type)}&concern=${encodeURIComponent(row.concern_name)}&standard=${encodeURIComponent(row.standard)}`;
return `<a href="${url}" class="text-success fw-bold" title="Download detailed data for ${row.facilities_type}">
${data} <i class="bi bi-download ms-1"></i>
</a>`;
}
}
],
dom: 'Bfrtip',
buttons: [{ extend: 'excelHtml5', title: 'Top Concern + Standard Report', text: '<i class="bi bi-file-earmark-excel-fill me-1"></i> Export Excel' }],
pageLength: 5
});
}
// Without Standard Table
if (res.without_standard) {
$('#withoutStandardTable').DataTable({
data: res.without_standard,
columns: [
{ data: 'facilities_type' },
{ data: 'concern_name' },
{
data: 'non_compliant_count',
render: function (data, type, row) {
const url = `assets/get/export_noncompliant_details1.php?facility=${encodeURIComponent(row.facilities_type)}&concern=${encodeURIComponent(row.concern_name)}`;
return `<a href="${url}" class="text-success fw-bold" title="Download details for ${row.facilities_type} - ${row.concern_name}">
${data} <i class="bi bi-download ms-1"></i>
</a>`;
}
}
],
dom: 'Bfrtip',
buttons: [{ extend: 'excelHtml5', title: 'Top Concern Report', text: '<i class="bi bi-file-earmark-excel-fill me-1"></i> Export Excel' }],
pageLength: 5
});
}
},
error: function (err) {
console.error('Error fetching top concerns:', err);
}
});
// 🔹 Load Zone-wise Tables
const zones = ['Red Zone', 'Yellow Zone', 'Orange Zone', 'Green Zone'];
zones.forEach(zone => {
let tableId = '#' + zone.toLowerCase().replaceAll(' ', '_') + '_table';
$(tableId).DataTable({
ajax: { url: 'assets/get/fetch_gap_data.php', type: 'POST', data: { zone: zone } },
columns: [
{ data: "facilities_type" },
{ data: "compliance_label" },
{ data: "concern_name" },
{ data: "area_of_con_subtypedeatils" },
{ data: "standard" },
{ data: "csqa_reference_id" },
{ data: "Measurable_Element" },
{ data: "facility_count" }
],
dom: 'Bfrtip',
buttons: [{ extend: 'excelHtml5', title: zone + ' Compliance Report', text: '<i class="bi bi-file-earmark-excel-fill me-1"></i> Export Excel' }],
pageLength: 5
});
});
});
</script>
<?php include("assets/head/f.php"); ?>