Commit 71a7ff4e authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(sports): registration wizard member detection + cashier queue visibility

- Members pay 50 EGP, non-members pay 100 EGP (was flat 100 for all)
- If membership_number found in DB, player_type='member' regardless of
  annual subscription status
- Add 'sa_registration_fee' to SUB_SA treasury whitelist so cashier sees it
- Add sa_registration_fee to member-not-required whitelist in PaymentRequestService
- Add Arabic label for sa_registration_fee type
- Wizard view shows dynamic fee from registration data instead of hardcoded 100
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent a6123dbb
...@@ -24,7 +24,7 @@ final class PaymentRequestService ...@@ -24,7 +24,7 @@ final class PaymentRequestService
$notes = $data['notes'] ?? null; $notes = $data['notes'] ?? null;
$currency = $data['currency'] ?? 'EGP'; $currency = $data['currency'] ?? 'EGP';
if ($memberId <= 0 && !in_array($paymentType, ['sports_registration', 'hourly_booking', 'sa_form_fee', 'sa_subscription', 'sports_subscription', 'activity_subscription'], true)) { if ($memberId <= 0 && !in_array($paymentType, ['sports_registration', 'hourly_booking', 'sa_form_fee', 'sa_subscription', 'sports_subscription', 'activity_subscription', 'sa_registration_fee'], true)) {
return ['success' => false, 'error' => 'العضو مطلوب']; return ['success' => false, 'error' => 'العضو مطلوب'];
} }
if ($paymentType === '') { if ($paymentType === '') {
...@@ -344,6 +344,7 @@ final class PaymentRequestService ...@@ -344,6 +344,7 @@ final class PaymentRequestService
'fine' => 'غرامة', 'fine' => 'غرامة',
'carnet_replacement' => 'بدل فاقد كارنيه', 'carnet_replacement' => 'بدل فاقد كارنيه',
'sports_registration' => 'تسجيل رياضي', 'sports_registration' => 'تسجيل رياضي',
'sa_registration_fee' => 'رسوم تسجيل نشاط رياضي',
'activity_subscription' => 'اشتراك نشاط', 'activity_subscription' => 'اشتراك نشاط',
'seasonal_fee' => 'رسوم عضوية موسمية', 'seasonal_fee' => 'رسوم عضوية موسمية',
'foreign_membership_fee' => 'رسوم عضوية أجنبية', 'foreign_membership_fee' => 'رسوم عضوية أجنبية',
......
...@@ -61,9 +61,9 @@ class RegistrationWizardController extends Controller ...@@ -61,9 +61,9 @@ class RegistrationWizardController extends Controller
} }
if ($membership) { if ($membership) {
$playerType = $membership['effective_type'];
$membershipReason = $membership['reason']; $membershipReason = $membership['reason'];
if ($membership['found'] && $membership['member']) { if ($membership['found'] && $membership['member']) {
$playerType = 'member';
$memberId = (int) $membership['member_id']; $memberId = (int) $membership['member_id'];
$m = $membership['member']; $m = $membership['member'];
$fullNameAr = $fullNameAr ?: ($m['full_name_ar'] ?? ''); $fullNameAr = $fullNameAr ?: ($m['full_name_ar'] ?? '');
...@@ -73,6 +73,8 @@ class RegistrationWizardController extends Controller ...@@ -73,6 +73,8 @@ class RegistrationWizardController extends Controller
if ($nationalId !== '' && strlen($nationalId) === 14 && !$nidParsed) { if ($nationalId !== '' && strlen($nationalId) === 14 && !$nidParsed) {
$nidParsed = NationalIdParser::parse($nationalId); $nidParsed = NationalIdParser::parse($nationalId);
} }
} else {
$playerType = 'non_member';
} }
} }
......
...@@ -280,11 +280,12 @@ final class RegistrationWizardService ...@@ -280,11 +280,12 @@ final class RegistrationWizardService
public static function calculateFees(string $playerType): array public static function calculateFees(string $playerType): array
{ {
$fee = $playerType === 'member' ? 50.0 : 100.0;
return [ return [
'registration_fee' => 100.0, 'registration_fee' => $fee,
'card_fee' => 0.0, 'card_fee' => 0.0,
'form_fee' => 0.0, 'form_fee' => 0.0,
'total_fees' => 100.0, 'total_fees' => $fee,
]; ];
} }
...@@ -309,11 +310,11 @@ final class RegistrationWizardService ...@@ -309,11 +310,11 @@ final class RegistrationWizardService
$totalFee = (float) $registration['total_fees']; $totalFee = (float) $registration['total_fees'];
if ($totalFee <= 0) { if ($totalFee <= 0) {
$totalFee = 100.0; $totalFee = $registration['player_type'] === 'member' ? 50.0 : 100.0;
} }
$memberId = (int) ($registration['member_id'] ?? 0); $memberId = (int) ($registration['member_id'] ?? 0);
$description = 'رسوم تسجيل نشاط رياضي (100 ج.م) — ' . ($registration['full_name_ar'] ?? ''); $description = 'رسوم تسجيل نشاط رياضي (' . (int) $totalFee . ' ج.م) — ' . ($registration['full_name_ar'] ?? '');
$result = PaymentRequestService::createRequest([ $result = PaymentRequestService::createRequest([
'member_id' => $memberId, 'member_id' => $memberId,
......
...@@ -73,8 +73,8 @@ ...@@ -73,8 +73,8 @@
</div> </div>
<p style="font-size:15px;color:#374151;margin:0 0 8px;font-weight:600;">رسوم تسجيل النشاط الرياضي</p> <p style="font-size:15px;color:#374151;margin:0 0 8px;font-weight:600;">رسوم تسجيل النشاط الرياضي</p>
<p style="font-size:13px;color:#6B7280;margin:0 0 20px;">مبلغ شامل يغطي الاستمارة والكارت — بدون أي رسوم إضافية</p> <p style="font-size:13px;color:#6B7280;margin:0 0 20px;">مبلغ شامل يغطي الاستمارة والكارت — بدون أي رسوم إضافية</p>
<div style="font-size:42px;font-weight:800;color:#2563EB;margin-bottom:8px;">100 <span style="font-size:18px;">ج.م</span></div> <div style="font-size:42px;font-weight:800;color:#2563EB;margin-bottom:8px;"><?= (int) $registration['total_fees'] ?> <span style="font-size:18px;">ج.م</span></div>
<div style="font-size:12px;color:#6B7280;margin-bottom:24px;">مبلغ ثابت لكل شخص</div> <div style="font-size:12px;color:#6B7280;margin-bottom:24px;"><?= $registration['player_type'] === 'member' ? 'أعضاء النادي' : 'غير أعضاء' ?></div>
<?php if (($registration['form_payment_status'] ?? 'unpaid') === 'pending'): ?> <?php if (($registration['form_payment_status'] ?? 'unpaid') === 'pending'): ?>
<div style="padding:16px;background:#FEF3C7;border-radius:10px;"> <div style="padding:16px;background:#FEF3C7;border-radius:10px;">
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</div> </div>
<?php else: ?> <?php else: ?>
<button type="button" id="btnPayForm" class="btn btn-primary" style="width:100%;padding:16px;font-size:16px;font-weight:700;border-radius:12px;min-height:56px;"> <button type="button" id="btnPayForm" class="btn btn-primary" style="width:100%;padding:16px;font-size:16px;font-weight:700;border-radius:12px;min-height:56px;">
<i data-lucide="banknote" style="width:20px;height:20px;vertical-align:middle;margin-left:6px;"></i> إرسال للخزينة — 100 ج.م <i data-lucide="banknote" style="width:20px;height:20px;vertical-align:middle;margin-left:6px;"></i> إرسال للخزينة — <?= (int) $registration['total_fees'] ?> ج.م
</button> </button>
<?php endif; ?> <?php endif; ?>
</div> </div>
...@@ -419,7 +419,7 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -419,7 +419,7 @@ document.addEventListener('DOMContentLoaded', function() {
} else { } else {
alert(data.error || 'حدث خطأ'); alert(data.error || 'حدث خطأ');
btnPayForm.disabled = false; btnPayForm.disabled = false;
btnPayForm.textContent = 'إرسال للخزينة — 100 ج.م'; btnPayForm.textContent = 'إرسال للخزينة — <?= (int) $registration['total_fees'] ?> ج.م';
} }
}); });
}); });
......
...@@ -177,7 +177,7 @@ final class TreasuryService ...@@ -177,7 +177,7 @@ final class TreasuryService
} }
if ($treasury['code'] === 'SUB_SA') { if ($treasury['code'] === 'SUB_SA') {
$where .= " AND pr.payment_type IN ('activity_subscription','hourly_booking','sports_registration','sa_form_fee','sa_subscription','sports_subscription')"; $where .= " AND pr.payment_type IN ('activity_subscription','hourly_booking','sports_registration','sa_form_fee','sa_subscription','sports_subscription','sa_registration_fee')";
} elseif ($treasury['code'] === 'SUB_MEM') { } elseif ($treasury['code'] === 'SUB_MEM') {
$where .= " AND pr.payment_type IN ('form_fee','membership_fee','down_payment','addition_fee','annual_subscription','divorce_fee','death_fee','waiver_fee','separation_fee','fine','carnet_replacement','seasonal_fee','foreign_membership_fee','sports_membership_fee')"; $where .= " AND pr.payment_type IN ('form_fee','membership_fee','down_payment','addition_fee','annual_subscription','divorce_fee','death_fee','waiver_fee','separation_fee','fine','carnet_replacement','seasonal_fee','foreign_membership_fee','sports_membership_fee')";
} }
......
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