diff --git a/app/Config/AuthGroups.php b/app/Config/AuthGroups.php index 4b7a92f..367e071 100644 --- a/app/Config/AuthGroups.php +++ b/app/Config/AuthGroups.php @@ -114,6 +114,7 @@ class AuthGroups extends ShieldAuthGroups 'billing.access' => 'Can access billing module', 'opd.doctor-panel.access' => 'Can access OPD doctor work panel (doctor-only)', + 'billing.patient.edit-name-anytime' => 'Can edit patient name even after 24-hour restriction', 'billing.opd.edit' => 'Can edit OPD registrations', 'billing.opd.pay' => 'Can confirm OPD payments', 'billing.charges.view' => 'Can view charges invoices', @@ -219,6 +220,7 @@ class AuthGroups extends ShieldAuthGroups 'users.delete', 'beta.access', 'billing.*', + 'billing.patient.edit-name-anytime', 'opd.doctor-panel.access', 'settings.bed_status.view', 'settings.charges.access', diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 5bf931e..adbedc1 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -470,7 +470,7 @@ class Patient extends BaseController $sql = "select *, Date_Format(insert_date,'%Y-%m-%d') as str_regdate, if(gender=1,'Male','Female') as xgender , - if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit + if(date_add(insert_date,interval 24 hour)>sysdate(),1,0) as p_edit from patient_master where id=" . $pno; $query = $this->db->query($sql); $data['data'] = $query->getResult(); diff --git a/app/Views/billing/Person_Edit_V.php b/app/Views/billing/Person_Edit_V.php index 1032bac..080e29f 100644 --- a/app/Views/billing/Person_Edit_V.php +++ b/app/Views/billing/Person_Edit_V.php @@ -11,11 +11,16 @@ user(); $patientAbhaId = (string) ($data[0]->abha_id ?? $data[0]->abha_no ?? $data[0]->abha ?? $data[0]->abha_address ?? ''); + $canEditNameAnytime = is_object($user) && method_exists($user, 'can') ? $user->can('billing.patient.edit-name-anytime') : false; $isAdmin = is_object($user) && method_exists($user, 'inGroup') ? $user->inGroup('admin') : false; - if ($data[0]->p_edit == 1 || $isAdmin) { + + // Allow edit if within 24 hours OR user has edit-name-anytime permission OR is admin + if ($data[0]->p_edit == 1 || $canEditNameAnytime || $isAdmin) { $readonly = ''; + $readonlyName = ''; } else { $readonly = 'readonly'; + $readonlyName = 'readonly'; } ?> @@ -55,7 +60,7 @@
> + value="p_fname ?>" type="text" autocomplete="off" >