Pārlūkot izejas kodu

done demo

master
azri 1 dienu atpakaļ
vecāks
revīzija
55c770a161
3 mainītis faili ar 205 papildinājumiem un 10 dzēšanām
  1. 0
    1
      resources/views/home.blade.php
  2. 69
    6
      resources/views/project.blade.php
  3. 136
    3
      routes/web.php

+ 0
- 1
resources/views/home.blade.php Parādīt failu

@@ -35,7 +35,6 @@
35 35
                 @if ($hasNotification)
36 36
                     <div class="absolute top-[2px] left-0 w-2 h-2 bg-[#E50A0A] rounded-full"></div>
37 37
                 @endif
38
-
39 38
                 <i class="fa-regular fa-bell text-md hover:text-[#BD8736]"></i>
40 39
             </div>
41 40
 

+ 69
- 6
resources/views/project.blade.php Parādīt failu

@@ -34,9 +34,10 @@
34 34
             </div>
35 35
 
36 36
             <div class="relative w-fit">
37
-                <select
38
-                    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">
39
-                    <option value="comited" selected>Komited</option>
37
+                <select id="selectProjectType"
38
+                    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"
39
+                    onchange="fetchAndRenderProjects()">
40
+                    <option value="commited" selected>Komited</option>
40 41
                     <option value="potential">Pontential</option>
41 42
                 </select>
42 43
             </div>
@@ -96,8 +97,8 @@
96 97
                             <th class="text-xs px-4 py-5">Keluasan (Ekar)</th>
97 98
                         </tr>
98 99
                     </thead>
99
-                    <tbody>
100
-                        @foreach ($comittedFDIProject as $index => $project)
100
+                    <tbody id="FDItableBody">
101
+                        @foreach ($commitedFDIProject as $index => $project)
101 102
                             <tr>
102 103
                                 <td class="px-4 py-2">{{ $index + 1 }}</td>
103 104
                                 <td class="px-4 py-2">{{ $project['company_name'] }}</td>
@@ -224,7 +225,8 @@
224 225
             <h5 class="font-semibold mb-4">Rekod Penetapan KPI Pelaburan</h5>
225 226
             <p class="text-xs font-bold">YB Dato’ Pengerusi memohon agar sasaran adalah melebihi sasaran tahun 2024: <span
226 227
                     class="text-[#BD8736]">DEADLINE, 2 WEEK from JPPP MEETING.</span></p>
227
-            <p class="text-xs font-bold">15-04-2025 | Jumlah Pelaburan Komited telah dikemaskini berdasarkan data yang diisi
228
+            <p class="text-xs font-bold">15-04-2025 | Jumlah Pelaburan Komited telah dikemaskini berdasarkan data yang
229
+                diisi
228 230
                 oleh S-GLC. Jumlah pelaburan komited berjumlah RM 2,000,333.00.</p>
229 231
 
230 232
         </div>
@@ -233,4 +235,65 @@
233 235
 @endsection
234 236
 
235 237
 @section('scripts')
