[Superuser] Perbaikan Halaman Akses Superuser
This commit is contained in:
@@ -553,6 +553,10 @@ tbody > tr[hidden] { display: none; }
|
||||
.satu-form__check { align-self: center; }
|
||||
.satu-detail dt { font-size: var(--text-sm); font-weight: 600; color: var(--color-muted); }
|
||||
.satu-detail dd { margin: 0; overflow-wrap: anywhere; }
|
||||
/* Rincian berupa daftar di modal Lihat (mis. anggota grup MK): selebar modal, satu butir per baris */
|
||||
.satu-detail__wide { grid-column: 1 / -1; }
|
||||
.satu-detail__list { margin: 0; padding-inline-start: 1.25rem; display: grid; gap: var(--space-2xs); line-height: 1.5; }
|
||||
.satu-detail__list li::marker { color: var(--color-muted); font-variant-numeric: tabular-nums; }
|
||||
.satu-form__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-sm); }
|
||||
|
||||
.satu-dl { display: grid; gap: 0; margin: 0; }
|
||||
|
||||
+6
-2
@@ -844,6 +844,8 @@ Alpine.data('laporanReport', (config) => ({
|
||||
Alpine.data('satuRemoteTable', (config) => ({
|
||||
url: config.url,
|
||||
values: { ...config.filters },
|
||||
// Nilai bawaan filter dari server (dipakai load() untuk mengirim filter yang dikosongkan pengguna)
|
||||
defaults: { ...config.filters },
|
||||
q: '',
|
||||
per: config.data.per_page,
|
||||
page: config.data.page,
|
||||
@@ -991,8 +993,10 @@ Alpine.data('satuRemoteTable', (config) => ({
|
||||
const params = new URLSearchParams({ page: String(page), per: String(this.per) });
|
||||
if (this.q.trim() !== '') params.set('q', this.q.trim());
|
||||
Object.entries(this.values).forEach(([name, value]) => {
|
||||
// Kotak centang: hanya dikirim saat dicentang
|
||||
if (value === '' || value === null || value === false) return;
|
||||
// Kotak centang: hanya dikirim saat dicentang. Filter yang punya nilai bawaan tetap dikirim kosong saat
|
||||
// dikosongkan pengguna, agar server bisa membedakan "dikosongkan" (semua) dari "tidak dikirim" (bawaan).
|
||||
if (value === null || value === false) return;
|
||||
if (value === '' && (this.defaults[name] === '' || this.defaults[name] === false || this.defaults[name] === undefined)) return;
|
||||
params.set(name, value === true ? '1' : value);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{{-- Daftar berformat SATU dengan paginasi server (untuk data yang barisnya mahal dihitung): filter, cari, dan halaman lewat GET. --}}
|
||||
{{--
|
||||
Daftar berformat SATU dengan paginasi server (untuk data yang barisnya mahal dihitung): filter, cari, dan halaman lewat GET.
|
||||
Opsional: $perOptions (pilihan data per halaman, bawaan 10/25), $searchPlaceholder, filter bertipe 'date' atau 'hidden'
|
||||
(ikut terkirim tanpa ditampilkan) selain 'select'.
|
||||
--}}
|
||||
@php
|
||||
$query = request()->query('q');
|
||||
$query = is_string($query) ? $query : '';
|
||||
@@ -7,6 +11,9 @@
|
||||
$start = max(1, min($current - 2, $last - 4));
|
||||
$window = range($start, $start + min(5, $last) - 1);
|
||||
$per = $rows->perPage();
|
||||
$perOptions ??= [10, 25];
|
||||
$hiddenFilters = array_filter($filters, fn (array $f): bool => ($f['type'] ?? 'select') === 'hidden');
|
||||
$visibleFilters = array_filter($filters, fn (array $f): bool => ($f['type'] ?? 'select') !== 'hidden');
|
||||
@endphp
|
||||
|
||||
<x-layouts.app :title="$names['plural']">
|
||||
@@ -17,21 +24,36 @@
|
||||
|
||||
{{-- Kontrol memakai atribut form="satu-form" agar tabel (dengan tautan dan formulir aksi) tidak berada di dalam formulir pencarian. --}}
|
||||
<div class="stack" x-data x-on:change="$refs.satuForm.requestSubmit()">
|
||||
<form id="satu-form" x-ref="satuForm" method="GET" action="{{ url()->current() }}" role="search" aria-label="Pencarian dan filter"></form>
|
||||
<form id="satu-form" x-ref="satuForm" method="GET" action="{{ url()->current() }}" role="search" aria-label="Pencarian dan filter">
|
||||
@foreach ($hiddenFilters as $filter)
|
||||
<input type="hidden" name="{{ $filter['name'] }}" value="{{ request($filter['name']) }}">
|
||||
@endforeach
|
||||
</form>
|
||||
|
||||
@if ($filters)
|
||||
@if ($visibleFilters)
|
||||
<x-glass.panel padding="sm" as="section" aria-label="Filter data">
|
||||
<div class="filter-bar">
|
||||
@foreach ($filters as $filter)
|
||||
<x-form.select
|
||||
:name="$filter['name']"
|
||||
:label="$filter['label']"
|
||||
:options="$filter['options']"
|
||||
:value="request($filter['name'])"
|
||||
placeholder=""
|
||||
:id="'filter-'.$filter['name']"
|
||||
form="satu-form"
|
||||
/>
|
||||
@foreach ($visibleFilters as $filter)
|
||||
@if (($filter['type'] ?? 'select') === 'date')
|
||||
<x-form.field
|
||||
type="date"
|
||||
:name="$filter['name']"
|
||||
:label="$filter['label']"
|
||||
:value="request($filter['name'])"
|
||||
:id="'filter-'.$filter['name']"
|
||||
form="satu-form"
|
||||
/>
|
||||
@else
|
||||
<x-form.select
|
||||
:name="$filter['name']"
|
||||
:label="$filter['label']"
|
||||
:options="$filter['options']"
|
||||
:value="request($filter['name'])"
|
||||
placeholder=""
|
||||
:id="'filter-'.$filter['name']"
|
||||
form="satu-form"
|
||||
/>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
@@ -44,7 +66,7 @@
|
||||
<label class="visually-hidden" for="satu-q">Cari data</label>
|
||||
<div class="field__control">
|
||||
<span class="field__icon" aria-hidden="true"><x-heroicon-o-magnifying-glass /></span>
|
||||
<input id="satu-q" type="search" name="q" form="satu-form" value="{{ $query }}" class="field__input" style="--pad-start: 2.5rem" placeholder="Cari {{ Str::lower($names['plural']) }}" autocomplete="off" enterkeyhint="search">
|
||||
<input id="satu-q" type="search" name="q" form="satu-form" value="{{ $query }}" class="field__input" style="--pad-start: 2.5rem" placeholder="{{ $searchPlaceholder ?? 'Cari '.Str::lower($names['plural']) }}" autocomplete="off" enterkeyhint="search">
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -100,8 +122,9 @@
|
||||
<label class="satu-foot__per">
|
||||
<span class="visually-hidden">Jumlah data per halaman</span>
|
||||
<select name="per" form="satu-form" class="field__input field__select" data-no-clear>
|
||||
<option value="10" @selected($per === 10)>10 data</option>
|
||||
<option value="25" @selected($per === 25)>25 data</option>
|
||||
@foreach ($perOptions as $n)
|
||||
<option value="{{ $n }}" @selected($per === (int) $n)>{{ $n }} data</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
$onPage = request()->routeIs('operator.halaman');
|
||||
$slug = $onPage ? (string) request()->route('slug') : null;
|
||||
$trail = $slug ? \App\Support\Prototype\Satu\Catalog::trail($slug) : [];
|
||||
// Akun DB lama: hanya menu yang dipegang otoritasnya di SIAKAD lama (MenuAccess); akun demo melihat seluruh katalog.
|
||||
$account = auth()->user();
|
||||
$menu = $account instanceof \App\Models\Legacy\Account
|
||||
? app(\App\Support\Legacy\MenuAccess::class)->filterMenu(\App\Support\Prototype\Satu\Catalog::menu(), $account)
|
||||
: \App\Support\Prototype\Satu\Catalog::menu();
|
||||
@endphp
|
||||
|
||||
<x-nav.item :href="route('operator.dashboard')" :active="request()->routeIs('operator.dashboard')" icon="home">Beranda</x-nav.item>
|
||||
@@ -13,7 +18,7 @@
|
||||
<input id="menu-q" type="search" class="menu-filter__input" placeholder="Cari menu" autocomplete="off" x-model="q" x-on:input="find()">
|
||||
</div>
|
||||
|
||||
@foreach (\App\Support\Prototype\Satu\Catalog::menu() as $group)
|
||||
@foreach ($menu as $group)
|
||||
<x-nav.group :label="$group['label']" :icon="$group['icon']" :open="($trail[0] ?? null) === $group['label']">
|
||||
@foreach ($group['items'] as $item)
|
||||
@if ($item['type'] === 'link')
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
$editable ??= true;
|
||||
$ownRowsOnly ??= false;
|
||||
$viewable ??= true;
|
||||
// $barLinks (opsional): tautan tambahan di kanan bilah cari, [['label', 'href', 'icon']].
|
||||
$barLinks ??= [];
|
||||
// $detailColumns (opsional): kolom modal Lihat bila berbeda dari kolom tabel; kolom ber-'detail' => 'kunci' menampilkan
|
||||
// row.{kunci} (larik teks) sebagai daftar bernomor selebar modal, mis. anggota grup mata kuliah.
|
||||
$detailColumns ??= $columns;
|
||||
$destroy = ($destroy ?? []) + ['title' => 'Hapus data terpilih?', 'message' => 'Data yang dipilih akan dihapus.'];
|
||||
$allTools = [
|
||||
'T' => ['Tambah', 'plus', 'primary', 'startInsert()'],
|
||||
@@ -99,6 +104,9 @@
|
||||
</div>
|
||||
|
||||
<div class="satu-bar__tools">
|
||||
@foreach ($barLinks as $link)
|
||||
<x-ui.button variant="secondary" :icon="$link['icon'] ?? null" size="sm" :href="$link['href']">{{ $link['label'] }}</x-ui.button>
|
||||
@endforeach
|
||||
@foreach ($active as [$label, $icon, $variant, $click])
|
||||
<x-ui.button :variant="$variant" :icon="$icon" size="sm" x-on:click="{{ $click }}">{{ $label }}</x-ui.button>
|
||||
@endforeach
|
||||
@@ -202,12 +210,27 @@
|
||||
<x-ui.dialog-close />
|
||||
</div>
|
||||
<dl class="satu-form satu-detail">
|
||||
<template x-for="col in columns" x-bind:key="col.key">
|
||||
<div>
|
||||
<dt x-text="col.label"></dt>
|
||||
<dd x-text="viewing && viewing[col.key] !== null && viewing[col.key] !== '' && viewing[col.key] !== undefined ? viewing[col.key] : '-'"></dd>
|
||||
</div>
|
||||
</template>
|
||||
@foreach ($detailColumns as $column)
|
||||
@if ($column['detail'] ?? false)
|
||||
{{-- Rincian berupa daftar (row.{detail} = larik teks): selebar modal, satu butir per baris --}}
|
||||
<div class="satu-detail__wide">
|
||||
<dt>{{ $column['label'] }} <span x-text="viewing && Array.isArray(viewing.{{ $column['detail'] }}) && viewing.{{ $column['detail'] }}.length ? '(' + viewing.{{ $column['detail'] }}.length + ')' : ''"></span></dt>
|
||||
<dd>
|
||||
<ol class="satu-detail__list" x-show="viewing && Array.isArray(viewing.{{ $column['detail'] }}) && viewing.{{ $column['detail'] }}.length">
|
||||
<template x-for="(item, i) in (viewing && Array.isArray(viewing.{{ $column['detail'] }}) ? viewing.{{ $column['detail'] }} : [])" x-bind:key="i">
|
||||
<li x-text="item"></li>
|
||||
</template>
|
||||
</ol>
|
||||
<span x-show="!viewing || !Array.isArray(viewing.{{ $column['detail'] }}) || !viewing.{{ $column['detail'] }}.length">-</span>
|
||||
</dd>
|
||||
</div>
|
||||
@else
|
||||
<div>
|
||||
<dt>{{ $column['label'] }}</dt>
|
||||
<dd x-text="viewing && viewing.{{ $column['key'] }} !== null && viewing.{{ $column['key'] }} !== '' && viewing.{{ $column['key'] }} !== undefined ? viewing.{{ $column['key'] }} : '-'"></dd>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</dl>
|
||||
<div class="dialog__actions">
|
||||
<x-ui.button variant="secondary" x-on:click="$refs.detail.close()">Tutup</x-ui.button>
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
Superuser hanya mengelola sistem. Halaman akademik milik peran lain tetap tertutup bagi Superuser. Otoritas akun diatur dari halaman detail Pengguna.
|
||||
</x-ui.alert>
|
||||
|
||||
<x-glass.panel padding="none">
|
||||
<x-ui.table label="Daftar otoritas">
|
||||
<table class="table">
|
||||
{{-- Format tabel SATU (cari dan halaman di sisi klien) seperti daftar di halaman Operator. --}}
|
||||
<x-satu.datatable label="Daftar otoritas" placeholder="Cari otoritas atau peran" :per="25">
|
||||
<table class="table satu-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Otoritas</th>
|
||||
@@ -32,7 +32,6 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</x-ui.table>
|
||||
</x-glass.panel>
|
||||
</x-satu.datatable>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
|
||||
@@ -1,36 +1,47 @@
|
||||
@php
|
||||
// Akun DB lama: butir tanpa sumber data di DB lama (sesi aktif, pengaturan, cadangan, pengumuman) disembunyikan.
|
||||
// Akun DB lama: sidebar mengikuti struktur menu SIAKAD lama (t_menu) yang dipegang otoritas akun; hanya menu yang sudah
|
||||
// punya halaman (LegacyMenu::SUPERUSER) yang ditautkan. Akun demo: menu prototipe.
|
||||
$legacy = auth()->user() instanceof \App\Models\Legacy\Account;
|
||||
$tree = $legacy ? app(\App\Support\Legacy\LegacyMenu::class)->tree((int) auth()->id(), \App\Support\Legacy\LegacyMenu::SUPERUSER) : [];
|
||||
$icon = fn (string $title, string $fallback): string => \App\Support\Prototype\Satu\Catalog::icon($title, $fallback);
|
||||
@endphp
|
||||
|
||||
<x-nav.item :href="route('superuser.dashboard')" :active="request()->routeIs('superuser.dashboard')" icon="home">Dashboard</x-nav.item>
|
||||
|
||||
<x-nav.group label="Pengguna dan akses" icon="users" :open="request()->routeIs('superuser.pengguna*', 'superuser.reset-password*', 'superuser.hak-akses*', 'superuser.sesi-aktif')">
|
||||
<x-nav.item :href="route('superuser.pengguna.index')" :active="request()->routeIs('superuser.pengguna*')" icon="user-group">Pengguna</x-nav.item>
|
||||
<x-nav.item :href="route('superuser.reset-password')" :active="request()->routeIs('superuser.reset-password*')" icon="key">Atur ulang kata sandi</x-nav.item>
|
||||
<x-nav.item :href="route('superuser.hak-akses')" :active="request()->routeIs('superuser.hak-akses*')" icon="shield-check">Hak akses</x-nav.item>
|
||||
@unless ($legacy)
|
||||
@if ($legacy)
|
||||
@foreach ($tree as $module)
|
||||
<x-nav.group :label="$module['nama']" :icon="$module['icon']" :open="$module['open']">
|
||||
@foreach ($module['items'] as $item)
|
||||
@if (isset($item['items']))
|
||||
<x-nav.group :label="$item['nama']" :icon="$icon($item['nama'], $module['icon'])" class="nav-group--sub" :open="$item['open']">
|
||||
@foreach ($item['items'] as $link)
|
||||
<x-nav.item :href="$link['href']" :active="$link['active']" :icon="$icon($link['nama'], $module['icon'])">{{ $link['nama'] }}</x-nav.item>
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@else
|
||||
<x-nav.item :href="$item['href']" :active="$item['active']" :icon="$icon($item['nama'], $module['icon'])">{{ $item['nama'] }}</x-nav.item>
|
||||
@endif
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@endforeach
|
||||
@else
|
||||
<x-nav.group label="Pengguna dan akses" icon="users" :open="request()->routeIs('superuser.pengguna*', 'superuser.reset-password*', 'superuser.hak-akses*', 'superuser.sesi-aktif')">
|
||||
<x-nav.item :href="route('superuser.pengguna.index')" :active="request()->routeIs('superuser.pengguna*')" icon="user-group">Pengguna</x-nav.item>
|
||||
<x-nav.item :href="route('superuser.reset-password')" :active="request()->routeIs('superuser.reset-password*')" icon="key">Atur ulang kata sandi</x-nav.item>
|
||||
<x-nav.item :href="route('superuser.hak-akses')" :active="request()->routeIs('superuser.hak-akses*')" icon="shield-check">Hak akses</x-nav.item>
|
||||
<x-nav.item :href="route('superuser.sesi-aktif')" :active="request()->routeIs('superuser.sesi-aktif')" icon="finger-print">Sesi aktif</x-nav.item>
|
||||
@endunless
|
||||
</x-nav.group>
|
||||
</x-nav.group>
|
||||
|
||||
<x-nav.group label="Sistem" icon="cog-6-tooth" :open="request()->routeIs('superuser.pengaturan*', 'superuser.periode*', 'superuser.log-aktivitas*', 'superuser.cadangan*', 'superuser.kesehatan-sistem')">
|
||||
@if ($legacy)
|
||||
<x-nav.item :href="route('superuser.periode')" :active="request()->routeIs('superuser.periode*')" icon="calendar-days">Periode akademik</x-nav.item>
|
||||
@else
|
||||
<x-nav.group label="Sistem" icon="cog-6-tooth" :open="request()->routeIs('superuser.pengaturan*', 'superuser.log-aktivitas*', 'superuser.cadangan*', 'superuser.kesehatan-sistem')">
|
||||
<x-nav.item :href="route('superuser.pengaturan')" :active="request()->routeIs('superuser.pengaturan*')" icon="cog-6-tooth">Pengaturan</x-nav.item>
|
||||
@endif
|
||||
<x-nav.item :href="route('superuser.log-aktivitas.index')" :active="request()->routeIs('superuser.log-aktivitas*')" icon="clipboard-document-list">Log aktivitas</x-nav.item>
|
||||
@unless ($legacy)
|
||||
<x-nav.item :href="route('superuser.log-aktivitas.index')" :active="request()->routeIs('superuser.log-aktivitas*')" icon="clipboard-document-list">Log aktivitas</x-nav.item>
|
||||
<x-nav.item :href="route('superuser.cadangan')" :active="request()->routeIs('superuser.cadangan*')" icon="circle-stack">Cadangan data</x-nav.item>
|
||||
@endunless
|
||||
<x-nav.item :href="route('superuser.kesehatan-sistem')" :active="request()->routeIs('superuser.kesehatan-sistem')" icon="server-stack">Kesehatan sistem</x-nav.item>
|
||||
</x-nav.group>
|
||||
<x-nav.item :href="route('superuser.kesehatan-sistem')" :active="request()->routeIs('superuser.kesehatan-sistem')" icon="server-stack">Kesehatan sistem</x-nav.item>
|
||||
</x-nav.group>
|
||||
|
||||
<x-nav.group label="Informasi" icon="megaphone" :open="request()->routeIs('pengumuman.*', 'kalender.*', 'akun.*')">
|
||||
@unless ($legacy)
|
||||
<x-nav.group label="Informasi" icon="megaphone" :open="request()->routeIs('pengumuman.*', 'kalender.*', 'akun.*')">
|
||||
<x-nav.item :href="route('pengumuman.index')" :active="request()->routeIs('pengumuman.*')" icon="megaphone">Pengumuman</x-nav.item>
|
||||
@endunless
|
||||
<x-nav.item :href="route('kalender.index')" :active="request()->routeIs('kalender.*')" icon="calendar-days">Kalender akademik</x-nav.item>
|
||||
<x-nav.item :href="route('akun.profil')" :active="request()->routeIs('akun.*')" icon="user-circle">Profil saya</x-nav.item>
|
||||
</x-nav.group>
|
||||
<x-nav.item :href="route('kalender.index')" :active="request()->routeIs('kalender.*')" icon="calendar-days">Kalender akademik</x-nav.item>
|
||||
<x-nav.item :href="route('akun.profil')" :active="request()->routeIs('akun.*')" icon="user-circle">Profil saya</x-nav.item>
|
||||
</x-nav.group>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user