Commit 271457f8 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(sports): rename assessment to classification, fix medical approval sync

1. Renamed "تقييم اللاعبين" to "تصنيف وتعيين اللاعبين" throughout
   (sidebar, page titles, buttons) — better describes the actual action
   of classifying players into groups.

2. Assessment page now shows discipline tabs — clicking a discipline
   filters groups to only show those belonging to that activity.
   Player's selected disciplines are already visible at top.

3. Fixed medical certificate bug: when approving via the player profile
   edit form (updateMedical), the document's approval_status was not
   being synced. Now setting player to fit/conditional also marks the
   latest document as approved, and unfit marks it as rejected.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 5903c64f
......@@ -126,6 +126,6 @@ class CoachAssessmentController extends Controller
}
return $this->redirect('/sa/coach-assessment')
->withSuccess('تم تقييم اللاعب وتعيينه في مجموعة "' . $result['group_name'] . '" بنجاح');
->withSuccess('تم تصنيف اللاعب وتعيينه في مجموعة "' . $result['group_name'] . '" بنجاح');
}
}
......@@ -292,6 +292,14 @@ class PlayerDocumentController extends Controller
if ($doctorName !== '') $docUpdate['doctor_name'] = $doctorName;
if ($clinicName !== '') $docUpdate['clinic_name'] = $clinicName;
if (in_array($medicalStatus, ['fit', 'conditional'], true)) {
$docUpdate['approval_status'] = 'approved';
$docUpdate['approved_by'] = (int) (App::getInstance()->session()->get('employee_id') ?? 0);
$docUpdate['approved_at'] = now();
} elseif ($medicalStatus === 'unfit') {
$docUpdate['approval_status'] = 'rejected';
}
$db->update('sa_player_documents', $docUpdate, 'id = ?', [(int) $latestDoc['id']]);
}
......
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تقييم: <?= e($registration['full_name_ar']) ?><?php $__template->endSection(); ?>
<?php $__template->section('title'); ?>تصنيف وتعيين: <?= e($registration['full_name_ar']) ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
<a href="/sa/coach-assessment" class="btn btn-outline"><i data-lucide="arrow-right" style="width:15px;height:15px;vertical-align:middle;margin-left:4px;"></i> العودة للقائمة</a>
<a href="/sa/coach-assessment" class="btn btn-outline"><i data-lucide="arrow-right" style="width:15px;height:15px;vertical-align:middle;margin-left:4px;"></i> العودة</a>
<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
......@@ -63,7 +63,7 @@
<div class="card" style="margin-bottom:16px;">
<div style="padding:16px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;">
<i data-lucide="target" style="width:18px;height:18px;color:#0D7377;"></i>
<h3 style="margin:0;color:#0D7377;font-size:15px;">التقييم الفني</h3>
<h3 style="margin:0;color:#0D7377;font-size:15px;">تصنيف المستوى</h3>
</div>
<div style="padding:20px;">
<!-- Skill Level -->
......@@ -87,23 +87,44 @@
<!-- Assessment Notes -->
<div class="form-group" style="margin-bottom:20px;">
<label class="form-label">ملاحظات التقييم</label>
<textarea name="assessment_notes" class="form-input" rows="3" placeholder="ملاحظات المدرب عن مستوى اللاعب..."></textarea>
<label class="form-label">ملاحظات المدرب</label>
<textarea name="assessment_notes" class="form-input" rows="3" placeholder="ملاحظات عن مستوى اللاعب..."></textarea>
</div>
</div>
</div>
<!-- Group Selection -->
<!-- Group Selection by Discipline -->
<div class="card" style="margin-bottom:16px;">
<div style="padding:16px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;">
<i data-lucide="users" style="width:18px;height:18px;color:#0D7377;"></i>
<h3 style="margin:0;color:#0D7377;font-size:15px;">تعيين في مجموعة <span style="color:#DC2626;">*</span></h3>
</div>
<div style="padding:16px;">
<?php
$groupsByDiscipline = [];
foreach ($groups as $g) {
$dId = (int) ($g['discipline_id'] ?? 0);
$dName = $g['discipline_name'] ?? 'بدون نشاط';
if (!isset($groupsByDiscipline[$dId])) {
$groupsByDiscipline[$dId] = ['name' => $dName, 'groups' => []];
}
$groupsByDiscipline[$dId]['groups'][] = $g;
}
?>
<?php if (count($groupsByDiscipline) > 1): ?>
<div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px;">
<?php foreach ($groupsByDiscipline as $dId => $dData): ?>
<button type="button" class="disc-tab btn btn-outline" data-disc="<?= $dId ?>" style="padding:8px 16px;font-size:13px;border-radius:8px;">
<?= e($dData['name']) ?> <span style="font-size:11px;color:#6B7280;">(<?= count($dData['groups']) ?>)</span>
</button>
<?php endforeach; ?>
<button type="button" class="disc-tab btn btn-outline" data-disc="all" style="padding:8px 16px;font-size:13px;border-radius:8px;">الكل</button>
</div>
<?php endif; ?>
<input type="text" id="groupSearch" class="form-input" placeholder="ابحث عن مجموعة..." style="margin-bottom:12px;padding:12px;font-size:14px;border-radius:10px;">
<div style="max-height:400px;overflow-y:auto;display:grid;gap:8px;">
<div style="max-height:400px;overflow-y:auto;display:grid;gap:8px;" id="groupsList">
<?php foreach ($groups as $g): ?>
<label class="group-radio-option" data-name="<?= e($g['name_ar'] . ' ' . ($g['discipline_name'] ?? '') . ' ' . ($g['program_name'] ?? '')) ?>"
<label class="group-radio-option" data-disc-id="<?= (int) ($g['discipline_id'] ?? 0) ?>" data-name="<?= e($g['name_ar'] . ' ' . ($g['discipline_name'] ?? '') . ' ' . ($g['program_name'] ?? '')) ?>"
style="display:flex;align-items:center;gap:12px;padding:14px;border:2px solid #E5E7EB;border-radius:10px;cursor:pointer;transition:all 0.2s;">
<input type="radio" name="group_id" value="<?= (int) $g['id'] ?>" required style="accent-color:#2563EB;width:20px;height:20px;flex-shrink:0;">
<div style="flex:1;min-width:0;">
......@@ -126,7 +147,7 @@
</div>
<button type="submit" class="btn btn-primary" style="width:100%;padding:16px;font-size:16px;font-weight:700;border-radius:12px;">
<i data-lucide="check-circle" style="width:18px;height:18px;vertical-align:middle;margin-left:6px;"></i> تأكيد التقييم والتعيين
<i data-lucide="check-circle" style="width:18px;height:18px;vertical-align:middle;margin-left:6px;"></i> تأكيد التصنيف والتعيين
</button>
</form>
......@@ -135,15 +156,34 @@ document.addEventListener('DOMContentLoaded', function() {
if (typeof lucide !== 'undefined') lucide.createIcons();
var search = document.getElementById('groupSearch');
if (search) {
search.addEventListener('input', function() {
var q = this.value.toLowerCase();
var activeDisc = 'all';
function filterGroups() {
var q = (search ? search.value.toLowerCase() : '');
document.querySelectorAll('.group-radio-option').forEach(function(el) {
el.style.display = (!q || el.dataset.name.toLowerCase().indexOf(q) >= 0) ? '' : 'none';
});
var matchSearch = !q || el.dataset.name.toLowerCase().indexOf(q) >= 0;
var matchDisc = activeDisc === 'all' || el.dataset.discId === activeDisc;
el.style.display = (matchSearch && matchDisc) ? '' : 'none';
});
}
if (search) {
search.addEventListener('input', filterGroups);
}
document.querySelectorAll('.disc-tab').forEach(function(tab) {
tab.addEventListener('click', function() {
document.querySelectorAll('.disc-tab').forEach(function(t) {
t.style.background = '';
t.style.color = '';
});
this.style.background = '#0D7377';
this.style.color = '#fff';
activeDisc = this.dataset.disc;
filterGroups();
});
});
document.querySelectorAll('input[name="group_id"]').forEach(function(radio) {
radio.addEventListener('change', function() {
document.querySelectorAll('.group-radio-option').forEach(function(el) {
......
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تقييم اللاعبين — المدربين<?php $__template->endSection(); ?>
<?php $__template->section('title'); ?>تصنيف وتعيين اللاعبين<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card" style="margin-bottom:16px;">
<div style="padding:16px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;flex-wrap:wrap;">
<i data-lucide="clipboard-check" style="width:20px;height:20px;color:#0D7377;"></i>
<h3 style="margin:0;color:#0D7377;font-size:16px;">لاعبين في انتظار التقييم الفني</h3>
<h3 style="margin:0;color:#0D7377;font-size:16px;">لاعبين في انتظار التصنيف والتعيين</h3>
<span style="background:#FEF3C7;color:#92400E;padding:3px 10px;border-radius:12px;font-size:12px;font-weight:700;"><?= count($players) ?></span>
<form method="GET" style="margin-right:auto;display:flex;align-items:center;gap:8px;">
<select name="discipline_id" class="form-input" style="padding:6px 12px;font-size:13px;border-radius:8px;min-width:140px;" onchange="this.form.submit()">
......@@ -21,7 +21,7 @@
<?php if (empty($players)): ?>
<div style="padding:60px 24px;text-align:center;color:#6B7280;">
<i data-lucide="check-circle" style="width:48px;height:48px;color:#D1D5DB;display:block;margin:0 auto 15px;"></i>
<div style="font-size:15px;">لا يوجد لاعبين في انتظار التقييم</div>
<div style="font-size:15px;">لا يوجد لاعبين في انتظار التصنيف</div>
<div style="font-size:13px;margin-top:8px;">جميع اللاعبين المسجلين تم تعيينهم في مجموعات</div>
</div>
<?php else: ?>
......@@ -81,7 +81,7 @@
</td>
<td style="padding:12px 16px;text-align:center;">
<a href="/sa/coach-assessment/<?= (int) $p['registration_id'] ?>" class="btn btn-sm btn-primary" style="padding:8px 16px;font-size:13px;">
<i data-lucide="clipboard-check" style="width:14px;height:14px;vertical-align:middle;margin-left:4px;"></i> تقييم
<i data-lucide="clipboard-check" style="width:14px;height:14px;vertical-align:middle;margin-left:4px;"></i> تصنيف وتعيين
</a>
</td>
</tr>
......
......@@ -45,8 +45,8 @@ MenuRegistry::register('sports_activity', [
['label_ar' => 'إيجارات اللوكرات', 'label_en' => 'Locker Rentals', 'route' => '/sa/locker-rentals', 'permission' => 'sa.locker_rental.view','order' => 21],
['label_ar' => 'تذاكر السباحة', 'label_en' => 'Pool Tickets', 'route' => '/sa/pool-tickets', 'permission' => 'sa.pool_ticket.view', 'order' => 22],
['label_ar' => 'الألعاب الترفيهية','label_en' => 'Recreational Games','route' => '/sa/games', 'permission' => 'sa.game.view', 'order' => 23],
['label_ar' => '── تقييم المدربين ──','label_en' => '── Coach Assessment ──','route' => '#', 'permission' => 'sa.coach_assessment.view','order' => 25],
['label_ar' => قييم اللاعبين', 'label_en' => 'Player Assessment','route' => '/sa/coach-assessment','permission' => 'sa.coach_assessment.view','order' => 26],
['label_ar' => '── التصنيف والتعيين ──','label_en' => '── Classification ──','route' => '#', 'permission' => 'sa.coach_assessment.view','order' => 25],
['label_ar' => صنيف اللاعبين', 'label_en' => 'Classify Players','route' => '/sa/coach-assessment','permission' => 'sa.coach_assessment.view','order' => 26],
['label_ar' => '── السباحة ──', 'label_en' => '── Swimming ──', 'route' => '#', 'permission' => 'sa.swimming.dashboard','order' => 30],
['label_ar' => 'لوحة تحكم السباحة','label_en' => 'Swimming Dashboard','route' => '/sa/swimming', 'permission' => 'sa.swimming.dashboard','order' => 31],
['label_ar' => 'مدربين السباحة', 'label_en' => 'Swimming Coaches','route' => '/sa/swimming/coaches','permission' => 'sa.swimming.coach_manage','order' => 31.5],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment