m
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
<h2 class="text-[32px] md:text-[42px] font-extrabold text-[#1a2b49] mb-3 drop-shadow-sm">🏆 Bảng xếp hạng</h2>
|
||||
<p class="text-[16px] md:text-[18px] text-gray-700 mb-4 max-w-2xl">Tôn vinh những cá nhân lan tỏa văn hóa cảm ơn và ghi nhận trong tổ chức.</p>
|
||||
</x-hero-banner>
|
||||
<img src="{{ asset('images/illustrations/trophy.svg') }}" alt="trophy" class="absolute right-4 bottom-0 w-40 h-40 md:w-56 md:h-56 opacity-20 pointer-events-none">
|
||||
</div>
|
||||
|
||||
<!-- Month Filter -->
|
||||
@@ -147,8 +146,13 @@
|
||||
|
||||
{{-- Users in Group --}}
|
||||
<div class="p-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
@foreach($group as $user)
|
||||
<div class="group bg-white rounded-[16px] p-4 flex items-center gap-4 transition-all duration-300 hover:-translate-y-1 hover:shadow-[0_12px_24px_rgba(0,0,0,0.06)] border border-gray-100 cursor-default relative overflow-hidden">
|
||||
@php
|
||||
$total = $group->count();
|
||||
$desktopLimit = $total > 12 ? 11 : 12;
|
||||
$mobileLimit = $total > 4 ? 3 : 4;
|
||||
@endphp
|
||||
@foreach($group as $index => $user)
|
||||
<div class="group user-card bg-white rounded-[16px] p-4 flex items-center gap-4 transition-all duration-300 hover:-translate-y-1 hover:shadow-[0_12px_24px_rgba(0,0,0,0.06)] border border-gray-100 cursor-default relative overflow-hidden @if($index >= $desktopLimit) hide-all @elseif($index >= $mobileLimit) hide-mobile @endif">
|
||||
<div class="absolute inset-0 bg-gradient-to-r from-blue-50 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"></div>
|
||||
<x-avatar :user="$user" class="w-12 h-12" />
|
||||
<div class="flex-1 min-w-0 relative z-10">
|
||||
@@ -160,6 +164,30 @@
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@if($total > 4)
|
||||
{{-- Mobile Xem Them Button --}}
|
||||
<button type="button" class="xem-them-btn-mobile md:hidden flex flex-col items-center justify-center bg-white rounded-[16px] border border-gray-200 border-dashed hover:border-primary hover:bg-blue-50 transition-all p-4 text-primary font-bold min-h-[80px]" onclick="expandGroup(this)">
|
||||
<div class="flex items-center gap-1 mb-1 text-lg">
|
||||
<svg class="w-5 h-5" 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"></path></svg>
|
||||
<span>+{{ $total - 3 }}</span>
|
||||
</div>
|
||||
<span class="text-xs">Xem thêm</span>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if($total > 12)
|
||||
{{-- Desktop Xem Them Button --}}
|
||||
<button type="button" class="xem-them-btn-desktop hidden md:flex flex-col items-center justify-center bg-white rounded-[16px] border border-gray-200 border-dashed hover:border-primary hover:bg-blue-50 transition-all p-4 text-primary font-bold min-h-[80px]" onclick="expandGroup(this)">
|
||||
<div class="flex items-center gap-1 mb-1 text-lg">
|
||||
<svg class="w-5 h-5" 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"></path></svg>
|
||||
<span>+{{ $total - 11 }}</span>
|
||||
</div>
|
||||
<span class="text-xs">Xem thêm</span>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -274,8 +302,13 @@
|
||||
|
||||
{{-- Users in Group --}}
|
||||
<div class="p-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
@foreach($group as $user)
|
||||
<div class="group bg-white rounded-[16px] p-4 flex items-center gap-4 transition-all duration-300 hover:-translate-y-1 hover:shadow-[0_12px_24px_rgba(0,0,0,0.06)] border border-gray-100 cursor-default relative overflow-hidden">
|
||||
@php
|
||||
$total = $group->count();
|
||||
$desktopLimit = $total > 12 ? 11 : 12;
|
||||
$mobileLimit = $total > 4 ? 3 : 4;
|
||||
@endphp
|
||||
@foreach($group as $index => $user)
|
||||
<div class="group bg-white rounded-[16px] p-4 flex items-center gap-4 transition-all duration-300 hover:-translate-y-1 hover:shadow-[0_12px_24px_rgba(0,0,0,0.06)] border border-gray-100 cursor-default relative overflow-hidden @if($index >= $desktopLimit) hide-all @elseif($index >= $mobileLimit) hide-mobile @endif">
|
||||
<div class="absolute inset-0 bg-gradient-to-r from-purple-50 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"></div>
|
||||
<x-avatar :user="$user" class="w-12 h-12" />
|
||||
<div class="flex-1 min-w-0 relative z-10">
|
||||
@@ -287,6 +320,30 @@
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@if($total > 4)
|
||||
{{-- Mobile Xem Them Button --}}
|
||||
<button type="button" class="xem-them-btn-mobile md:hidden flex flex-col items-center justify-center bg-white rounded-[16px] border border-gray-200 border-dashed hover:border-primary hover:bg-blue-50 transition-all p-4 text-primary font-bold min-h-[80px]" onclick="expandGroup(this)">
|
||||
<div class="flex items-center gap-1 mb-1 text-lg">
|
||||
<svg class="w-5 h-5" 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"></path></svg>
|
||||
<span>+{{ $total - 3 }}</span>
|
||||
</div>
|
||||
<span class="text-xs">Xem thêm</span>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@if($total > 12)
|
||||
{{-- Desktop Xem Them Button --}}
|
||||
<button type="button" class="xem-them-btn-desktop hidden md:flex flex-col items-center justify-center bg-white rounded-[16px] border border-gray-200 border-dashed hover:border-primary hover:bg-blue-50 transition-all p-4 text-primary font-bold min-h-[80px]" onclick="expandGroup(this)">
|
||||
<div class="flex items-center gap-1 mb-1 text-lg">
|
||||
<svg class="w-5 h-5" 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"></path></svg>
|
||||
<span>+{{ $total - 11 }}</span>
|
||||
</div>
|
||||
<span class="text-xs">Xem thêm</span>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -307,6 +364,12 @@
|
||||
.animate-fade-in {
|
||||
animation: fadeIn 0.4s ease-out forwards;
|
||||
}
|
||||
|
||||
/* Custom classes for hiding excess items */
|
||||
.hide-all { display: none !important; }
|
||||
@media (max-width: 767px) {
|
||||
.hide-mobile { display: none !important; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@endsection
|
||||
@@ -344,5 +407,18 @@
|
||||
contentReceived.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function expandGroup(btn) {
|
||||
const container = btn.closest('.grid');
|
||||
const hiddenItems = container.querySelectorAll('.hide-all, .hide-mobile');
|
||||
|
||||
hiddenItems.forEach(el => {
|
||||
el.classList.remove('hide-all', 'hide-mobile');
|
||||
});
|
||||
|
||||
// Hide all xem-them buttons in this container
|
||||
const btns = container.querySelectorAll('.xem-them-btn-mobile, .xem-them-btn-desktop');
|
||||
btns.forEach(b => b.style.display = 'none');
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user