63 lines
3.9 KiB
PHP
63 lines
3.9 KiB
PHP
<x-satu.frame :page="$page" :crumbs="$crumbs">
|
|
<div class="stack" x-data="{ shown: false }">
|
|
<x-glass.panel padding="lg" as="section" aria-labelledby="judul-parameter">
|
|
<h2 id="judul-parameter" class="panel-title">Parameter laporan</h2>
|
|
|
|
<form class="satu-form mt-4" novalidate x-on:submit.prevent="if ($el.reportValidity()) { shown = true; $nextTick(() => $refs.hasil.scrollIntoView({ behavior: 'smooth', block: 'nearest' })) } else { $dispatch('toast', { tone: 'warning', message: 'Lengkapi isian yang wajib diisi.' }) }">
|
|
@foreach ($fields as $i => $field)
|
|
@php $name = 'param_'.$i; @endphp
|
|
@if ($field['type'] === 'checkbox')
|
|
<div class="satu-form__check"><x-form.checkbox :name="$name" :label="$field['label']" :checked="str_contains(Str::lower($field['label']), 'gunakan kop')" /></div>
|
|
@elseif ($field['type'] === 'select')
|
|
<x-form.select :name="$name" :label="$field['label']" :options="array_combine($field['options'], $field['options'])" :placeholder="Str::lower($field['label']) === 'format' ? null : ''" :required="$field['required']" />
|
|
@else
|
|
<x-form.field :name="$name" :label="$field['label']" :type="$field['type'] === 'search' ? 'text' : $field['type']" :placeholder="$field['type'] === 'search' ? $field['placeholder'] : null" :required="$field['required']" autocomplete="off" />
|
|
@endif
|
|
@endforeach
|
|
|
|
@if (! $fields)
|
|
<p class="text-muted">Laporan ini tidak memerlukan parameter.</p>
|
|
@endif
|
|
|
|
<div class="satu-form__actions">
|
|
<x-ui.button type="submit" icon="eye">Tampilkan</x-ui.button>
|
|
<x-ui.button variant="secondary" icon="arrow-top-right-on-square" x-on:click="$dispatch('toast', { tone: 'info', message: 'Lihat di tab baru: tampilan prototipe, belum membuka dokumen.' })">Lihat di Tab Baru</x-ui.button>
|
|
</div>
|
|
</form>
|
|
</x-glass.panel>
|
|
|
|
<div x-ref="hasil" x-show="shown" x-cloak x-transition.opacity.duration.300ms>
|
|
<x-glass.panel padding="none" as="section" aria-labelledby="judul-pratinjau">
|
|
<div class="satu-bar">
|
|
<h2 id="judul-pratinjau" class="panel-title">Pratinjau {{ $page['title'] }}</h2>
|
|
<div class="satu-bar__tools">
|
|
<x-ui.button variant="secondary" size="sm" icon="arrow-down-tray" x-on:click="$dispatch('toast', { tone: 'info', message: 'Unduh: tampilan prototipe, belum membuat berkas.' })">Unduh</x-ui.button>
|
|
</div>
|
|
</div>
|
|
<x-ui.table :label="'Pratinjau '.Str::lower($page['title'])">
|
|
<table class="table satu-table">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col" class="num">No.</th>
|
|
@foreach ($previewHeaders as $h)
|
|
<th scope="col" @class(['num' => $h['num']])>{{ $h['label'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($previewRows as $n => $row)
|
|
<tr>
|
|
<td class="num">{{ $n + 1 }}</td>
|
|
@foreach ($row as $ci => $cell)
|
|
<td @class(['num' => $previewHeaders[$ci]['num']])>{{ $cell['v'] }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</x-ui.table>
|
|
</x-glass.panel>
|
|
</div>
|
|
</div>
|
|
</x-satu.frame>
|