diff --git a/app/Controllers/Setting/HospitalProfile.php b/app/Controllers/Setting/HospitalProfile.php index 62d6109..799d492 100644 --- a/app/Controllers/Setting/HospitalProfile.php +++ b/app/Controllers/Setting/HospitalProfile.php @@ -35,6 +35,9 @@ class HospitalProfile extends BaseController 'pharmacy_gst' => $this->readSettingValue('H_Med_GST'), 'pharmacy_logo' => $pharmacyLogo, 'pharmacy_logo_url' => $pharmacyLogo !== '' ? base_url('assets/images/' . rawurlencode($pharmacyLogo)) : '', + 'sidebar_auto_hide_seconds' => $this->readSettingValue('SIDEBAR_AUTO_HIDE_SECONDS') !== '' + ? $this->readSettingValue('SIDEBAR_AUTO_HIDE_SECONDS') + : '7', ]); } @@ -64,6 +67,8 @@ class HospitalProfile extends BaseController $pharmacyAddress = trim((string) $this->request->getPost('pharmacy_address')); $pharmacyPhone = trim((string) $this->request->getPost('pharmacy_phone')); $pharmacyGst = trim((string) $this->request->getPost('pharmacy_gst')); + $sidebarAutoHideSecondsRaw = trim((string) $this->request->getPost('sidebar_auto_hide_seconds')); + $sidebarAutoHideSeconds = $sidebarAutoHideSecondsRaw === '' ? 7 : (int) $sidebarAutoHideSecondsRaw; if ($name === '' || $address === '') { return $this->response->setJSON([ @@ -83,6 +88,15 @@ class HospitalProfile extends BaseController ]); } + if ($sidebarAutoHideSeconds < 0 || $sidebarAutoHideSeconds > 60) { + return $this->response->setJSON([ + 'update' => 0, + 'error_text' => 'Sidebar auto hide seconds must be between 0 and 60.', + 'csrfName' => csrf_token(), + 'csrfHash' => csrf_hash(), + ]); + } + $savedCount = 0; if ($this->upsertSettingValue('H_Name', $name)) { $savedCount++; @@ -117,6 +131,9 @@ class HospitalProfile extends BaseController if ($this->upsertSettingValue('H_Med_GST', $pharmacyGst)) { $savedCount++; } + if ($this->upsertSettingValue('SIDEBAR_AUTO_HIDE_SECONDS', (string) $sidebarAutoHideSeconds)) { + $savedCount++; + } $logoResult = $this->processLogoUpload( $this->request->getFile('hospital_logo'), @@ -226,6 +243,7 @@ class HospitalProfile extends BaseController 'H_Med_phone_No', 'H_Med_GST', 'H_Med_logo', + 'SIDEBAR_AUTO_HIDE_SECONDS', ])->delete(); if ($logo !== '') { diff --git a/app/Views/Setting/Admin/hospital_profile.php b/app/Views/Setting/Admin/hospital_profile.php index 57d2741..032c1a5 100644 --- a/app/Views/Setting/Admin/hospital_profile.php +++ b/app/Views/Setting/Admin/hospital_profile.php @@ -36,6 +36,11 @@