{{-- ===================================================== Etebarit - by Gisoo Web Solutions ------------------------------------------------------ Gisoo.net ------------------------------------------------------ Copyright (c) 2026 Gisoo Web Solutions ===================================================== This code is protected by copyright ===================================================== File: explainer.blade.php ------------------------------------------------------ Use: A self-contained "how is my good-standing calculated" button + modal. Shows the base score, what each action adds or removes (from the single source of truth in the service), the level ladder, and -- when a breakdown is passed -- the user's own current numbers. ===================================================== --}} @props([ 'breakdown' => null, 'label' => null, // First-person copy ("your score") by default; admin screens pass false to // get third-person copy ("the user's score"). 'self' => true, ]) @php use App\Services\GoodStandingService; use App\Support\Format; use App\Support\GoodStanding; // Points per action, straight from the service constants, so the explainer // can never drift from the real formula. $rules = [ ['key' => 'early', 'points' => GoodStandingService::EARLY_POINTS], ['key' => 'on_time', 'points' => GoodStandingService::ON_TIME_POINTS], ['key' => 'late_paid', 'points' => GoodStandingService::LATE_POINTS], ['key' => 'overdue', 'points' => GoodStandingService::OVERDUE_POINTS], ['key' => 'overdue_days', 'points' => GoodStandingService::OVERDUE_PER_DAY_POINTS], ['key' => 'expired', 'points' => GoodStandingService::EXPIRED_POINTS], ]; $signed = static fn (int $n) => ($n > 0 ? '+' : ($n < 0 ? '−' : '')).Format::persianDigits((string) abs($n)); @endphp