feature: user list
This commit is contained in:
@@ -1,45 +1,69 @@
|
||||
<div class="bg-white rounded-[24px] shadow-[0_10px_30px_rgba(15,23,42,0.05)] p-6 border border-white hover:shadow-md transition-all flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="bg-white rounded-[24px] shadow-[0_10px_30px_rgba(15,23,42,0.05)] p-6 border border-white hover:shadow-md transition-all flex items-start justify-between">
|
||||
<div class="flex items-start gap-4">
|
||||
<div class="w-14 h-14 rounded-2xl bg-purple-50 flex items-center justify-center text-purple-500 shrink-0">
|
||||
<svg class="w-7 h-7" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-[13px] font-bold text-gray-400 uppercase tracking-wider mb-1">User nhận nhiều nhất</span>
|
||||
@if($topReceivedUser)
|
||||
<span class="text-[16px] font-extrabold text-[#1a2b49] leading-tight">{{ $topReceivedUser->name }}</span>
|
||||
<span class="text-[12px] text-gray-500 font-semibold mt-0.5">MSNV: {{ $topReceivedUser->msnv }}</span>
|
||||
<span class="text-[13px] font-bold text-gray-400 uppercase tracking-wider mb-2">User nhận nhiều nhất</span>
|
||||
@if(isset($topReceivedUsers) && $topReceivedUsers->isNotEmpty())
|
||||
<div class="flex flex-col gap-3">
|
||||
@foreach($topReceivedUsers as $user)
|
||||
<div class="flex flex-col leading-tight">
|
||||
<span class="text-[16px] font-extrabold text-[#1a2b49]">{{ $user->name }}</span>
|
||||
<div class="text-[12px] text-gray-500 font-semibold mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5">
|
||||
<span>MSNV: {{ $user->msnv }}</span>
|
||||
@if($user->mail)
|
||||
<span class="text-gray-300">•</span>
|
||||
<span>Email: {{ $user->mail }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<span class="text-[15px] font-semibold text-gray-400">Không có dữ liệu</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<span class="text-[36px] font-extrabold text-purple-600 leading-none">{{ $topReceivedUser?->total_received ?? 0 }}</span>
|
||||
<div class="text-right shrink-0">
|
||||
<span class="text-[36px] font-extrabold text-purple-600 leading-none">{{ isset($topReceivedUsers) && $topReceivedUsers->isNotEmpty() ? $topReceivedUsers->first()->total_received : 0 }}</span>
|
||||
<span class="block text-[11px] text-gray-400 font-bold uppercase mt-1">Thẻ Nhận</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-[24px] shadow-[0_10px_30px_rgba(15,23,42,0.05)] p-6 border border-white hover:shadow-md transition-all flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="bg-white rounded-[24px] shadow-[0_10px_30px_rgba(15,23,42,0.05)] p-6 border border-white hover:shadow-md transition-all flex items-start justify-between">
|
||||
<div class="flex items-start gap-4">
|
||||
<div class="w-14 h-14 rounded-2xl bg-blue-50 flex items-center justify-center text-blue-500 shrink-0">
|
||||
<svg class="w-7 h-7 transform -rotate-45" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-[13px] font-bold text-gray-400 uppercase tracking-wider mb-1">User gửi nhiều nhất</span>
|
||||
@if($topSentUser)
|
||||
<span class="text-[16px] font-extrabold text-[#1a2b49] leading-tight">{{ $topSentUser->name }}</span>
|
||||
<span class="text-[12px] text-gray-500 font-semibold mt-0.5">MSNV: {{ $topSentUser->msnv }}</span>
|
||||
<span class="text-[13px] font-bold text-gray-400 uppercase tracking-wider mb-2">User gửi nhiều nhất</span>
|
||||
@if(isset($topSentUsers) && $topSentUsers->isNotEmpty())
|
||||
<div class="flex flex-col gap-3">
|
||||
@foreach($topSentUsers as $user)
|
||||
<div class="flex flex-col leading-tight">
|
||||
<span class="text-[16px] font-extrabold text-[#1a2b49]">{{ $user->name }}</span>
|
||||
<div class="text-[12px] text-gray-500 font-semibold mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5">
|
||||
<span>MSNV: {{ $user->msnv }}</span>
|
||||
@if($user->mail)
|
||||
<span class="text-gray-300">•</span>
|
||||
<span>Email: {{ $user->mail }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<span class="text-[15px] font-semibold text-gray-400">Không có dữ liệu</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<span class="text-[36px] font-extrabold text-blue-600 leading-none">{{ $topSentUser?->total_sent ?? 0 }}</span>
|
||||
<div class="text-right shrink-0">
|
||||
<span class="text-[36px] font-extrabold text-blue-600 leading-none">{{ isset($topSentUsers) && $topSentUsers->isNotEmpty() ? $topSentUsers->first()->total_sent : 0 }}</span>
|
||||
<span class="block text-[11px] text-gray-400 font-bold uppercase mt-1">Thẻ Gửi</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,19 +11,24 @@
|
||||
<table class="min-w-full divide-y divide-gray-100 text-sm">
|
||||
<thead class="bg-gray-50/50">
|
||||
<tr>
|
||||
<th class="table-header-cell">Thao tác</th>
|
||||
<th class="table-header-cell">MSNV</th>
|
||||
<th class="table-header-cell">Nhân viên</th>
|
||||
<th class="table-header-cell">Phòng ban</th>
|
||||
<th class="table-header-cell">Đã Nhận</th>
|
||||
<th class="table-header-cell">Đã Gửi</th>
|
||||
<th class="table-header-cell">Số dư thẻ</th>
|
||||
<th class="table-header-cell">Quyền gửi</th>
|
||||
<th class="table-header-cell">Vai trò</th>
|
||||
<th class="table-header-cell">Trạng thái</th>
|
||||
<th class="table-header-cell text-right">Thao tác</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-100">
|
||||
@forelse($users as $u)
|
||||
<tr class="hover:bg-slate-50/60 transition-colors">
|
||||
<td class="table-body-cell font-medium space-x-3">
|
||||
<a href="{{ route('admin.users.edit', $u->msnv) }}" class="table-action-link !text-[#3462f7] hover:!text-blue-800">Chỉnh sửa</a>
|
||||
</td>
|
||||
<td class="table-body-cell font-bold text-text-dark">{{ $u->msnv }}</td>
|
||||
<td class="table-body-cell">
|
||||
<div class="flex flex-col">
|
||||
@@ -31,6 +36,20 @@
|
||||
<span class="text-xs text-gray-400 mt-0.5">{{ $u->mail }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
@php
|
||||
$deptVal = $u->departments;
|
||||
if (is_numeric($deptVal)) {
|
||||
$idx = ((int)$deptVal) - 1;
|
||||
$deptName = config('constants.DEPARTMENTS')[$idx] ?? 'Team';
|
||||
} else {
|
||||
$deptName = $deptVal ?? 'Team';
|
||||
}
|
||||
@endphp
|
||||
<div class="max-w-[200px] truncate font-medium text-gray-600" title="{{ $deptName }}">
|
||||
{{ $deptName }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-body-cell font-extrabold text-green-600">+{{ $u->total_received }}</td>
|
||||
<td class="table-body-cell font-extrabold text-blue-600">{{ $u->total_sent }}</td>
|
||||
<td class="table-body-cell font-extrabold text-orange-500">{{ $u->card }}</td>
|
||||
@@ -42,19 +61,23 @@
|
||||
@endif
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
@if($u->status == \App\Models\User::STATUS_ACTIVE)
|
||||
@if($u->role == config('constants.ROLE_ADMIN'))
|
||||
<span class="px-2.5 py-1 inline-flex text-[10px] leading-5 font-bold rounded-full bg-blue-50 text-blue-700 border border-blue-100">Admin</span>
|
||||
@else
|
||||
<span class="px-2.5 py-1 inline-flex text-[10px] leading-5 font-bold text-gray-500">Member</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
@if($u->status == config('constants.STATUS_ACTIVE'))
|
||||
<span class="px-2.5 py-1 inline-flex text-[10px] leading-5 font-bold rounded-full bg-blue-50 text-blue-700 border border-blue-100">Đang làm việc</span>
|
||||
@else
|
||||
<span class="px-2.5 py-1 inline-flex text-[10px] leading-5 font-bold rounded-full bg-red-50 text-red-700 border border-red-100">Đã nghỉ việc</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="table-body-cell text-right font-medium space-x-3">
|
||||
<a href="{{ route('admin.users.edit', $u->msnv) }}" class="table-action-link !text-[#3462f7] hover:!text-blue-800">Quản lý</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-10 text-center text-text-light font-medium">Chưa có user nào đang hoạt động.</td>
|
||||
<td colspan="10" class="px-6 py-10 text-center text-text-light font-medium">Chưa có user nào đang hoạt động.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user