[Operator] Pembaruan Laman Operator
This commit is contained in:
@@ -557,6 +557,60 @@ tbody > tr[hidden] { display: none; }
|
||||
.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; }
|
||||
/* Panel judul modal Lihat: kolom biasa dikumpulkan di satu kotak di atas rincian */
|
||||
.satu-detail__head {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
gap: var(--space-sm) var(--space-md);
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
border: var(--rule-hair) solid var(--color-rule);
|
||||
border-radius: var(--radius-inner);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
/* Rincian berupa tabel di modal Lihat (mis. anggota kelompok MK): ringkas, bergaris penuh, kolom sejajar antar kelompok */
|
||||
.satu-detail__table {
|
||||
margin-top: var(--space-2xs);
|
||||
border: var(--rule-hair) solid var(--color-rule);
|
||||
border-radius: var(--radius-control);
|
||||
overflow: hidden;
|
||||
}
|
||||
.satu-detail__table .table { table-layout: fixed; border-collapse: collapse; }
|
||||
.satu-detail__table .table th,
|
||||
.satu-detail__table .table td {
|
||||
white-space: nowrap;
|
||||
border: var(--rule-hair) solid var(--color-rule);
|
||||
}
|
||||
.satu-detail__table .table th { background: var(--color-surface); }
|
||||
.satu-detail__table .table tr > :first-child { border-inline-start: 0; }
|
||||
.satu-detail__table .table tr > :last-child { border-inline-end: 0; }
|
||||
.satu-detail__table .table thead tr > * { border-block-start: 0; }
|
||||
.satu-detail__table .table tbody tr:last-child > * { border-block-end: 0; }
|
||||
/* Kolom pertama (kode) dan kolom angka berlebar tetap agar sejajar antar tabel; kolom nama mengisi sisanya dan boleh membungkus */
|
||||
.satu-detail__table .table th:first-child, .satu-detail__table .table td:first-child { width: 8.5rem; }
|
||||
.satu-detail__table .table th.num, .satu-detail__table .table td.num { width: 6.5rem; }
|
||||
.satu-detail__table .table th:first-child.num, .satu-detail__table .table td:first-child.num { width: 5.5rem; }
|
||||
.satu-detail__table .table td:not(.num):not(:first-child) { white-space: normal; overflow-wrap: anywhere; }
|
||||
/* Rincian berkelompok di modal Lihat (mis. ruangan per lantai): judul kelompok + jumlah, lalu butir sebagai chip */
|
||||
.satu-detail__groups { display: grid; gap: var(--space-sm); }
|
||||
.satu-detail__group-title { margin: 0 0 var(--space-2xs); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
|
||||
.satu-detail__group-count { font-weight: 400; color: var(--color-muted); }
|
||||
.satu-detail__group-count::before { content: "("; }
|
||||
.satu-detail__group-count::after { content: ")"; }
|
||||
.satu-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
|
||||
.satu-chip {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 0.4em;
|
||||
padding: 0.15rem 0.6rem;
|
||||
border: var(--rule-hair) solid var(--color-rule);
|
||||
border-radius: 999px;
|
||||
background: var(--color-surface);
|
||||
font-size: var(--text-sm);
|
||||
line-height: 1.4;
|
||||
color: var(--color-ink-2);
|
||||
}
|
||||
.satu-chip__meta { 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; }
|
||||
|
||||
@@ -380,6 +380,31 @@ a.pager__link:active { background: color-mix(in oklab, var(--color-ink) 12%, tra
|
||||
|
||||
.dialog__body > :not(.dialog__head, .dialog__actions) { padding: var(--space-md) var(--space-lg); }
|
||||
|
||||
/*
|
||||
* Semua dialog: header dan footer tetap terlihat, hanya isinya yang bergulir (bilah gulir tipis). Dropdown Select2
|
||||
* menempel di elemen dialog (bukan di isi), jadi tidak terpotong oleh isi yang bergulir; dialog ber-Select2 tetap
|
||||
* overflow visible (aturan di atas) agar dropdown boleh keluar dari tepi dialog.
|
||||
*/
|
||||
.dialog:not(:has(select.field__select)) { overflow: hidden; }
|
||||
.dialog__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: calc(100dvh - 2 * var(--gutter));
|
||||
}
|
||||
.dialog__body > .dialog__head,
|
||||
.dialog__body > .dialog__actions { flex-shrink: 0; }
|
||||
.dialog__body > :not(.dialog__head, .dialog__actions) {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--color-rule) transparent;
|
||||
}
|
||||
.dialog__body > :not(.dialog__head, .dialog__actions)::-webkit-scrollbar { width: 0.375rem; height: 0.375rem; }
|
||||
.dialog__body > :not(.dialog__head, .dialog__actions)::-webkit-scrollbar-thumb { background: var(--color-rule); border-radius: var(--radius-pill); }
|
||||
.dialog__body > :not(.dialog__head, .dialog__actions)::-webkit-scrollbar-track { background: transparent; }
|
||||
|
||||
.dialog__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
+20
-2
@@ -989,8 +989,9 @@ Alpine.data('satuRemoteTable', (config) => ({
|
||||
if (next !== this.page) this.load(next);
|
||||
},
|
||||
|
||||
async load(page) {
|
||||
const params = new URLSearchParams({ page: String(page), per: String(this.per) });
|
||||
// Filter dan kata cari yang sedang dipakai sebagai parameter query (tanpa halaman)
|
||||
queryParams() {
|
||||
const params = new URLSearchParams();
|
||||
if (this.q.trim() !== '') params.set('q', this.q.trim());
|
||||
Object.entries(this.values).forEach(([name, value]) => {
|
||||
// Kotak centang: hanya dikirim saat dicentang. Filter yang punya nilai bawaan tetap dikirim kosong saat
|
||||
@@ -999,6 +1000,19 @@ Alpine.data('satuRemoteTable', (config) => ({
|
||||
if (value === '' && (this.defaults[name] === '' || this.defaults[name] === false || this.defaults[name] === undefined)) return;
|
||||
params.set(name, value === true ? '1' : value);
|
||||
});
|
||||
return params;
|
||||
},
|
||||
|
||||
// Tautan yang membawa filter dan kata cari saat ini (mis. Unduh CSV)
|
||||
linkWith(url) {
|
||||
const query = this.queryParams().toString();
|
||||
return query === '' ? url : `${url}${url.includes('?') ? '&' : '?'}${query}`;
|
||||
},
|
||||
|
||||
async load(page) {
|
||||
const params = this.queryParams();
|
||||
params.set('page', String(page));
|
||||
params.set('per', String(this.per));
|
||||
|
||||
// Permintaan lama dibatalkan agar hasil yang terlambat tidak menimpa yang terbaru
|
||||
this.controller?.abort();
|
||||
@@ -1018,6 +1032,10 @@ Alpine.data('satuRemoteTable', (config) => ({
|
||||
}
|
||||
|
||||
Object.assign(this, { view: data.rows, page: data.page, pages: data.last_page, total: data.total, per: data.per_page });
|
||||
// Kolom dinamis (laporan): kepala tabel mengikuti kolom hasil terbaru
|
||||
if (Array.isArray(data.columns) && data.columns.length) {
|
||||
this.columns = data.columns.map((c) => ({ key: c.key, label: c.label, num: Boolean(c.num) }));
|
||||
}
|
||||
this.picked = [];
|
||||
console.info(`[SIAKAD] GET ${this.url}?${params}`, { total: data.total, halaman: `${data.page}/${data.last_page}`, waktu: `${Math.round(performance.now() - started)} ms` });
|
||||
// Halaman terakhir baru saja kosong (mis. setelah hapus): pindah ke halaman terakhir yang masih ada
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{{--
|
||||
Satu simpul pohon menu SIAKAD lama milik akun operator (LegacyMenu::tree dengan MenuAccess::menuRoutes): tautan (<x-nav.item>)
|
||||
atau subgrup (<x-nav.group>) yang memanggil dirinya sendiri untuk anak-anaknya. $node = simpul, $fallback = ikon modul.
|
||||
--}}
|
||||
@php
|
||||
$iconFor = fn (string $title): string => \App\Support\Prototype\Satu\Catalog::icon($title, $fallback);
|
||||
@endphp
|
||||
|
||||
@if (isset($node['items']))
|
||||
<x-nav.group :label="$node['nama']" :icon="$iconFor($node['nama'])" class="nav-group--sub" :open="$node['open']">
|
||||
@foreach ($node['items'] as $child)
|
||||
@include('operator.partials.menu-legacy-node', ['node' => $child, 'fallback' => $fallback])
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@else
|
||||
<x-nav.item data-menu :href="$node['href']" :active="$node['active']" :icon="$iconFor($node['nama'])">{{ $node['nama'] }}</x-nav.item>
|
||||
@endif
|
||||
@@ -2,11 +2,12 @@
|
||||
$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.
|
||||
// Akun DB lama: sidebar = struktur menu SIAKAD lama (t_menu) yang dipegang otoritas akun operator ini sendiri
|
||||
// (t_otoritasuser → t_menuotoritas); tiap menu lama menautkan halaman Operator (MenuAccess::menuRoutes, terpisah dari
|
||||
// pemetaan Superuser). Akun demo: katalog SATU (menu.txt).
|
||||
$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();
|
||||
$legacy = $account instanceof \App\Models\Legacy\Account;
|
||||
$tree = $legacy ? app(\App\Support\Legacy\LegacyMenu::class)->tree((int) $account->getKey(), \App\Support\Legacy\MenuAccess::menuRoutes()) : [];
|
||||
@endphp
|
||||
|
||||
<x-nav.item :href="route('operator.dashboard')" :active="request()->routeIs('operator.dashboard')" icon="home">Beranda</x-nav.item>
|
||||
@@ -18,18 +19,28 @@
|
||||
<input id="menu-q" type="search" class="menu-filter__input" placeholder="Cari menu" autocomplete="off" x-model="q" x-on:input="find()">
|
||||
</div>
|
||||
|
||||
@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')
|
||||
<x-nav.item data-menu :href="route('operator.halaman', $item['slug'])" :active="$slug === $item['slug']" :icon="\App\Support\Prototype\Satu\Catalog::icon($item['title'], $group['icon'])">{{ $item['title'] }}</x-nav.item>
|
||||
@else
|
||||
<x-nav.group :label="$item['label']" :icon="\App\Support\Prototype\Satu\Catalog::icon($item['label'], $group['icon'])" class="nav-group--sub" :open="($trail[1] ?? null) === $item['label'] && ($trail[0] ?? null) === $group['label']">
|
||||
@foreach ($item['items'] as $link)
|
||||
<x-nav.item data-menu :href="route('operator.halaman', $link['slug'])" :active="$slug === $link['slug']" :icon="\App\Support\Prototype\Satu\Catalog::icon($link['title'], $group['icon'])">{{ $link['title'] }}</x-nav.item>
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@endif
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@endforeach
|
||||
@if ($legacy)
|
||||
@foreach ($tree as $module)
|
||||
<x-nav.group :label="$module['nama']" :icon="$module['icon']" :open="$module['open']">
|
||||
@foreach ($module['items'] as $node)
|
||||
@include('operator.partials.menu-legacy-node', ['node' => $node, 'fallback' => $module['icon']])
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@endforeach
|
||||
@else
|
||||
@foreach (\App\Support\Prototype\Satu\Catalog::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')
|
||||
<x-nav.item data-menu :href="route('operator.halaman', $item['slug'])" :active="$slug === $item['slug']" :icon="\App\Support\Prototype\Satu\Catalog::icon($item['title'], $group['icon'])">{{ $item['title'] }}</x-nav.item>
|
||||
@else
|
||||
<x-nav.group :label="$item['label']" :icon="\App\Support\Prototype\Satu\Catalog::icon($item['label'], $group['icon'])" class="nav-group--sub" :open="($trail[1] ?? null) === $item['label'] && ($trail[0] ?? null) === $group['label']">
|
||||
@foreach ($item['items'] as $link)
|
||||
<x-nav.item data-menu :href="route('operator.halaman', $link['slug'])" :active="$slug === $link['slug']" :icon="\App\Support\Prototype\Satu\Catalog::icon($link['title'], $group['icon'])">{{ $link['title'] }}</x-nav.item>
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@endif
|
||||
@endforeach
|
||||
</x-nav.group>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
// $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;
|
||||
// $searchable (opsional, bawaan true): false = tanpa kotak cari (mis. laporan yang sumbernya tidak mengenal kata cari).
|
||||
$searchable ??= true;
|
||||
// $columns kosong = kolom dinamis: kepala dan sel tabel dirender Alpine dari data.columns JSON ({key, label, num}).
|
||||
$dynamicColumns = $columns === [];
|
||||
$destroy = ($destroy ?? []) + ['title' => 'Hapus data terpilih?', 'message' => 'Data yang dipilih akan dihapus.'];
|
||||
$allTools = [
|
||||
'T' => ['Tambah', 'plus', 'primary', 'startInsert()'],
|
||||
@@ -60,7 +64,10 @@
|
||||
'viewUrl' => $viewUrl,
|
||||
'destroyUrl' => $destroyUrl,
|
||||
'form' => $form ? ['withFilters' => $form['withFilters'] ?? [], 'cascades' => collect($form['fields'])->filter(fn (array $f): bool => isset($f['dependsOn']))->map(fn (array $f): array => ['field' => $f['name'], 'parent' => $f['dependsOn'], 'options' => $f['optionsBy'], 'emptyHint' => $f['emptyHint'] ?? null, 'label' => mb_strtolower($f['label']), 'parentLabel' => mb_strtolower((string) collect($form['fields'])->firstWhere('name', $f['dependsOn'])['label'])])->values()->all(), 'storeUrl' => $form['storeUrl'], 'updateUrl' => $form['updateUrl'] ?? null, 'fields' => array_map(fn (array $f): array => ['name' => $f['name'], 'default' => $f['default'] ?? (($f['multiple'] ?? false) ? [] : '')], $form['fields'])] : null,
|
||||
'columns' => collect($columns)->map(fn (array $c): array => ['key' => $c['key'], 'label' => $c['label']])->values()->all(),
|
||||
// Kolom dinamis: kolom awal dari data halaman pertama agar render awal langsung punya kepala dan sel
|
||||
'columns' => $dynamicColumns
|
||||
? collect($data['columns'] ?? [])->map(fn (array $c): array => ['key' => $c['key'], 'label' => $c['label'], 'num' => (bool) ($c['num'] ?? false)])->values()->all()
|
||||
: collect($columns)->map(fn (array $c): array => ['key' => $c['key'], 'label' => $c['label']])->values()->all(),
|
||||
'token' => csrf_token(),
|
||||
];
|
||||
@endphp
|
||||
@@ -77,6 +84,18 @@
|
||||
x-model="values.{{ $filter['name'] }}"
|
||||
x-on:change="search()"
|
||||
/>
|
||||
@elseif (in_array($filter['type'] ?? 'select', ['text', 'number', 'date'], true))
|
||||
{{-- Isian bebas (teks NIM/nama, angka, tanggal): menyaring setelah jeda ketik --}}
|
||||
<x-form.field
|
||||
:type="$filter['type']"
|
||||
:name="'filter_'.$filter['name']"
|
||||
:label="$filter['label']"
|
||||
:placeholder="$filter['placeholder'] ?? null"
|
||||
:hint="$filter['hint'] ?? null"
|
||||
x-model="values.{{ $filter['name'] }}"
|
||||
x-on:input.debounce.500ms="search()"
|
||||
x-on:change="search()"
|
||||
/>
|
||||
@else
|
||||
<x-form.select
|
||||
:name="'filter_'.$filter['name']"
|
||||
@@ -95,6 +114,7 @@
|
||||
|
||||
<x-glass.panel padding="none" as="section" :aria-label="'Daftar '.$page['title']">
|
||||
<div class="satu-bar">
|
||||
@if ($searchable)
|
||||
<div class="satu-bar__search field">
|
||||
<label class="visually-hidden" for="satu-q">Cari data</label>
|
||||
<div class="field__control">
|
||||
@@ -102,10 +122,18 @@
|
||||
<input id="satu-q" type="search" class="field__input" style="--pad-start: 2.5rem" placeholder="Cari {{ Str::lower($page['title']) }}" autocomplete="off" x-model="q" x-on:input.debounce.400ms="search()">
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="satu-bar__search"></div>
|
||||
@endif
|
||||
|
||||
<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>
|
||||
@if ($link['withFilters'] ?? false)
|
||||
{{-- Tautan yang membawa filter dan kata cari yang sedang dipakai (mis. Unduh CSV) --}}
|
||||
<a class="btn btn--secondary btn--sm" x-bind:href="linkWith(@js($link['href']))"><x-dynamic-component :component="'heroicon-o-'.($link['icon'] ?? 'link')" /><span>{{ $link['label'] }}</span></a>
|
||||
@else
|
||||
<x-ui.button variant="secondary" :icon="$link['icon'] ?? null" size="sm" :href="$link['href']">{{ $link['label'] }}</x-ui.button>
|
||||
@endif
|
||||
@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>
|
||||
@@ -120,6 +148,11 @@
|
||||
@if ($checkbox)
|
||||
<th scope="col" class="satu-check"><input type="checkbox" class="check__input" aria-label="Pilih semua baris di halaman ini" x-bind:checked="allPicked" x-on:change="toggleAll()"></th>
|
||||
@endif
|
||||
@if ($dynamicColumns)
|
||||
<template x-for="col in columns" x-bind:key="col.key">
|
||||
<th scope="col" x-bind:class="col.num ? 'num' : ''" x-text="col.label"></th>
|
||||
</template>
|
||||
@endif
|
||||
@foreach ($columns as $column)
|
||||
<th scope="col" @class(['num' => $column['num'] ?? false])>{{ $column['label'] }}</th>
|
||||
@endforeach
|
||||
@@ -131,6 +164,11 @@
|
||||
<tbody>
|
||||
<template x-for="row in view" x-bind:key="row.id">
|
||||
<tr>
|
||||
@if ($dynamicColumns)
|
||||
<template x-for="(col, ci) in columns" x-bind:key="col.key">
|
||||
<td x-bind:class="{ num: col.num, table__title: ci === 0 }" x-text="row[col.key] === null || row[col.key] === undefined || row[col.key] === '' ? '-' : row[col.key]"></td>
|
||||
</template>
|
||||
@endif
|
||||
@if ($checkbox)
|
||||
<td class="satu-check">
|
||||
@if ($ownRowsOnly)
|
||||
@@ -209,18 +247,113 @@
|
||||
<p id="satu-detail-judul" class="dialog__title">Detail {{ Str::lower($page['title']) }}</p>
|
||||
<x-ui.dialog-close />
|
||||
</div>
|
||||
@php
|
||||
// Modal Lihat: kolom biasa dikumpulkan di panel judul, kolom rincian (daftar/kelompok/tabel) di bawahnya.
|
||||
$detailScalar = array_values(array_filter($detailColumns, fn (array $c): bool => ! ($c['detail'] ?? false)));
|
||||
$detailRich = array_values(array_filter($detailColumns, fn (array $c): bool => (bool) ($c['detail'] ?? false)));
|
||||
@endphp
|
||||
<dl class="satu-form satu-detail">
|
||||
@foreach ($detailColumns as $column)
|
||||
@if ($column['detail'] ?? false)
|
||||
@if ($detailRich !== [] && $detailScalar !== [])
|
||||
<div class="satu-detail__head">
|
||||
@foreach ($detailScalar as $column)
|
||||
<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>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@foreach ($detailRich !== [] && $detailScalar !== [] ? $detailRich : $detailColumns as $column)
|
||||
@if (($column['detail'] ?? false) && ($column['table'] ?? false) && ($column['grouped'] ?? false))
|
||||
{{-- Rincian berkelompok, tiap kelompok satu tabel (row.{detail} = [{judul, jumlah, baris: [objek]}]; 'table' = kolom) --}}
|
||||
@php $d = 'viewing.'.$column['detail']; @endphp
|
||||
<div class="satu-detail__wide">
|
||||
<dt>{{ $column['label'] }} <span x-text="viewing && Array.isArray({{ $d }}) && {{ $d }}.length ? '(' + {{ $d }}.reduce((n, g) => n + (Array.isArray(g.baris) ? g.baris.length : 0), 0) + ')' : ''"></span></dt>
|
||||
<dd>
|
||||
<div class="satu-detail__groups" x-show="viewing && Array.isArray({{ $d }}) && {{ $d }}.length">
|
||||
<template x-for="(group, gi) in (viewing && Array.isArray({{ $d }}) ? {{ $d }} : [])" x-bind:key="gi">
|
||||
<section class="satu-detail__group">
|
||||
<p class="satu-detail__group-title"><span x-text="group.judul"></span> <span class="satu-detail__group-count" x-text="group.jumlah"></span></p>
|
||||
<div class="table-wrap satu-detail__table">
|
||||
<table class="table table--compact">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach ($column['table'] as $tc)
|
||||
<th scope="col" @class(['num' => $tc['num'] ?? false])>{{ $tc['label'] }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="(item, i) in (Array.isArray(group.baris) ? group.baris : [])" x-bind:key="i">
|
||||
<tr>
|
||||
@foreach ($column['table'] as $tc)
|
||||
<td @class(['num' => $tc['num'] ?? false])><span x-text="item.{{ $tc['key'] }} === null || item.{{ $tc['key'] }} === undefined || item.{{ $tc['key'] }} === '' ? '-' : item.{{ $tc['key'] }}"></span></td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
<span x-show="!viewing || !Array.isArray({{ $d }}) || !{{ $d }}.length">-</span>
|
||||
</dd>
|
||||
</div>
|
||||
@elseif (($column['detail'] ?? false) && ($column['table'] ?? false))
|
||||
{{-- Rincian berupa tabel (row.{detail} = larik objek; 'table' = kolom [{key, label, num}]) --}}
|
||||
<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>
|
||||
<div class="table-wrap satu-detail__table" x-show="viewing && Array.isArray(viewing.{{ $column['detail'] }}) && viewing.{{ $column['detail'] }}.length">
|
||||
<table class="table table--compact">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach ($column['table'] as $tc)
|
||||
<th scope="col" @class(['num' => $tc['num'] ?? false])>{{ $tc['label'] }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="(item, i) in (viewing && Array.isArray(viewing.{{ $column['detail'] }}) ? viewing.{{ $column['detail'] }} : [])" x-bind:key="i">
|
||||
<tr>
|
||||
@foreach ($column['table'] as $tc)
|
||||
<td @class(['num' => $tc['num'] ?? false])><span x-text="item.{{ $tc['key'] }} === null || item.{{ $tc['key'] }} === undefined || item.{{ $tc['key'] }} === '' ? '-' : item.{{ $tc['key'] }}"></span></td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span x-show="!viewing || !Array.isArray(viewing.{{ $column['detail'] }}) || !viewing.{{ $column['detail'] }}.length">-</span>
|
||||
</dd>
|
||||
</div>
|
||||
@elseif ($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>
|
||||
@if ($column['grouped'] ?? false)
|
||||
{{-- Kelompok (row.{detail} = [{judul, jumlah, butir: [{nama, meta}]}]): judul kelompok lalu butir sebagai chip --}}
|
||||
<div class="satu-detail__groups" x-show="viewing && Array.isArray(viewing.{{ $column['detail'] }}) && viewing.{{ $column['detail'] }}.length">
|
||||
<template x-for="(group, i) in (viewing && Array.isArray(viewing.{{ $column['detail'] }}) ? viewing.{{ $column['detail'] }} : [])" x-bind:key="i">
|
||||
<section class="satu-detail__group">
|
||||
<p class="satu-detail__group-title"><span x-text="group.judul"></span> <span class="satu-detail__group-count" x-text="group.jumlah"></span></p>
|
||||
<ul class="satu-chips">
|
||||
<template x-for="(chip, j) in group.butir" x-bind:key="j">
|
||||
<li class="satu-chip"><span x-text="chip.nama"></span><span class="satu-chip__meta" x-show="chip.meta" x-text="chip.meta"></span></li>
|
||||
</template>
|
||||
</ul>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
@else
|
||||
<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>
|
||||
@endif
|
||||
<span x-show="!viewing || !Array.isArray(viewing.{{ $column['detail'] }}) || !viewing.{{ $column['detail'] }}.length">-</span>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user