786 lines
28 KiB
PHP
786 lines
28 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/includes/app.php';
|
|
|
|
function print_sheet_score_display(?float $value): string
|
|
{
|
|
if ($value === null) {
|
|
return '—';
|
|
}
|
|
|
|
return rtrim(rtrim(number_format($value, 2, '.', ''), '0'), '.');
|
|
}
|
|
|
|
$applicationId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ?: 0;
|
|
$requestedCycleId = filter_input(INPUT_GET, 'cycle', FILTER_VALIDATE_INT) ?: 0;
|
|
$requestedAssessmentId = filter_input(INPUT_GET, 'assessment_id', FILTER_VALIDATE_INT) ?: 0;
|
|
$application = $applicationId > 0 ? get_application($applicationId) : null;
|
|
$isApprovedCenter = $application && (string) ($application['status'] ?? '') === 'approved';
|
|
$cycleContext = ['cycles' => [], 'selected' => null, 'active' => null, 'read_only' => false];
|
|
$selectedCycle = null;
|
|
$selectedCycleId = 0;
|
|
$cycleLabel = 'لا توجد دورة بعد';
|
|
|
|
$buildCenterAssessmentsUrl = static function (int $targetApplicationId = 0, int $targetCycleId = 0): string {
|
|
$params = [];
|
|
if ($targetApplicationId > 0) {
|
|
$params['id'] = $targetApplicationId;
|
|
}
|
|
if ($targetCycleId > 0) {
|
|
$params['cycle'] = $targetCycleId;
|
|
}
|
|
return 'center_assessments.php' . ($params !== [] ? '?' . http_build_query($params) : '');
|
|
};
|
|
|
|
$buildCenterAssessmentScoreUrl = static function (int $targetApplicationId = 0, int $targetCycleId = 0, int $targetAssessmentId = 0): string {
|
|
$params = [];
|
|
if ($targetApplicationId > 0) {
|
|
$params['id'] = $targetApplicationId;
|
|
}
|
|
if ($targetCycleId > 0) {
|
|
$params['cycle'] = $targetCycleId;
|
|
}
|
|
if ($targetAssessmentId > 0) {
|
|
$params['assessment_id'] = $targetAssessmentId;
|
|
}
|
|
return 'center_assessment_score_sheet.php' . ($params !== [] ? '?' . http_build_query($params) : '');
|
|
};
|
|
|
|
if (!$application || !$isApprovedCenter || $requestedCycleId <= 0 || $requestedAssessmentId <= 0) {
|
|
set_flash('error', 'اختر مركزاً ودورة وتقييماً صحيحاً لفتح ورقة الطباعة.');
|
|
header('Location: ' . $buildCenterAssessmentsUrl($applicationId, $requestedCycleId));
|
|
exit;
|
|
}
|
|
|
|
$cycleContext = resolve_school_cycle_context((int) $application['id'], $application, $requestedCycleId);
|
|
$selectedCycle = $cycleContext['selected'];
|
|
$selectedCycleId = $selectedCycle ? (int) ($selectedCycle['id'] ?? 0) : 0;
|
|
$cycleLabel = $selectedCycle ? (string) ($selectedCycle['cycle_name'] ?? $cycleLabel) : $cycleLabel;
|
|
|
|
if ($selectedCycleId <= 0) {
|
|
set_flash('error', 'تعذر تحديد الدورة المطلوبة لورقة الطباعة.');
|
|
header('Location: ' . $buildCenterAssessmentsUrl((int) $application['id'], $requestedCycleId));
|
|
exit;
|
|
}
|
|
|
|
$selectedAssessment = null;
|
|
foreach (list_center_assessments_by_cycle((int) $application['id'], $selectedCycleId) as $assessment) {
|
|
if ((int) ($assessment['id'] ?? 0) === $requestedAssessmentId) {
|
|
$selectedAssessment = $assessment;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!$selectedAssessment) {
|
|
set_flash('error', 'تعذر العثور على التقييم المطلوب لطباعة النموذج.');
|
|
header('Location: ' . $buildCenterAssessmentsUrl((int) $application['id'], $selectedCycleId));
|
|
exit;
|
|
}
|
|
|
|
$criteria = list_center_assessment_criteria_by_assessment((int) $application['id'], $selectedCycleId, $requestedAssessmentId, true);
|
|
$scoreBundle = center_assessment_score_bundle_by_assessment((int) $application['id'], $selectedCycleId, $requestedAssessmentId);
|
|
$scoreRow = $scoreBundle['score'] ?? null;
|
|
$criteriaScores = $scoreBundle['criteria_scores'] ?? [];
|
|
$statusKey = center_assessment_normalize_status((string) ($scoreRow['status'] ?? 'pending'));
|
|
$statusMeta = center_assessment_status_map()[$statusKey] ?? ['label' => 'غير محدد'];
|
|
$totalScore = isset($scoreRow['score']) && $scoreRow['score'] !== null ? (float) $scoreRow['score'] : null;
|
|
$maxScore = isset($scoreRow['max_score']) && $scoreRow['max_score'] !== null
|
|
? (float) $scoreRow['max_score']
|
|
: (float) ($selectedAssessment['max_score'] ?? 0);
|
|
if ($criteria !== []) {
|
|
$criteriaMax = 0.0;
|
|
foreach ($criteria as $criterion) {
|
|
$criteriaMax += (float) ($criterion['max_score'] ?? 0);
|
|
}
|
|
$maxScore = $criteriaMax > 0 ? $criteriaMax : $maxScore;
|
|
}
|
|
$percentage = $totalScore !== null && $maxScore > 0 ? round(($totalScore / $maxScore) * 100, 2) : null;
|
|
$notes = trim((string) ($scoreRow['notes'] ?? ''));
|
|
$assessmentDate = (string) ($scoreRow['assessed_on'] ?? '');
|
|
$settings = get_app_settings();
|
|
$projectName = (string) (!empty($settings['app_name']) ? $settings['app_name'] : project_name());
|
|
$projectLogo = (string) ($settings['app_logo'] ?? '');
|
|
$pageTitle = 'ورقة متابعة تقييم المركز — ' . (string) ($selectedAssessment['title'] ?? '');
|
|
$pageDescription = 'نموذج رسمي قابل للطباعة لتوثيق تقييم المركز والتوقيعات وخطة المتابعة الإدارية.';
|
|
$generatedAt = date('Y-m-d H:i');
|
|
$scoreSheetUrl = $buildCenterAssessmentScoreUrl((int) $application['id'], $selectedCycleId, $requestedAssessmentId);
|
|
?>
|
|
<!doctype html>
|
|
<html lang="ar" dir="rtl">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= e($pageTitle) ?> | <?= e($projectName) ?></title>
|
|
<meta name="description" content="<?= e($pageDescription) ?>">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--ink: #17324d;
|
|
--ink-soft: #48637d;
|
|
--line: #cfd9e5;
|
|
--line-strong: #8da6be;
|
|
--panel: #ffffff;
|
|
--panel-soft: #f4f7fb;
|
|
--accent: #0f4c81;
|
|
--accent-soft: #e9f2fb;
|
|
--success-soft: #edf7ef;
|
|
}
|
|
* { box-sizing: border-box; }
|
|
body {
|
|
margin: 0;
|
|
background: #eef3f8;
|
|
color: var(--ink);
|
|
font-family: 'Cairo', system-ui, sans-serif;
|
|
line-height: 1.65;
|
|
}
|
|
.screen-toolbar {
|
|
max-width: 1100px;
|
|
margin: 0 auto;
|
|
padding: 1.25rem 1rem 0;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
gap: 0.75rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
.toolbar-actions {
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
.toolbar-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.45rem;
|
|
padding: 0.8rem 1.15rem;
|
|
border-radius: 999px;
|
|
text-decoration: none;
|
|
border: 1px solid rgba(15, 76, 129, 0.18);
|
|
background: rgba(255,255,255,0.92);
|
|
color: var(--ink);
|
|
font-weight: 700;
|
|
box-shadow: 0 14px 35px rgba(15, 76, 129, 0.08);
|
|
cursor: pointer;
|
|
}
|
|
.toolbar-btn.primary {
|
|
background: linear-gradient(135deg, #0f4c81, #2f7bc4);
|
|
color: #fff;
|
|
border-color: transparent;
|
|
}
|
|
.sheet-wrap {
|
|
max-width: 1100px;
|
|
margin: 0 auto;
|
|
padding: 1rem;
|
|
}
|
|
.sheet {
|
|
background: var(--panel);
|
|
border: 1px solid var(--line);
|
|
border-radius: 28px;
|
|
box-shadow: 0 25px 60px rgba(17, 43, 70, 0.08);
|
|
padding: 2rem;
|
|
}
|
|
.sheet-header {
|
|
display: grid;
|
|
grid-template-columns: minmax(0, 1fr) auto;
|
|
gap: 1.5rem;
|
|
align-items: start;
|
|
padding-bottom: 1.5rem;
|
|
border-bottom: 2px solid var(--line);
|
|
}
|
|
.sheet-brand {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
.sheet-brand img {
|
|
width: 76px;
|
|
height: 76px;
|
|
object-fit: contain;
|
|
border-radius: 18px;
|
|
border: 1px solid var(--line);
|
|
padding: 0.5rem;
|
|
background: #fff;
|
|
}
|
|
.brand-mark {
|
|
width: 76px;
|
|
height: 76px;
|
|
border-radius: 18px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: linear-gradient(135deg, #0f4c81, #2f7bc4);
|
|
color: #fff;
|
|
font-size: 1.8rem;
|
|
font-weight: 800;
|
|
}
|
|
.eyebrow {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.4rem;
|
|
padding: 0.3rem 0.75rem;
|
|
border-radius: 999px;
|
|
background: var(--accent-soft);
|
|
color: var(--accent);
|
|
font-weight: 700;
|
|
font-size: 0.85rem;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
h1 {
|
|
margin: 0 0 0.35rem;
|
|
font-size: 2rem;
|
|
line-height: 1.25;
|
|
}
|
|
.subhead {
|
|
margin: 0;
|
|
color: var(--ink-soft);
|
|
font-size: 1rem;
|
|
}
|
|
.document-meta {
|
|
min-width: 250px;
|
|
border: 1px solid var(--line);
|
|
border-radius: 20px;
|
|
background: var(--panel-soft);
|
|
padding: 1rem 1.15rem;
|
|
}
|
|
.document-meta .meta-row,
|
|
.info-grid .info-item,
|
|
.summary-grid .summary-card {
|
|
display: flex;
|
|
align-items: baseline;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
}
|
|
.meta-row + .meta-row { margin-top: 0.45rem; }
|
|
.meta-label,
|
|
.info-label,
|
|
.summary-label {
|
|
color: var(--ink-soft);
|
|
font-size: 0.92rem;
|
|
}
|
|
.meta-value,
|
|
.info-value,
|
|
.summary-value {
|
|
font-weight: 700;
|
|
}
|
|
.section {
|
|
margin-top: 1.35rem;
|
|
border: 1px solid var(--line);
|
|
border-radius: 22px;
|
|
overflow: hidden;
|
|
background: #fff;
|
|
}
|
|
.section-head {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
align-items: center;
|
|
padding: 0.95rem 1.2rem;
|
|
background: linear-gradient(180deg, #f8fbff, #edf4fb);
|
|
border-bottom: 1px solid var(--line);
|
|
}
|
|
.section-title {
|
|
margin: 0;
|
|
font-size: 1.05rem;
|
|
font-weight: 800;
|
|
}
|
|
.section-note {
|
|
color: var(--ink-soft);
|
|
font-size: 0.9rem;
|
|
margin: 0;
|
|
}
|
|
.section-body { padding: 1.15rem 1.2rem 1.3rem; }
|
|
.info-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 0.85rem 1rem;
|
|
}
|
|
.info-item {
|
|
padding: 0.75rem 0.9rem;
|
|
background: var(--panel-soft);
|
|
border-radius: 16px;
|
|
min-height: 56px;
|
|
}
|
|
.summary-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
gap: 0.85rem;
|
|
}
|
|
.print-top-grid,
|
|
.print-bottom-grid {
|
|
display: grid;
|
|
gap: 1rem;
|
|
}
|
|
.summary-card {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
justify-content: center;
|
|
padding: 1rem;
|
|
border-radius: 18px;
|
|
border: 1px solid var(--line);
|
|
background: linear-gradient(180deg, #fff, #f8fbff);
|
|
min-height: 108px;
|
|
}
|
|
.summary-card.status-card { background: var(--success-soft); }
|
|
.summary-value.big {
|
|
font-size: 1.45rem;
|
|
font-weight: 800;
|
|
margin-top: 0.2rem;
|
|
}
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
th, td {
|
|
border: 1px solid var(--line);
|
|
padding: 0.8rem 0.7rem;
|
|
vertical-align: top;
|
|
text-align: right;
|
|
font-size: 0.95rem;
|
|
}
|
|
thead th {
|
|
background: #f3f7fb;
|
|
font-weight: 800;
|
|
}
|
|
td.center, th.center { text-align: center; }
|
|
.muted { color: var(--ink-soft); }
|
|
.notes-box,
|
|
.lines-box {
|
|
min-height: 110px;
|
|
border: 1px dashed var(--line-strong);
|
|
border-radius: 18px;
|
|
padding: 0.95rem 1rem;
|
|
background: linear-gradient(180deg, #fff, #fbfdff);
|
|
}
|
|
.notes-box.empty::after {
|
|
content: '................................................................................................................................................................................';
|
|
color: var(--line-strong);
|
|
word-break: break-word;
|
|
line-height: 2;
|
|
}
|
|
.follow-up-table td {
|
|
height: 54px;
|
|
}
|
|
.signature-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
gap: 1rem;
|
|
}
|
|
.signature-card {
|
|
border: 1px solid var(--line);
|
|
border-radius: 18px;
|
|
padding: 1rem;
|
|
background: #fff;
|
|
min-height: 155px;
|
|
}
|
|
.signature-role {
|
|
font-weight: 800;
|
|
margin-bottom: 1.5rem;
|
|
font-size: 1rem;
|
|
}
|
|
.signature-line {
|
|
border-bottom: 1px solid var(--line-strong);
|
|
margin: 1rem 0 0.45rem;
|
|
height: 1.25rem;
|
|
}
|
|
.print-footnote {
|
|
margin-top: 1.25rem;
|
|
color: var(--ink-soft);
|
|
font-size: 0.86rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
@media (max-width: 900px) {
|
|
.sheet-header,
|
|
.info-grid,
|
|
.summary-grid,
|
|
.signature-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
.document-meta { min-width: 0; }
|
|
}
|
|
@media print {
|
|
@page { size: A4; margin: 8mm; }
|
|
body {
|
|
background: #fff;
|
|
color: #000;
|
|
font-size: 11px;
|
|
line-height: 1.3;
|
|
}
|
|
.screen-toolbar { display: none !important; }
|
|
.sheet-wrap { max-width: none; padding: 0; }
|
|
.sheet {
|
|
box-shadow: none;
|
|
border: none;
|
|
border-radius: 0;
|
|
padding: 0;
|
|
}
|
|
.sheet-header {
|
|
gap: 0.75rem;
|
|
padding-bottom: 0.5rem;
|
|
margin-bottom: 0.4rem;
|
|
}
|
|
.sheet-brand { gap: 0.7rem; }
|
|
.sheet-brand img,
|
|
.brand-mark {
|
|
width: 52px;
|
|
height: 52px;
|
|
border-radius: 12px;
|
|
font-size: 1.25rem;
|
|
}
|
|
.eyebrow {
|
|
margin-bottom: 0.3rem;
|
|
padding: 0.12rem 0.5rem;
|
|
font-size: 0.66rem;
|
|
}
|
|
h1 {
|
|
font-size: 1.15rem;
|
|
margin-bottom: 0.1rem;
|
|
}
|
|
.subhead {
|
|
font-size: 0.74rem;
|
|
line-height: 1.25;
|
|
}
|
|
.document-meta {
|
|
min-width: 205px;
|
|
padding: 0.5rem 0.65rem;
|
|
border-radius: 12px;
|
|
}
|
|
.meta-row + .meta-row { margin-top: 0.18rem; }
|
|
.meta-label,
|
|
.info-label,
|
|
.summary-label,
|
|
.section-note,
|
|
.muted,
|
|
.print-footnote {
|
|
font-size: 0.68rem;
|
|
line-height: 1.2;
|
|
}
|
|
.print-top-grid {
|
|
grid-template-columns: 1.25fr 0.95fr;
|
|
gap: 0.45rem;
|
|
margin-top: 0.45rem;
|
|
}
|
|
.print-bottom-grid {
|
|
grid-template-columns: 0.95fr 1.05fr;
|
|
gap: 0.45rem;
|
|
margin-top: 0.45rem;
|
|
}
|
|
.section {
|
|
margin-top: 0.45rem;
|
|
border-radius: 12px;
|
|
}
|
|
.section-head {
|
|
padding: 0.45rem 0.65rem;
|
|
gap: 0.45rem;
|
|
}
|
|
.section-title {
|
|
font-size: 0.82rem;
|
|
line-height: 1.2;
|
|
}
|
|
.section-body {
|
|
padding: 0.5rem 0.65rem 0.6rem;
|
|
}
|
|
.info-grid {
|
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
gap: 0.35rem 0.45rem;
|
|
}
|
|
.info-item {
|
|
min-height: 0;
|
|
padding: 0.35rem 0.45rem;
|
|
border-radius: 10px;
|
|
}
|
|
.summary-grid {
|
|
gap: 0.35rem;
|
|
}
|
|
.summary-card {
|
|
min-height: 0;
|
|
padding: 0.45rem 0.5rem;
|
|
border-radius: 10px;
|
|
}
|
|
.summary-value.big {
|
|
font-size: 1rem;
|
|
margin-top: 0.05rem;
|
|
}
|
|
table { table-layout: fixed; }
|
|
th, td {
|
|
padding: 0.28rem 0.32rem;
|
|
font-size: 0.68rem;
|
|
line-height: 1.2;
|
|
}
|
|
td > div + div { margin-top: 0.08rem; }
|
|
.notes-box,
|
|
.lines-box {
|
|
min-height: 54px;
|
|
padding: 0.45rem 0.55rem;
|
|
border-radius: 10px;
|
|
}
|
|
.notes-box.empty::after {
|
|
line-height: 1.55;
|
|
font-size: 0.66rem;
|
|
}
|
|
.follow-up-table td {
|
|
height: 28px;
|
|
}
|
|
.follow-up-table tbody tr:nth-child(n+3) {
|
|
display: none;
|
|
}
|
|
.criterion-desc {
|
|
display: none;
|
|
}
|
|
.signature-grid {
|
|
gap: 0.35rem;
|
|
}
|
|
.signature-card {
|
|
min-height: 82px;
|
|
padding: 0.45rem 0.5rem;
|
|
border-radius: 10px;
|
|
}
|
|
.signature-role {
|
|
font-size: 0.74rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
.signature-line {
|
|
margin: 0.5rem 0 0.2rem;
|
|
height: 0.65rem;
|
|
}
|
|
.print-footnote {
|
|
margin-top: 0.45rem;
|
|
}
|
|
.section,
|
|
.document-meta,
|
|
.summary-card,
|
|
.signature-card,
|
|
.info-item,
|
|
tr,
|
|
td,
|
|
th {
|
|
break-inside: avoid;
|
|
}
|
|
a { color: inherit; text-decoration: none; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="screen-toolbar">
|
|
<div>
|
|
<div style="font-weight:800; font-size:1.05rem; color:#17324d;">ورقة تقييم قابلة للطباعة</div>
|
|
<div style="color:#48637d; font-size:0.92rem;">نموذج رسمي للتوقيعات وخطة المتابعة الإدارية.</div>
|
|
</div>
|
|
<div class="toolbar-actions">
|
|
<a class="toolbar-btn" href="<?= e($scoreSheetUrl) ?>">العودة إلى صفحة الرصد</a>
|
|
<a class="toolbar-btn" href="<?= e($buildCenterAssessmentsUrl((int) $application['id'], $selectedCycleId)) ?>">كل تقييمات المركز</a>
|
|
<button class="toolbar-btn primary" type="button" onclick="window.print()">طباعة / حفظ PDF</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="sheet-wrap">
|
|
<article class="sheet">
|
|
<header class="sheet-header">
|
|
<div>
|
|
<div class="sheet-brand">
|
|
<?php if ($projectLogo !== ''): ?>
|
|
<img src="<?= e(asset_url($projectLogo)) ?>" alt="<?= e($projectName) ?>">
|
|
<?php else: ?>
|
|
<span class="brand-mark"><?= e(mb_substr($projectName, 0, 1)) ?></span>
|
|
<?php endif; ?>
|
|
<div>
|
|
<div class="eyebrow">نموذج رسمي معتمد للمتابعة</div>
|
|
<h1>ورقة تقييم ومتابعة إدارية للمركز</h1>
|
|
<p class="subhead"><?= e($projectName) ?> — توثيق نتيجة التقييم وخطوات المتابعة والتوقيعات.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="document-meta">
|
|
<div class="meta-row"><span class="meta-label">رقم المركز</span><span class="meta-value">#<?= e((string) $application['id']) ?></span></div>
|
|
<div class="meta-row"><span class="meta-label">الدورة</span><span class="meta-value"><?= e($cycleLabel) ?></span></div>
|
|
<div class="meta-row"><span class="meta-label">تاريخ التقييم</span><span class="meta-value"><?= e($assessmentDate !== '' ? $assessmentDate : '................') ?></span></div>
|
|
<div class="meta-row"><span class="meta-label">تاريخ الطباعة</span><span class="meta-value"><?= e($generatedAt) ?></span></div>
|
|
<div class="meta-row"><span class="meta-label">الحالة</span><span class="meta-value"><?= e((string) ($statusMeta['label'] ?? 'غير محدد')) ?></span></div>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="print-top-grid">
|
|
<section class="section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">بيانات المركز والتقييم</h2>
|
|
<p class="section-note">يمكن اعتماد هذه الصفحة في الملف الورقي أو حفظها بصيغة PDF.</p>
|
|
</div>
|
|
<div class="section-body">
|
|
<div class="info-grid">
|
|
<div class="info-item"><span class="info-label">اسم المركز</span><span class="info-value"><?= e((string) ($application['center_name'] ?? '')) ?></span></div>
|
|
<div class="info-item"><span class="info-label">المدينة</span><span class="info-value"><?= e((string) (($application['city'] ?? '') !== '' ? $application['city'] : '—')) ?></span></div>
|
|
<div class="info-item"><span class="info-label">مدير المركز</span><span class="info-value"><?= e((string) (($application['director_name'] ?? '') !== '' ? $application['director_name'] : '—')) ?></span></div>
|
|
<div class="info-item"><span class="info-label">التقييم</span><span class="info-value"><?= e((string) ($selectedAssessment['title'] ?? '')) ?></span></div>
|
|
<div class="info-item"><span class="info-label">الفئة</span><span class="info-value"><?= e((string) (($selectedAssessment['category'] ?? '') !== '' ? $selectedAssessment['category'] : '—')) ?></span></div>
|
|
<div class="info-item"><span class="info-label">نوع المقياس</span><span class="info-value"><?= e((string) assessment_scale_type_label((string) ($selectedAssessment['scale_type'] ?? ''))) ?></span></div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">ملخص النتيجة</h2>
|
|
<p class="section-note">يعرض هذا القسم النتيجة الحالية إن كانت مرصودة، أو يترك مساحة للتعبئة اليدوية.</p>
|
|
</div>
|
|
<div class="section-body">
|
|
<div class="summary-grid">
|
|
<div class="summary-card">
|
|
<div class="summary-label">الدرجة المحققة</div>
|
|
<div class="summary-value big"><?= e(print_sheet_score_display($totalScore)) ?></div>
|
|
</div>
|
|
<div class="summary-card">
|
|
<div class="summary-label">الدرجة القصوى</div>
|
|
<div class="summary-value big"><?= e(print_sheet_score_display($maxScore)) ?></div>
|
|
</div>
|
|
<div class="summary-card">
|
|
<div class="summary-label">النسبة المئوية</div>
|
|
<div class="summary-value big"><?= e($percentage !== null ? print_sheet_score_display($percentage) . '%' : '—') ?></div>
|
|
</div>
|
|
<div class="summary-card status-card">
|
|
<div class="summary-label">وزن التقييم</div>
|
|
<div class="summary-value big"><?= e(print_sheet_score_display((float) ($selectedAssessment['weight_percentage'] ?? 0))) ?>%</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<section class="section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">تفاصيل البنود</h2>
|
|
<p class="section-note"><?= $criteria !== [] ? 'تفصيل البنود النشطة لهذا التقييم.' : 'لا توجد بنود معرفة حالياً، لذا يظهر سطر موحد للتقييم العام.' ?></p>
|
|
</div>
|
|
<div class="section-body">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th class="center" style="width:64px;">#</th>
|
|
<th>البند / المعيار</th>
|
|
<th class="center" style="width:120px;">الدرجة القصوى</th>
|
|
<th class="center" style="width:140px;">الدرجة المرصودة</th>
|
|
<th>ملاحظات مختصرة</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($criteria !== []): ?>
|
|
<?php foreach ($criteria as $index => $criterion): ?>
|
|
<?php
|
|
$criterionId = (int) ($criterion['id'] ?? 0);
|
|
$criterionScore = $criteriaScores[$criterionId] ?? null;
|
|
$criterionNote = trim((string) ($criterionScore['notes'] ?? ''));
|
|
?>
|
|
<tr>
|
|
<td class="center"><?= e((string) ($index + 1)) ?></td>
|
|
<td>
|
|
<div style="font-weight:700;"><?= e((string) ($criterion['title'] ?? '')) ?></div>
|
|
<?php if (!empty($criterion['description'])): ?><div class="muted criterion-desc"><?= e((string) $criterion['description']) ?></div><?php endif; ?>
|
|
</td>
|
|
<td class="center"><?= e(print_sheet_score_display((float) ($criterion['max_score'] ?? 0))) ?></td>
|
|
<td class="center"><?= e(isset($criterionScore['score']) && $criterionScore['score'] !== null ? print_sheet_score_display((float) $criterionScore['score']) : '................') ?></td>
|
|
<td><?= e($criterionNote !== '' ? $criterionNote : '................................................................') ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<tr>
|
|
<td class="center">1</td>
|
|
<td><?= e((string) ($selectedAssessment['title'] ?? 'التقييم العام')) ?></td>
|
|
<td class="center"><?= e(print_sheet_score_display($maxScore)) ?></td>
|
|
<td class="center"><?= e($totalScore !== null ? print_sheet_score_display($totalScore) : '................') ?></td>
|
|
<td>................................................................</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="print-bottom-grid">
|
|
<section class="section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">ملاحظات المقيم</h2>
|
|
<p class="section-note">أبرز الملاحظات أو أسباب القرار أو التوصية العامة.</p>
|
|
</div>
|
|
<div class="section-body">
|
|
<div class="notes-box<?= $notes === '' ? ' empty' : '' ?>"><?= $notes !== '' ? nl2br(e($notes)) : '' ?></div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">خطة المتابعة الإدارية</h2>
|
|
<p class="section-note">تُعبّأ عند وجود ملاحظات تتطلب معالجة أو متابعة لاحقة.</p>
|
|
</div>
|
|
<div class="section-body">
|
|
<table class="follow-up-table">
|
|
<thead>
|
|
<tr>
|
|
<th style="width:48%;">الإجراء المطلوب</th>
|
|
<th style="width:18%;">المسؤول</th>
|
|
<th style="width:18%;">الموعد المستهدف</th>
|
|
<th style="width:16%;">حالة المتابعة</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td></td><td></td><td></td><td></td></tr>
|
|
<tr><td></td><td></td><td></td><td></td></tr>
|
|
<tr><td></td><td></td><td></td><td></td></tr>
|
|
<tr><td></td><td></td><td></td><td></td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<section class="section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">التوقيعات والاعتماد</h2>
|
|
<p class="section-note">للاستخدام الرسمي بين المقيم وإدارة المركز والإدارة المشرفة.</p>
|
|
</div>
|
|
<div class="section-body">
|
|
<div class="signature-grid">
|
|
<div class="signature-card">
|
|
<div class="signature-role">المقيم / المشرف</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">الاسم والتوقيع</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">التاريخ</div>
|
|
</div>
|
|
<div class="signature-card">
|
|
<div class="signature-role">مدير المركز</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">الاسم والتوقيع</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">التاريخ</div>
|
|
</div>
|
|
<div class="signature-card">
|
|
<div class="signature-role">اعتماد الإدارة</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">الاسم والتوقيع</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">التاريخ</div>
|
|
</div>
|
|
<div class="signature-card">
|
|
<div class="signature-role">متابعة الإغلاق</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">تمت المراجعة / أغلقت الملاحظات</div>
|
|
<div class="signature-line"></div>
|
|
<div class="muted">التاريخ</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="print-footnote">
|
|
<span>هذه الورقة ناتجة من نظام إدارة المراكز ويمكن أرشفتها ضمن ملف المركز.</span>
|
|
<span>مرجع التقييم: #<?= e((string) ($selectedAssessment['id'] ?? 0)) ?> — <?= e((string) ($selectedAssessment['title'] ?? '')) ?></span>
|
|
</div>
|
|
</article>
|
|
</div>
|
|
</body>
|
|
</html>
|