@extends('agency.layouts.app') @section('title', 'Faturalar') @section('content') @php $dtColumns = [ ['key' => 'invoice_number', 'label' => 'Fatura No', 'sortable' => true, 'sort' => 'invoice_number'], ['key' => 'issue_date', 'label' => 'Tarih', 'sortable' => true, 'sort' => 'issue_date', 'width' => '105px'], ['key' => 'billing', 'label' => 'Muhatap'], ['key' => 'source', 'label' => 'Kaynak', 'width' => '120px'], ['key' => 'items', 'label' => 'Kalem', 'align' => 'center', 'width' => '70px', 'visible' => false], ['key' => 'amount', 'label' => 'Tutar', 'sortable' => true, 'sort' => 'amount', 'align' => 'end', 'width' => '130px'], ['key' => 'status', 'label' => 'Durum', 'sortable' => true, 'sort' => 'status', 'align' => 'center', 'width' => '100px'], ['key' => 'official', 'label' => 'Resmi Fatura', 'sortable' => true, 'sort' => 'official_status', 'align' => 'center', 'width' => '130px'], ['key' => '_actions', 'label' => '', 'fixed' => true, 'align' => 'end', 'width' => '190px'], ]; $dtFilters = [ ['key' => 'date_from', 'label' => 'Başlangıç', 'type' => 'date', 'value' => request('date_from')], ['key' => 'date_to', 'label' => 'Bitiş', 'type' => 'date', 'value' => request('date_to')], ['key' => 'status', 'label' => 'Durum', 'value' => request('status'), 'options' => \App\Models\Sale\SaleInvoice::STATUSES], ['key' => 'official_status', 'label' => 'Resmi Fatura', 'value' => request('official_status'), 'options' => \App\Models\Sale\SaleInvoice::OFFICIAL_STATUSES], ['key' => 'invoice_type', 'label' => 'Tür', 'value' => request('invoice_type'), 'options' => \App\Models\Sale\SaleInvoice::TYPES], ['key' => 'billing_type', 'label' => 'Muhatap', 'value' => request('billing_type'), 'options' => ['individual' => 'Şahıs', 'company' => 'Şirket']], ['key' => 'product_type', 'label' => 'Ürün Tipi', 'value' => request('product_type'), 'options' => $productTypes->pluck('name', 'id')->all()], ]; $dtStats = [ ['label' => 'Toplam Fatura', 'value' => number_format($stats['total'], 0, ',', '.'), 'icon' => 'fa-file-invoice', 'color' => '#059669'], ['label' => 'Bu Ay Kesilen', 'value' => number_format($stats['month_count'], 0, ',', '.'), 'icon' => 'fa-calendar-check', 'color' => '#2563eb'], ['label' => 'Kesilen Tutar (tüm birimler)', 'value' => number_format((float) $stats['issued_sum'], 2, ',', '.'), 'icon' => 'fa-coins', 'color' => '#0f766e'], ['label' => 'Resmi Fatura Bekleyen', 'value' => number_format($stats['official_pending'], 0, ',', '.'), 'icon' => 'fa-triangle-exclamation', 'color' => '#d97706'], ]; @endphp