103 lines
7.0 KiB
PHP
103 lines
7.0 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<div class="flex items-center justify-between gap-4">
|
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-white leading-tight">{{ __('Zaliczki') }}</h2>
|
|
<a href="{{ route('zaliczki.create') }}" class="inline-flex items-center px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded-md shadow-sm transition">Dodaj zaliczkę</a>
|
|
</div>
|
|
</x-slot>
|
|
|
|
<style>
|
|
.advance-table-row:hover {
|
|
background-color: #f9fafb;
|
|
}
|
|
|
|
.dark .advance-table-row:hover {
|
|
background-color: #374151 !important;
|
|
color: #f9fafb;
|
|
}
|
|
</style>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
|
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg border border-gray-200 dark:border-gray-700/50 p-6 text-gray-900 dark:text-white">
|
|
@if(session('status'))
|
|
<div class="mb-5 rounded-md bg-green-50 dark:bg-green-900/30 px-4 py-3 text-sm text-green-700 dark:text-green-300">{{ session('status') }}</div>
|
|
@endif
|
|
|
|
<form method="GET" action="{{ route('zaliczki') }}" class="mb-6 flex flex-wrap items-center gap-2">
|
|
<div class="w-full sm:w-64">
|
|
<x-input-label for="search" value="Szukaj" class="sr-only" />
|
|
<x-text-input id="search" type="text" name="search" :value="request('search')" placeholder="Użytkownik, e-mail lub kwota" class="block w-full px-3 py-2 text-sm" />
|
|
</div>
|
|
<div class="w-full sm:w-40">
|
|
<x-input-label for="type" value="Rodzaj" class="sr-only" />
|
|
<select id="type" name="type" class="block w-full border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm py-2 text-sm">
|
|
<option value="">Wszystkie rodzaje</option>
|
|
@foreach($types as $type)
|
|
<option value="{{ $type->id }}" {{ (string) request('type') === (string) $type->id ? 'selected' : '' }}>{{ $type->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="w-full sm:w-36">
|
|
<x-input-label for="date_from" value="Od" class="sr-only" />
|
|
<x-text-input id="date_from" type="date" name="date_from" :value="request('date_from')" class="block w-full" />
|
|
</div>
|
|
<div class="w-full sm:w-36">
|
|
<x-input-label for="date_to" value="Do" class="sr-only" />
|
|
<x-text-input id="date_to" type="date" name="date_to" :value="request('date_to')" class="block w-full" />
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<x-primary-button type="submit">Szukaj</x-primary-button>
|
|
@if(request()->hasAny(['search', 'type', 'date_from', 'date_to']))
|
|
<a href="{{ route('zaliczki') }}" class="inline-flex items-center px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md font-semibold text-xs text-gray-700 dark:text-gray-300 uppercase tracking-widest shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700 transition">Wyczyść</a>
|
|
@endif
|
|
</div>
|
|
</form>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full border-collapse">
|
|
<thead>
|
|
<tr class="border-b border-gray-200 dark:border-gray-700 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-300">
|
|
<th class="py-3.5 px-4 text-left">Data</th>
|
|
<th class="py-3.5 px-4 text-left">Użytkownik</th>
|
|
<th class="py-3.5 px-4 text-left">Kwota</th>
|
|
<th class="py-3.5 px-4 text-left">Rodzaj</th>
|
|
<th class="py-3.5 px-4 text-center">Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 dark:divide-gray-700/60 text-sm">
|
|
@forelse($advances as $advance)
|
|
<tr class="advance-table-row hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">
|
|
<td class="py-4 px-4">{{ $advance->date->format('d.m.Y') }}</td>
|
|
<td class="py-4 px-4 font-medium">
|
|
<a href="{{ route('users.show', $advance->user) }}" class="text-indigo-600 hover:text-indigo-800 dark:text-indigo-400 dark:hover:text-indigo-300 transition-colors">
|
|
{{ $advance->user->name }} {{ $advance->user->surname }}
|
|
</a>
|
|
</td>
|
|
<td class="py-4 px-4">{{ number_format((float) $advance->amount, 2, ',', ' ') }} zł</td>
|
|
<td class="py-4 px-4">{{ $advance->type->name }}</td>
|
|
<td class="py-4 px-4">
|
|
<div class="flex items-center justify-center gap-3">
|
|
<a href="{{ route('zaliczki.edit', $advance) }}" class="text-indigo-600 dark:text-indigo-400 hover:text-indigo-900 dark:hover:text-indigo-300 font-medium text-sm transition">Edytuj</a>
|
|
<form method="POST" action="{{ route('zaliczki.destroy', $advance) }}" onsubmit="return confirm('Czy na pewno chcesz usunąć tę zaliczkę?');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 font-medium text-sm transition">Usuń</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="5" class="py-8 text-center text-gray-500 dark:text-gray-400">Brak zaliczek spełniających podane kryteria.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@if($advances->hasPages())
|
|
<div class="mt-6 pt-4 border-t border-gray-200 dark:border-gray-700">{{ $advances->links() }}</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout> |