From ebc75097c19adb3eccb2fcacbcf3e725573acee6 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Tue, 20 Jan 2026 09:53:56 +0700 Subject: [PATCH] fix: - add filterTable $watch to reset pagination - add click handler to table cells (SP_ACCESSNUMBER, HOSTORDERNUMBER, STATS) - change STATS from button to text cell --- CHECKLIST.md | 10 ++-- app/Controllers/Request.php | 105 ------------------------------------ app/Views/admin/index.php | 13 +++-- 3 files changed, 16 insertions(+), 112 deletions(-) delete mode 100644 app/Controllers/Request.php diff --git a/CHECKLIST.md b/CHECKLIST.md index 67060c8..aab0d15 100644 --- a/CHECKLIST.md +++ b/CHECKLIST.md @@ -32,9 +32,6 @@ _Features that improve speed and correctness of lab operations._ - Toggle lab result preview between Indonesian and English - [X] **T-009:** Apply Row Color-Coding - Color-code "No Register" column (Yellow/Blue/Green) -- [ ] **T-010:** Update PDF Report Metadata - - Replace 'Printed By' with validating user's name - - Add 'Finish Validation' status per sample - [X] **T-011:** Initialize RME Sidebar Menu - Create menu items: Dashboard, Patient, Hasil Lab, Validation, Unreceived, Report, Sample Collection, User Management, Unvalidate - [ ] **T-012:** Create 'Detail Unvalidated' History Log/View @@ -64,6 +61,13 @@ _UI improvements and backend optimizations._ --- +## P3 - Onsite / Onprem Tasks + +- [ ] **T-010:** Update PDF Report Metadata + - Replace 'Printed By' with validating user's name + - Add 'Finish Validation' status per sample + +--- ## Quick Progress Summary | Priority | Total | Completed | diff --git a/app/Controllers/Request.php b/app/Controllers/Request.php deleted file mode 100644 index 326a2df..0000000 --- a/app/Controllers/Request.php +++ /dev/null @@ -1,105 +0,0 @@ -request->getGet('date1'); - $date2 = $this->request->getGet('date2'); - - $db = \Config\Database::connect(); - $sql = "SELECT * from GDC_CMOD.dbo.V_DASHBOARD_DEV where - COLLECTIONDATE between '$date1 00:00' and '$date2 23:59' - and ODR_DDATE between '$date1 00:00' and '$date2 23:59'"; - $rows = $db->query($sql)->getResultArray(); - foreach ($rows as &$row) { - $row['COLLECTIONDATE'] = date('Y-m-d H:i', strtotime($row['COLLECTIONDATE'])); - $row['ODR_DDATE'] = date('Y-m-d H:i', strtotime($row['ODR_DDATE'])); - $row['REQDATE'] = date('Y-m-d H:i', strtotime($row['REQDATE'])); - } - $data['data'] = $rows; - return $this->response->setJSON($data); - } - - - public function show($accessnumber) { - $db = db_connect(); - $data['accessnumber'] = $accessnumber; - $sql = "SELECT d.STATS, r.* FROM GDC_CMOD.dbo.V_DASHBOARD_DEV d - left join GDC_CMOD.dbo.CM_REQUESTS r ON r.ACCESSNUMBER=d.SP_ACCESSNUMBER - WHERE d.SP_ACCESSNUMBER='$accessnumber'"; - $result = $db - ->query($sql) - ->getResultArray(); - $data['val1'] = $result[0]['ISVAL1']; - $data['val1user'] = $result[0]['VAL1USER']; - $data['val2'] = $result[0]['ISVAL2']; - $data['val2user'] = $result[0]['VAL2USER']; - return view('admin/modal_request',$data); - } - - public function showUnval($accessnumber) { - $data['accessnumber'] = $accessnumber; - return view('admin/modal_unvalidate',$data); - } - - public function unval($accessnumber) { - $input = $this->request->getJSON(true); - $userid = $input['userid']; - $comment = $input['comment']; - $db = db_connect(); - $sql = "update GDC_CMOD.dbo.CM_REQUESTS set ISVAL1=null, VAL1USER=null, VAL1DATE=null, ISVAL2=null, VAL2USER=null, VAL2DATE=null, - ISPENDING=1, PENDINGTEXT='$comment', PENDINGUSER='$userid', PENDINGDATE=GETDATE() where ACCESSNUMBER='$accessnumber'"; - $db->query($sql); - $data = ['status' => 'success', 'message' => 'Data updated successfully', 'data' => "$accessnumber" ]; - - return $this->response->setJSON($data); - } - - public function val($accessnumber) { - $input = $this->request->getJSON(true); - $userid = $input['userid']; - $db = db_connect(); - //cek val - $sql = "select * from GDC_CMOD.dbo.CM_REQUESTS where ACCESSNUMBER='$accessnumber'"; - $result = $db->query($sql)->getResultArray(); - //$data['data'] = $result; - if(!isset($result[0])) { - $sql = "insert into GDC_CMOD.dbo.CM_REQUESTS(ACCESSNUMBER, ISVAL1, VAL1USER, VAL1DATE) VALUES ('$accessnumber', 1, '$userid', GETDATE())"; - $db->query($sql); - $data['val'] = 1; - $data['userid'] = $userid; - } else { - $row = $result[0]; - $isval1 = $row['ISVAL1']; - $isval2 = $row['ISVAL2']; - $val1user = $row['VAL1USER']; - if( $isval1 == 1 ) { - // val done - if ( $isval2 == 1 ) { return $this->response->setJSON(['message'=> 'validation done, not updating anything']); } - else { - // val2 if user val1 != userid - if($val1user != $userid) { - $sql = "update GDC_CMOD.dbo.CM_REQUESTS set ISVAL2=1, VAL2USER='$userid', VAL2DATE=GETDATE() where ACCESSNUMBER='$accessnumber'"; - $data['val'] = 2; - $data['userid'] = $userid; - } else { - $this->response->setStatusCode(500); - return $this->response->setJSON([ 'message'=> 'user already validate this request' ]); - } - } - } else { - // val1 - $sql = "update GDC_CMOD.dbo.CM_REQUESTS set ISVAL1=1, VAL1USER='$userid', VAL1DATE=GETDATE() where ACCESSNUMBER='$accessnumber'"; - $data['val'] = 1; - $data['userid'] = $userid; - } - $db->query($sql); - } - - return $this->response->setJSON($data); - } -} diff --git a/app/Views/admin/index.php b/app/Views/admin/index.php index 062b649..2f871d2 100644 --- a/app/Views/admin/index.php +++ b/app/Views/admin/index.php @@ -211,8 +211,10 @@ - - + + @@ -241,8 +243,8 @@ @click="openPreviewDialog(req.SP_ACCESSNUMBER, 'preview', req)">Preview - + @@ -359,6 +361,9 @@ this.today = new Date().toISOString().slice(0, 10); this.filter.date1 = this.today; this.filter.date2 = this.today; + this.$watch('filterTable', () => { + this.currentPage = 1; + }); this.fetchList(); },