@extends('admin/layouts/admin') @section('title', __('einvoicing.admin.dashboard.title')) @section('content') @php $statusClass = static fn (string $status) => match ($status) { 'delivered', 'accepted' => 'bg-green-100 text-green-800 dark:bg-green-800/30 dark:text-green-400', 'submitted', 'generated', 'closed' => 'bg-blue-100 text-blue-800 dark:bg-blue-800/30 dark:text-blue-400', 'pending', 'open' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-800/30 dark:text-yellow-400', 'failed', 'rejected' => 'bg-red-100 text-red-800 dark:bg-red-800/30 dark:text-red-400', default => 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300', }; $statusIcon = static fn (string $status) => match ($status) { 'delivered', 'accepted' => 'bi-check-circle-fill', 'failed', 'rejected' => 'bi-exclamation-circle-fill', 'submitted', 'generated', 'closed' => 'bi-send-check-fill', default => 'bi-clock-fill', }; @endphp
@include('admin/shared/alerts')

{{ __('einvoicing.admin.dashboard.title') }}

{{ __('einvoicing.admin.dashboard.description') }}

{{ __('einvoicing.admin.dashboard.settings') }}
@if (setting('einvoicing_provider', 'local') === 'local' || setting('einvoicing_b2g_provider', 'local') === 'local') @endif
@foreach ([ ['icon' => 'bi-diagram-3', 'label' => __('einvoicing.admin.dashboard.provider'), 'value' => strtoupper(setting('einvoicing_provider', 'local'))], ['icon' => 'bi-calendar3', 'label' => __('einvoicing.admin.dashboard.regime'), 'value' => __('einvoicing.settings.regimes.'.setting('einvoicing_vat_regime', 'real_normal_monthly'))], ['icon' => 'bi-globe2', 'label' => __('einvoicing.admin.dashboard.timezone'), 'value' => setting('einvoicing_timezone', 'Europe/Paris')], ['icon' => 'bi-power', 'label' => __('einvoicing.admin.dashboard.activation'), 'value' => setting('einvoicing_activation_date') ? \Carbon\Carbon::parse(setting('einvoicing_activation_date'))->isoFormat('LL') : __('einvoicing.admin.dashboard.disabled')], ] as $metric)

{{ $metric['label'] }}

{{ $metric['value'] }}

@endforeach
@foreach ([ ['key' => 'documents', 'items' => $documents, 'icon' => 'bi-files', 'columns' => 5], ['key' => 'periods', 'items' => $periods, 'icon' => 'bi-calendar-range', 'columns' => 5], ['key' => 'payments', 'items' => $payments, 'icon' => 'bi-cash-stack', 'columns' => 4], ] as $section)

{{ __('einvoicing.admin.dashboard.'.$section['key']) }}

{{ __('einvoicing.admin.dashboard.'.$section['key'].'_description') }}

{{ $section['items']->count() }}
@php $headings = $section['key'] === 'documents' ? ['document', 'provider_column', 'status', 'error', 'actions'] : ($section['key'] === 'periods' ? ['type', 'period', 'deadline', 'status', 'actions'] : ['invoice', 'type', 'amount', 'date']); @endphp @foreach ($headings as $heading)@endforeach @forelse ($section['items'] as $item) @if ($section['key'] === 'documents') @elseif ($section['key'] === 'periods') @else @endif @empty @endforelse
{{ __('einvoicing.admin.dashboard.'.$heading) }}
{{ optional($item->documentable)->identifier() ?: '—' }}

{{ $item->format }}

{{ $item->provider }} {{ __('einvoicing.document_statuses.'.$item->status) }} {{ $item->last_error_message ? \Illuminate\Support\Str::limit($item->last_error_message, 90) : __('einvoicing.admin.dashboard.no_error') }}
@csrf
@if($item->structured_document_path) @foreach(['pdf' => 'download_pdf', 'xml' => 'download_xml', 'manifest' => 'download_manifest'] as $file => $label){{ __('einvoicing.admin.dashboard.'.$label) }}@endforeach @endif
{{ __('einvoicing.report_types.'.$item->type) }} {{ $item->period_start->isoFormat('L') }} {{ $item->period_end->isoFormat('L') }} {{ $item->due_at->isoFormat('LLL') }} {{ __('einvoicing.document_statuses.'.$item->status) }}
@csrf
@if($item->artifact_path){{ __('einvoicing.admin.dashboard.download_xml') }}{{ __('einvoicing.admin.dashboard.download_manifest') }}@endif
{{ optional($item->invoice)->identifier() ?: '—' }} {{ __('einvoicing.payment_types.'.$item->type) }} {{ $item->type === 'refund' ? '−' : '' }}{{ formatted_price($item->amount, $item->currency) }} {{ $item->occurred_at->isoFormat('LLL') }}

{{ __('einvoicing.admin.dashboard.empty_'.$section['key']) }}

@if($section['key'] === 'documents' && $documents->hasPages())
{{ $documents->links('admin.shared.layouts.pagination') }}
@endif
@endforeach

{{ __('einvoicing.admin.dashboard.accounting_exports') }}

{{ __('einvoicing.admin.dashboard.accounting_exports_description') }}

{{ $accountingExports->count() }}
@foreach(['document', 'provider_column', 'event', 'status', 'external_id', 'error', 'actions'] as $heading)@endforeach @forelse($accountingExports as $export) @php $source = $export->exportable; $invoice = $source instanceof \App\Models\Billing\PaymentTransaction ? $source->invoice : ($source instanceof \App\Models\Billing\CreditNote ? $source->invoice : $source); @endphp @empty@endforelse
{{ __('einvoicing.admin.dashboard.'.$heading) }}
{{ method_exists($source, 'identifier') ? $source->identifier() : optional($invoice)->identifier() }} {{ $export->provider }}

{{ __('einvoicing.admin.dashboard.accounting_only') }}

{{ __('einvoicing.accounting_events.'.$export->event_type) }} {{ __('einvoicing.document_statuses.'.$export->status) }} {{ $export->external_id ?: '—' }} {{ $export->last_error_message ? \Illuminate\Support\Str::limit($export->last_error_message, 90) : '—' }}
@csrf

{{ __('einvoicing.admin.dashboard.empty_accounting_exports') }}

@endsection