278 lines
19 KiB
PHP
278 lines
19 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/queue_bootstrap.php';
|
|
qh_boot();
|
|
qh_admin_handle_request();
|
|
|
|
$stats = qh_admin_stats();
|
|
$profile = qh_fetch_hospital_profile();
|
|
$logoUrl = qh_hospital_logo_url();
|
|
$faviconUrl = qh_hospital_favicon_url();
|
|
$tagline = qh_hospital_tagline();
|
|
$website = trim((string) ($profile['website'] ?? ''));
|
|
$websiteIsValid = $website !== '' && filter_var($website, FILTER_VALIDATE_URL) !== false;
|
|
|
|
qh_page_start(
|
|
'admin',
|
|
qh_t('Hospital profile', 'ملف المستشفى'),
|
|
qh_t('Manage the hospital brand, logo, favicon, contact details, and presentation settings.', 'إدارة هوية المستشفى والشعار والأيقونة وبيانات التواصل وإعدادات العرض.')
|
|
);
|
|
?>
|
|
<div class="container-xxl px-3 px-lg-4">
|
|
<div class="admin-layout">
|
|
<aside class="admin-sidebar-column">
|
|
<?php qh_render_admin_sidebar('admin_hospital.php', $stats); ?>
|
|
</aside>
|
|
|
|
<div class="admin-content-stack">
|
|
<section class="page-header-panel admin-hero-panel mb-0 hospital-hero-panel">
|
|
<div>
|
|
<span class="section-kicker"><?= qh_h(qh_t('Brand settings', 'إعدادات الهوية')) ?></span>
|
|
<div class="locale-chip mt-3"><?= qh_h(qh_current_language_badge()) ?></div>
|
|
<h1 class="section-title-xl mt-2 mb-2"><?= qh_h(qh_t('Hospital profile and branding.', 'ملف المستشفى والهوية البصرية.')) ?></h1>
|
|
<p class="section-copy mb-0"><?= qh_h(qh_t('Set the hospital name, logo, favicon, contact details, working hours, and brand colors from one dedicated page.', 'اضبط اسم المستشفى والشعار والأيقونة وبيانات التواصل وساعات العمل وألوان الهوية من صفحة مخصصة واحدة.')) ?></p>
|
|
</div>
|
|
|
|
<div class="hospital-brand-preview">
|
|
<div class="hospital-brand-mark">
|
|
<?php if ($logoUrl !== ''): ?>
|
|
<img src="<?= qh_h($logoUrl) ?>" alt="<?= qh_h(qh_hospital_name()) ?>">
|
|
<?php else: ?>
|
|
<span><?= qh_h(qh_hospital_brand_initials()) ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div>
|
|
<div class="section-kicker mb-2"><?= qh_h(qh_t('Live preview', 'معاينة مباشرة')) ?></div>
|
|
<h2 class="section-title mb-1"><?= qh_h(qh_hospital_name()) ?></h2>
|
|
<?php if ($tagline !== ''): ?>
|
|
<p class="section-copy mb-2"><?= qh_h($tagline) ?></p>
|
|
<?php endif; ?>
|
|
<div class="hospital-color-pills">
|
|
<span class="hospital-color-pill"><span class="hospital-color-swatch" style="background: <?= qh_h(qh_hospital_primary_color()) ?>"></span><?= qh_h(qh_hospital_primary_color()) ?></span>
|
|
<span class="hospital-color-pill"><span class="hospital-color-swatch" style="background: <?= qh_h(qh_hospital_secondary_color()) ?>"></span><?= qh_h(qh_hospital_secondary_color()) ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="admin-directory-layout hospital-profile-layout">
|
|
<section class="panel-card admin-form-card">
|
|
<form method="post" enctype="multipart/form-data" class="vstack gap-5">
|
|
<input type="hidden" name="action" value="save_hospital_profile">
|
|
<input type="hidden" name="return_to" value="admin_hospital.php">
|
|
|
|
<!-- Basic Info -->
|
|
<div>
|
|
<div class="admin-section-head mb-4">
|
|
<div>
|
|
<h2 class="section-title mb-1"><?= qh_h(qh_t('Basic Information', 'المعلومات الأساسية')) ?></h2>
|
|
<p class="section-copy mb-0"><?= qh_h(qh_t('Core naming used across the system.', 'التسمية الأساسية المستخدمة في النظام.')) ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="row g-3">
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalNameEn"><?= qh_h(qh_t('Hospital name (English)', 'اسم المستشفى بالإنجليزية')) ?></label>
|
|
<input id="hospitalNameEn" class="form-control" type="text" name="name_en" value="<?= qh_h((string) ($profile['name_en'] ?? '')) ?>" required>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalNameAr"><?= qh_h(qh_t('Hospital name (Arabic)', 'اسم المستشفى بالعربية')) ?></label>
|
|
<input id="hospitalNameAr" class="form-control" type="text" name="name_ar" value="<?= qh_h((string) ($profile['name_ar'] ?? '')) ?>" required>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<label class="form-label fw-bold" for="hospitalShortName"><?= qh_h(qh_t('Short name', 'الاسم المختصر')) ?></label>
|
|
<input id="hospitalShortName" class="form-control" type="text" maxlength="40" name="short_name" value="<?= qh_h((string) ($profile['short_name'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<label class="form-label fw-bold" for="hospitalTaglineEn"><?= qh_h(qh_t('Tagline (English)', 'الشعار النصي بالإنجليزية')) ?></label>
|
|
<input id="hospitalTaglineEn" class="form-control" type="text" name="tagline_en" value="<?= qh_h((string) ($profile['tagline_en'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<label class="form-label fw-bold" for="hospitalTaglineAr"><?= qh_h(qh_t('Tagline (Arabic)', 'الشعار النصي بالعربية')) ?></label>
|
|
<input id="hospitalTaglineAr" class="form-control" type="text" name="tagline_ar" value="<?= qh_h((string) ($profile['tagline_ar'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="newsTickerEn"><?= qh_h(qh_t('News Ticker (English)', 'شريط الأخبار بالإنجليزية')) ?></label>
|
|
<input id="newsTickerEn" class="form-control" type="text" name="news_ticker_en" value="<?= qh_h((string) ($profile['news_ticker_en'] ?? '')) ?>" placeholder="<?= qh_h(qh_t('Scrolling text for display board', 'نص متحرك لشاشة العرض')) ?>">
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="newsTickerAr"><?= qh_h(qh_t('News Ticker (Arabic)', 'شريط الأخبار بالعربية')) ?></label>
|
|
<input id="newsTickerAr" class="form-control" type="text" name="news_ticker_ar" value="<?= qh_h((string) ($profile['news_ticker_ar'] ?? '')) ?>" placeholder="<?= qh_h(qh_t('Scrolling text for display board', 'نص متحرك لشاشة العرض')) ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr class="m-0 text-muted">
|
|
|
|
<!-- Contact & Location -->
|
|
<div>
|
|
<div class="admin-section-head mb-4">
|
|
<div>
|
|
<h2 class="section-title mb-1"><?= qh_h(qh_t('Contact & Location', 'التواصل والموقع')) ?></h2>
|
|
<p class="section-copy mb-0"><?= qh_h(qh_t('Public details shown to patients or staff.', 'التفاصيل العامة المعروضة للمرضى أو الموظفين.')) ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="row g-3">
|
|
<div class="col-lg-4">
|
|
<label class="form-label fw-bold" for="hospitalPhone"><?= qh_h(qh_t('Phone number', 'رقم الهاتف')) ?></label>
|
|
<input id="hospitalPhone" class="form-control" type="text" name="phone" value="<?= qh_h((string) ($profile['phone'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<label class="form-label fw-bold" for="hospitalEmail"><?= qh_h(qh_t('Email address', 'البريد الإلكتروني')) ?></label>
|
|
<input id="hospitalEmail" class="form-control" type="email" name="email" value="<?= qh_h((string) ($profile['email'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<label class="form-label fw-bold" for="hospitalWebsite"><?= qh_h(qh_t('Website URL', 'رابط الموقع الإلكتروني')) ?></label>
|
|
<input id="hospitalWebsite" class="form-control" type="url" name="website" placeholder="https://example.com" value="<?= qh_h((string) ($profile['website'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalAddressEn"><?= qh_h(qh_t('Address (English)', 'العنوان بالإنجليزية')) ?></label>
|
|
<textarea id="hospitalAddressEn" class="form-control" name="address_en" rows="3"><?= qh_h((string) ($profile['address_en'] ?? '')) ?></textarea>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalAddressAr"><?= qh_h(qh_t('Address (Arabic)', 'العنوان بالعربية')) ?></label>
|
|
<textarea id="hospitalAddressAr" class="form-control" name="address_ar" rows="3"><?= qh_h((string) ($profile['address_ar'] ?? '')) ?></textarea>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalHoursEn"><?= qh_h(qh_t('Working hours (English)', 'ساعات العمل بالإنجليزية')) ?></label>
|
|
<input id="hospitalHoursEn" class="form-control" type="text" name="working_hours_en" value="<?= qh_h((string) ($profile['working_hours_en'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalHoursAr"><?= qh_h(qh_t('Working hours (Arabic)', 'ساعات العمل بالعربية')) ?></label>
|
|
<input id="hospitalHoursAr" class="form-control" type="text" name="working_hours_ar" value="<?= qh_h((string) ($profile['working_hours_ar'] ?? '')) ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr class="m-0 text-muted">
|
|
|
|
<!-- Branding -->
|
|
<div>
|
|
<div class="admin-section-head mb-4">
|
|
<div>
|
|
<h2 class="section-title mb-1"><?= qh_h(qh_t('Branding & Assets', 'الهوية والأصول')) ?></h2>
|
|
<p class="section-copy mb-0"><?= qh_h(qh_t('Upload logo/favicon and choose brand colors.', 'قم برفع الشعار/الأيقونة واختر ألوان الهوية.')) ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="row g-4">
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalLogoUpload"><?= qh_h(qh_t('Upload Logo', 'رفع الشعار')) ?></label>
|
|
<input id="hospitalLogoUpload" class="form-control" type="file" name="logo_upload" accept="image/*">
|
|
<?php if ($logoUrl !== ''): ?>
|
|
<div class="form-check mt-2">
|
|
<input class="form-check-input" type="checkbox" name="remove_logo" value="1" id="removeLogo">
|
|
<label class="form-check-label text-danger" for="removeLogo">
|
|
<?= qh_h(qh_t('Remove current logo', 'إزالة الشعار الحالي')) ?>
|
|
</label>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<label class="form-label fw-bold" for="hospitalFaviconUpload"><?= qh_h(qh_t('Upload Favicon', 'رفع الأيقونة')) ?></label>
|
|
<input id="hospitalFaviconUpload" class="form-control" type="file" name="favicon_upload" accept="image/*">
|
|
<?php if ($faviconUrl !== ''): ?>
|
|
<div class="form-check mt-2">
|
|
<input class="form-check-input" type="checkbox" name="remove_favicon" value="1" id="removeFavicon">
|
|
<label class="form-check-label text-danger" for="removeFavicon">
|
|
<?= qh_h(qh_t('Remove current favicon', 'إزالة الأيقونة الحالية')) ?>
|
|
</label>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-lg-3">
|
|
<label class="form-label fw-bold" for="hospitalPrimaryColor"><?= qh_h(qh_t('Primary color', 'اللون الأساسي')) ?></label>
|
|
<input id="hospitalPrimaryColor" class="form-control form-control-color w-100" type="color" name="primary_color" value="<?= qh_h(qh_hospital_primary_color()) ?>">
|
|
</div>
|
|
<div class="col-lg-3">
|
|
<label class="form-label fw-bold" for="hospitalSecondaryColor"><?= qh_h(qh_t('Secondary color', 'اللون الثانوي')) ?></label>
|
|
<input id="hospitalSecondaryColor" class="form-control form-control-color w-100" type="color" name="secondary_color" value="<?= qh_h(qh_hospital_secondary_color()) ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex flex-wrap gap-2 pt-2">
|
|
<button class="btn btn-dark btn-lg px-4" type="submit"><?= qh_h(qh_t('Save hospital profile', 'حفظ ملف المستشفى')) ?></button>
|
|
<a class="btn btn-outline-secondary btn-lg px-4" href="<?= qh_h(qh_url('admin.php')) ?>"><?= qh_h(qh_t('Cancel', 'إلغاء')) ?></a>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<div class="vstack gap-4">
|
|
<section class="panel-card hospital-preview-card">
|
|
<div class="admin-section-head">
|
|
<div>
|
|
<span class="section-kicker"><?= qh_h(qh_t('Brand preview', 'معاينة الهوية')) ?></span>
|
|
<h2 class="section-title mt-2 mb-1"><?= qh_h(qh_t('What staff will see', 'ما الذي سيراه الطاقم')) ?></h2>
|
|
<p class="section-copy mb-0"><?= qh_h(qh_t('This preview mirrors the saved logo, brand colors, and hospital details used by the app shell.', 'تعكس هذه المعاينة الشعار والألوان وبيانات المستشفى المستخدمة في واجهة التطبيق.')) ?></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hospital-preview-stack mt-4">
|
|
<div class="hospital-preview-header">
|
|
<div class="hospital-preview-logo">
|
|
<?php if ($logoUrl !== ''): ?>
|
|
<img src="<?= qh_h($logoUrl) ?>" alt="<?= qh_h(qh_hospital_name()) ?>">
|
|
<?php else: ?>
|
|
<span><?= qh_h(qh_hospital_brand_initials()) ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div>
|
|
<strong><?= qh_h(qh_hospital_name()) ?></strong>
|
|
<?php if ($tagline !== ''): ?>
|
|
<p class="section-copy mb-0"><?= qh_h($tagline) ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<dl class="hospital-detail-list mb-0">
|
|
<?php if (qh_hospital_contact_value('phone') !== ''): ?>
|
|
<div><dt><?= qh_h(qh_t('Phone', 'الهاتف')) ?></dt><dd><?= qh_h(qh_hospital_contact_value('phone')) ?></dd></div>
|
|
<?php endif; ?>
|
|
<?php if (qh_hospital_contact_value('email') !== ''): ?>
|
|
<div><dt><?= qh_h(qh_t('Email', 'البريد الإلكتروني')) ?></dt><dd><?= qh_h(qh_hospital_contact_value('email')) ?></dd></div>
|
|
<?php endif; ?>
|
|
<?php if ($websiteIsValid): ?>
|
|
<div><dt><?= qh_h(qh_t('Website', 'الموقع الإلكتروني')) ?></dt><dd><a href="<?= qh_h($website) ?>" target="_blank" rel="noreferrer"><?= qh_h($website) ?></a></dd></div>
|
|
<?php endif; ?>
|
|
<?php if (qh_hospital_contact_value(qh_is_ar() ? 'address_ar' : 'address_en') !== ''): ?>
|
|
<div><dt><?= qh_h(qh_t('Address', 'العنوان')) ?></dt><dd><?= nl2br(qh_h(qh_hospital_contact_value(qh_is_ar() ? 'address_ar' : 'address_en'))) ?></dd></div>
|
|
<?php endif; ?>
|
|
<?php if (qh_hospital_contact_value(qh_is_ar() ? 'working_hours_ar' : 'working_hours_en') !== ''): ?>
|
|
<div><dt><?= qh_h(qh_t('Working hours', 'ساعات العمل')) ?></dt><dd><?= qh_h(qh_hospital_contact_value(qh_is_ar() ? 'working_hours_ar' : 'working_hours_en')) ?></dd></div>
|
|
<?php endif; ?>
|
|
</dl>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="panel-card hospital-preview-card">
|
|
<div class="admin-section-head">
|
|
<div>
|
|
<span class="section-kicker"><?= qh_h(qh_t('Assets', 'الأصول')) ?></span>
|
|
<h2 class="section-title mt-2 mb-1"><?= qh_h(qh_t('Logo and favicon status', 'حالة الشعار والأيقونة')) ?></h2>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hospital-asset-grid mt-4">
|
|
<div class="hospital-asset-box">
|
|
<span class="workflow-step"><?= qh_h(qh_t('Logo', 'الشعار')) ?></span>
|
|
<?php if ($logoUrl !== ''): ?>
|
|
<img class="hospital-asset-image" src="<?= qh_h($logoUrl) ?>" alt="<?= qh_h(qh_t('Hospital logo preview', 'معاينة شعار المستشفى')) ?>">
|
|
<?php else: ?>
|
|
<div class="empty-state compact mt-3"><strong><?= qh_h(qh_t('No logo yet.', 'لا يوجد شعار حتى الآن.')) ?></strong><span><?= qh_h(qh_t('Upload a logo to replace the initials badge in the top header.', 'ارفع شعاراً لاستبدال شارة الأحرف في الترويسة العلوية.')) ?></span></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="hospital-asset-box">
|
|
<span class="workflow-step"><?= qh_h(qh_t('Favicon', 'الأيقونة')) ?></span>
|
|
<?php if ($faviconUrl !== ''): ?>
|
|
<img class="hospital-asset-image hospital-asset-favicon" src="<?= qh_h($faviconUrl) ?>" alt="<?= qh_h(qh_t('Favicon preview', 'معاينة الأيقونة')) ?>">
|
|
<?php else: ?>
|
|
<div class="empty-state compact mt-3"><strong><?= qh_h(qh_t('No custom favicon yet.', 'لا توجد أيقونة مخصصة حتى الآن.')) ?></strong><span><?= qh_h(qh_t('If missing, the app will reuse the logo as the browser icon when available.', 'إذا كانت مفقودة، سيعيد التطبيق استخدام الشعار كأيقونة للمتصفح عند توفره.')) ?></span></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php qh_page_end(); ?>
|