122 lines
6.7 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">
Profil pracownika
</h2>
<a href="{{ route('users.index') }}" class="inline-flex items-center px-4 py-2 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-800 dark:text-white text-sm font-medium rounded-md shadow-sm transition">
Powrót do listy
</a>
</div>
</x-slot>
<style>
html.dark .employee-profile-card,
html.dark .employee-profile-info,
html.dark .employee-profile-finance {
background-color: #1f2b3d !important;
border-color: rgba(148, 163, 184, 0.18) !important;
color: #f8fafc !important;
}
html.dark .employee-profile-card .employee-balance-card {
background-color: rgba(255, 255, 255, 0.06) !important;
border-color: rgba(148, 163, 184, 0.18) !important;
}
html.dark .employee-profile-finance table,
html.dark .employee-profile-finance th,
html.dark .employee-profile-finance td {
color: #f8fafc !important;
border-color: rgba(148, 163, 184, 0.12) !important;
}
</style>
<div class="py-12">
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8 space-y-6">
<div class="employee-profile-card overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700/50 dark:bg-gray-800">
<div class="p-6 text-gray-900 dark:text-white">
<div class="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
<div>
<p class="text-sm uppercase tracking-wide text-gray-500 dark:text-gray-400">Pracownik</p>
<h3 class="mt-1 text-3xl font-bold text-slate-900 dark:text-white">{{ $user->name }} {{ $user->surname }}</h3>
</div>
<div class="employee-balance-card min-w-[220px] rounded-xl border border-white/10 bg-white/5 px-5 py-4 shadow-sm dark:border-slate-600/40 dark:bg-white/5 dark:shadow-slate-950/20">
<p class="text-xs uppercase tracking-wide text-slate-300">Bilans zaliczek</p>
<p class="mt-2 text-3xl font-bold {{ $balance >= 0 ? 'text-emerald-400' : 'text-red-400' }}">
{{ number_format((float) $balance, 2, ',', ' ') }}
</p>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="employee-profile-info bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg border border-gray-200 dark:border-gray-700/50 p-6">
<h4 class="text-lg font-semibold mb-4">Dane osobowe</h4>
<dl class="space-y-3 text-sm">
<div>
<dt class="text-gray-500 dark:text-gray-400">Imię</dt>
<dd class="font-medium text-gray-900 dark:text-white">{{ $user->name }}</dd>
</div>
<div>
<dt class="text-gray-500 dark:text-gray-400">Nazwisko</dt>
<dd class="font-medium text-gray-900 dark:text-white">{{ $user->surname }}</dd>
</div>
<div>
<dt class="text-gray-500 dark:text-gray-400">E-mail</dt>
<dd class="font-medium text-gray-900 dark:text-white break-all">{{ $user->email }}</dd>
</div>
<div>
<dt class="text-gray-500 dark:text-gray-400">Role</dt>
<dd class="font-medium text-gray-900 dark:text-white">
@forelse($user->roles as $role)
<span class="inline-flex items-center rounded-md bg-white/5 px-2.5 py-1 text-xs font-medium text-slate-200 mr-2 mb-2">
{{ $role->name }}
</span>
@empty
<span class="text-gray-500 dark:text-gray-400">Brak ról</span>
@endforelse
</dd>
</div>
</dl>
</div>
<div class="employee-profile-finance lg:col-span-2 bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg border border-gray-200 dark:border-gray-700/50 p-6">
<h4 class="text-lg font-semibold mb-4">Podsumowanie finansowe</h4>
@if($user->advances->isEmpty())
<p class="text-gray-500 dark:text-gray-400">Brak zaliczek dla tego pracownika.</p>
@else
<div class="overflow-x-auto">
<table class="min-w-full text-left text-sm">
<thead>
<tr class="border-b border-gray-200 text-gray-500 dark:border-gray-700 dark:text-gray-400">
<th class="pb-4 pr-20 font-semibold">Data</th>
<th class="pb-4 pr-16 font-semibold">Typ</th>
<th class="pb-4 pr-2 text-right font-semibold">Kwota</th>
</tr>
</thead>
<tbody>
@foreach($user->advances->sortByDesc('date') as $advance)
<tr>
<td class="py-4 pr-20 text-gray-700 dark:text-gray-200">{{ $advance->date->format('d.m.Y') }}</td>
<td class="py-4 pr-16 text-gray-700 dark:text-gray-200">{{ $advance->type?->name ?? '—' }}</td>
<td class="py-4 pr-2 text-right font-medium {{ $advance->amount >= 0 ? 'text-emerald-400' : 'text-red-400' }}">
{{ number_format((float) $advance->amount, 2, ',', ' ') }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
</div>
</div>
</div>
</x-app-layout>