{{-- ===================================================== Etebarit - by Gisoo Web Solutions ------------------------------------------------------ Gisoo.net ------------------------------------------------------ Copyright (c) 2026 Gisoo Web Solutions ===================================================== This code is protected by copyright ===================================================== File: wallet.blade.php ------------------------------------------------------ Use: The shop wallet: sales earnings net of the merchant fee, the settlement flow to the merchant's own bank account, and the shop-wallet ledger. The switcher at the top keeps it distinct from the personal wallet. ===================================================== --}} @extends('layouts.merchant') @section('title', __('front.shop.wallet.title')) @php use App\Support\Format; @endphp @section('breadcrumb') @endsection @section('page') @php $settleStatusStyles = [ 'pending' => 'bg-[#fff5e6] text-amber-600', 'approved' => 'bg-[#eef0fb] text-primary-600', 'settled' => 'bg-[#e7f7ee] text-green-600', 'rejected' => 'bg-[#f1f0f5] text-ink-muted', ]; $hasAccounts = $bankAccounts->isNotEmpty(); $canRequest = $pendingSettlement === null && $hasAccounts && $walletBalance >= $settlementMinimum; $defaultAccount = optional($bankAccounts->firstWhere('is_default', true) ?? $bankAccounts->first())->id; @endphp

{{ __('front.shop.wallet.title') }}

{{ __('front.shop.wallet.subtitle') }}

{{-- The two wallets, side by side: this one is highlighted. --}} {{-- What this wallet is (and is not) --}}

{{ __('front.shop.wallet.explainer') }}

{{-- Balance + settlement action --}}
{{ __('front.shop.wallet.available') }}
@toman($walletBalance) {{ __('front.shop.toman') }}
@if ($canRequest) @endif
{{-- State / guidance --}}
{{ __('front.shop.wallet.settle_title') }}
@if ($pendingSettlement)
{{ __('front.shop.settlement.pending_note', ['amount' => Format::persianDigits(Format::tomanFa($pendingSettlement->amount))]) }}
@elseif (! $hasAccounts) {{ __('front.shop.settlement.no_account') }} @elseif ($walletBalance < $settlementMinimum)

{{ __('front.shop.settlement.below_minimum', ['min' => Format::persianDigits(Format::tomanFa($settlementMinimum))]) }}

@else

{{ __('front.shop.wallet.settle_hint') }}

@endif
{{-- Settlement history --}} @if ($settlements->isNotEmpty())

{{ __('front.shop.wallet.settlements_title') }}

@foreach ($settlements as $settlement) @endforeach
{{ __('front.shop.settlement.code') }} {{ __('front.shop.settlement.amount') }} {{ __('front.shop.settlement.destination') }} {{ __('front.shop.settlement.status') }} {{ __('front.shop.settlement.date') }}
{{ $settlement->code }} @toman($settlement->amount) {{ __('front.shop.toman') }} {{ $settlement->bankAccount?->maskedCard() ?? '—' }} status] ?? 'bg-[#f1f0f5] text-ink-muted'])>{{ __('front.shop.settlement.statuses.'.$settlement->status) }} @jalaliDateTime($settlement->created_at)
@endif {{-- Shop wallet ledger --}}

{{ __('front.shop.wallet.ledger_title') }}

{{ __('front.shop.wallet.ledger_hint') }}

@forelse ($entries as $entry) @php $credit = $entry->isCredit(); @endphp
! $loop->first])>
{{ $entry->reasonLabel('front.shop.wallet.reasons') }}
@if ($entry->transaction?->order){{ $entry->transaction->order->code }} • @endif{{ \App\Support\Format::jalaliDateTimeFa($entry->created_at) }}
$credit, 'text-secondary-500' => ! $credit])>{{ $credit ? '+ ' : '− ' }}@toman($entry->amount) {{ __('front.shop.toman') }}
@empty

{{ __('front.shop.wallet.ledger_empty') }}

@endforelse
@if ($entries->hasPages())
{{ $entries->links() }}
@endif
{{-- Settlement request modal. Same layout as the personal-wallet withdrawal modal (icon header, amount + max, radio-list of destinations), only in the shop's secondary red. --}} @if ($canRequest) @php $settleAccounts = $bankAccounts->map(fn ($account) => [ 'id' => $account->id, 'bank' => $account->bankName(), 'card' => Format::persianDigits($account->maskedCard()), 'isDefault' => (bool) $account->is_default, ])->values(); @endphp
@endif @endsection