238
+    <script>
239
+        async function fetchAndRenderProjects() {
240
+
241
+            const selectedType = document.getElementById('selectProjectType').value;
242
+
243
+            try {
244
+
245
+                const response = await fetch(`/api/project/${selectedType}`); // Adjust to your real endpoint
246
+                const data = await response.json();
247
+
248
+                if (!data.FDIProject || !data.DDIProject) return
249
+
250
+                renderFDITable(data.FDIProject)
251
+
252
+            } catch (error) {
253
+                console.error('Error fetching projects:', error);
254
+            }
255
+        }
256
+
257
+        function renderFDITable(data) {
258
+
259
+            const tbody = document.getElementById('FDItableBody');
260
+            tbody.innerHTML = ''; // Clear existing content
261
+
262
+            data.forEach((project, index) => {
263
+                const statusHTML = (() => {
264
+                    switch (project.status) {
265
+                        case 1:
266
+                            return `<div class="px-3 py-1 text-xs rounded-lg border inline-block"
267
+                                style="color:#E5A20A; background-color:#FFFBF4; border-color:#E5A20A;width:100%">
268
+                                Perjanjian Muktamad</div>`;
269
+                        case 0:
270
+                            return `<div class="px-3 py-1 text-xs rounded-lg border inline-block"
271
+                                style="color:#49B452; background-color:#F7FFF7; border-color:#49B452;width:100%">
272
+                                Deraf Perjanjian</div>`;
273
+                        default:
274
+                            return `<div>-</div>`;
275
+                    }
276
+                })();
277
+
278
+                const row = `
279
+                    <tr>
280
+                        <td class="px-4 py-2">${index + 1}</td>
281
+                        <td class="px-4 py-2">${project.company_name}</td>
282
+                        <td class="px-4 py-2">${project.type}</td>
283
+                        <td class="px-4 py-2 text-center">${statusHTML}</td>
284
+                        <td class="px-4 py-2 text-xs">${project.note}</td>
285
+                        <td class="px-4 py-2 text-xs">${project.moa_date}</td>
286
+                        <td class="px-4 py-2 text-xs">${project.area}</td>
287
+                        <td class="px-4 py-2 text-xs">${Number(project.invesment_approx).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})}</td>
288
+                        <td class="px-4 py-2 text-xs">${project.labour_approx}</td>
289
+                        <td class="px-4 py-2 text-xs">${project.land_area ? Number(project.land_area).toLocaleString() : '<span class="text-md font-bold">TBC</span>'}</td>
290
+                    </tr>
291
+                `;
292
+                tbody.insertAdjacentHTML('beforeend', row);
293
+            });
294
+
295
+        }
296
+
297
+        document.addEventListener('DOMContentLoaded', fetchAndRenderProjects);
298
+    </script>
236 299
 @endsection

+ 136
- 3
routes/web.php Parādīt failu

