[Superuser] Integrasi Pertama ke Database
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
<x-glass.panel as="section" padding="md" aria-label="Filter beranda">
|
||||
<form method="GET" action="{{ route('operator.dashboard') }}" class="beranda-filter" x-data x-on:change="$el.requestSubmit()">
|
||||
<x-form.select name="periode" label="Periode akademik" :options="$periods" :value="$periode" data-no-clear />
|
||||
<x-form.select name="periode" label="Periode akademik" :options="$periods" :value="$periode" />
|
||||
<x-form.select name="prodi" label="Program studi" :options="$programs" :value="$prodi" placeholder="Semua program studi" />
|
||||
<noscript><x-ui.button type="submit" variant="secondary">Tampilkan</x-ui.button></noscript>
|
||||
</form>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
$editable (false = tanpa aksi Ubah di baris; $form hanya untuk Tambah),
|
||||
$viewable (false = tanpa aksi Lihat dan modal detail di baris),
|
||||
kolom 'swatch' => true (kotak warna + kode dari row.{key}), isian form type 'color' (pemilih warna + kode heksa), dan
|
||||
isian 'wide' => true (selebar penuh baris), select 'tags' => true (daftar yang bisa dicari sekaligus boleh membuat nilai baru dengan mengetik; nilai = teks) serta
|
||||
isian select bertingkat 'dependsOn' => nama isian induk + 'optionsBy' => [nilai induk => [[nilai, label], ...]] (pilihan
|
||||
dibangun ulang saat induk berubah; 'search' => true selalu menampilkan kolom cari; 'emptyHint' teks bila induk terpilih tapi tak ada pilihan), isian 'wide' => true (selebar penuh baris), select 'tags' => true (daftar yang bisa dicari sekaligus boleh membuat nilai baru dengan mengetik; nilai = teks) serta
|
||||
'placeholder' (teks placeholder select),
|
||||
$ownRowsOnly (true = kotak centang dan Hapus per baris hanya pada baris yang membawa row.form; baris lain hanya dibaca),
|
||||
$viewUrl (aksi Lihat, "__ID__" diganti row.id), $destroyUrl + $destroy['title'|'message'] (Hapus sungguhan
|
||||
@@ -53,7 +54,7 @@
|
||||
'ownRowsOnly' => $ownRowsOnly,
|
||||
'viewUrl' => $viewUrl,
|
||||
'destroyUrl' => $destroyUrl,
|
||||
'form' => $form ? ['withFilters' => $form['withFilters'] ?? [], '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,
|
||||
'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(),
|
||||
'token' => csrf_token(),
|
||||
];
|
||||
@@ -218,7 +219,7 @@
|
||||
@if ($form)
|
||||
{{-- Modal formulir tambah/ubah: kolom menurut $form['fields'], nilai di formData --}}
|
||||
<dialog x-ref="form" class="dialog dialog--wide" aria-labelledby="satu-form-judul" x-on:click="formBackdrop($event)" x-on:close="setTimeout(() => $refs.form.open || (editing = null), 300)">
|
||||
<form class="dialog__body" x-on:submit.prevent="save()" novalidate>
|
||||
<form class="dialog__body" x-on:submit.prevent="save()" x-effect="syncCascades()" novalidate>
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-pencil-square /></span>
|
||||
<p id="satu-form-judul" class="dialog__title" x-text="editing === 'new' ? 'Tambah {{ $form['title'] }}' : 'Ubah {{ $form['title'] }}'"></p>
|
||||
@@ -233,13 +234,14 @@
|
||||
<x-form.select
|
||||
:name="'form_'.$f['name']"
|
||||
:label="$f['label']"
|
||||
:options="$f['options']"
|
||||
:options="isset($f['dependsOn']) ? [] : $f['options']"
|
||||
:optional="! ($f['required'] ?? false)"
|
||||
:hint="$f['hint'] ?? null"
|
||||
placeholder=""
|
||||
:required="$f['required'] ?? false"
|
||||
:multiple="$f['multiple'] ?? false"
|
||||
:data-tags="! empty($f['tags']) ? 'true' : null"
|
||||
:data-search="! empty($f['search']) ? 'true' : null"
|
||||
:data-placeholder="$f['placeholder'] ?? null"
|
||||
x-model="formData.{{ $f['name'] }}"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user