{{-- resources/views/cases/show.blade.php --}} @extends('layouts.app') @section('title', 'Дело №' . $case->case_number) @php $debtSummary = $case->getDebtSummary(); if ($case->status === 'active') { $statusClass = 'success'; $statusText = 'Активное'; } elseif ($case->status === 'suspended') { $statusClass = 'warning'; $statusText = 'Приостановлено'; } elseif ($case->status === 'closed') { $statusClass = 'danger'; $statusText = 'Закрыто'; } else { $statusClass = 'info'; $statusText = $case->status; } $hasActiveDocument = isset($debtSummary['has_active_debt']) && $debtSummary['has_active_debt']; $activeDocument = isset($debtSummary['active_document']) ? $debtSummary['active_document'] : null; $principal = isset($debtSummary['principal']) ? $debtSummary['principal'] : 0; $penalty = isset($debtSummary['penalty']) ? $debtSummary['penalty'] : 0; $courtCosts = isset($debtSummary['court_costs']) ? $debtSummary['court_costs'] : 0; $total = isset($debtSummary['total']) ? $debtSummary['total'] : 0; $remainingPrincipal = isset($debtSummary['remaining_principal']) ? $debtSummary['remaining_principal'] : 0; $remainingPenalty = isset($debtSummary['remaining_penalty']) ? $debtSummary['remaining_penalty'] : 0; $remainingCourtCosts = isset($debtSummary['remaining_court_costs']) ? $debtSummary['remaining_court_costs'] : 0; $totalRemaining = isset($debtSummary['total_remaining']) ? $debtSummary['total_remaining'] : 0; $totalPaid = isset($debtSummary['total_paid']) ? $debtSummary['total_paid'] : 0; $allDocuments = $case->documents; $allPayments = $case->payments; $allActions = $case->actions; $timeline = collect(); foreach ($allDocuments as $doc) { $timeline->push([ 'type' => 'document', 'data' => $doc, 'sort_date' => $doc->document_date ? $doc->document_date->format('Y-m-d H:i:s') : '0000-00-00 00:00:00', ]); } foreach ($allPayments as $pay) { $timeline->push([ 'type' => 'payment', 'data' => $pay, 'sort_date' => $pay->payment_date ? $pay->payment_date->format('Y-m-d H:i:s') : '0000-00-00 00:00:00', ]); } $timeline = $timeline->sortBy('sort_date')->values(); @endphp @section('content') @if($case->description)

{{ $case->description }}

@endif

Должники

@forelse($case->individualDebtors as $debtor) {{ $debtor->full_name }} @if($debtor->pivot->is_main_debtor) Основной @endif
Долг: {{ number_format($debtor->pivot->debt_amount, 2, ',', ' ') }} ₽
@empty @endforelse @forelse($case->legalDebtors as $debtor) {{ $debtor->short_name ?? $debtor->full_name }} @if($debtor->pivot->is_main_debtor) Основной @endif
Долг: {{ number_format($debtor->pivot->debt_amount, 2, ',', ' ') }} ₽
@empty @endforelse @if($case->individualDebtors->isEmpty() && $case->legalDebtors->isEmpty())
Нет должников
@endif

Объекты

@forelse($case->objects as $object) {{ Str::limit($object->address, 60) }} @empty
Нет объектов
@endforelse

Информация

Создано: {{ $case->created_at->format('d.m.Y H:i') }}
Обновлено: {{ $case->updated_at->format('d.m.Y H:i') }}
@csrf
Редактировать дело

Текущая задолженность

