{{-- 文件功能:勤务台页面(职务管理荣誉展示台) 左侧子菜单:任职列表、日榜、周榜、月榜、总榜 URL:/duty-hall?tab=roster|day|week|month|all @extends layouts.app --}} @extends('layouts.app') @section('title', '勤务台 · ' . ($tabs[$tab]['label'] ?? '任职列表') . ' - 飘落流星') @section('nav-icon', '🏛️') @section('nav-title', '勤务台') @section('content')
{{-- ═══ 左侧子菜单 ═══ --}} {{-- ═══ 主内容区 ═══ --}}
{{-- ─── Tab:任职列表 ─── --}} @if ($tab === 'roster')

🏛️ 任职列表

按部门 · 职务展示当前全部在职人员

@if ($currentStaff->isEmpty())
📭

暂未设置任何部门

@else
@foreach ($currentStaff as $dept)
{{-- 部门标题 --}}
{{ $dept->icon ?? '🏢' }} {{ $dept->name }} {{ $dept->positions->count() }} 个职务
@if ($dept->positions->isEmpty())
该部门暂无职务设置
@else
@foreach ($dept->positions as $position)
{{-- 职务名 --}}
{{ $position->icon }} {{ $position->name }} @php $current = $position->activeUserPositions->count(); $maxSlots = $position->max_persons; $isFull = $maxSlots !== null && $current >= $maxSlots; @endphp {{-- 名额计数标签 --}} {{ $current }} @if ($maxSlots !== null) /{{ $maxSlots }} @endif 人 @if ($isFull) 已满 @elseif ($current === 0) (暂缺) @endif
{{-- 在职人员列表 --}} @if ($position->activeUserPositions->isNotEmpty())
@foreach ($position->activeUserPositions as $up)

{{ $up->user?->username ?? '未知' }}

{{ $up->appointed_at?->format('Y-m-d') }} 起 · {{ $up->duration_days }} 天

@endforeach
@else {{-- 空缺占位 --}}
👤 暂无任职人员
@endif
@endforeach
@endif
@endforeach
@endif {{-- ─── Tab:日/周/月/总榜 ─── --}} @else @php $tabMeta = $tabs[$tab]; $periodLabel = match ($tab) { 'day' => today()->format('Y年m月d日'), 'week' => now()->startOfWeek()->format('m月d日') . ' – ' . now()->endOfWeek()->format('m月d日'), 'month' => now()->format('Y年m月'), 'all' => '历史累计', }; @endphp

{{ $tabMeta['icon'] }} 勤务{{ $tabMeta['label'] }}

{{ $periodLabel }} · 按在职期间登录时长排名

@if ($leaderboard->isEmpty())
📊

该时段暂无勤务记录

@else {{-- 表头 --}}
名次
成员
在线时长
签到次数
@foreach ($leaderboard as $i => $row) @php $h = intdiv($row->total_seconds, 3600); $m = intdiv($row->total_seconds % 3600, 60); $medal = match ($i) { 0 => '🥇', 1 => '🥈', 2 => '🥉', default => null, }; @endphp
{{-- 名次 --}}
@if ($medal) {{ $medal }} @else {{ $i + 1 }} @endif
{{-- 成员 --}}

{{ $row->user?->username ?? '未知' }}

LV.{{ $row->user?->user_level ?? '' }}

{{-- 时长 --}}
{{ $h }}h {{ $m }}m
{{-- 次数 --}}
{{ $row->checkin_count }} 次
@endforeach @endif
@endif
{{-- 移动端底部 Tab 导航 --}}
@foreach ($tabs as $key => $meta) {{ $meta['icon'] }} {{ $meta['label'] }} @endforeach
@endsection