Commit f7c01e7d authored by Mahmoud Aglan's avatar Mahmoud Aglan

feat(sports): add card print button to player profile + medical board links

1. Player profile now shows a "طباعة الكارت" button (green) if the
   player has an active card, or "إنشاء الكارت" (outline) if they have
   a paid registration without a card yet. This provides a direct path
   to print/generate cards without re-entering the wizard.

2. Medical Board list (/medical-board) now has clickable player names
   that link to the player's profile (SA players → /sa/players/{id},
   membership players → /members/{id}).
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 271457f8
......@@ -48,7 +48,19 @@
<?php foreach ($records as $record): ?>
<tr>
<td>
<?php
$playerLink = null;
if (($record['source'] ?? 'membership') === 'sports_activity' && !empty($record['sa_player_id'])) {
$playerLink = '/sa/players/' . (int) $record['sa_player_id'];
} elseif (!empty($record['player_id'])) {
$playerLink = '/members/' . (int) $record['player_id'];
}
?>
<?php if ($playerLink): ?>
<a href="<?= $playerLink ?>" style="color:#1D4ED8;text-decoration:none;font-weight:700;"><?= e($record['player_name'] ?? '') ?></a>
<?php else: ?>
<strong><?= e($record['player_name'] ?? '') ?></strong>
<?php endif; ?>
<?php if (($record['source'] ?? 'membership') === 'sports_activity'): ?>
<span style="padding:2px 6px;border-radius:8px;font-size:10px;font-weight:600;background:#EFF6FF;color:#2563EB;margin-right:4px;">نشاط رياضي</span>
<?php endif; ?>
......
......@@ -301,6 +301,24 @@ class PlayerController extends Controller
[(int) $id]
);
$activeCard = $db->selectOne(
"SELECT id, card_number, status, valid_from, valid_until
FROM sa_player_cards
WHERE player_id = ? AND is_archived = 0
ORDER BY id DESC LIMIT 1",
[(int) $id]
);
$paidRegistration = null;
if (!$activeCard) {
$paidRegistration = $db->selectOne(
"SELECT id FROM sa_registrations
WHERE player_id = ? AND payment_status = 'paid' AND card_generated = 0
ORDER BY id DESC LIMIT 1",
[(int) $id]
);
}
return $this->view('SportsActivity.Views.players.show', [
'player' => $player,
'documents' => $documents,
......@@ -310,6 +328,8 @@ class PlayerController extends Controller
'enrolledGroups' => $enrolledGroups,
'recentBookings' => $recentBookings,
'gateHistory' => $gateHistory,
'activeCard' => $activeCard,
'paidRegistration' => $paidRegistration,
]);
}
......
......@@ -4,6 +4,11 @@ $__template->layout('Layout.main');
<?php $__template->section('title'); ?>بيانات اللاعب: <?= e($player['full_name_ar'] ?? '') ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
<?php if (!empty($activeCard) && can('sa.card.print')): ?>
<a href="/sa/cards/<?= (int) $activeCard['id'] ?>/print" target="_blank" class="btn btn-primary" style="background:#059669;border-color:#059669;"><i data-lucide="printer" style="width:16px;height:16px;vertical-align:middle;margin-left:4px;"></i> طباعة الكارت</a>
<?php elseif (!empty($paidRegistration) && can('sa.registration.manage')): ?>
<a href="/sa/registration/<?= (int) $paidRegistration['id'] ?>" class="btn btn-outline" style="color:#2563EB;border-color:#2563EB;"><i data-lucide="credit-card" style="width:16px;height:16px;vertical-align:middle;margin-left:4px;"></i> إنشاء الكارت</a>
<?php endif; ?>
<?php if (can('sa.player.manage')): ?>
<a href="/sa/players/<?= (int) $player['id'] ?>/edit" class="btn btn-primary"><i data-lucide="edit-3" style="width:16px;height:16px;vertical-align:middle;margin-left:4px;"></i> تعديل</a>
<?php endif; ?>
......
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