Add permission for Admin to edit patient name anytime

- Add billing.patient.edit-name-anytime permission to AuthGroups
- Update patient edit time restriction from 12 hours to 24 hours
- Modify Person_Edit_V to check for edit-name-anytime permission
- Admin can now edit patient name field (input_name) even after 24-hour window
This commit is contained in:
DevSoftTech Server 2026-06-05 17:33:31 +05:30
parent 718e01156d
commit 8ef46cddb1
3 changed files with 10 additions and 3 deletions

View File

@ -114,6 +114,7 @@ class AuthGroups extends ShieldAuthGroups
'billing.access' => 'Can access billing module', 'billing.access' => 'Can access billing module',
'opd.doctor-panel.access' => 'Can access OPD doctor work panel (doctor-only)', '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.edit' => 'Can edit OPD registrations',
'billing.opd.pay' => 'Can confirm OPD payments', 'billing.opd.pay' => 'Can confirm OPD payments',
'billing.charges.view' => 'Can view charges invoices', 'billing.charges.view' => 'Can view charges invoices',
@ -219,6 +220,7 @@ class AuthGroups extends ShieldAuthGroups
'users.delete', 'users.delete',
'beta.access', 'beta.access',
'billing.*', 'billing.*',
'billing.patient.edit-name-anytime',
'opd.doctor-panel.access', 'opd.doctor-panel.access',
'settings.bed_status.view', 'settings.bed_status.view',
'settings.charges.access', 'settings.charges.access',

View File

@ -470,7 +470,7 @@ class Patient extends BaseController
$sql = "select *, $sql = "select *,
Date_Format(insert_date,'%Y-%m-%d') as str_regdate, Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
if(gender=1,'Male','Female') as xgender , 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; from patient_master where id=" . $pno;
$query = $this->db->query($sql); $query = $this->db->query($sql);
$data['data'] = $query->getResult(); $data['data'] = $query->getResult();

View File

@ -11,11 +11,16 @@
<?php <?php
$user = auth()->user(); $user = auth()->user();
$patientAbhaId = (string) ($data[0]->abha_id ?? $data[0]->abha_no ?? $data[0]->abha ?? $data[0]->abha_address ?? ''); $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; $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 = ''; $readonly = '';
$readonlyName = '';
} else { } else {
$readonly = 'readonly'; $readonly = 'readonly';
$readonlyName = 'readonly';
} }
?> ?>
<!-- Main content --> <!-- Main content -->
@ -55,7 +60,7 @@
<div class="form-group"> <div class="form-group">
<label>Full Name</label> <label>Full Name</label>
<input class="form-control input-sm" name="input_name" placeholder="Full Name" <input class="form-control input-sm" name="input_name" placeholder="Full Name"
value="<?=$data[0]->p_fname ?>" type="text" autocomplete="off" <?=$readonly?>> value="<?=$data[0]->p_fname ?>" type="text" autocomplete="off" <?=$readonlyName?>>
</div> </div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">