@extends('layouts.app')
@section('title', '座位表')
@push('styles')
@endpush
@section('content')
@if ($maps->isEmpty())
尚未建立座位表
@if ($canManage)
,
到後台建立
@endif
@else
@foreach ($maps as $i => $m)
@foreach ($m->seats as $s)
@php
$u = $s->user;
$search = mb_strtolower(implode(' ', array_filter([$s->code, $s->label, $u?->name, $u?->department, $u?->position, $u?->email])));
$seatRot = $s->rotation ?? ($s->h > $s->w ? 90 : 0);
$mon = (int) ($s->options['monitors'] ?? 1);
$lap = !empty($s->options['laptop']);
$eq = ($mon !== 1 || $lap) ? '
' . str_repeat('🖥', $mon) . ($lap ? '💻' : '') . '
' : '';
$chairMark = '
'
. ($s->partition ? '
' : '');
$style = "left:calc(var(--sv-cell) * {$s->x});top:calc(var(--sv-cell) * {$s->y});width:calc(var(--sv-cell) * {$s->w});height:calc(var(--sv-cell) * {$s->h});";
@endphp
@if ($s->type === 'seat' && $u)
@if ($s->h >= 2)
@if ($u->avatarUrl())
@else{{ mb_substr($u->name, 0, 1) }}@endif
@endif
{{ $u->name }}
{!! $eq !!}{!! $chairMark !!}
@elseif ($s->type === 'seat')
@if ($s->label)
{{ $s->label }}
@endif
{!! $eq !!}{!! $chairMark !!}
@else
{{ $s->label ?? ['room' => '會議室', 'table' => '桌子', 'fan' => '電扇', 'fridge' => '冰箱', 'door' => '門', 'tv' => '電視'][$s->type] ?? '' }}
@endif
@endforeach
點人:新人走過去認識他 · 方向鍵/WASD 走動新人、Enter 跟旁邊的人聊天 · 拖曳旋轉 · 右鍵拖曳平移 · 滾輪縮放
@endforeach
@php
$seatMaps3d = $maps->mapWithKeys(fn ($m) => [$m->id => [
'cols' => $m->cols,
'rows' => $m->rows,
'seats' => $m->seats->map(fn ($s) => [
'type' => $s->type,
'code' => $s->code,
'label' => $s->label,
'x' => $s->x, 'y' => $s->y, 'w' => $s->w, 'h' => $s->h, 'rotation' => $s->rotation, 'partition' => (bool) $s->partition, 'options' => $s->options,
'search' => mb_strtolower(implode(' ', array_filter([$s->code, $s->label, $s->user?->name, $s->user?->department, $s->user?->position, $s->user?->email]))),
'user' => ($s->type === 'seat' && $s->user) ? [
'name' => $s->user->name,
'dept' => trim(($s->user->department ?? '') . ' ' . ($s->user->position ?? '')),
'email' => $s->user->email,
'phone' => $s->user->phone ?? '',
'avatar' => $s->user->avatarUrl(),
'gender' => $s->user->gender,
'nickname' => $s->user->nickname,
'department' => $s->user->department,
'position' => $s->user->position,
'duty' => $s->user->duty,
'url' => Route::has('profile.show') ? route('profile.show', $s->user) : null,
] : null,
])->values(),
]]);
@endphp
@endif
@endsection
@push('scripts')
@endpush