82 lines
3.9 KiB
PHP
82 lines
3.9 KiB
PHP
{{-- Sambutan (panel gradien) dan kartu identitas akademik: dua panel bersaudara, tidak bersarang. Slot = aksi cepat di sambutan. --}}
|
|
@props(['user', 'details' => [], 'subtitle' => null])
|
|
|
|
@php
|
|
$role = $user->role;
|
|
$idLabel = $role->identifierLabel();
|
|
$idValue = $details[$idLabel] ?? null;
|
|
$others = array_diff_key($details, [$idLabel => true]);
|
|
$subtitle ??= "Anda masuk sebagai {$role->label()} di Sistem Informasi Akademik Universitas Tanjungpura.";
|
|
|
|
$now = now()->locale('id');
|
|
$hour = (int) $now->format('G');
|
|
$sapaan = match (true) {
|
|
$hour < 11 => 'Selamat pagi',
|
|
$hour < 15 => 'Selamat siang',
|
|
$hour < 18 => 'Selamat sore',
|
|
default => 'Selamat malam',
|
|
};
|
|
$icons = ['Username' => 'at-symbol', 'Jabatan' => 'briefcase', 'Unit kerja' => 'building-office-2', 'Program studi' => 'academic-cap', 'Fakultas' => 'building-library', 'Angkatan' => 'calendar-days', 'Status' => 'check-badge'];
|
|
$initial = \Illuminate\Support\Str::of($user->name)->explode(' ')->filter()->take(2)->map(fn ($w) => \Illuminate\Support\Str::upper(\Illuminate\Support\Str::substr($w, 0, 1)))->implode('');
|
|
@endphp
|
|
|
|
<div {{ $attributes->class('welcome') }}>
|
|
<x-glass.panel as="section" padding="none" aria-labelledby="judul-sambutan" class="welcome__hero">
|
|
<span class="welcome__orb welcome__orb--a" aria-hidden="true"></span>
|
|
<span class="welcome__orb welcome__orb--b" aria-hidden="true"></span>
|
|
|
|
<div class="welcome__top">
|
|
<p class="welcome__eyebrow">
|
|
<x-heroicon-o-sparkles aria-hidden="true" />
|
|
<span>{{ $sapaan }}</span>
|
|
<span class="welcome__dot" aria-hidden="true"></span>
|
|
<time datetime="{{ $now->toDateString() }}">{{ $now->isoFormat('dddd, D MMMM YYYY') }}</time>
|
|
</p>
|
|
<h1 id="judul-sambutan" class="welcome__title">Selamat Datang, {{ $user->name }}!</h1>
|
|
<p class="welcome__lede">{{ $subtitle }}</p>
|
|
</div>
|
|
|
|
<div class="welcome__foot">
|
|
<span class="welcome__chip welcome__chip--role"><x-heroicon-s-shield-check aria-hidden="true" />{{ $role->label() }}</span>
|
|
@foreach (array_slice($others, 0, 3, true) as $label => $value)
|
|
@continue($label === 'Username')
|
|
<span class="welcome__chip"><span class="visually-hidden">{{ $label }}: </span>{{ $value }}</span>
|
|
@endforeach
|
|
@if (trim((string) $slot) !== '')
|
|
<div class="welcome__actions">{{ $slot }}</div>
|
|
@endif
|
|
</div>
|
|
</x-glass.panel>
|
|
|
|
<x-glass.panel as="aside" padding="none" aria-labelledby="judul-identitas" class="welcome__id">
|
|
<div class="welcome__id-head">
|
|
<span class="welcome__avatar" aria-hidden="true"><x-brand.logo size="lg" :priority="true" /></span>
|
|
<div class="welcome__id-text">
|
|
<h2 id="judul-identitas" class="welcome__id-title">Identitas akademik</h2>
|
|
<p class="welcome__id-name">{{ $user->name }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
@if ($idValue !== null)
|
|
<div class="welcome__idnum">
|
|
<span class="welcome__idnum-label">{{ $idLabel }}</span>
|
|
<span class="welcome__idnum-value num">{{ $idValue }}</span>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($others)
|
|
<dl class="welcome__facts">
|
|
@foreach ($others as $label => $value)
|
|
<div class="welcome__fact">
|
|
<span class="welcome__fact-icon" aria-hidden="true"><x-dynamic-component :component="'heroicon-o-'.($icons[$label] ?? 'tag')" /></span>
|
|
<div class="welcome__fact-text">
|
|
<dt>{{ $label }}</dt>
|
|
<dd>{{ $value }}</dd>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</dl>
|
|
@endif
|
|
</x-glass.panel>
|
|
</div>
|