diff --git a/admin_company_profile.php b/admin_company_profile.php
index 4574855..60972c9 100644
--- a/admin_company_profile.php
+++ b/admin_company_profile.php
@@ -14,6 +14,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$companyPhone = trim($_POST['company_phone'] ?? '');
$companyAddress = trim($_POST['company_address'] ?? '');
$platformCharge = trim($_POST['platform_charge_percentage'] ?? '0');
+ $timezone = trim($_POST['timezone'] ?? 'UTC');
$updates = [
'company_name' => $companyName,
@@ -21,6 +22,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
'company_phone' => $companyPhone,
'company_address' => $companyAddress,
'platform_charge_percentage' => $platformCharge,
+ 'timezone' => $timezone,
'terms_en' => trim($_POST['terms_en'] ?? ''),
'terms_ar' => trim($_POST['terms_ar'] ?? ''),
'privacy_en' => trim($_POST['privacy_en'] ?? ''),
@@ -80,6 +82,7 @@ $currentEmail = $settings['company_email'] ?? '';
$currentPhone = $settings['company_phone'] ?? '';
$currentAddress = $settings['company_address'] ?? '';
$currentPlatformCharge = $settings['platform_charge_percentage'] ?? '0';
+$currentTimezone = $settings['timezone'] ?? 'UTC';
$currentLogo = $settings['logo_path'] ?? '';
$currentFavicon = $settings['favicon_path'] ?? '';
$currentTermsEn = $settings['terms_en'] ?? '';
@@ -163,6 +166,18 @@ render_header('Company Profile', 'admin', true);
Percentage applied as a platform fee.
+
+
+
+
System Timezone
+
+
diff --git a/db/migrations/add_settings_table.php b/db/migrations/add_settings_table.php
index d4dbd5a..a25bad6 100644
--- a/db/migrations/add_settings_table.php
+++ b/db/migrations/add_settings_table.php
@@ -14,9 +14,10 @@ try {
('company_address', '123 Transport St, City, Country'),
('platform_charge_percentage', '0'),
('logo_path', ''),
- ('favicon_path', '');
+ ('favicon_path', ''),
+ ('timezone', 'UTC');
");
echo "Settings table created/updated.\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
-}
\ No newline at end of file
+}
diff --git a/includes/app.php b/includes/app.php
index ca54225..32a3825 100644
--- a/includes/app.php
+++ b/includes/app.php
@@ -254,7 +254,8 @@ $translations = [
'reset_password_title' => 'Reset Password',
'reset_password_subtitle' => 'Enter your email to receive a reset link',
'send_reset_link' => 'Send Reset Link',
- 'back_to_login' => 'Back to Login'
+ 'back_to_login' => 'Back to Login',
+ 'timezone' => 'Timezone',
),
"ar" => array (
'app_name' => 'CargoLink',
@@ -497,7 +498,8 @@ $translations = [
'reset_password_title' => 'إعادة تعيين كلمة المرور',
'reset_password_subtitle' => 'أدخل بريدك الإلكتروني لتلقي رابط إعادة التعيين',
'send_reset_link' => 'إرسال رابط إعادة التعيين',
- 'back_to_login' => 'العودة لتسجيل الدخول'
+ 'back_to_login' => 'العودة لتسجيل الدخول',
+ 'timezone' => 'المنطقة الزمنية',
)
];
@@ -711,4 +713,12 @@ function has_permission(string $permissionSlug, ?int $userId = null): bool
function format_currency(float $amount): string
{
return number_format($amount, 3) . ' OMR';
-}
\ No newline at end of file
+}
+
+// Set timezone from settings
+try {
+ $tz = get_setting('timezone', 'UTC');
+ if ($tz && in_array($tz, DateTimeZone::listIdentifiers())) {
+ date_default_timezone_set($tz);
+ }
+} catch (Throwable $e) {}