{{-- ===================================================== Etebarit - by Gisoo Web Solutions ------------------------------------------------------ Gisoo.net ------------------------------------------------------ Copyright (c) 2026 Gisoo Web Solutions ===================================================== This code is protected by copyright ===================================================== File: dashboard.blade.php ------------------------------------------------------ Use: The user panel landing: the virtual card, available credit and cash, the next few installments and the latest transactions. An order is only ever named by its id and shop -- never by what was bought. ===================================================== --}} @extends('layouts.user') @section('title', __('front.panel.dashboard')) @php use App\Support\Format; @endphp @section('page')

{{ __('front.dashboard.greeting', ['name' => auth()->user()->first_name]) }}

{{-- ===== Card (right) + balances 1,2 (middle) + good-standing 3 (left) ===== --}} @php $showSlider = ! $hasCommitment && $suggestedPlans->isNotEmpty(); @endphp
{{-- Right column: card (1), available credit (2), cash (3) stacked --}}
{{-- Virtual credit card --}}
{{ __('front.dashboard.card_title') }}
@if ($card) {{-- Chip on its own line. --}} {{-- Number on the left, copy button to its right. --}}
{{ Format::persianDigits($card->formattedNumber()) }}
{{-- Holder, expiry, CVV2 (values right-aligned; digit order kept LTR) --}}
{{ __('front.dashboard.card_holder') }}
{{ auth()->user()->fullName() }}
{{ __('front.dashboard.card_expiry') }}
@jalali($card->expires_at, 'Y/m')
{{ __('front.dashboard.card_cvv2') }}
{{ Format::persianDigits((string) $card->cvv2) }}
@else

{{ __('front.dashboard.card_none') }}

@endif
{{-- Physical-card services need the PIN; nudge until it is on. --}} @if (! auth()->user()->hasPin()) {{ __('front.settings.pin.card_note') }} @endif {{-- Available credit (2) --}}
{{ __('front.dashboard.available_credit') }}
@toman($available) {{ __('front.dashboard.toman') }}
{{ __('front.dashboard.of_ceiling', ['percent' => Format::persianDigits((string) $percent)]) }}
{{-- Cash balance --}}
{{ __('front.dashboard.cash_balance') }}
@toman($cash) {{ __('front.dashboard.toman') }}
{{-- ===== Good-standing (box 3, left column) ===== --}}
{{-- Status: the meter, score and how to grow. --}}
{{ __('front.standing.box_title') }}
{{ __('front.standing.box_sub') }}
{{ Format::persianDigits((string) $standing['score']) }} / {{ Format::persianDigits((string) \App\Support\GoodStanding::MAX_SCORE) }}
@if (! $hasCommitment) @if ($unlock)

{{ __('front.standing.unlock_hint', [ 'points' => Format::persianDigits((string) $unlock['points_needed']), 'level' => $unlock['next_label'], ]) }}

@endif @unless ($showSlider)

{{ __('front.standing.no_suggestions') }}

@endunless @elseif ($commitment) {{-- Active commitment: a compact snapshot of the live plan --}} @php $paidPercent = $commitment['total'] > 0 ? (int) round($commitment['paid'] / $commitment['total'] * 100) : 0; @endphp
{{ $commitment['plan_name'] }}
{{ $commitment['code'] }}
@toman($commitment['amount']) {{ __('front.dashboard.toman') }} {{ Format::persianDigits((string) $commitment['months']) }} {{ __('front.standing.months_word') }}
{{ __('front.standing.view_installments') }}
{{-- Paid progress --}}
{{ __('front.standing.commitment_progress', ['paid' => Format::persianDigits((string) $commitment['paid']), 'total' => Format::persianDigits((string) $commitment['total'])]) }} {{ Format::persianDigits((string) $paidPercent) }}٪
{{-- Installment tally by state --}}
@foreach ([ ['n' => $commitment['paid'], 'label' => __('front.standing.commitment_st_paid'), 'cls' => 'bg-[#e7f7ee] text-green-600'], ['n' => $commitment['upcoming'], 'label' => __('front.standing.commitment_st_upcoming'), 'cls' => 'bg-[#f2f0fa] text-primary-600'], ['n' => $commitment['due'], 'label' => __('front.standing.commitment_st_due'), 'cls' => 'bg-[#fff5e6] text-amber-600'], ['n' => $commitment['overdue'], 'label' => __('front.standing.commitment_st_overdue'), 'cls' => 'bg-secondary-50 text-secondary-500'], ] as $chip)
{{ Format::persianDigits((string) $chip['n']) }}
{{ $chip['label'] }}
@endforeach
{{-- Good-standing reward still on the table --}}

@if ($commitment['unpaid'] > 0) {{ __('front.standing.commitment_points', ['points' => Format::persianDigits((string) $commitment['earnable_points'])]) }} @else {{ __('front.standing.commitment_points_done') }} @endif