@if($hasActiveDocument && $activeDocument)
{{ $activeDocument->document_type }} @if($activeDocument->document_date) от {{ $activeDocument->document_date->format('d.m.Y') }} @endif Платежи с {{ $activeDocument->document_date->format('d.m.Y') }}
@else Выберите документ для расчета @endif
Основной долг
{{ number_format($remainingPrincipal, 2, ',', ' ') }} ₽
Начислено: {{ number_format($principal, 2, ',', ' ') }} ₽
@if($principal > 0) @php $paidPrincipalPercent = round(($principal - $remainingPrincipal) / $principal * 100); @endphp
Погашено: {{ $paidPrincipalPercent }}% @endif
Пени
{{ number_format($remainingPenalty, 2, ',', ' ') }} ₽
Начислено: {{ number_format($penalty, 2, ',', ' ') }} ₽
@if($penalty > 0) @php $paidPenaltyPercent = round(($penalty - $remainingPenalty) / $penalty * 100); @endphp
Погашено: {{ $paidPenaltyPercent }}% @endif
Судебные расходы
{{ number_format($remainingCourtCosts, 2, ',', ' ') }} ₽
Начислено: {{ number_format($courtCosts, 2, ',', ' ') }} ₽
@if($courtCosts > 0) @php $paidCostsPercent = round(($courtCosts - $remainingCourtCosts) / $courtCosts * 100); @endphp
Погашено: {{ $paidCostsPercent }}% @endif
@if($total > 0)
Общая сумма:{{ number_format($total, 2, ',', ' ') }} ₽
Погашено:{{ number_format($totalPaid, 2, ',', ' ') }} ₽
Остаток:{{ number_format($totalRemaining, 2, ',', ' ') }} ₽
@php $totalPaidPercent = $total > 0 ? round($totalPaid / $total * 100) : 0; @endphp
Общий прогресс: {{ $totalPaidPercent }}%
@endif
@if($timeline->isNotEmpty())
@foreach($timeline as $item)
{{ $item['sort_date'] ? date('d.m.Y', strtotime($item['sort_date'])) : '-' }} @if($item['type'] === 'document') Док {{ $item['data']->document_type }} @if($item['data']->document_number) №{{ $item['data']->document_number }} @endif @if($item['data']->total_amount > 0) @if($item['data']->debt_amount > 0)Долг: {{ number_format($item['data']->debt_amount, 0, ',', ' ') }} ₽@endif @if($item['data']->penalty_amount > 0)Пени: {{ number_format($item['data']->penalty_amount, 0, ',', ' ') }} ₽@endif @if($item['data']->court_costs > 0)Изд: {{ number_format($item['data']->court_costs, 0, ',', ' ') }} ₽@endif @endif @if($item['data']->is_active_debt) Актуальный @endif @if($item['data']->scan_file) @endif @else Платеж +{{ number_format($item['data']->amount, 2, ',', ' ') }} ₽ ({{ $item['data']->payment_type_name }}) @if($item['data']->payer_name) | от {{ $item['data']->payer_name }} @endif @if($item['data']->basisDocument) | по {{ Str::limit($item['data']->basisDocument->document_type, 20) }} @endif @php $alloc = $item['data']->allocation; $allocTotal = $alloc ? ($alloc->principal_portion + $alloc->penalty_portion + $alloc->court_cost_portion) : 0; $notAllocated = $item['data']->amount - $allocTotal; @endphp @if($alloc && $allocTotal > 0) @if($alloc->principal_portion > 0)Д: {{ number_format($alloc->principal_portion, 0, ',', ' ') }}@endif @if($alloc->penalty_portion > 0)П: {{ number_format($alloc->penalty_portion, 0, ',', ' ') }}@endif @if($alloc->court_cost_portion > 0)И: {{ number_format($alloc->court_cost_portion, 0, ',', ' ') }}@endif @else Не распред. @endif @if($notAllocated > 0.01) !{{ number_format($notAllocated, 0, ',', ' ') }} ₽ @endif @endif
@endforeach
@else

Нет событий

@endif
@include('cases.partials.add-document-modal') @include('cases.partials.add-payment-modal') @include('cases.partials.add-action-modal') @include('cases.partials.allocate-payment-modal') @push('scripts') @endpush @endsection