new_malcomm_oline/resources/views/dashboard.blade.php
2026-08-26 14:51:08 +02:00

140 lines
8.7 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Dashboard') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
{{-- Karty ze statystykami --}}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
{{-- Wszyscy użytkownicy --}}
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700/50 flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Wszyscy użytkownicy</p>
<p class="text-3xl font-bold text-gray-900 dark:text-white mt-1">
{{ $totalUsers ?? 0 }}
</p>
</div>
<div class="p-3 bg-indigo-50 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-400 rounded-full">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
</div>
</div>
{{-- Administratorzy --}}
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700/50 flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Administratorzy</p>
<p class="text-3xl font-bold text-gray-900 dark:text-white mt-1">
{{ $adminCount ?? 0 }}
</p>
</div>
<div class="p-3 bg-red-50 dark:bg-red-900/40 text-red-600 dark:text-red-400 rounded-full">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
</svg>
</div>
</div>
{{-- Kierownicy --}}
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700/50 flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Kierownicy</p>
<p class="text-3xl font-bold text-gray-900 dark:text-white mt-1">
{{ $managerCount ?? 0 }}
</p>
</div>
<div class="p-3 bg-amber-50 dark:bg-amber-900/40 text-amber-600 dark:text-amber-400 rounded-full">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
</div>
</div>
{{-- Pracownicy / Użytkownicy --}}
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700/50 flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Pracownicy</p>
<p class="text-3xl font-bold text-gray-900 dark:text-white mt-1">
{{ $workerCount ?? 0 }}
</p>
</div>
<div class="p-3 bg-emerald-50 dark:bg-emerald-900/40 text-emerald-600 dark:text-emerald-400 rounded-full">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
</div>
</div>
</div>
{{-- Sekcja dolna: Szybkie akcje i powitanie --}}
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
{{-- Powitanie i szybki stan --}}
<div class="lg:col-span-2 bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700/50">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">
Witaj, {{ Auth::user()->name }}! 👋
</h3>
<p class="text-gray-600 dark:text-gray-300 text-sm mb-4">
Jesteś zalogowany w systemie. Poniżej znajdziesz szybkie skróty do najważniejszych modułów w aplikacji.
</p>
<div class="pt-4 border-t border-gray-200 dark:border-gray-700 flex flex-wrap gap-3">
<a href="{{ route('users.index') }}"
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 gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 43v17m0 0l-4-4m4 4l4-4" />
</svg>
<span>Zarządzaj użytkownikami</span>
</a>
@hasanyrole('admin|kierownik')
<a href="{{ route('users.create') }}"
class="inline-flex items-center px-4 py-2 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-600 text-sm font-medium rounded-md shadow-sm transition gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
<span>Dodaj użytkownika</span>
</a>
@endhasanyrole
</div>
</div>
{{-- Ostatnio zarejestrowani --}}
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700/50">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">
Ostatnio dodani
</h3>
<div class="space-y-3">
@forelse($recentUsers ?? [] as $user)
<div class="flex items-center justify-between pb-2 border-b border-gray-100 dark:border-gray-700/50 last:border-0 last:pb-0">
<div>
<p class="text-sm font-medium text-gray-900 dark:text-white">
{{ $user->name }} {{ $user->surname }}
</p>
<p class="text-xs text-gray-500 dark:text-gray-400">
{{ $user->email }}
</p>
</div>
<span class="text-xs text-gray-400 dark:text-gray-500">
{{ $user->created_at->diffForHumans() }}
</span>
</div>
@empty
<p class="text-sm text-gray-500 dark:text-gray-400">Brak nowych użytkowników.</p>
@endforelse
</div>
</div>
</div>
</div>
</div>
</x-app-layout>