{{-- resources/views/faktury/index.blade.php --}} @extends('layouts.app') @section('content')
{{-- Nagłówek --}}

Faktury

+ Nowa faktura
{{-- Komunikaty --}} @if (session('success'))
{{ session('success') }}
@endif @if (session('info'))
{{ session('info') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- Filtry --}}
Wyczyść
{{-- Tabela --}}
@forelse($faktury as $f) @php $isLocked = !($f->can_be_editable ?? true); $isDeleted = (bool)($f->usunieto ?? false); $statusBadge = $isDeleted ? ['label' => 'Usunięta', 'class' => 'badge bg-danger'] : ($isLocked ? ['label' => 'Zablokowana', 'class' => 'badge bg-secondary'] : ['label' => 'W edycji', 'class' => 'badge bg-success']); @endphp @php // Bezpieczne rzutowanie na bool (gdy aliasy z DB::raw albo PG) $isLocked = !((bool)($f->can_be_editable ?? true)); $isDeleted = (bool)($f->usunieto ?? false); $editDisabled = $isLocked || $isDeleted; @endphp {{-- STATUS --}} {{-- AKCJE --}} @empty @endforelse
# Numer (P_2) Data (P_1) Rodzaj Waluta Netto VAT Brutto (P_15) Pozycje Płatności Status Akcje
{{ $f->id_faktura }} {{ $f->p_2_numer }} {{ \Illuminate\Support\Carbon::parse($f->p_1_data_wystawienia)->format('Y-m-d') }} {{ $f->rodzaj_faktury }} {{ $f->kod_waluty }} {{ $f->suma_netto !== null ? number_format($f->suma_netto, 2, ',', ' ') : '—' }} {{ $f->suma_vat !== null ? number_format($f->suma_vat, 2, ',', ' ') : '—' }} {{ $f->p_15_brutto !== null ? number_format($f->p_15_brutto, 2, ',', ' ') : '—' }} {{ $f->pozycje_count ?? 0 }} {{ $f->platnosci_count ?? 0 }} {{ $statusBadge['label'] }}
Podgląd XML PDF {{-- ZABLOKUJ / ODBLOKUJ --}} @if(!$isDeleted && !$isLocked)
@csrf @method('PATCH')
@elseif(!$isDeleted && $isLocked)
@csrf @method('PATCH')
@endif @if(!$editDisabled) Edytuj @else @endif {{-- USUŃ / PRZYWRÓĆ (soft delete przez kolumnę usunieto) --}} @if(!$isDeleted)
@csrf @method('PATCH')
@else
@csrf @method('PATCH')
@endif
Brak faktur. Utwórz pierwszą →
{{-- Paginacja (Bootstrap 5) --}}
{{ $faktury->links('pagination::bootstrap-5') }}
@endsection