From c1a4c7bfbe8ea3880555b2934a82ca3680efd114 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Fri, 14 Nov 2025 16:51:05 +0700 Subject: [PATCH] prework --- app/Views/_layouts/main.php | 2 +- app/Views/admin/index.php | 84 +++++++++++++++--------------- app/Views/admin/modal_specimen.php | 16 ++++-- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/app/Views/_layouts/main.php b/app/Views/_layouts/main.php index c17a38b..0af7345 100644 --- a/app/Views/_layouts/main.php +++ b/app/Views/_layouts/main.php @@ -141,7 +141,7 @@ - + renderSection('script'); ?> diff --git a/app/Views/admin/index.php b/app/Views/admin/index.php index 82c7958..d4da899 100644 --- a/app/Views/admin/index.php +++ b/app/Views/admin/index.php @@ -24,6 +24,32 @@
+
'> +
+
+ Date : +
+ +
+ +
+ +
-
+ +
+ +
+ +
+ +
+ +
+
+
+
@@ -163,39 +189,9 @@ $(document).ready(function () { $('#datatables').DataTable({ layout: { - topStart: { - div: { - id: 'myCustomDiv', - className: 'custom-div-style', - html: ` - '> -
-
- Date : -
- -
- -
- -
-
- -
- -
- -
- -
- -
-
-
- ` - } - } + topStart: 'info', + topEnd: 'search', + bottomStart: null, bottomEnd: null }, order: [[0, 'asc'], [3, 'asc']], paging: false, @@ -237,18 +233,20 @@ modalContent.innerHTML = "

Loading data...

"; try { - // Get API - const res = await fetch(`api/specimen/${access}`); - const data = await res.json(); - $.get(``, function(tpl) { - //console.log(tpl); - //console.log(data); - const html = Mustache.render(tpl, data); - modalContent.innerHTML=html; + $.getJSON(`api/specimen/${access}`, function(data) { + $.get(``, function(tpl) { + data.samples = data.samples.map(s => ({ + ...s, + is_coll: s.colstatus == 1, + is_recv: s.tubestatus == 4 + })); + console.log(data); + const html = Mustache.render(tpl, data); + modalContent.innerHTML=html; + }); }); } catch (err) { - modalContent.innerHTML = - "

Gagal memuat data.

"; + modalContent.innerHTML = "

Gagal memuat data.

"; console.error(err); } }); diff --git a/app/Views/admin/modal_specimen.php b/app/Views/admin/modal_specimen.php index ca457d4..97f4a7b 100644 --- a/app/Views/admin/modal_specimen.php +++ b/app/Views/admin/modal_specimen.php @@ -41,9 +41,10 @@
- + + @@ -51,17 +52,24 @@ {{#samples}} + + + - - {{/samples}}
Status Sample Code Sample NameCollectedReceived Action
{{sampcode}}{{name}} + + {{sampcode}}{{name}} +