diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2d73d3c..f504331 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -47,6 +47,8 @@ $routes->group('cs', ['filter' => 'role:4'], function($routes) { // ------------------------------------------------------For API------------------------------------------------------ // // $routes->get('/api/dashboard', 'ApiDashboard::index'); +$routes->get('api/result/(:any)', 'Result::show/$1'); + $routes->get('api/specimen/(:any)', 'Specimen::show/$1'); $routes->post('api/specimen/collect/(:any)', 'Specimen::collect/$1'); $routes->post('api/specimen/unreceive/(:any)', 'Specimen::unreceive/$1'); \ No newline at end of file diff --git a/app/Controllers/ApiDashboard.php b/app/Controllers/ApiDashboard.php index 6b6a6bf..6284ee7 100644 --- a/app/Controllers/ApiDashboard.php +++ b/app/Controllers/ApiDashboard.php @@ -54,18 +54,21 @@ class ApiDashboard extends ResourceController { // Simpan ke array $dataList[] = [ 'statCode' => $statCode, - 'reqdate' => $reqdate, - 'patname' => $patname, - 'reqnum' => $reqnum, - 'hosnum' => $hosnum, - 'reff' => $row['REFF'] ?? '', - 'doc' => $row['DOC'] ?? '', - 'tests' => $row['TESTS'] ?? '', - 'stats' => $stats, + 'reqdate' => $reqdate, + 'patname' => $patname, + 'reqnum' => $reqnum, + 'hosnum' => $hosnum, + 'reff' => $row['REFF'] ?? '', + 'doc' => $row['DOC'] ?? '', + 'tests' => $row['TESTS'] ?? '', + 'stats' => $stats, 'isPrinted'=> $row['ODR_ISPRINTED'] ?? 0, 'isPending'=> $row['ODR_ISPENDING'] ?? 0, 'isHardcopy'=> $row['ODR_NFLAGHARDCOPY'] ?? 0, - 'isVal' => $row['ISVAL'] ?? 0, + 'isVal1' => $row['ISVAL1'] ?? 0, + 'val1user' => $row['VAL1USER'] ?? '', + 'isVal2' => $row['ISVAL2'] ?? 0, + 'val2user' => $row['VAL2USER'] ?? '', 'isDelete' => $isDelete, ]; } diff --git a/app/Controllers/Result.php b/app/Controllers/Result.php index be31fa2..49084af 100644 --- a/app/Controllers/Result.php +++ b/app/Controllers/Result.php @@ -16,7 +16,8 @@ class Result extends BaseController { ->getResultArray(); $data['status'] = $result[0]['STATS']; $data['verif'] = $result[0]['ISVAL2']; - return view('result/result_show',$data); + //return view('result/result_show',$data); + return view('admin/modal_result',$data); } public function invalidate($accessnumber) { diff --git a/app/Views/admin/index.php b/app/Views/admin/index.php index 20c0dc8..94d9a11 100644 --- a/app/Views/admin/index.php +++ b/app/Views/admin/index.php @@ -117,8 +117,10 @@ - - Verify
+ + + +
"; } ?> Ind | @@ -148,11 +150,22 @@

Specimen Collection

- + + endSection() ?> @@ -236,6 +249,53 @@ }); } + window.verify = function(accessNumber) { + const modalBody = $('#verifyModal .modal-body'); + modalBody.html('
Loading...

Fetching verification details for #' + accessNumber + '...

'); + + $.ajax({ + url: ''+accessNumber, + method: 'GET', // Or 'POST', depending on your server setup + data: { access_number: accessNumber }, + dataType: 'html', + success: function(response) { + modalBody.html(response); + }, + error: function(xhr, status, error) { + console.error("AJAX Error:", status, error); + modalBody.html(` + + `); + } + }); + }; + + /* + function verify(accessnumber) { + // toggle checkbox + const row = document.getElementById(`row-${accessnumber}-${samplenumber}`); + const checkbox = row.querySelector('.coll-checkbox'); + checkbox.checked = status; + + $.ajax({ + url: `/${accessnumber}`, + type: "POST", + contentType: "application/json; charset=utf-8", + dataType: "json", + data: JSON.stringify({ samplenumber:samplenumber, status:status, userid:"" }), + success: function(response) { + console.log("Success:", response); + }, + error: function(xhr, status, error) { + console.error("Error:", status, error); + } + }); + } + */ + function unreceive(accessnumber, samplenumber) { // toggle checkbox const row = document.getElementById(`row-${accessnumber}-${samplenumber}`); @@ -265,7 +325,7 @@ // Untuk Detail document.addEventListener('DOMContentLoaded', function () { const modal = document.getElementById('detailModal'); - const modalContent = document.getElementById('modalContent'); + const modalContent = document.getElementById('specimenModalContent'); document.querySelectorAll('.pointercol').forEach(td => { td.addEventListener('click', async function () { const access = this.dataset.access; diff --git a/app/Views/admin/modal_result.php b/app/Views/admin/modal_result.php new file mode 100644 index 0000000..748b0f2 --- /dev/null +++ b/app/Views/admin/modal_result.php @@ -0,0 +1,8 @@ +