{{-- ===================================================== Etebarit - by Gisoo Web Solutions ------------------------------------------------------ Gisoo.net ------------------------------------------------------ Copyright (c) 2026 Gisoo Web Solutions ===================================================== This code is protected by copyright ===================================================== File: show.blade.php ------------------------------------------------------ Use: Organization detail: the info tab with the cap progress bar and installment stats, and the edit tab on the shared form. Bulk settlement arrives with the repayment milestone. ===================================================== --}} @extends('layouts.admin') @section('title', $organization->name.' - '.__('admin.organizations.title')) @section('breadcrumb') @endsection @section('page') @php $canManage = auth('admin')->user()->allowed('organizations.manage'); $usedPercent = $organization->credit_cap > 0 ? intdiv($organization->remainingCap() * 100, $organization->credit_cap) : 0; @endphp {{ __('admin.organizations.back_to_list') }}
{{-- ===== Header ===== --}}
@if ($organization->logo_path) {{ $organization->name }} @else @endif
{{ $organization->name }}
@fa($stats['users']) {{ __('admin.organizations.users_suffix') }}
$organization->status === \App\Models\Organization::STATUS_ACTIVE, 'bg-secondary-50 text-secondary-500' => $organization->status === \App\Models\Organization::STATUS_FULL, 'bg-[#f1f0f5] text-ink-muted' => $organization->status === \App\Models\Organization::STATUS_INACTIVE, ])> {{ __("admin.organizations.statuses.{$organization->status}") }}
{{-- ===== Tabs ===== --}}
@if ($canManage) @endif
{{-- ===== Info tab ===== --}}
{{ __('admin.organizations.cards.credit') }}
@toman($organization->remainingCap()) {{ __('admin.organizations.of') }} @toman($organization->credit_cap) {{ __('admin.toman') }}
{{ __('admin.organizations.cards.open_installments') }}
@fa($stats['open_count']) (@toman($stats['open_sum']) {{ __('admin.users.wallet.toman') }})
{{ __('admin.organizations.cards.penalties') }}
@fa($stats['penalty_count']) (@toman($stats['penalty_sum']) {{ __('admin.users.wallet.toman') }})
@php $canSettle = auth('admin')->user()->allowed('organizations.settle'); $selectable = $installments->reject(fn ($i) => $i->isPaid()); @endphp {{-- One Alpine scope around the whole section: the export button has to see the same selection the settle buttons do. --}}
{{ __('admin.organizations.installments_section') }} {{-- Status filter. The search term rides along so the two narrow the same list instead of resetting each other. --}}
{{-- Ticked rows win; with nothing ticked the workbook is the whole filtered, searched list. --}}
@csrf

{{ __('admin.organizations.installments_note') }}

@if ($installments->isEmpty())

{{ $search !== '' ? __('admin.organizations.no_installments_search') : __("admin.organizations.no_installments_filtered.{$filter}") }}

@else
@if ($canSettle) @endif @foreach ($installments as $installment) @if ($canSettle) @endif @endforeach
isEmpty()) class="size-4 accent-[#563bb1]" aria-label="{{ __('admin.organizations.select_all') }}"> {{ __('admin.organizations.inst_columns.user') }} {{ __('admin.organizations.inst_columns.code') }} {{ __('admin.organizations.inst_columns.sequence') }} {{ __('admin.organizations.inst_columns.due') }} {{ __('admin.organizations.inst_columns.amount') }} {{ __('admin.organizations.inst_columns.status') }}
@if (! $installment->isPaid()) @endif {{ $installment->creditRequest->user->fullName() }} {{ $installment->creditRequest->code }} @fa($installment->sequence) {{ __('admin.organizations.inst_of') }} @fa($installment->creditRequest->plan->months) @jalali($installment->due_at) @toman($installment->amount) {{ __('admin.users.wallet.toman') }} @if ($installment->penalty_amount > 0) + @toman($installment->penalty_amount) {{ __('admin.users.wallet.toman') }} @endif $installment->status === \App\Models\Installment::STATUS_UPCOMING, 'bg-[#fff5e6] text-amber-600' => $installment->status === \App\Models\Installment::STATUS_DUE, 'bg-secondary-50 text-secondary-500' => $installment->status === \App\Models\Installment::STATUS_OVERDUE, 'bg-[#e7f7ee] text-green-600' => $installment->status === \App\Models\Installment::STATUS_PAID, ])> {{ __("front.installments.statuses.{$installment->status}") }}
@if ($canSettle && $selectable->isNotEmpty()) {{-- Selection summary + bulk actions --}}
{{ __('admin.organizations.selected_count') }} {{ __('admin.organizations.selected_total') }} {{ __('admin.users.wallet.toman') }}
{{-- Hidden forms carrying the selection --}} {{-- Settlement modal: deposit warning + tracking code, confirm unlocks after a short delay. --}} @endif
@endif
{{-- ===== Edit tab ===== --}} @if ($canManage)
@include('admin.organizations._form', [ 'organization' => $organization, 'action' => route('admin.organizations.update', $organization), 'method' => 'PUT', 'submitLabel' => __('admin.organizations.save'), 'confirmMessage' => __('admin.organizations.confirm_save'), ])
@endif
@endsection