62 lines
3.4 KiB
PHP
62 lines
3.4 KiB
PHP
@php $aktif = $tabs[$tab]; @endphp
|
|
|
|
<x-layouts.app title="Pengaturan sistem">
|
|
<x-ui.page-header title="Pengaturan sistem" description="Atur identitas institusi, aturan akademik, keamanan, dan surel." />
|
|
|
|
<div class="stack">
|
|
<x-ui.tabs label="Kelompok pengaturan">
|
|
@foreach ($tabs as $key => $definition)
|
|
<x-ui.tab :href="route('superuser.pengaturan', ['tab' => $key])" :active="$tab === $key">{{ $definition['label'] }}</x-ui.tab>
|
|
@endforeach
|
|
</x-ui.tabs>
|
|
|
|
@if ($errors->any())
|
|
<x-ui.alert tone="danger" title="Pengaturan belum dapat disimpan">Periksa isian yang ditandai lalu coba lagi.</x-ui.alert>
|
|
@endif
|
|
|
|
<form method="POST" action="{{ route('superuser.pengaturan.update') }}" enctype="multipart/form-data" class="stack" novalidate>
|
|
@csrf
|
|
@method('PUT')
|
|
<input type="hidden" name="tab" value="{{ $tab }}">
|
|
|
|
<x-glass.panel padding="lg">
|
|
<x-form.section :title="'Pengaturan '.\Illuminate\Support\Str::lower($aktif['label'])" :description="$aktif['description']" :columns="2">
|
|
@foreach ($aktif['fields'] as $field)
|
|
@php
|
|
$type = $field['type'];
|
|
$attrs = $field['attrs'] ?? [];
|
|
$full = ($field['span'] ?? null) === 'full' || $type === 'textarea';
|
|
@endphp
|
|
<div @class(['col-span-full' => $full])>
|
|
@if ($type === 'select')
|
|
<x-form.select :name="$field['name']" :label="$field['label']" :options="$field['options']" :value="$field['default'] ?? null" :hint="$field['hint'] ?? null" />
|
|
@elseif ($type === 'textarea')
|
|
<x-form.textarea :name="$field['name']" :label="$field['label']" :value="$field['default'] ?? null" :hint="$field['hint'] ?? null" :rows="3" />
|
|
@elseif ($type === 'checkbox')
|
|
<x-form.checkbox :name="$field['name']" :label="$field['label']" :checked="(bool) ($field['default'] ?? false)" />
|
|
@else
|
|
<x-form.field
|
|
:name="$field['name']"
|
|
:label="$field['label']"
|
|
:type="$type"
|
|
:value="$type === 'file' ? null : ($field['default'] ?? null)"
|
|
:hint="$field['hint'] ?? null"
|
|
:suffix="$field['suffix'] ?? null"
|
|
:min="$attrs['min'] ?? null"
|
|
:max="$attrs['max'] ?? null"
|
|
:accept="$type === 'file' ? 'image/png,image/jpeg' : null"
|
|
/>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</x-form.section>
|
|
</x-glass.panel>
|
|
|
|
<x-form.actions>
|
|
<x-ui.button type="submit" icon="check">Simpan pengaturan</x-ui.button>
|
|
<x-ui.button variant="secondary" :href="route('superuser.pengaturan', ['tab' => $tab])">Atur ulang</x-ui.button>
|
|
</x-form.actions>
|
|
</form>
|
|
</div>
|
|
</x-layouts.app>
|