[Operator] Perbaikan Laman Portal -> Konsultasi

This commit is contained in:
Ariyutta
2026-11-11 09:28:34 +07:00
parent 52d49cdb41
commit d6425a601d
19 changed files with 1134 additions and 301 deletions
@@ -5,6 +5,7 @@
columns: [['key', 'label', 'num' => bool, 'badge' => bool]]; kolom badge memakai row.{key} dan nada row.tone.
filters: [['name', 'label', 'options' => [], 'value' => bawaan]] atau ['name', 'label', 'type' => 'check'].
Opsional: $tools (kunci tombol bilah yang boleh tampil, [] = tanpa tombol), $selectable (false = tanpa kotak centang),
$editable (false = tanpa aksi Ubah di baris; $form hanya untuk Tambah),
$viewUrl (aksi Lihat, "__ID__" diganti row.id), $destroyUrl + $destroy['title'|'message'] (Hapus sungguhan
lewat POST {ids}); $form = ['title', 'storeUrl', 'updateUrl' ("__ID__"), 'fields' => [['name', 'label', 'type' =>
text|number|date|select, 'options', 'required', 'max', 'min', 'hint', 'multiple', 'default']]] untuk Tambah/Ubah lewat
@@ -16,6 +17,7 @@
$destroyUrl ??= null;
$form ??= null;
$selectable ??= true;
$editable ??= true;
$destroy = ($destroy ?? []) + ['title' => 'Hapus data terpilih?', 'message' => 'Data yang dipilih akan dihapus.'];
$allTools = [
'T' => ['Tambah', 'plus', 'primary', 'startInsert()'],
@@ -43,7 +45,7 @@
'data' => $data,
'viewUrl' => $viewUrl,
'destroyUrl' => $destroyUrl,
'form' => $form ? ['storeUrl' => $form['storeUrl'], 'updateUrl' => $form['updateUrl'], 'fields' => array_map(fn (array $f): array => ['name' => $f['name'], 'default' => $f['default'] ?? (($f['multiple'] ?? false) ? [] : '')], $form['fields'])] : null,
'form' => $form ? ['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(),
];
@@ -129,7 +131,7 @@
@else
<x-ui.button variant="ghost" size="sm" icon="eye" :icon-only="true" aria-label="Lihat" x-on:click="startView(row)" />
@endif
@if ($form)
@if ($form && $editable)
<template x-if="row.form">
<x-ui.button variant="ghost" size="sm" icon="pencil-square" :icon-only="true" aria-label="Ubah" x-on:click="startEdit(row)" />
</template>