@else {{-- A request still under review: a plain link is enough. --}} {{ __('front.standing.has_active') }} @endif
{{-- Suggestions column: single-item slider, mouse + touch drag, no wrap, no autoplay -- the same engine as the home plans slider. --}} @if ($showSlider)
{{ __('front.standing.suggested_title') }}
@foreach ($suggestedPlans as $plan)
{{ $plan->name }}
{{ Format::persianDigits((string) $plan->months) }} {{ __('front.standing.months_word') }}
{{ __('front.standing.eligible') }}
{{-- Full plan details --}}
{{ __('front.standing.detail_amount') }}
@toman($plan->min_amount)@toman($plan->max_amount)
{{ __('front.standing.detail_fee') }}
{{ Format::persianDigits(Format::percentFromBp($plan->fee_percent)) }}٪
{{ __('front.standing.detail_penalty') }}
{{ Format::persianDigits(Format::percentFromBp($plan->penalty_percent)) }}٪
{{ __('front.standing.detail_grace') }}
{{ $plan->grace_days > 0 ? Format::persianDigits((string) $plan->grace_days).' '.__('front.standing.days_word') : __('front.standing.no_grace') }}
@php $planCols = array_values(array_filter($plan->collaterals ?? [])); @endphp @if (! empty($planCols))
{{ __('front.standing.detail_collaterals') }}
@foreach ($planCols as $c) {{ __('front.credit.collaterals.'.$c) }} @endforeach
@endif {{ __('front.standing.request_plan') }}
@endforeach
{{-- Controls: no-wrap, disabled at the ends (like the home slider) --}}
@endif
{{-- ===== Merchant panel (only for a merchant with a live shop) ===== --}} @if ($shop)
{{ __('front.dashboard.shop.title') }} {{ __('front.dashboard.shop.active') }}
{{-- Identity --}}
@if ($shop->logo_path) {{ $shop->name }} @else @endif
{{ $shop->name }}
{{ $shop->slug }}
{{-- Mini stats: full-width and 50/50 on mobile, inline on desktop --}}
{{ __('front.dashboard.shop.wallet') }}
@toman($shopStats['wallet'])
{{ __('front.dashboard.shop.monthly_sales') }}
@toman($shopStats['monthly_sales'])
{{-- Actions: full-width and split on mobile, inline on desktop --}}
@if ($shopStats['pending_settlement'])
{{ __('front.dashboard.shop.pending_settlement', ['amount' => \App\Support\Format::persianDigits(\App\Support\Format::tomanFa($shopStats['pending_settlement']->amount))]) }}
@endif
@endif {{-- ===== Quick actions ===== --}} @php $actions = [ ['label' => __('front.dashboard.quick.credit'), 'url' => route('account.credit.form'), 'bg' => 'bg-[#efeafb] text-primary-600', 'icon' => ''], ['label' => __('front.dashboard.quick.pay_installment'), 'url' => route('account.installments'), 'bg' => 'bg-[#fff5e6] text-amber-600', 'icon' => ''], ['label' => __('front.dashboard.quick.topup'), 'url' => route('account.wallet'), 'bg' => 'bg-[#e7f7ee] text-green-600', 'icon' => ''], ['label' => __('front.dashboard.quick.orders'), 'url' => route('account.orders'), 'bg' => 'bg-[#eaf3fe] text-[#2563eb]', 'icon' => ''], ['label' => __('front.dashboard.quick.physical_card'), 'url' => route('account.physical-card'), 'bg' => 'bg-[#e7f7ee] text-green-600', 'icon' => ''], ]; @endphp
@foreach ($actions as $action) {!! $action['icon'] !!} {{ $action['label'] }} @endforeach
{{-- ===== Upcoming installments + recent transactions ===== --}}
{{-- Upcoming installments --}}
{{ __('front.dashboard.upcoming_title') }}
{{ __('front.dashboard.view_all') }}
@forelse ($upcoming as $installment) @php $overdue = $installment->status === \App\Models\Installment::STATUS_OVERDUE; $due = $installment->due_at->copy()->startOfDay(); $days = (int) \Illuminate\Support\Carbon::now()->startOfDay()->diffInDays($due, false); $when = $overdue || $days < 0 ? __('front.dashboard.overdue') : ($days === 0 ? __('front.dashboard.due_today') : __('front.dashboard.due_in', ['days' => Format::persianDigits((string) $days)])); @endphp
$overdue, 'border-line' => ! $overdue, ])> $overdue, 'bg-[#f2f0fa] text-primary-600' => ! $overdue, ])> {{ Format::persianDigits(Format::jalali($installment->due_at, 'j')) }} {{ Format::jalali($installment->due_at, 'F') }}
{{ $installment->creditRequest->plan->name }} {{ $installment->creditRequest->code }}
$overdue, 'text-ink-faint' => ! $overdue])>{{ $when }}
@toman($installment->amount) {{ __('front.dashboard.toman') }}
@if ($installment->payableByUser()) {{ __('front.installments.pay') }} @else {{ __("front.installments.statuses.{$installment->status}") }} @endif
@empty

{{ __('front.dashboard.no_upcoming') }}

@endforelse
{{-- Recent transactions --}}
{{ __('front.dashboard.recent_title') }}
{{ __('front.dashboard.view_all') }}
@forelse ($recent as $transaction) @php $incoming = $transaction->isIncoming(); @endphp
! $loop->first])> $incoming, 'bg-[#efeafb] text-primary-600' => ! $incoming, ])> @if ($incoming) {{-- Money in: a down-left arrow into the wallet. --}} @else {{-- Money out: an up-right arrow out of the wallet. --}} @endif
{{ $transaction->describe('front.transactions.order_description', 'front.credit.reasons') }}
@jalali($transaction->created_at) • {{ __("front.transactions.types.{$transaction->type}") }}
$incoming, 'text-secondary-500' => ! $incoming]) dir="ltr">{{ $incoming ? '+ ' : '− ' }}@toman($transaction->amount)
@empty

{{ __('front.dashboard.no_recent') }}

@endforelse
@endsection