Integrasi Menu Laporan Operator
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support\Legacy;
|
||||
|
||||
/**
|
||||
* Penulis Data Pelengkap (tambah/ubah/hapus tabel referensi DB lama). Satu penulis melayani beberapa slug SATU.
|
||||
* Kesalahan bisnis (duplikat, masih dirujuk, induk tidak valid) dilempar sebagai PortalException berpesan Indonesia
|
||||
* yang langsung ditampilkan ke operator; kesalahan lain dibiarkan naik.
|
||||
*/
|
||||
interface ReferenceWriter
|
||||
{
|
||||
/** @return list<string> slug yang dilayani */
|
||||
public function slugs(): array;
|
||||
|
||||
/** @return array{create: bool, update: bool, delete: bool} */
|
||||
public function abilities(string $slug): array;
|
||||
|
||||
/**
|
||||
* Definisi formulir modal (format remote-list): ['title' => 'pekerjaan', 'fields' => [['name', 'label', 'type' =>
|
||||
* text|number|select, 'options' => [id => label], 'required', 'max', 'min', 'hint', 'default']]].
|
||||
*
|
||||
* @return array{title: string, fields: list<array<string, mixed>>}
|
||||
*/
|
||||
public function form(string $slug): array;
|
||||
|
||||
/**
|
||||
* Aturan validasi Laravel untuk isian formulir slug: [rules, attributes (nama tampilan)].
|
||||
*
|
||||
* @return array{0: array<string, mixed>, 1: array<string, string>}
|
||||
*/
|
||||
public function rules(string $slug): array;
|
||||
|
||||
/**
|
||||
* Nilai isian formulir untuk baris yang ditampilkan (kunci = id baris di daftar, nilai = name => nilai).
|
||||
*
|
||||
* @param list<int|string> $ids
|
||||
* @return array<int|string, array<string, mixed>>
|
||||
*/
|
||||
public function formValues(string $slug, array $ids): array;
|
||||
|
||||
/** @return int|string id baris baru */
|
||||
public function create(string $slug, array $input, string $actor, ?string $ip): int|string;
|
||||
|
||||
public function update(string $slug, int|string $id, array $input, string $actor, ?string $ip): void;
|
||||
|
||||
/**
|
||||
* Hapus; seluruh id ditolak (PortalException) bila ada yang dirujuk atau dilindungi.
|
||||
*
|
||||
* @param list<int|string> $ids
|
||||
* @return int jumlah terhapus
|
||||
*/
|
||||
public function delete(string $slug, array $ids): int;
|
||||
}
|
||||
Reference in New Issue
Block a user