From 7ee5332edf8eb0eae3e0db368705474968af5ac4 Mon Sep 17 00:00:00 2001
From: mahdahar <89adham@gmail.com>
Date: Thu, 22 Jan 2026 07:34:19 +0700
Subject: [PATCH] add username edit to users page
---
.gitignore | 2 +-
CHECKLIST.md | 38 +----------------------------
app/Controllers/UsersController.php | 10 ++++----
app/Views/superuser/users.php | 2 +-
4 files changed, 8 insertions(+), 44 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8d85d65..7a7fca8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -125,4 +125,4 @@ _modules/*
/results/
/phpunit*.xml
-.roo/
\ No newline at end of file
+.venv/
\ No newline at end of file
diff --git a/CHECKLIST.md b/CHECKLIST.md
index 7347f97..3e85503 100644
--- a/CHECKLIST.md
+++ b/CHECKLIST.md
@@ -1,27 +1,15 @@
# Project Checklist: Glen RME & Lab Management System
-**Last Updated:** January 19, 2026
-**Source:** PROJECT_BACKLOG.md
+**Last Updated:** January 21, 2026
---
-## P0 - Critical (Access Control & Security)
-
-_Must be completed first to ensure basic process flow is correct._
-
- [ ] **T-002:** Hide/Disable 'Validation' button after 2nd validation
- Prevent redundant validation actions
- [ ] **T-003:** Restrict Print/Save-to-PDF to CS Role only
- Lab can only preview, CS can print/save
- [X] **T-004:** Update User Role levels
- Standardize roles: Superuser, Admin, Lab, Phlebo, CS
-
----
-
-## P1 - High (Dashboard & UI Improvements)
-
-_Features that improve speed and correctness of lab operations._
-
- [X] **T-005:** Role-Based Dashboard Filtering
- Filter by patient_status or service_type (Klinik+Lab vs Lab Only)
- [ ] **T-006:** Create Clinical Patients Dashboard
@@ -38,13 +26,6 @@ _Features that improve speed and correctness of lab operations._
- Log unvalidation actions with timestamp, user ID, and reason
- [ ] **T-013:** Enhanced Patient Detail Logging
- Track: Sample Collection Time, Sample Received Time, Print History
-
----
-
-## P2 - Medium (Maintenance & UX)
-
-_UI improvements and backend optimizations._
-
- [ ] **T-014:** Add Dedicated Print Button
- Trigger browser/system print dialog
- [ ] **T-015:** Add Error Handling for Preview Button
@@ -57,30 +38,13 @@ _UI improvements and backend optimizations._
- Verify API integration: GDC_cmod, GDC_CS2, Report2
- [X] **T-018: Delayed** Dashboard Performance
- When getting data more than 100 rows, it load too slow.
- - Answer : Its Alpine Limitation, later will create pagination for dashboard.
-
----
-
-## 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 |
-|----------|-------|-----------|
-| P0 - Critical | 4 | 0 |
-| P1 - High | 9 | 0 |
-| P2 - Medium | 4 | 0 |
-| **Total** | **17** | **0** |
-
---
## Legend
-- Tasks are ordered by priority (P0 → P1 → P2)
- Check items as you complete them
- Refer to PROJECT_BACKLOG.md for detailed technical specifications
diff --git a/app/Controllers/UsersController.php b/app/Controllers/UsersController.php
index ed6cd00..10a7fc1 100644
--- a/app/Controllers/UsersController.php
+++ b/app/Controllers/UsersController.php
@@ -71,6 +71,7 @@ class UsersController extends BaseController
{
$input = $this->request->getJSON(true);
$userid = $input['userid'];
+ $username = $input['username'];
$userroleid = $input['userroleid'];
$password = $input['password'];
$password_2 = $input['password_2'];
@@ -83,8 +84,7 @@ class UsersController extends BaseController
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
$sqlUpdate = "
UPDATE gdc_cmod.dbo.USERS
- SET USERROLEID = ?,
- PASSWORD = ?
+ SET USERROLEID = ?, PASSWORD = ?, USERNAME = ?
WHERE USERID = ?
";
$fullUpdate = true;
@@ -92,7 +92,7 @@ class UsersController extends BaseController
} else {
$sqlUpdate = "
UPDATE gdc_cmod.dbo.USERS
- SET USERROLEID = ?
+ SET USERROLEID = ?, USERNAME = ?
WHERE USERID = ?
";
$fullUpdate = false;
@@ -102,9 +102,9 @@ class UsersController extends BaseController
try {
if ($fullUpdate) {
- $this->db->query($sqlUpdate, [$userroleid, $hashedPassword, $userid]);
+ $this->db->query($sqlUpdate, [$userroleid, $hashedPassword, $username, $userid]);
} else {
- $this->db->query($sqlUpdate, [$userroleid, $userid]);
+ $this->db->query($sqlUpdate, [$userroleid, $username, $userid]);
}
$this->db->transCommit();
diff --git a/app/Views/superuser/users.php b/app/Views/superuser/users.php
index ca14d96..172cceb 100644
--- a/app/Views/superuser/users.php
+++ b/app/Views/superuser/users.php
@@ -129,7 +129,7 @@
-