140 lines
7.7 KiB
PHP
140 lines
7.7 KiB
PHP
<x-layouts.app :title="$account['nama']">
|
|
<x-ui.page-header
|
|
:title="$account['nama']"
|
|
:description="$account['jenis'].' '.$account['username']"
|
|
:breadcrumbs="['Pengguna' => route('superuser.pengguna.index'), $account['nama'] => null]"
|
|
>
|
|
<x-slot:actions>
|
|
<x-ui.button variant="secondary" :href="route('superuser.pengguna.index')" icon="arrow-left">Kembali</x-ui.button>
|
|
<x-ui.button variant="secondary" :href="route('superuser.reset-password', ['username' => $account['username']])" icon="key">Atur ulang kata sandi</x-ui.button>
|
|
<x-ui.button variant="secondary" :href="route('superuser.log-aktivitas.index', ['pengguna' => $account['id']])" icon="clipboard-document-list">Riwayat masuk</x-ui.button>
|
|
</x-slot:actions>
|
|
</x-ui.page-header>
|
|
|
|
<div class="stack">
|
|
@if ($own)
|
|
<x-ui.alert tone="info" title="Akun Anda sendiri">
|
|
Status dan otoritas akun Anda tidak dapat diubah dari sini agar Anda tidak terkunci dari sistem.
|
|
</x-ui.alert>
|
|
@endif
|
|
|
|
<div class="split">
|
|
<x-glass.panel as="section" padding="lg" aria-labelledby="judul-akun">
|
|
<div class="panel-title">
|
|
<h2 id="judul-akun">Data akun</h2>
|
|
<x-ui.badge :tone="$account['aktif'] ? 'success' : 'danger'">{{ $account['status'] }}</x-ui.badge>
|
|
</div>
|
|
<dl class="ledger">
|
|
@php
|
|
$rows = array_filter([
|
|
'Nama' => $account['nama'],
|
|
($account['jenis'] === 'Pegawai' ? 'NIP' : 'NIM') => $account['username'],
|
|
'Jenis akun' => $account['jenis'],
|
|
'Email' => $account['email'],
|
|
'Program studi' => $account['program_studi'],
|
|
'Unit' => $account['unit'] ? implode(', ', $account['unit']) : null,
|
|
'Peran di SIAKAD' => $account['peran'],
|
|
'Masuk terakhir' => $account['terakhir'],
|
|
'Diubah oleh' => $account['diubah_oleh'] ? $account['diubah_oleh'].($account['diubah_pada'] ? ', '.$account['diubah_pada'] : '') : null,
|
|
], fn ($value) => filled($value));
|
|
@endphp
|
|
@foreach ($rows as $label => $value)
|
|
<div class="ledger__row">
|
|
<dt>{{ $label }}</dt>
|
|
<dd>{{ $value }}</dd>
|
|
</div>
|
|
@endforeach
|
|
</dl>
|
|
</x-glass.panel>
|
|
|
|
<x-glass.panel as="section" padding="lg" aria-labelledby="judul-status">
|
|
<div class="panel-title"><h2 id="judul-status">Status akun</h2></div>
|
|
<div class="stack">
|
|
<p class="text-muted">
|
|
@if ($account['aktif'])
|
|
Akun aktif dan dapat masuk. Membekukan akun menolak setiap percobaan masuk sampai diaktifkan kembali.
|
|
@else
|
|
Akun dibekukan dan tidak dapat masuk ke sistem.
|
|
@endif
|
|
</p>
|
|
@unless ($own)
|
|
<form method="POST" action="{{ route('superuser.pengguna.status', $account['id']) }}">
|
|
@csrf
|
|
@method('PUT')
|
|
<input type="hidden" name="aktif" value="{{ $account['aktif'] ? 0 : 1 }}">
|
|
<x-ui.button type="submit" :variant="$account['aktif'] ? 'secondary' : 'primary'" :icon="$account['aktif'] ? 'lock-closed' : 'lock-open'">
|
|
{{ $account['aktif'] ? 'Bekukan akun' : 'Aktifkan akun' }}
|
|
</x-ui.button>
|
|
</form>
|
|
@endunless
|
|
</div>
|
|
</x-glass.panel>
|
|
</div>
|
|
|
|
@if ($account['jenis'] === 'Pegawai')
|
|
<x-glass.panel as="section" padding="lg" aria-labelledby="judul-otoritas">
|
|
<div class="panel-title"><h2 id="judul-otoritas">Otoritas</h2></div>
|
|
<div class="stack">
|
|
@if ($account['granted'] === [])
|
|
<x-ui.empty icon="shield-check" title="Belum memiliki otoritas" description="Pegawai tanpa otoritas yang juga bukan dosen tidak dapat masuk ke SIAKAD." />
|
|
@else
|
|
<ul class="list">
|
|
@foreach ($account['granted'] as $id => $nama)
|
|
<li class="list__item">
|
|
<div class="list__main">
|
|
<a class="list__title" href="{{ route('superuser.hak-akses.show', $id) }}">{{ $nama }}</a>
|
|
</div>
|
|
@unless ($own)
|
|
<x-ui.confirm
|
|
:action="route('superuser.pengguna.otoritas.destroy', [$account['id'], $id])"
|
|
method="DELETE"
|
|
:title="'Cabut otoritas '.$nama.'?'"
|
|
message="Akun kehilangan hak akses dari otoritas ini pada saat masuk berikutnya."
|
|
confirm-label="Ya, cabut"
|
|
tone="danger"
|
|
icon="trash"
|
|
trigger-label="Cabut"
|
|
:label="'Cabut otoritas '.$nama"
|
|
/>
|
|
@endunless
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
@endif
|
|
|
|
@unless ($own)
|
|
@if ($authorities !== [])
|
|
<form method="POST" action="{{ route('superuser.pengguna.otoritas.store', $account['id']) }}" class="stack">
|
|
@csrf
|
|
<x-form.select name="otoritas" label="Tambah otoritas" :options="$authorities" placeholder="Pilih otoritas" required />
|
|
<div><x-ui.button type="submit" icon="plus">Tambahkan</x-ui.button></div>
|
|
</form>
|
|
@endif
|
|
@endunless
|
|
</div>
|
|
</x-glass.panel>
|
|
@endif
|
|
|
|
<x-glass.panel as="section" padding="lg" aria-labelledby="judul-riwayat">
|
|
<div class="panel-title">
|
|
<h2 id="judul-riwayat">Masuk terakhir</h2>
|
|
<x-ui.button variant="ghost" size="sm" :href="route('superuser.log-aktivitas.index', ['pengguna' => $account['id']])" icon="arrow-right">Semua</x-ui.button>
|
|
</div>
|
|
@if ($account['riwayat'] === [])
|
|
<x-ui.empty icon="clipboard-document-list" title="Belum ada riwayat masuk" description="Akun ini belum tercatat pernah masuk." />
|
|
@else
|
|
<ul class="list">
|
|
@foreach ($account['riwayat'] as $h)
|
|
<li class="list__item">
|
|
<div class="list__main">
|
|
<span class="list__title">{{ $h['waktu'] }}</span>
|
|
<span class="list__meta">{{ $h['komputer'] ?? '-' }}, {{ $h['ip'] ?? '-' }}</span>
|
|
</div>
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
@endif
|
|
</x-glass.panel>
|
|
</div>
|
|
</x-layouts.app>
|