Commit awal: prototipe UI SIAKAD Untan

This commit is contained in:
Ariyutta
2026-10-24 11:45:32 +07:00
commit d9b9cb5c0f
477 changed files with 51958 additions and 0 deletions
@@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers\Superuser;
use App\Http\Controllers\Controller;
use App\Support\Prototype\SuperuserData;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class PengaturanController extends Controller
{
public function show(Request $request): View
{
$tabs = SuperuserData::pengaturan();
$tab = (string) $request->query('tab');
if (! isset($tabs[$tab])) {
$tab = array_key_first($tabs);
}
return view('superuser.pengaturan.index', ['tabs' => $tabs, 'tab' => $tab]);
}
/** Tahap tampilan: formulir hanya divalidasi, belum disimpan. */
public function update(Request $request): RedirectResponse
{
$tabs = SuperuserData::pengaturan();
$tab = (string) $request->input('tab');
abort_unless(isset($tabs[$tab]), 404);
$rules = [];
$names = [];
$checkboxes = [];
foreach ($tabs[$tab]['fields'] as $field) {
if ($field['type'] === 'checkbox') {
$checkboxes[$field['name']] = $request->boolean($field['name']);
$rules[$field['name']] = ['boolean'];
} else {
$rules[$field['name']] = $field['rules'];
}
$names[$field['name']] = Str::lower($field['label']);
}
$request->merge($checkboxes);
$request->validate($rules, [], $names);
$label = Str::lower($tabs[$tab]['label']);
return redirect()->route('superuser.pengaturan', ['tab' => $tab])
->with('info', "Pengaturan {$label} berhasil divalidasi. Tampilan prototipe: perubahan belum disimpan karena basis data belum dibangun.");
}
}