@extends('layouts.app') @section('title', 'إعدادات العيادة') @php // Group titles + icons + descriptions. Anything not listed falls // back to a generic "متفرقات" entry — keeps the page extensible // without view edits when new groups appear in the controller payload. $groupMeta = [ 'general' => ['title' => 'عام', 'icon' => 'ti-settings', 'desc' => 'اسم العيادة، اللغة، العملة والمعلومات الأساسية'], 'appointments' => ['title' => 'المواعيد', 'icon' => 'ti-calendar-event', 'desc' => 'ساعات العمل، مدة الموعد، التذكيرات والحجز الإلكتروني'], 'invoices' => ['title' => 'الفواتير', 'icon' => 'ti-receipt', 'desc' => 'بادئة الفاتورة، الضريبة، شروط السداد'], 'notifications' => ['title' => 'الإشعارات', 'icon' => 'ti-bell', 'desc' => 'إشعارات المرضى عبر البريد الإلكتروني والرسائل النصية'], 'patients' => ['title' => 'المرضى', 'icon' => 'ti-users', 'desc' => 'إعدادات ملفات المرضى وأرقامها'], 'business' => ['title' => 'العمل', 'icon' => 'ti-building', 'desc' => 'العملة، اللغة، التوقيت'], 'security' => ['title' => 'الأمان', 'icon' => 'ti-shield', 'desc' => 'الصلاحيات وسياسات كلمة المرور'], ]; // Localized labels for individual settings — keyed by the raw key // stored in the database. Anything not listed falls back to the // setting's `description` column, then finally to its raw key. $settingLabels = [ 'locale' => 'لغة النظام', 'timezone' => 'المنطقة الزمنية', 'currency' => 'العملة (الكود)', 'currency_symbol' => 'رمز العملة', 'date_format' => 'صيغة التاريخ', 'working_hours_start' => 'بداية ساعات العمل', 'working_hours_end' => 'نهاية ساعات العمل', 'default_slot_duration' => 'مدة الموعد الافتراضية (دقائق)', 'advance_booking_days' => 'أقصى عدد أيام للحجز المسبق', 'reminder_hours_before' => 'إرسال التذكير قبل الموعد بـ (ساعات)', 'allow_online_booking' => 'السماح بالحجز الإلكتروني', 'invoice_prefix' => 'بادئة رقم الفاتورة', 'invoice_starting_number' => 'أول رقم فاتورة', 'tax_rate' => 'نسبة الضريبة (%)', 'tax_label' => 'اسم الضريبة كما يظهر للمريض', 'invoice_terms' => 'شروط الدفع المطبوعة على الفاتورة', 'file_number_prefix' => 'بادئة رقم ملف المريض', 'notification_email_enabled' => 'تفعيل إشعارات البريد الإلكتروني', 'notification_sms_enabled' => 'تفعيل إشعارات الرسائل النصية (SMS)', ]; // Some inputs benefit from picker UI (timezone select, locale select, // currency dropdown) instead of free-text. This map drives that. $settingChoices = [ 'locale' => [ 'ar' => 'العربية', 'en' => 'English', ], 'currency' => [ 'EGP' => 'EGP — جنيه مصري', 'SAR' => 'SAR — ريال سعودي', 'AED' => 'AED — درهم إماراتي', 'USD' => 'USD — دولار أمريكي', 'EUR' => 'EUR — يورو', ], 'date_format' => [ 'Y-m-d' => 'سنة-شهر-يوم (2026-05-09)', 'd/m/Y' => 'يوم/شهر/سنة (09/05/2026)', 'd-m-Y' => 'يوم-شهر-سنة (09-05-2026)', 'd M Y' => 'يوم اسم-الشهر سنة (09 May 2026)', ], 'timezone' => [ 'Africa/Cairo' => 'القاهرة', 'Asia/Riyadh' => 'الرياض', 'Asia/Dubai' => 'دبي', 'Asia/Kuwait' => 'الكويت', 'Asia/Amman' => 'عمّان', 'Asia/Beirut' => 'بيروت', 'Asia/Baghdad' => 'بغداد', 'Africa/Casablanca' => 'الدار البيضاء', 'UTC' => 'UTC (التوقيت العالمي)', ], ]; $groups = collect($grouped); $totalCount = $groups->reduce(fn ($carry, $items) => $carry + count($items), 0); @endphp @section('content')
@csrf
{{-- Group navigation (sidebar) --}}
@foreach($groups as $group => $items) @php $meta = $groupMeta[$group] ?? ['title' => ucfirst($group), 'icon' => 'ti-dots', 'desc' => null]; @endphp
{{ $meta['title'] }}
{{ count($items) }} إعداد
@endforeach {{-- Password change tab — not a ClinicSetting row, but rendered alongside so users find it in the same place as "my preferences". --}}
كلمة المرور
تغيير كلمة المرور الشخصية
{{-- Active group content --}}
@foreach($groups as $group => $items) @php $meta = $groupMeta[$group] ?? ['title' => ucfirst($group), 'icon' => 'ti-dots', 'desc' => null]; @endphp

{{ $meta['title'] }}

@if($meta['desc'])
{{ $meta['desc'] }}
@endif
@foreach($items as $s) @php $label = $settingLabels[$s->key] ?? ($s->description ?: $s->key); $choices = $settingChoices[$s->key] ?? null; $isTimeField = in_array($s->key, ['working_hours_start', 'working_hours_end']); @endphp
{{ $label }}
@if($s->type === 'boolean') @elseif($choices) @elseif($isTimeField) @elseif($s->type === 'integer' || $s->type === 'float') @elseif($s->type === 'text' || (is_string($s->value) && mb_strlen($s->value) > 80)) @else @endif
@endforeach
@endforeach {{-- Password change pane. Separate from the main settings form because it submits to its own endpoint and the field-level "dirty" tracker shouldn't fire on password typing. --}}

تغيير كلمة المرور

غيّر كلمة المرور الخاصة بحسابك الشخصي. هتحتاج تكتب كلمة المرور الحالية.
@csrf
كلمة المرور الحالية
كلمة المرور الجديدة
8 أحرف على الأقل.
تأكيد كلمة المرور الجديدة
{{-- Sticky save bar --}}
لا تغييرات معلقة.
@endsection @push('scripts') @endpush