Integrasi Menu Laporan Operator
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
{{--
|
||||
Halaman cetak laporan (tab baru): KOP universitas bila dipilih, parameter yang dipakai, tabel hasil, dan tombol cetak.
|
||||
Selalu tema terang; tombol disembunyikan saat dicetak.
|
||||
--}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<x-layouts.head :title="$title" description="Cetak laporan SIAKAD Universitas Tanjungpura." />
|
||||
<script>document.documentElement.dataset.theme = 'light';</script>
|
||||
</head>
|
||||
<body class="report-print">
|
||||
<main id="isi" class="report-print__page">
|
||||
<div class="report-print__tools">
|
||||
<x-ui.button icon="printer" x-data x-on:click="window.print()">Cetak</x-ui.button>
|
||||
</div>
|
||||
|
||||
@if ($kop)
|
||||
<header class="report-print__kop">
|
||||
<x-brand.logo size="lg" />
|
||||
<div>
|
||||
<p class="report-print__kop-org">Universitas Tanjungpura</p>
|
||||
<p class="report-print__kop-sub">Sistem Informasi Akademik (SIAKAD)</p>
|
||||
</div>
|
||||
</header>
|
||||
@endif
|
||||
|
||||
<h1 class="report-print__title">{{ $title }}</h1>
|
||||
|
||||
@if ($parameters)
|
||||
<dl class="report-print__params">
|
||||
@foreach ($parameters as $label => $value)
|
||||
<div><dt>{{ $label }}</dt><dd>{{ $value }}</dd></div>
|
||||
@endforeach
|
||||
</dl>
|
||||
@endif
|
||||
|
||||
@foreach ($result->summary as $line)
|
||||
<p class="report-print__summary">{{ $line }}</p>
|
||||
@endforeach
|
||||
@if ($result->note)
|
||||
<p class="report-print__summary">{{ $result->note }}</p>
|
||||
@endif
|
||||
|
||||
@if ($result->rows === [])
|
||||
<p>Tidak ada data yang cocok dengan parameter ini.</p>
|
||||
@else
|
||||
<table class="report-print__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="num">No.</th>
|
||||
@foreach ($result->columns as $c)
|
||||
<th scope="col" @class(['num' => $c['num'] ?? false])>{{ $c['label'] }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($result->rows as $n => $row)
|
||||
<tr>
|
||||
<td class="num">{{ $n + 1 }}</td>
|
||||
@foreach ($result->columns as $c)
|
||||
@php $cell = $row[$c['key']] ?? null; @endphp
|
||||
<td @class(['num' => $c['num'] ?? false])>{{ $cell === null || $cell === '' ? '–' : $cell }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<p class="report-print__foot">
|
||||
@if ($result->truncated())
|
||||
Dicetak {{ number_format(count($result->rows), 0, ',', '.') }} dari {{ number_format($result->count(), 0, ',', '.') }} baris; gunakan Unduh (CSV) untuk data selengkapnya.
|
||||
@endif
|
||||
Dicetak oleh {{ $operator }} pada {{ now()->translatedFormat('j F Y H:i') }}.
|
||||
</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -44,7 +44,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<label class="visually-hidden" for="kegiatan-nama-baru">Nama kegiatan akademik</label>
|
||||
<input id="kegiatan-nama-baru" class="field__input" maxlength="100" x-model="form.nama" x-ref="nama" required placeholder="Nama kegiatan akademik" x-on:keydown.enter.prevent="save()" x-on:keydown.escape.prevent="cancel()">
|
||||
<input id="kegiatan-nama-baru" class="field__input" maxlength="100" x-model="form.nama" x-ref="nama" placeholder="Contoh: Perkuliahan Tahap I" required placeholder="Nama kegiatan akademik" x-on:keydown.enter.prevent="save()" x-on:keydown.escape.prevent="cancel()">
|
||||
</td>
|
||||
<td>
|
||||
<div class="satu-inline__color">
|
||||
@@ -69,7 +69,7 @@
|
||||
<template x-if="editing === row.id">
|
||||
<td>
|
||||
<label class="visually-hidden" x-bind:for="'kegiatan-kode-' + row.id">Kode</label>
|
||||
<input class="field__input" maxlength="5" x-bind:id="'kegiatan-kode-' + row.id" x-model="form.kode" x-bind:disabled="!ready" x-on:keydown.enter.prevent="save()" x-on:keydown.escape.prevent="cancel()">
|
||||
<input class="field__input" maxlength="5" placeholder="Contoh: UTS" x-bind:id="'kegiatan-kode-' + row.id" x-model="form.kode" x-bind:disabled="!ready" x-on:keydown.enter.prevent="save()" x-on:keydown.escape.prevent="cancel()">
|
||||
</td>
|
||||
</template>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<template x-if="editing === row.id">
|
||||
<td>
|
||||
<label class="visually-hidden" x-bind:for="'kegiatan-nama-' + row.id">Nama kegiatan akademik</label>
|
||||
<input class="field__input" maxlength="100" x-bind:id="'kegiatan-nama-' + row.id" x-model="form.nama" x-ref="nama" required x-on:keydown.enter.prevent="save()" x-on:keydown.escape.prevent="cancel()">
|
||||
<input class="field__input" maxlength="100" x-bind:id="'kegiatan-nama-' + row.id" x-model="form.nama" x-ref="nama" placeholder="Contoh: Perkuliahan Tahap I" required x-on:keydown.enter.prevent="save()" x-on:keydown.escape.prevent="cancel()">
|
||||
</td>
|
||||
</template>
|
||||
|
||||
@@ -145,11 +145,12 @@
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
|
||||
<dialog x-ref="dialog" class="dialog dialog--danger" aria-labelledby="kegiatan-hapus-judul" aria-describedby="kegiatan-hapus-pesan" x-on:click="backdrop($event)" x-on:close="pending = null">
|
||||
<dialog x-ref="dialog" class="dialog dialog--danger" aria-labelledby="kegiatan-hapus-judul" aria-describedby="kegiatan-hapus-pesan" x-on:click="backdrop($event)" x-on:close="setTimeout(() => $refs.dialog.open || (pending = null), 300)">
|
||||
<div class="dialog__body">
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-exclamation-triangle /></span>
|
||||
<p id="kegiatan-hapus-judul" class="dialog__title">Hapus kegiatan akademik?</p>
|
||||
<x-ui.dialog-close />
|
||||
</div>
|
||||
<p id="kegiatan-hapus-pesan" class="dialog__message"><span x-text="pending ? pending.kode + ' – ' + pending.nama : ''"></span> akan dihapus dari basis data. Jenis yang sudah dipakai kalender tidak bisa dihapus.</p>
|
||||
<div class="dialog__actions">
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
{{--
|
||||
Laporan berdata asli (akun DB lama): parameter menjalankan laporan otomatis (JSON, komponen Alpine laporanReport),
|
||||
hasil berhalaman, Unduh (CSV) dan Lihat di Tab Baru sebagai tautan yang memuat parameter terkini.
|
||||
$definition['params'] dibuat sumber laporan; $config dipakai komponen (url, nilai awal, pilihan per halaman).
|
||||
--}}
|
||||
@php
|
||||
$note = $definition['note'] ?? null;
|
||||
@endphp
|
||||
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="$note">
|
||||
<div class="stack" x-data="laporanReport(@js($config))">
|
||||
<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" method="GET" action="{{ route('operator.halaman', $slug) }}" x-on:submit.prevent>
|
||||
@foreach ($definition['params'] as $p)
|
||||
@php $reload = $p['name'] !== 'kop'; @endphp
|
||||
@if ($p['type'] === 'check')
|
||||
<div class="satu-form__check">
|
||||
@if ($reload)
|
||||
<x-form.checkbox :name="$p['name']" :label="$p['label']" x-model="values.{{ $p['name'] }}" x-on:change="refresh()" />
|
||||
@else
|
||||
<x-form.checkbox :name="$p['name']" :label="$p['label']" x-model="values.{{ $p['name'] }}" />
|
||||
@endif
|
||||
</div>
|
||||
@elseif ($p['type'] === 'select')
|
||||
<x-form.select :name="$p['name']" :label="$p['label']" :options="$p['options'] ?? []" placeholder="" :required="$p['required'] ?? false" :hint="$p['hint'] ?? null" x-model="values.{{ $p['name'] }}" x-on:change="refresh()" />
|
||||
@else
|
||||
<x-form.field :name="$p['name']" :label="$p['label']" :type="$p['type']" :placeholder="$p['placeholder'] ?? ($p['type'] === 'text' ? 'Masukkan '.ucwords($p['label']) : null)" :required="$p['required'] ?? false" :hint="$p['hint'] ?? null" autocomplete="off" x-model="values.{{ $p['name'] }}" x-on:input.debounce.400ms="refresh()" x-on:change="refresh()" />
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<div class="satu-form__actions">
|
||||
<x-ui.button variant="secondary" icon="arrow-down-tray" href="#" x-bind:href="downloadHref" x-bind:aria-disabled="! ready" x-on:click="if (! ready) $event.preventDefault()">Unduh (CSV)</x-ui.button>
|
||||
<x-ui.button variant="secondary" icon="arrow-top-right-on-square" href="#" target="_blank" rel="noopener" x-bind:href="printHref" x-bind:aria-disabled="! ready" x-on:click="if (! ready) $event.preventDefault()">Lihat di Tab Baru</x-ui.button>
|
||||
</div>
|
||||
</form>
|
||||
</x-glass.panel>
|
||||
|
||||
<template x-if="! ready">
|
||||
<x-ui.alert tone="info">Lengkapi parameter yang wajib diisi untuk menampilkan laporan.</x-ui.alert>
|
||||
</template>
|
||||
|
||||
<template x-if="error">
|
||||
<x-ui.alert tone="danger"><span x-text="error"></span></x-ui.alert>
|
||||
</template>
|
||||
|
||||
<template x-if="ready && result">
|
||||
<x-glass.panel padding="none" as="section" aria-labelledby="judul-hasil">
|
||||
<div class="satu-bar">
|
||||
<h2 id="judul-hasil" class="panel-title">Hasil {{ $page['title'] }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="report-summary" x-show="result.summary.length > 0 || result.note || result.capped">
|
||||
<template x-for="line in result.summary" :key="line"><p x-text="line"></p></template>
|
||||
<p class="text-muted" x-show="result.note" x-text="result.note"></p>
|
||||
<p class="text-muted" x-show="result.capped" x-text="'Halaman hanya mencakup ' + result.cap.toLocaleString('id-ID') + ' baris pertama dari ' + result.total.toLocaleString('id-ID') + '. Persempit filter atau gunakan Unduh (CSV) untuk data selengkapnya.'"></p>
|
||||
</div>
|
||||
|
||||
<x-ui.table :label="'Hasil '.Str::lower($page['title'])">
|
||||
<table class="table satu-table" x-bind:aria-busy="loading">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="num">No.</th>
|
||||
<template x-for="c in result.columns" :key="c.key">
|
||||
<th scope="col" x-bind:class="c.num ? 'num' : ''" x-text="c.label"></th>
|
||||
</template>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="(row, i) in result.rows" :key="i">
|
||||
<tr>
|
||||
<td class="num" x-text="(result.from + i).toLocaleString('id-ID')"></td>
|
||||
<template x-for="c in result.columns" :key="c.key">
|
||||
<td x-bind:class="c.num ? 'num' : ''" x-text="cell(row[c.key])"></td>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="satu-empty" x-show="result.rows.length === 0" x-cloak>Tidak ada data yang cocok dengan parameter ini.</p>
|
||||
</x-ui.table>
|
||||
|
||||
<div class="satu-foot">
|
||||
<p class="satu-foot__info" aria-live="polite">Halaman <span x-text="result.page.toLocaleString('id-ID')"></span> dari <span x-text="result.last_page.toLocaleString('id-ID')"></span> (<span x-text="result.total.toLocaleString('id-ID')"></span> data)</p>
|
||||
|
||||
<label class="satu-foot__per">
|
||||
<span class="visually-hidden">Jumlah data per halaman</span>
|
||||
<select class="field__input field__select" data-no-clear data-no-select2 x-model.number="per" x-on:change="refresh()">
|
||||
@foreach ($config['perPage'] as $n)
|
||||
<option value="{{ $n }}">{{ $n }} data</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<nav class="satu-pager" aria-label="Halaman data">
|
||||
<button type="button" class="satu-pager__btn" aria-label="Halaman sebelumnya" x-bind:disabled="result.page === 1" x-on:click="go(result.page - 1)"><x-heroicon-m-chevron-left /></button>
|
||||
<template x-for="n in window" :key="n">
|
||||
<button type="button" class="satu-pager__btn" x-text="n" x-bind:aria-current="n === result.page ? 'page' : false" x-on:click="go(n)"></button>
|
||||
</template>
|
||||
<button type="button" class="satu-pager__btn" aria-label="Halaman berikutnya" x-bind:disabled="result.page === result.last_page" x-on:click="go(result.page + 1)"><x-heroicon-m-chevron-right /></button>
|
||||
</nav>
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
</template>
|
||||
</div>
|
||||
</x-satu.frame>
|
||||
@@ -1,122 +0,0 @@
|
||||
{{--
|
||||
Periode Akademik (akun DB lama): markup daftar SATU yang sama (bilah cari + Tambah, kolom katalog, aksi baris,
|
||||
satu-foot), tambah/ubah lewat modal formulir dan hapus lewat modal konfirmasi. Data dan simpan lewat JSON
|
||||
(satuPeriode di app.js); alamat halaman tidak berubah.
|
||||
--}}
|
||||
@php
|
||||
$config = ['rows' => $rows, 'urls' => $urls, 'token' => csrf_token(), 'per' => $perPage[0]];
|
||||
@endphp
|
||||
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="$note">
|
||||
<div class="stack" x-data="satuPeriode(@js($config))">
|
||||
<x-glass.panel padding="none" as="section" :aria-label="'Daftar '.$page['title']">
|
||||
<div class="satu-bar">
|
||||
<div class="satu-bar__search field">
|
||||
<label class="visually-hidden" for="satu-q">Cari data</label>
|
||||
<div class="field__control">
|
||||
<span class="field__icon" aria-hidden="true"><x-heroicon-o-magnifying-glass /></span>
|
||||
<input id="satu-q" type="search" class="field__input" style="--pad-start: 2.5rem" placeholder="Cari {{ Str::lower($page['title']) }}" autocomplete="off" x-model.debounce.200ms="q" x-on:input="reset()">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="satu-bar__tools">
|
||||
<x-ui.button variant="primary" icon="plus" size="sm" x-on:click="startInsert()">Tambah</x-ui.button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-ui.table :label="'Tabel '.Str::lower($page['title'])">
|
||||
<table class="table satu-table" x-bind:aria-busy="saving">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Kode</th>
|
||||
<th scope="col">Nama Periode</th>
|
||||
<th scope="col">Tgl. Awal Kuliah</th>
|
||||
<th scope="col">Tgl. Akhir Kuliah</th>
|
||||
<th scope="col">Tgl. Awal UTS</th>
|
||||
<th scope="col">Tgl. Awal UAS</th>
|
||||
<th scope="col">Aktif?</th>
|
||||
<th scope="col" class="table__actions"><span class="visually-hidden">Aksi</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="row in view" x-bind:key="row.id">
|
||||
<tr>
|
||||
<td class="table__title" x-text="row.kode"></td>
|
||||
<td x-text="row.nama"></td>
|
||||
<td x-text="row.awal"></td>
|
||||
<td x-text="row.akhir"></td>
|
||||
<td x-text="row.uts"></td>
|
||||
<td x-text="row.uas"></td>
|
||||
<td><span class="badge" x-bind:class="row.tone ? 'badge--' + row.tone : ''" x-text="row.aktif"></span></td>
|
||||
<td class="table__actions">
|
||||
<x-ui.button variant="ghost" size="sm" icon="pencil-square" :icon-only="true" aria-label="Ubah" x-on:click="startEdit(row)" />
|
||||
<x-ui.button variant="ghost" size="sm" icon="trash" :icon-only="true" aria-label="Hapus" x-on:click="askRemove(row)" />
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="satu-empty" x-show="filtered.length === 0" x-cloak>Tidak ada data yang cocok dengan pencarian.</p>
|
||||
</x-ui.table>
|
||||
|
||||
<div class="satu-foot">
|
||||
<p class="satu-foot__info" aria-live="polite">Halaman <span x-text="page"></span> dari <span x-text="pages"></span> (<span x-text="filtered.length"></span> data)</p>
|
||||
|
||||
<label class="satu-foot__per">
|
||||
<span class="visually-hidden">Jumlah data per halaman</span>
|
||||
<select class="field__input field__select" data-no-clear x-model.number="per" x-on:change="reset()">
|
||||
@foreach ($perPage as $n)
|
||||
<option value="{{ $n }}">{{ $n }} data</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<nav class="satu-pager" aria-label="Halaman data">
|
||||
<button type="button" class="satu-pager__btn" aria-label="Halaman sebelumnya" x-bind:disabled="page === 1" x-on:click="go(page - 1)"><x-heroicon-m-chevron-left /></button>
|
||||
<template x-for="n in window" x-bind:key="n">
|
||||
<button type="button" class="satu-pager__btn" x-text="n" x-bind:aria-current="n === page ? 'page' : false" x-on:click="go(n)"></button>
|
||||
</template>
|
||||
<button type="button" class="satu-pager__btn" aria-label="Halaman berikutnya" x-bind:disabled="page === pages" x-on:click="go(page + 1)"><x-heroicon-m-chevron-right /></button>
|
||||
</nav>
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
|
||||
{{-- Modal formulir tambah/ubah --}}
|
||||
<dialog x-ref="form" class="dialog" aria-labelledby="periode-form-judul" x-on:click="backdrop($event, 'form')" x-on:close="editing = null">
|
||||
<form class="dialog__body" x-on:submit.prevent="save()" novalidate>
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-calendar /></span>
|
||||
<p id="periode-form-judul" class="dialog__title" x-text="editing === 'new' ? 'Tambah periode akademik' : 'Ubah periode akademik'"></p>
|
||||
</div>
|
||||
|
||||
<div class="satu-form">
|
||||
<x-form.field name="thakad" label="Tahun akademik" placeholder="2025/2026" inputmode="numeric" pattern="\d{4}/\d{4}" maxlength="9" required hint="Format TTTT/TTTT, tahun berurutan." x-model="form.thakad" x-ref="thakad" />
|
||||
<x-form.select name="semester" label="Semester" :options="$semesters" required x-model.number="form.semester" />
|
||||
<x-form.select name="perkuliahan" label="Jenis periode" :options="$kinds" required x-model.number="form.perkuliahan" />
|
||||
<x-form.field name="mulai" label="Tanggal awal kuliah" type="date" :optional="true" x-model="form.mulai" />
|
||||
<x-form.field name="selesai" label="Tanggal akhir kuliah" type="date" :optional="true" x-model="form.selesai" />
|
||||
</div>
|
||||
|
||||
<div class="dialog__actions">
|
||||
<x-ui.button type="submit" variant="primary" icon="check" x-bind:disabled="saving">Simpan</x-ui.button>
|
||||
<x-ui.button variant="secondary" x-on:click="closeDialog('form')">Batal</x-ui.button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
{{-- Modal konfirmasi hapus --}}
|
||||
<dialog x-ref="dialog" class="dialog dialog--danger" aria-labelledby="periode-hapus-judul" aria-describedby="periode-hapus-pesan" x-on:click="backdrop($event, 'dialog')" x-on:close="pending = null">
|
||||
<div class="dialog__body">
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-exclamation-triangle /></span>
|
||||
<p id="periode-hapus-judul" class="dialog__title">Hapus periode akademik?</p>
|
||||
</div>
|
||||
<p id="periode-hapus-pesan" class="dialog__message"><span x-text="pending ? pending.kode + ' – ' + pending.nama : ''"></span> akan dihapus dari basis data. Periode yang sudah dipakai jadwal, KRS, atau data lain tidak bisa dihapus.</p>
|
||||
<div class="dialog__actions">
|
||||
<x-ui.button variant="danger" x-on:click="confirmRemove()" x-bind:disabled="saving">Ya, hapus</x-ui.button>
|
||||
<x-ui.button variant="secondary" x-on:click="closeDialog('dialog')">Batal</x-ui.button>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
</div>
|
||||
</x-satu.frame>
|
||||
@@ -1,6 +0,0 @@
|
||||
{{-- Halaman SATU tanpa sumber data di DB lama (akun DB lama): bingkai yang sama, isi keterangan menunggu data. --}}
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="'Halaman '.$page['title'].' belum memiliki sumber data di SIAKAD.'">
|
||||
<x-glass.panel padding="lg" as="section" :aria-label="'Daftar '.$page['title']">
|
||||
<x-ui.empty icon="clock" title="Halaman sedang menunggu informasi terkait isi kontennya yang dimuat" description="Data belum tersedia di DB" />
|
||||
</x-glass.panel>
|
||||
</x-satu.frame>
|
||||
@@ -4,6 +4,7 @@
|
||||
(fetch JSON ke $url), sehingga alamat halaman tidak berubah. Halaman pertama ikut dirender sebagai data awal.
|
||||
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'].
|
||||
$strict (bawaan false): true = hanya tombol yang sungguh bekerja (tanpa tombol notifikasi prototipe).
|
||||
Opsional: $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
|
||||
@@ -13,6 +14,7 @@
|
||||
$viewUrl ??= null;
|
||||
$destroyUrl ??= null;
|
||||
$form ??= null;
|
||||
$strict ??= false;
|
||||
$destroy = ($destroy ?? []) + ['title' => 'Hapus data terpilih?', 'message' => 'Data yang dipilih akan dihapus.'];
|
||||
$tools = [
|
||||
'T' => ['Tambah', 'plus', 'primary', $form ? 'startInsert()' : "demo('Tambah')"],
|
||||
@@ -20,7 +22,8 @@
|
||||
'A' => ['Aksi', 'ellipsis-horizontal-circle', 'secondary', "demo('Aksi')"],
|
||||
'C' => ['Cetak', 'printer', 'secondary', 'window.print()'],
|
||||
];
|
||||
$active = array_filter($tools, fn (string $key): bool => str_contains($page['flags'], $key), ARRAY_FILTER_USE_KEY);
|
||||
$active = array_filter($tools, fn (string $key): bool => str_contains($page['flags'], $key)
|
||||
&& (! $strict || match ($key) { 'T' => (bool) $form, 'H' => (bool) $destroyUrl, 'A' => false, default => true }), ARRAY_FILTER_USE_KEY);
|
||||
$checkbox = in_array('#', $page['columns'], true);
|
||||
$actions = in_array('Aksi', $page['columns'], true);
|
||||
@endphp
|
||||
@@ -120,17 +123,17 @@
|
||||
<td class="table__actions">
|
||||
@if ($viewUrl)
|
||||
<a class="btn btn--ghost btn--sm btn--icon" x-bind:href="link(row)" aria-label="Lihat"><x-heroicon-o-eye /></a>
|
||||
@else
|
||||
@elseif (! $strict)
|
||||
<x-ui.button variant="ghost" size="sm" icon="eye" :icon-only="true" aria-label="Lihat" x-on:click="demo('Lihat')" />
|
||||
@endif
|
||||
@if ($form)
|
||||
<x-ui.button variant="ghost" size="sm" icon="pencil-square" :icon-only="true" aria-label="Ubah" x-on:click="startEdit(row)" />
|
||||
@else
|
||||
@elseif (! $strict)
|
||||
<x-ui.button variant="ghost" size="sm" icon="pencil-square" :icon-only="true" aria-label="Ubah" x-on:click="demo('Ubah')" />
|
||||
@endif
|
||||
@if ($destroyUrl)
|
||||
<x-ui.button variant="ghost" size="sm" icon="trash" :icon-only="true" aria-label="Hapus" x-on:click="askRemove([row.id])" />
|
||||
@else
|
||||
@elseif (! $strict)
|
||||
<x-ui.button variant="ghost" size="sm" icon="trash" :icon-only="true" aria-label="Hapus" x-on:click="demo('Hapus')" />
|
||||
@endif
|
||||
</td>
|
||||
@@ -166,11 +169,12 @@
|
||||
|
||||
@if ($form)
|
||||
{{-- Modal formulir tambah/ubah: kolom menurut $form['fields'], nilai di formData --}}
|
||||
<dialog x-ref="form" class="dialog dialog--wide" aria-labelledby="satu-form-judul" x-on:click="formBackdrop($event)" x-on:close="editing = null">
|
||||
<dialog x-ref="form" class="dialog dialog--wide" aria-labelledby="satu-form-judul" x-on:click="formBackdrop($event)" x-on:close="setTimeout(() => $refs.form.open || (editing = null), 300)">
|
||||
<form class="dialog__body" x-on:submit.prevent="save()" novalidate>
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-pencil-square /></span>
|
||||
<p id="satu-form-judul" class="dialog__title" x-text="editing === 'new' ? 'Tambah {{ $form['title'] }}' : 'Ubah {{ $form['title'] }}'"></p>
|
||||
<x-ui.dialog-close />
|
||||
</div>
|
||||
|
||||
<div class="satu-form">
|
||||
@@ -194,7 +198,7 @@
|
||||
:type="$f['type'] ?? 'text'"
|
||||
:optional="! ($f['required'] ?? false)"
|
||||
:hint="$f['hint'] ?? null"
|
||||
:placeholder="$f['placeholder'] ?? null"
|
||||
:placeholder="$f['placeholder'] ?? (in_array($f['type'] ?? 'text', ['text', 'number'], true) ? 'Masukkan '.ucwords($f['label']) : null)"
|
||||
:required="$f['required'] ?? false"
|
||||
:maxlength="($f['type'] ?? 'text') === 'text' ? ($f['max'] ?? null) : null"
|
||||
:min="($f['type'] ?? 'text') === 'number' ? ($f['min'] ?? null) : null"
|
||||
@@ -214,11 +218,12 @@
|
||||
@endif
|
||||
|
||||
@if ($destroyUrl)
|
||||
<dialog x-ref="dialog" class="dialog dialog--danger" aria-labelledby="satu-hapus-judul" aria-describedby="satu-hapus-pesan" x-on:click="backdrop($event)" x-on:close="pending = []">
|
||||
<dialog x-ref="dialog" class="dialog dialog--danger" aria-labelledby="satu-hapus-judul" aria-describedby="satu-hapus-pesan" x-on:click="backdrop($event)" x-on:close="setTimeout(() => $refs.dialog.open || (pending = []), 300)">
|
||||
<div class="dialog__body">
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-exclamation-triangle /></span>
|
||||
<p id="satu-hapus-judul" class="dialog__title">{{ $destroy['title'] }}</p>
|
||||
<x-ui.dialog-close />
|
||||
</div>
|
||||
<p id="satu-hapus-pesan" class="dialog__message"><span x-text="pending.length"></span> baris dipilih. {{ $destroy['message'] }}</p>
|
||||
<div class="dialog__actions">
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
{{--
|
||||
Data Pelengkap > Template Laporan > Surat Keterangan Aktif: templat tetap seperti SATU (DB lama tidak menyimpannya),
|
||||
hanya dilihat. Bagian: Format No. Surat (isian berkurung), Header, Kalimat Pembuka, Isi (butir bernomor), Kalimat Penutup.
|
||||
--}}
|
||||
@php
|
||||
$now = now();
|
||||
$semester = $now->month >= 8 ? 'Ganjil '.$now->year.'/'.($now->year + 1) : 'Genap '.($now->year - 1).'/'.$now->year;
|
||||
$tokens = [
|
||||
'{{no_surat}}' => 'Tempat kosong untuk No. Surat',
|
||||
'{{bulan_romawi}}' => 'Bulan No. Surat format Romawi',
|
||||
'{{bulan_biasa}}' => 'Bulan No. Surat format biasa',
|
||||
'{{tahun_surat}}' => 'Tahun No. Surat',
|
||||
];
|
||||
// [label, isian]; isian berupa array = beberapa baris. Jeda kosong memisahkan data mahasiswa dan orang tua.
|
||||
$isi = [
|
||||
[['Nama'], ['Nama Mahasiswa']],
|
||||
[['NIM'], ['NIM Mahasiswa']],
|
||||
[['Perguruan Tinggi', 'Program Studi'], ['Nama Perguruan Tinggi', 'Nama Prodi']],
|
||||
[['Tingkat / Semester'], ['I (Satu)']],
|
||||
[['Pada Semester / Tahun'], [$semester]],
|
||||
null,
|
||||
[['Nama Ayah'], ['Nama Orang Tua Ayah']],
|
||||
[['Pekerjaan Ayah'], ['Pekerjaan Orang Tua Ayah']],
|
||||
[['Alamat Ayah'], ['Alamat Orang Tua Ayah']],
|
||||
[['Nama Ibu'], ['Nama Orang Tua Ibu']],
|
||||
[['Pekerjaan Ibu'], ['Pekerjaan Orang Tua Ibu']],
|
||||
[['Alamat Ibu'], ['Alamat Orang Tua Ibu']],
|
||||
];
|
||||
@endphp
|
||||
|
||||
{{-- note="" (bukan null): null membuat prop kembali ke catatan bawaan --}}
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" note="">
|
||||
<x-ui.alert tone="info" title="Format No. Surat">
|
||||
<p>Isikan pada inputan Isi Template dengan inputan:</p>
|
||||
<dl class="surat-tokens">
|
||||
@foreach ($tokens as $token => $arti)
|
||||
<dt><code>{{ $token }}</code></dt>
|
||||
<dd>{{ $arti }}</dd>
|
||||
@endforeach
|
||||
</dl>
|
||||
</x-ui.alert>
|
||||
|
||||
<x-glass.panel padding="lg" as="section" aria-labelledby="judul-templat">
|
||||
<h2 id="judul-templat" class="panel-title">Isi templat</h2>
|
||||
<dl class="satu-dl">
|
||||
<div class="satu-dl__row">
|
||||
<dt>Header</dt>
|
||||
<dd>–</dd>
|
||||
</div>
|
||||
<div class="satu-dl__row">
|
||||
<dt>Kalimat Pembuka</dt>
|
||||
<dd>Kepala Biro Akademik dan Kemahasiswaan Universitas Tanjungpura di Pontianak, dengan ini menerangkan bahwa :</dd>
|
||||
</div>
|
||||
<div class="satu-dl__row">
|
||||
<dt>Isi</dt>
|
||||
<dd>
|
||||
<ol class="surat-isi">
|
||||
@foreach ($isi as $butir)
|
||||
@if ($butir === null)
|
||||
<li class="surat-isi__gap" aria-hidden="true"></li>
|
||||
@else
|
||||
<li>
|
||||
<span class="surat-isi__label">
|
||||
@foreach ($butir[0] as $label) <span>{{ $label }}</span> @endforeach
|
||||
</span>
|
||||
<span class="surat-isi__value">
|
||||
@foreach ($butir[1] as $value) <span>{{ $value }}</span> @endforeach
|
||||
</span>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
</ol>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="satu-dl__row">
|
||||
<dt>Kalimat Penutup</dt>
|
||||
<dd>Adalah benar mahasiswa teregistrasi di Universitas Tanjungpura dan masih aktif kuliah sampai dengan sekarang. Demikian surat keterangan ini dibuat untuk dapat dipergunakan sebagaimana mestinya.</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</x-glass.panel>
|
||||
</x-satu.frame>
|
||||
Reference in New Issue
Block a user