Files
project/resources/views/dashboard.blade.php

81 lines
4.3 KiB
PHP

@php
$customers = \App\Models\Customer::doesntHave('address')->get();
$created_invoices = \App\Models\Invoice::where('status', '=', 'created')->orderBy('created_at')->get();
$sent_invoices = \App\Models\Invoice::where('status', '=', 'sent')->orderBy('created_at')->get();
$unpaid_incoming = \App\Models\Incoming::where('pay_date', '=', null)->orderBy('due_date')->get();
@endphp
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('dashboard.Dashboard') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 grid grid-cols-3 gap-4">
<!-- Invoices not paid -->
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg col-span-2">
<div class="p-6 text-gray-900 dark:text-gray-100">
<h2 class="mb-4 text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('dashboard.Invoices not paid') }}</h2>
@foreach($sent_invoices as $invoice)
<a href="{{ route('payment.create') }}"
class="flex max-w even:bg-gray-100 odd:bg-white">
<div class="w-1/4">{{ $invoice->number }}</div>
<div class="w-1/4">{{ $invoice->address->name }}</div>
<div class="w-1/4">{{ \Illuminate\Support\Number::currency($invoice->sum) }}</div>
<div class="w-1/4">{{ $invoice->created }}</div>
</a>
@endforeach
</div>
</div>
<!-- Invoices not sent -->
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900 dark:text-gray-100">
<h2 class="mb-4 text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('dashboard.Invoices not sent') }}</h2>
@foreach($created_invoices as $invoice)
<a href="{{ route('invoice.edit', $invoice->id) }}"
class="flex max-w even:bg-gray-100 odd:bg-white">
<div class="w-1/2">{{ $invoice->number }}</div>
<div class="w-1/2">{{ $invoice->address->name }}</div>
</a>
@endforeach
</div>
</div>
<!-- Customers without address -->
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900 dark:text-gray-100">
<h2 class="mb-4 text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('dashboard.Customers without address') }}</h2>
@foreach($customers as $customer)
<a href="{{ route('customer.edit', $customer->id) }}"
class="flex max-w even:bg-gray-100 odd:bg-white">
<div class="w-1/2">{{ $customer->name }}</div>
<div class="w-1/2">{{ $customer->email }}</div>
</a>
@endforeach
</div>
</div>
<!-- Incoming invoices, that are not paid -->
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg col-span-2">
<div class="p-6 text-gray-900 dark:text-gray-100">
<h2 class="mb-4 text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('dashboard.Incoming not paid') }}</h2>
@foreach($unpaid_incoming as $incoming)
<a href="{{ route('incoming.edit', $incoming->id) }}"
class="flex max-w even:bg-gray-100 odd:bg-white">
<div class="w-1/6">{{ $incoming->invoice_number }}</div>
<div class="w-1/2">{{ $incoming->supplier->name }}</div>
<div class="w-1/6">{{ \Illuminate\Support\Number::currency($incoming->gross) }}</div>
<div class="w-1/6">{{ $incoming->due }}</div>
</a>
@endforeach
</div>
</div>
</div>
</div>
</x-app-layout>