@@ -155,7 +155,7 @@ Route::get('/agency', function () {
155 155
 
156 156
 Route::get('/project', function () {
157 157
 
158
-    $comittedFDIProject = [
158
+    $commitedFDIProject = [
159 159
         [
160 160
             "id" => 1,
161 161
             "company_name" => "Fire Phoenix International",
@@ -233,10 +233,10 @@ Route::get('/project', function () {
233 233
         ]
234 234
     ];
235 235
 
236
-    return view('project', compact('comittedFDIProject', 'commitedDDIProject'));
236
+    return view('project', compact('commitedFDIProject', 'commitedDDIProject'));
237 237
 });
238 238
 
239
-Route::get('/agency_performance', function(){
239
+Route::get('/agency_performance', function () {
240 240
     $agencys = [
241 241
         [
242 242
             "id" => 1,
@@ -302,3 +302,136 @@ Route::get('/agency_performance', function(){
302 302
 
303 303
     return view('agency_performance', compact('agencys'));
304 304
 });
305
+
306
+/* For demo purpose only - please delete this when building the actual app */
307
+// To demo comited and potential project
308
+Route::prefix('api')->group(function () {
309
+    Route::get('project/{type}', function ($type) {
310
+
311
+        $comittedFDIProject = [
312
+            [
313
+                "id" => 1,
314
+                "company_name" => "Fire Phoenix International",
315
+                "type" => "Data Center",
316
+                "status" => 1,
317
+                "note" => "Dalam Proses Submit",
318
+                "moa_date" => "22-02-2025",
319
+                "area" => "Gambang",
320
+                "invesment_approx" => 100000000,
321
+                "labour_approx" => 50,
322
+                "land_area" => 4757
323
+            ],
324
+            [
325
+                "id" => 2,
326
+                "company_name" => "Lestari Angkasa Sdn Bhd",
327
+                "type" => "International Space Port",
328
+                "status" => 0,
329
+                "note" => "Loi Ditandatangani pada 14-03-2025",
330
+                "moa_date" => "22-02-2025",
331
+                "area" => "Pekan",
332
+                "invesment_approx" => 100000000,
333
+                "labour_approx" => 50,
334
+                "land_area" => null
335
+            ]
336
+        ];
337
+
338
+        $commitedDDIProject = [
339
+            [
340
+                "id" => 1,
341
+                "company_name" => "Kicap Bentong Sdn. Bhd (Jualan)",
342
+                "type" => "Kilang Memproses Kicap (Pembesaran)",
343
+                "status" => 0,
344
+                "note" => "Dalam Proses Submit",
345
+                "moa_date" => "",
346
+                "area" => "Kawasan Perindustrian Bentong",
347
+                "invesment_approx" => 100000000,
348
+                "labour_approx" => 50,
349
+                "land_area" => 2
350
+            ],
351
+            [
352
+                "id" => 2,
353
+                "company_name" => "Advanced Achieve Property Management Sdn. Bhd",
354
+                "type" => "International Space Port",
355
+                "status" => 1,
356
+                "note" => "Dalam Proses Pindahan",
357
+                "moa_date" => "",
358
+                "area" => "KP Gebeng 1",
359
+                "invesment_approx" => 100000000,
360
+                "labour_approx" => 50,
361
+                "land_area" => 1.74
362
+            ],
363
+            [
364
+                "id" => 3,
365
+                "company_name" => "BH Setia Sdn Bhd (Jualan IKS)",
366
+                "type" => "Data Center",
367
+                "status" => 1,
368
+                "note" => "Proses Dalam Pindahan",
369
+                "moa_date" => "22-02-2025",
370
+                "area" => "KP Gebeng 2",
371
+                "invesment_approx" => 100000000,
372
+                "labour_approx" => 50,
373
+                "land_area" => 2.046
374
+            ],
375
+            [
376
+                "id" => 4,
377
+                "company_name" => "Gading Senggara Property (Pajakan)",
378
+                "type" => "International Space Port",
379
+                "status" => 0,
380
+                "note" => "Dalam Proses Memuktamadkan Perjanjian",
381
+                "moa_date" => "",
382
+                "area" => "KP Gebeng 3",
383
+                "invesment_approx" => 100000000,
384
+                "labour_approx" => 50,
385
+                "land_area" => 152
386
+            ]
387
+        ];
388
+
389
+        $potentialFDIProject = [
390
+            [
391
+                "id" => 1,
392
+                "company_name" => "Kicap Bentong Sdn. Bhd (Jualan)",
393
+                "type" => "Kilang Memproses Kicap (Pembesaran)",
394
+                "status" => null,
395
+                "note" => "Dalam Proses Submit",
396
+                "moa_date" => "",
397
+                "area" => "Kawasan Perindustrian Bentong",
398
+                "invesment_approx" => 100000000,
399
+                "labour_approx" => 50,
400
+                "land_area" => 2
401
+            ]
402
+        ];
403
+
404
+        $potentialDDIProject = [
405
+            [
406
+                "id" => 1,
407
+                "company_name" => "Kicap Bentong Sdn. Bhd (Jualan)",
408
+                "type" => "Kilang Memproses Kicap (Pembesaran)",
409
+                "status" => 0,
410
+                "note" => "Dalam Proses Submit",
411
+                "moa_date" => "",
412
+                "area" => "Kawasan Perindustrian Bentong",
413
+                "invesment_approx" => 100000000,
414
+                "labour_approx" => 50,
415
+                "land_area" => 2
416
+            ]
417
+        ];
418
+
419
+        if ($type == "commited") {
420
+            return array(
421
+                "FDIProject" => $comittedFDIProject,
422
+                "DDIProject" => $commitedDDIProject,
423
+            );
424
+        }
425
+
426
+        if ($type == "potential") {
427
+            return array(
428
+                "FDIProject" => $potentialFDIProject,
429
+                "DDIProject" => $potentialDDIProject,
430
+            );
431
+        }
432
+
433
+        return array(
434
+            []
435
+        );
436
+    });
437
+});

Notiek ielāde…
Atcelt
Saglabāt