|
@@ -44,25 +44,31 @@
|
44
|
44
|
|
45
|
45
|
<div class="relative w-fit">
|
46
|
46
|
<select
|
47
|
|
- class="appearance-none w-full pl-4 pr-10 py-1 px-5 border border-gray-300 rounded-lg text-sm text-gray-700 cursor-pointer bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
47
|
+ id="selectProjectStatus"
|
|
48
|
+ class="appearance-none w-full pl-4 pr-10 py-1 px-5 border border-gray-300 rounded-lg text-sm text-gray-700 cursor-pointer bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
49
|
+ onchange="renderFDITable()">
|
48
|
50
|
<option value="all" selected>Status</option>
|
49
|
|
- <option value="final">Perjanjian Muktamad</option>
|
50
|
|
- <option value="draft">Deraf Perjanjian</option>
|
|
51
|
+ <option value="1">Perjanjian Muktamad</option>
|
|
52
|
+ <option value="0">Deraf Perjanjian</option>
|
51
|
53
|
</select>
|
52
|
54
|
</div>
|
53
|
55
|
|
54
|
56
|
<div class="relative w-fit">
|
55
|
57
|
<select
|
56
|
|
- class="appearance-none w-full pl-4 pr-10 py-1 px-5 border border-gray-300 rounded-lg text-sm text-gray-700 cursor-pointer bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
58
|
+ id="selectProjectArea"
|
|
59
|
+ class="appearance-none w-full pl-4 pr-10 py-1 px-5 border border-gray-300 rounded-lg text-sm text-gray-700 cursor-pointer bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
60
|
+ onchange="renderFDITable()">
|
57
|
61
|
<option value="all" selected>Daerah</option>
|
58
|
|
- <option value="1">Gambang</option>
|
59
|
|
- <option value="2">Pekan</option>
|
|
62
|
+ <option value="Gambang">Gambang</option>
|
|
63
|
+ <option value="Pekan">Pekan</option>
|
60
|
64
|
</select>
|
61
|
65
|
</div>
|
62
|
66
|
|
63
|
67
|
<div class="relative w-fit">
|
64
|
68
|
<select
|
65
|
|
- class="appearance-none w-full pl-4 pr-10 py-1 px-5 border border-gray-300 rounded-lg text-sm text-gray-700 cursor-pointer bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
69
|
+ id="selectProjectYear"
|
|
70
|
+ class="appearance-none w-full pl-4 pr-10 py-1 px-5 border border-gray-300 rounded-lg text-sm text-gray-700 cursor-pointer bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
71
|
+ onchange="renderFDITable()">
|
66
|
72
|
<option value="all" selected>Tahun</option>
|
67
|
73
|
<option value="2026">2026</option>
|
68
|
74
|
<option value="2025">2025</option>
|
|
@@ -236,6 +242,10 @@
|
236
|
242
|
|
237
|
243
|
@section('scripts')
|
238
|
244
|
<script>
|
|
245
|
+
|
|
246
|
+ var FDIProject = [];
|
|
247
|
+ var DDIProject = [];
|
|
248
|
+
|
239
|
249
|
async function fetchAndRenderProjects() {
|
240
|
250
|
|
241
|
251
|
const selectedType = document.getElementById('selectProjectType').value;
|
|
@@ -247,18 +257,21 @@
|
247
|
257
|
|
248
|
258
|
if (!data.FDIProject || !data.DDIProject) return
|
249
|
259
|
|
250
|
|
- renderFDITable(data.FDIProject)
|
|
260
|
+ FDIProject = data.FDIProject
|
|
261
|
+ renderFDITable()
|
251
|
262
|
|
252
|
263
|
} catch (error) {
|
253
|
264
|
console.error('Error fetching projects:', error);
|
254
|
265
|
}
|
255
|
266
|
}
|
256
|
267
|
|
257
|
|
- function renderFDITable(data) {
|
|
268
|
+ function renderFDITable() {
|
258
|
269
|
|
259
|
270
|
const tbody = document.getElementById('FDItableBody');
|
260
|
271
|
tbody.innerHTML = ''; // Clear existing content
|
261
|
272
|
|
|
273
|
+ data = filterData(FDIProject)
|
|
274
|
+
|
262
|
275
|
data.forEach((project, index) => {
|
263
|
276
|
const statusHTML = (() => {
|
264
|
277
|
switch (project.status) {
|
|
@@ -294,6 +307,24 @@
|
294
|
307
|
|
295
|
308
|
}
|
296
|
309
|
|
|
310
|
+ function filterData(data){
|
|
311
|
+
|
|
312
|
+ const status = document.getElementById("selectProjectStatus").value
|
|
313
|
+ const area = document.getElementById("selectProjectArea").value
|
|
314
|
+ const year = document.getElementById("selectProjectYear").value
|
|
315
|
+
|
|
316
|
+ // filter by status
|
|
317
|
+ data = data.filter(project => (status === "all" || parseInt(status) === parseInt(project.status)))
|
|
318
|
+
|
|
319
|
+ // filter by area
|
|
320
|
+ data = data.filter(project => (area === "all" || area === project.area))
|
|
321
|
+
|
|
322
|
+ // filter by year
|
|
323
|
+ data = data.filter(project => (year === "all" || parseInt(year) === parseInt(project.year)))
|
|
324
|
+
|
|
325
|
+ return data
|
|
326
|
+ }
|
|
327
|
+
|
297
|
328
|
document.addEventListener('DOMContentLoaded', fetchAndRenderProjects);
|
298
|
329
|
</script>
|
299
|
330
|
@endsection
|