1. 10 Jun, 2026 1 commit
    • Mahmoud Aglan's avatar
      Fix membership fee calculations, subscription escalation, and over-25 children freeze · 0dd4abfc
      Mahmoud Aglan authored
      - TemporaryFeeCalculator: resolve current pricing_configs price instead of stored
        membership_value, matching SpouseFeeCalculator and ChildFeeCalculator behaviour
      - SubscriptionGenerator: add per-dependent dedup guards (spouse/child/temporary)
        to prevent duplicate subscription rows on repeated batch runs
      - Phase_89_001 migration: idempotent fix for subscription late-fine escalation rules
        (10/50/100/200/300% over 5 years, correct from the broken seed 100/200/300%)
      - Members show view: add warning banner listing active male children aged 25+ with
        direct freeze button, surfacing the existing freeze route that was never linked
      Co-Authored-By: 's avatarClaude Sonnet 4.6 <noreply@anthropic.com>
      0dd4abfc
  2. 08 Jun, 2026 1 commit
    • Mahmoud Aglan's avatar
      Fix children age display: compute dynamically from DOB, auto-separate at 25 · 110d7771
      Mahmoud Aglan authored
      - MemberController: SELECT TIMESTAMPDIFF for age_years/age_months in children query
      - children-table.php: compute age from DOB in view (fallback for static column)
      - show.php (member): same dynamic age + add 'separated' status translation
      - show.php (child): compute age from DOB dynamically, fix 25+ threshold check
      - AgeMonitorJob: add daily age recalculation for all children, change auto-freeze
        to auto-separate (status='separated', classification='separated')
      - AutoFreezeService: update processAutoFreeze() to separate instead of just freeze
      - DB fixes: corrected DOBs from NIDs, updated all ages, separated 3 children >= 25
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      110d7771
  3. 07 Jun, 2026 1 commit
    • Mahmoud Aglan's avatar
      Fix transfer fee calculation and remove dev fee from dependents · 7e3ac060
      Mahmoud Aglan authored
      - SeparationFeeCalculator: handle NULL qualification_id with fallback
        pricing lookup, use actual membership_type instead of hardcoded 'working'
      - SeparationFeeCalculator companion surcharge: use current pricing_configs
        instead of stale member.membership_value
      - SubscriptionGeneratorJob: set development_fee=0.00 for spouse/child/temp
        (matching SubscriptionGenerator service that was already fixed)
      - RetroactiveMembershipService: default dev fee to 0.00 for non-member types
      - RetroactiveWizardController: same default logic for missing form fields
      - Retroactive wizard JS: generate 0.00 dev fee for dependent subscriptions
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      7e3ac060
  4. 03 Jun, 2026 2 commits
    • Mahmoud Aglan's avatar
      Fix fee calculation: handle NULL qualification_id in pricing lookup · c8353344
      Mahmoud Aglan authored
      Members with qualification_id=NULL (old retroactive entries) were falling
      back to the stored membership_value (e.g. 119,800) instead of using the
      current pricing (150,000). Now when qualification is NULL, we look up the
      minimum price for that branch+type, which gives the correct base value.
      
      Also fixed 26 existing subscription records in live DB: removed dev fee
      (35.00) from spouse/child/temp subscriptions and recalculated totals.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      c8353344
    • Mahmoud Aglan's avatar
      Fix fee calculations: use current pricing, remove dev fee for dependents · 6873f19e
      Mahmoud Aglan authored
      Business rule fixes per ticket #68:
      
      1. Spouse/child fee percentages now use CURRENT membership value from
         pricing_configs (150k/225k/300k) instead of old stored value at creation
      
      2. Spouse annual subscription = 492 (SVC_ANNUAL_SPOUSE) WITHOUT dev fee
         Was incorrectly using child rate (222) + dev fee (35) = 257
      
      3. Child/temp annual subscription = 222 WITHOUT dev fee
         Was incorrectly adding 35 dev fee = 257
      
      4. Late marriage penalty: now calculated from LATER of (marriage_date,
         member_activated_at) to TODAY — not from marriage to member creation
      
      5. SubscriptionGenerator batch: spouse/child/temp subscriptions no longer
         include development_fee (set to 0.00). Only member keeps dev fee.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      6873f19e
  5. 01 Jun, 2026 3 commits
    • Mahmoud Aglan's avatar
      Overhaul coach create form: full validation, NID auto-parse, edge cases · e1f1837a
      Mahmoud Aglan authored
      Frontend:
      - Client-side NID parser (no API call) — extracts DOB, gender, age, governorate
      - Shows green badge with parsed info (governorate, gender, age)
      - Red highlight + Arabic message on every invalid field
      - Validates: code, name, employment_type, payment_model (non-academy),
        academy_id (academy), NID length, email format, phone format
      - Hides payment/rate fields for academy coaches (not needed)
      - Shows note explaining academy coaches follow salary system
      - Gender/DOB auto-locked when NID is valid, manual otherwise
      - Age displayed under DOB field
      
      Backend:
      - Strips non-digits from NID input
      - Uppercase code automatically
      - Checks NID uniqueness against existing coaches
      - Validates email with filter_var
      - Academy coach requires academy_id selected
      - payment_model defaults to 'salary' for academy, 'per_session' fallback
      - max_groups minimum 1
      - Success message includes coach name
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      e1f1837a
    • Mahmoud Aglan's avatar
      Migration: add updated_by/created_by to all 17 tables with autoTrackAuthor · 646d11e6
      Mahmoud Aglan authored
      Tables fixed (already applied to live DB directly):
      reservations, academy_settlements, achievement_definitions,
      activity_subscriptions, facility_grids, facility_monthly_plans,
      facility_zone_schedules, player_evaluations, player_injuries,
      pool_bookings, pool_configurations, pool_schedules,
      sa_player_documents, sa_pricing_rules, tournaments,
      training_groups, training_sessions
      
      Migration is idempotent — checks column existence before ALTER.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      646d11e6
    • Mahmoud Aglan's avatar
      Fix 2 boot failures: reservations.updated_by missing, sa_coaches.payment_model NULL · 299e67a6
      Mahmoud Aglan authored
      - reservations: added updated_by column (model has autoTrackAuthor=true but column didn't exist)
      - sa_coaches: academy coaches now default to payment_model='salary' instead of NULL (NOT NULL column)
      - Also applied column fix directly to live DB via SSH
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      299e67a6
  6. 31 May, 2026 5 commits
  7. 30 May, 2026 3 commits
    • Mahmoud Aglan's avatar
      Add seed: 32 bot players + test tournament for bracket testing · 56cb4395
      Mahmoud Aglan authored
      Run: php cli.php seed:run Phase_88_001_seed_tournament_bot_players
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      56cb4395
    • Mahmoud Aglan's avatar
      Fix retroactive wizard: parse NID for date_of_birth and gender · 0f4ca990
      Mahmoud Aglan authored
      The members table has date_of_birth as NOT NULL, but the wizard passed
      null when no explicit DOB was entered. Now NationalIdParser extracts
      DOB and gender from the 14-digit national ID for the main member,
      spouses, children, and temporary members.
      
      If no NID and no DOB provided, returns a clear validation error instead
      of letting the DB constraint violation propagate.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      0f4ca990
    • Mahmoud Aglan's avatar
      Fix 5 support ticket bugs: AJAX errors, capacity validation, audit export,... · 30062682
      Mahmoud Aglan authored
      Fix 5 support ticket bugs: AJAX errors, capacity validation, audit export, player lookup, fee display
      
      TKT-59: ExceptionHandler now returns JSON for AJAX/XHR requests instead of
      HTML error pages. Booking wizard JS improved to show actual error messages.
      
      TKT-57: Pricing rule creation now validates group_size_max against the
      facility unit's max_capacity, preventing over-capacity rules.
      
      TKT-46: Added audit log CSV export with all current filters applied.
      New route GET /audit/export and export button in the filter bar.
      
      TKT-55: Player registration member lookup now uses only the DB id
      (set by AJAX member lookup) instead of ambiguous membership_number/id
      fallback. National ID field locked when auto-filled from member record.
      
      TKT-50: Fee breakdown text now shows base amount and development fee
      separately (e.g. "اشتراك سنوي: 222.00 + تنمية: 35.00 = 257.00")
      instead of just the combined total.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      30062682
  8. 24 May, 2026 15 commits
  9. 23 May, 2026 9 commits