Penambahan Menu Setting
This commit is contained in:
@@ -565,6 +565,31 @@ a.stat { text-decoration: none; color: inherit; }
|
||||
.satu-dl__row { grid-template-columns: 1fr; gap: var(--space-3xs); }
|
||||
}
|
||||
|
||||
/* Setting Prodi: baris unit (fakultas, jurusan) sebagai judul kelompok; prodi menjorok; kolom centang di tengah */
|
||||
.setting-table__unit th { font-weight: 600; text-align: start; border-block-start: var(--rule-hair) solid var(--color-rule); }
|
||||
.setting-table__unit--jurusan th { padding-inline-start: calc(var(--space-md) + var(--space-sm)); font-weight: 500; }
|
||||
.setting-table__prodi { padding-inline-start: calc(var(--space-md) + var(--space-lg)); }
|
||||
.setting-table__check { text-align: center; }
|
||||
.setting-table__select { min-width: 12rem; min-height: 2.25rem; padding-block: var(--space-3xs); }
|
||||
|
||||
/* Rincian Setting Prodi: kepala dua kolom, tab tombol (bukan tautan), dua kolom daftar per tab, formulir edit berkelompok */
|
||||
.setting-detail__tools { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
|
||||
.setting-detail__kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-sm) var(--space-lg); margin: 0 0 var(--space-md); }
|
||||
.setting-detail__kv div { display: grid; grid-template-columns: minmax(10rem, 1fr) 2fr; gap: var(--space-sm); padding-block: var(--space-xs); border-block-end: var(--rule-hair) solid var(--color-rule); }
|
||||
.setting-detail__kv dt { color: var(--color-muted); }
|
||||
.setting-detail__kv dd { margin: 0; font-weight: 500; }
|
||||
.setting-detail__tabs { margin-block-end: var(--space-md); }
|
||||
button.tab { border: 0; background: none; font: inherit; cursor: pointer; }
|
||||
.tab[aria-selected="true"] { color: var(--color-accent-text); box-shadow: inset 0 -2px 0 var(--color-accent); }
|
||||
@media (forced-colors: active) {
|
||||
.tab[aria-selected="true"] { border-block-end: 2px solid Highlight; }
|
||||
}
|
||||
.setting-detail__panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0 var(--space-lg); align-items: start; }
|
||||
.setting-detail__hint { margin: var(--space-3xs) 0 0; font-size: var(--text-sm); font-weight: 400; }
|
||||
.setting-form__group { display: grid; gap: var(--space-sm); margin: 0; padding: var(--space-sm) 0 0; border: 0; border-block-start: var(--rule-hair) solid var(--color-rule); }
|
||||
.setting-form__legend { padding: 0; font-weight: 600; }
|
||||
.dialog--wide { width: min(40rem, calc(100% - 2 * var(--gutter))); }
|
||||
|
||||
/* Template Surat Keterangan Aktif: daftar isian berkurung dan butir Isi bernomor (label : isian) */
|
||||
.surat-tokens { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-3xs) var(--space-sm); margin: var(--space-xs) 0 0; }
|
||||
.surat-tokens dt code { font-size: var(--text-sm); }
|
||||
@@ -705,6 +730,15 @@ button, a, summary, label, select, [role="tab"] { touch-action: manipulation; }
|
||||
background: var(--swatch, transparent);
|
||||
}
|
||||
|
||||
/* Jenis Jawaban: daftar jawaban bernilai di sel tabel dan baris isian di modal */
|
||||
.satu-table--wrap td { white-space: normal; vertical-align: top; }
|
||||
.satu-answers__list { display: grid; gap: var(--space-3xs); margin: 0; padding: 0; list-style: none; }
|
||||
.satu-answers { display: grid; gap: var(--space-xs); margin: 0; padding: 0; border: 0; min-width: 0; }
|
||||
.satu-answers__legend { font-weight: 600; font-size: var(--text-sm); padding: 0; margin-bottom: var(--space-3xs); }
|
||||
.satu-answers__head, .satu-answers__row { display: grid; grid-template-columns: 5rem minmax(0, 1fr) auto; gap: var(--space-xs); align-items: center; }
|
||||
.satu-answers__head { font-size: var(--text-xs); color: var(--color-muted); }
|
||||
.satu-answers__row .field__input { min-height: 2.25rem; padding-block: var(--space-3xs); }
|
||||
|
||||
.satu-inline .field__input { min-height: 2.25rem; padding-block: var(--space-3xs); }
|
||||
.satu-inline__color { display: flex; align-items: center; gap: var(--space-2xs); }
|
||||
.satu-inline__color .field__input { min-width: 7rem; }
|
||||
|
||||
@@ -1182,6 +1182,9 @@ const enhanceSelect = (el) => {
|
||||
const placeholder = name ? `Pilih ${name}` : 'Pilih...';
|
||||
const $el = $(el);
|
||||
|
||||
// Di dalam <dialog> (lapisan atas) dropdown harus ikut di dalam dialog; di body ia tertutup modal
|
||||
const dialog = el.closest('dialog');
|
||||
|
||||
$el.select2({
|
||||
width: '100%',
|
||||
placeholder: hasEmpty ? placeholder : undefined,
|
||||
@@ -1190,6 +1193,7 @@ const enhanceSelect = (el) => {
|
||||
minimumResultsForSearch: el.options.length > 8 ? 0 : Infinity,
|
||||
dropdownCssClass: 'select2-glass',
|
||||
selectionCssClass: 'select2-glass',
|
||||
dropdownParent: dialog ? $(dialog) : $(document.body),
|
||||
});
|
||||
|
||||
// Select2 -> Alpine: x-model dan x-on:change mendengar event bawaan
|
||||
@@ -1238,4 +1242,494 @@ document.addEventListener('alpine:initialized', () => {
|
||||
}).observe(document.body, { childList: true, subtree: true });
|
||||
});
|
||||
|
||||
// Setting > Setting Prodi rincian (akun DB lama): tab bagian dan modal Edit (PUT JSON, lalu halaman dimuat ulang)
|
||||
Alpine.data('satuSettingProdi', (config) => ({
|
||||
tab: 'krs',
|
||||
form: JSON.parse(JSON.stringify(config.form)),
|
||||
saving: false,
|
||||
|
||||
openForm() {
|
||||
this.form = JSON.parse(JSON.stringify(config.form));
|
||||
const dialog = this.$refs.form;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
},
|
||||
|
||||
closeForm() {
|
||||
this.$refs.form?.close();
|
||||
},
|
||||
|
||||
backdrop(event) {
|
||||
if (event.target === this.$refs.form) this.closeForm();
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (this.saving) return;
|
||||
const section = (s) => ({ buka: Boolean(s.buka), awal: s.buka ? s.awal || null : null, akhir: s.buka ? s.akhir || null : null });
|
||||
const body = {
|
||||
periode: config.periode,
|
||||
kurikulum: this.form.kurikulum || null,
|
||||
krs: section(this.form.krs),
|
||||
nilai: section(this.form.nilai),
|
||||
registrasi: section(this.form.registrasi),
|
||||
};
|
||||
this.saving = true;
|
||||
try {
|
||||
const response = await fetch(config.url, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-TOKEN': config.token, 'X-Requested-With': 'XMLHttpRequest' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const data = await response.json().catch(() => null);
|
||||
if (!response.ok) {
|
||||
const first = data?.errors ? Object.values(data.errors).flat()[0] : null;
|
||||
throw new Error(first || data?.message || 'Permintaan gagal. Muat ulang halaman lalu coba lagi.');
|
||||
}
|
||||
console.info(`[SIAKAD] PUT ${config.url}`, { hasil: data?.message });
|
||||
window.toast('success', data.message);
|
||||
this.closeForm();
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
// Setting > Periode Akademik (akun DB lama): daftar di sisi klien, tambah/ubah lewat modal formulir, hapus lewat modal konfirmasi
|
||||
Alpine.data('satuPeriode', (config) => ({
|
||||
rows: config.rows,
|
||||
urls: config.urls,
|
||||
token: config.token,
|
||||
q: '',
|
||||
per: config.per,
|
||||
page: 1,
|
||||
editing: null,
|
||||
form: { thakad: '', semester: 1, perkuliahan: 1, mulai: '', selesai: '' },
|
||||
saving: false,
|
||||
pending: null,
|
||||
|
||||
get filtered() {
|
||||
const q = this.q.trim().toLowerCase();
|
||||
if (q === '') return this.rows;
|
||||
return this.rows.filter((row) => [row.kode, row.nama, row.awal, row.akhir, row.aktif].some((value) => String(value).toLowerCase().includes(q)));
|
||||
},
|
||||
|
||||
get pages() {
|
||||
return Math.max(1, Math.ceil(this.filtered.length / this.per));
|
||||
},
|
||||
|
||||
get view() {
|
||||
const start = (this.page - 1) * this.per;
|
||||
return this.filtered.slice(start, start + this.per);
|
||||
},
|
||||
|
||||
get window() {
|
||||
const start = Math.max(1, Math.min(this.page - 2, this.pages - 4));
|
||||
return Array.from({ length: Math.min(5, this.pages) }, (_, i) => start + i);
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.page = 1;
|
||||
},
|
||||
|
||||
go(page) {
|
||||
this.page = Math.min(Math.max(1, page), this.pages);
|
||||
},
|
||||
|
||||
startInsert() {
|
||||
this.editing = 'new';
|
||||
this.form = { thakad: '', semester: 1, perkuliahan: 1, mulai: '', selesai: '' };
|
||||
this.openForm();
|
||||
},
|
||||
|
||||
startEdit(row) {
|
||||
this.editing = row.id;
|
||||
this.form = { thakad: row.thakad, semester: row.semester, perkuliahan: row.perkuliahan, mulai: row.mulai ?? '', selesai: row.selesai ?? '' };
|
||||
this.openForm();
|
||||
},
|
||||
|
||||
openForm() {
|
||||
const dialog = this.$refs.form;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
this.$nextTick(() => this.$refs.thakad?.focus());
|
||||
},
|
||||
|
||||
closeDialog(ref) {
|
||||
this.$refs[ref]?.close();
|
||||
},
|
||||
|
||||
backdrop(event, ref) {
|
||||
if (event.target === this.$refs[ref]) this.closeDialog(ref);
|
||||
},
|
||||
|
||||
async request(url, method, body) {
|
||||
const response = await fetch(url, {
|
||||
method,
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-TOKEN': this.token, 'X-Requested-With': 'XMLHttpRequest' },
|
||||
body: body === undefined ? undefined : JSON.stringify(body),
|
||||
});
|
||||
const data = await response.json().catch(() => null);
|
||||
if (!response.ok) {
|
||||
const first = data?.errors ? Object.values(data.errors).flat()[0] : null;
|
||||
throw new Error(first || data?.message || 'Permintaan gagal. Muat ulang halaman lalu coba lagi.');
|
||||
}
|
||||
console.info(`[SIAKAD] ${method} ${url}`, { hasil: data?.message });
|
||||
return data;
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (this.saving || this.editing === null) return;
|
||||
if (!/^\d{4}\/\d{4}$/.test(this.form.thakad.trim())) {
|
||||
window.toast('warning', 'Tahun akademik harus berformat TTTT/TTTT, misalnya 2025/2026.');
|
||||
this.$refs.thakad?.focus();
|
||||
return;
|
||||
}
|
||||
const isNew = this.editing === 'new';
|
||||
const url = isNew ? this.urls.store : this.urls.update.replace('__ID__', this.editing);
|
||||
const body = {
|
||||
thakad: this.form.thakad.trim(),
|
||||
semester: Number(this.form.semester),
|
||||
perkuliahan: Number(this.form.perkuliahan),
|
||||
mulai: this.form.mulai || null,
|
||||
selesai: this.form.selesai || null,
|
||||
};
|
||||
this.saving = true;
|
||||
try {
|
||||
const data = await this.request(url, isNew ? 'POST' : 'PUT', body);
|
||||
this.rows = data.rows;
|
||||
window.toast('success', data.message);
|
||||
this.closeDialog('form');
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
|
||||
askRemove(row) {
|
||||
this.pending = row;
|
||||
const dialog = this.$refs.dialog;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
},
|
||||
|
||||
async confirmRemove() {
|
||||
if (!this.pending || this.saving) return;
|
||||
this.saving = true;
|
||||
try {
|
||||
const data = await this.request(this.urls.destroy.replace('__ID__', this.pending.id), 'DELETE');
|
||||
this.rows = data.rows;
|
||||
if (this.page > this.pages) this.page = this.pages;
|
||||
window.toast('success', data.message);
|
||||
this.closeDialog('dialog');
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
/* Setting > Kategori Kuesioner Layanan: daftar di sisi klien, tambah/ubah lewat modal satu kolom, hapus lewat konfirmasi. */
|
||||
Alpine.data('satuKategoriKuesioner', (config) => ({
|
||||
rows: config.rows,
|
||||
urls: config.urls,
|
||||
token: config.token,
|
||||
ready: config.ready,
|
||||
q: '',
|
||||
per: config.per,
|
||||
page: 1,
|
||||
editing: null,
|
||||
form: { nama: '' },
|
||||
saving: false,
|
||||
pending: null,
|
||||
|
||||
get filtered() {
|
||||
const q = this.q.trim().toLowerCase();
|
||||
if (q === '') return this.rows;
|
||||
return this.rows.filter((row) => row.nama.toLowerCase().includes(q));
|
||||
},
|
||||
|
||||
get pages() {
|
||||
return Math.max(1, Math.ceil(this.filtered.length / this.per));
|
||||
},
|
||||
|
||||
get view() {
|
||||
const start = (this.page - 1) * this.per;
|
||||
return this.filtered.slice(start, start + this.per);
|
||||
},
|
||||
|
||||
get window() {
|
||||
const start = Math.max(1, Math.min(this.page - 2, this.pages - 4));
|
||||
return Array.from({ length: Math.min(5, this.pages) }, (_, i) => start + i);
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.page = 1;
|
||||
},
|
||||
|
||||
go(page) {
|
||||
this.page = Math.min(Math.max(1, page), this.pages);
|
||||
},
|
||||
|
||||
startInsert() {
|
||||
this.editing = 'new';
|
||||
this.form = { nama: '' };
|
||||
this.openForm();
|
||||
},
|
||||
|
||||
startEdit(row) {
|
||||
this.editing = row.id;
|
||||
this.form = { nama: row.nama };
|
||||
this.openForm();
|
||||
},
|
||||
|
||||
openForm() {
|
||||
const dialog = this.$refs.form;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
this.$nextTick(() => this.$refs.nama?.focus());
|
||||
},
|
||||
|
||||
closeDialog(ref) {
|
||||
this.$refs[ref]?.close();
|
||||
},
|
||||
|
||||
backdrop(event, ref) {
|
||||
if (event.target === this.$refs[ref]) this.closeDialog(ref);
|
||||
},
|
||||
|
||||
async request(url, method, body) {
|
||||
const response = await fetch(url, {
|
||||
method,
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-TOKEN': this.token, 'X-Requested-With': 'XMLHttpRequest' },
|
||||
body: body === undefined ? undefined : JSON.stringify(body),
|
||||
});
|
||||
const data = await response.json().catch(() => null);
|
||||
if (!response.ok) {
|
||||
const first = data?.errors ? Object.values(data.errors).flat()[0] : null;
|
||||
throw new Error(first || data?.message || 'Permintaan gagal. Muat ulang halaman lalu coba lagi.');
|
||||
}
|
||||
console.info(`[SIAKAD] ${method} ${url}`, { hasil: data?.message });
|
||||
return data;
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (this.saving || this.editing === null) return;
|
||||
if (this.form.nama.trim() === '') {
|
||||
window.toast('warning', 'Nama kategori wajib diisi.');
|
||||
this.$refs.nama?.focus();
|
||||
return;
|
||||
}
|
||||
const isNew = this.editing === 'new';
|
||||
const url = isNew ? this.urls.store : this.urls.update.replace('__ID__', this.editing);
|
||||
this.saving = true;
|
||||
try {
|
||||
const data = await this.request(url, isNew ? 'POST' : 'PUT', { nama: this.form.nama.trim() });
|
||||
this.rows = data.rows;
|
||||
if (this.page > this.pages) this.page = this.pages;
|
||||
window.toast('success', data.message);
|
||||
this.closeDialog('form');
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
|
||||
askRemove(row) {
|
||||
this.pending = row;
|
||||
const dialog = this.$refs.dialog;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
},
|
||||
|
||||
async confirmRemove() {
|
||||
if (!this.pending || this.saving) return;
|
||||
this.saving = true;
|
||||
try {
|
||||
const data = await this.request(this.urls.destroy.replace('__ID__', this.pending.id), 'DELETE');
|
||||
this.rows = data.rows;
|
||||
if (this.page > this.pages) this.page = this.pages;
|
||||
window.toast('success', data.message);
|
||||
this.closeDialog('dialog');
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
/* Setting > Jenis Jawaban: daftar di sisi klien dengan centang baris, modal nama + daftar jawaban, hapus massal. */
|
||||
Alpine.data('satuJenisJawaban', (config) => ({
|
||||
rows: config.rows,
|
||||
urls: config.urls,
|
||||
token: config.token,
|
||||
ready: config.ready,
|
||||
q: '',
|
||||
per: config.per,
|
||||
page: 1,
|
||||
picked: [],
|
||||
editing: null,
|
||||
form: { nama: '', jawaban: [] },
|
||||
keySeq: 0,
|
||||
saving: false,
|
||||
pending: [],
|
||||
|
||||
get filtered() {
|
||||
const q = this.q.trim().toLowerCase();
|
||||
if (q === '') return this.rows;
|
||||
return this.rows.filter((row) => row.nama.toLowerCase().includes(q) || row.jawaban.some((a) => a.teks.toLowerCase().includes(q)));
|
||||
},
|
||||
|
||||
get pages() {
|
||||
return Math.max(1, Math.ceil(this.filtered.length / this.per));
|
||||
},
|
||||
|
||||
get view() {
|
||||
const start = (this.page - 1) * this.per;
|
||||
return this.filtered.slice(start, start + this.per);
|
||||
},
|
||||
|
||||
get window() {
|
||||
const start = Math.max(1, Math.min(this.page - 2, this.pages - 4));
|
||||
return Array.from({ length: Math.min(5, this.pages) }, (_, i) => start + i);
|
||||
},
|
||||
|
||||
get allPicked() {
|
||||
return this.view.length > 0 && this.view.every((row) => this.picked.includes(row.id));
|
||||
},
|
||||
|
||||
get pendingLabel() {
|
||||
const names = this.rows.filter((row) => this.pending.includes(row.id)).map((row) => row.nama);
|
||||
return names.length > 3 ? `${names.length} jenis jawaban` : names.join(', ');
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.page = 1;
|
||||
},
|
||||
|
||||
go(page) {
|
||||
this.page = Math.min(Math.max(1, page), this.pages);
|
||||
},
|
||||
|
||||
toggleAll() {
|
||||
const ids = this.view.map((row) => row.id);
|
||||
this.picked = this.allPicked ? this.picked.filter((id) => !ids.includes(id)) : [...new Set([...this.picked, ...ids])];
|
||||
},
|
||||
|
||||
answer(nilai = '', teks = '') {
|
||||
return { key: ++this.keySeq, nilai, teks };
|
||||
},
|
||||
|
||||
addAnswer() {
|
||||
const last = this.form.jawaban[this.form.jawaban.length - 1];
|
||||
this.form.jawaban.push(this.answer(Number.isInteger(last?.nilai) ? last.nilai + 1 : 1));
|
||||
},
|
||||
|
||||
removeAnswer(i) {
|
||||
if (this.form.jawaban.length > 1) this.form.jawaban.splice(i, 1);
|
||||
},
|
||||
|
||||
startInsert() {
|
||||
this.editing = 'new';
|
||||
this.form = { nama: '', jawaban: [this.answer(1)] };
|
||||
this.openForm();
|
||||
},
|
||||
|
||||
startEdit(row) {
|
||||
this.editing = row.id;
|
||||
this.form = { nama: row.nama, jawaban: row.jawaban.map((a) => this.answer(a.nilai, a.teks)) };
|
||||
this.openForm();
|
||||
},
|
||||
|
||||
openForm() {
|
||||
const dialog = this.$refs.form;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
this.$nextTick(() => this.$refs.nama?.focus());
|
||||
},
|
||||
|
||||
closeDialog(ref) {
|
||||
this.$refs[ref]?.close();
|
||||
},
|
||||
|
||||
backdrop(event, ref) {
|
||||
if (event.target === this.$refs[ref]) this.closeDialog(ref);
|
||||
},
|
||||
|
||||
async request(url, method, body) {
|
||||
const response = await fetch(url, {
|
||||
method,
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-TOKEN': this.token, 'X-Requested-With': 'XMLHttpRequest' },
|
||||
body: body === undefined ? undefined : JSON.stringify(body),
|
||||
});
|
||||
const data = await response.json().catch(() => null);
|
||||
if (!response.ok) {
|
||||
const first = data?.errors ? Object.values(data.errors).flat()[0] : null;
|
||||
throw new Error(first || data?.message || 'Permintaan gagal. Muat ulang halaman lalu coba lagi.');
|
||||
}
|
||||
console.info(`[SIAKAD] ${method} ${url}`, { hasil: data?.message });
|
||||
return data;
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (this.saving || this.editing === null) return;
|
||||
if (this.form.nama.trim() === '') {
|
||||
window.toast('warning', 'Nama jenis jawaban wajib diisi.');
|
||||
this.$refs.nama?.focus();
|
||||
return;
|
||||
}
|
||||
const jawaban = this.form.jawaban.filter((a) => a.teks.trim() !== '').map((a) => ({ nilai: Number(a.nilai), teks: a.teks.trim() }));
|
||||
if (jawaban.length === 0) {
|
||||
window.toast('warning', 'Isi minimal satu jawaban.');
|
||||
return;
|
||||
}
|
||||
const isNew = this.editing === 'new';
|
||||
const url = isNew ? this.urls.store : this.urls.update.replace('__ID__', this.editing);
|
||||
this.saving = true;
|
||||
try {
|
||||
const data = await this.request(url, isNew ? 'POST' : 'PUT', { nama: this.form.nama.trim(), jawaban });
|
||||
this.rows = data.rows;
|
||||
if (this.page > this.pages) this.page = this.pages;
|
||||
window.toast('success', data.message);
|
||||
this.closeDialog('form');
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
|
||||
remove() {
|
||||
if (!this.picked.length) {
|
||||
window.toast('warning', 'Pilih data yang akan dihapus terlebih dahulu.');
|
||||
return;
|
||||
}
|
||||
this.askRemove(this.picked);
|
||||
},
|
||||
|
||||
askRemove(ids) {
|
||||
this.pending = [...ids];
|
||||
const dialog = this.$refs.dialog;
|
||||
if (dialog && !dialog.open) dialog.showModal();
|
||||
},
|
||||
|
||||
async confirmRemove() {
|
||||
const ids = [...this.pending];
|
||||
if (!ids.length || this.saving) return;
|
||||
this.saving = true;
|
||||
try {
|
||||
const data = await this.request(this.urls.destroy, 'POST', { ids });
|
||||
this.rows = data.rows;
|
||||
this.picked = this.picked.filter((id) => !ids.includes(id));
|
||||
if (this.page > this.pages) this.page = this.pages;
|
||||
window.toast('success', data.message);
|
||||
this.closeDialog('dialog');
|
||||
} catch (error) {
|
||||
window.toast('danger', error.message);
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
Alpine.start();
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
{{--
|
||||
Jenis Jawaban (akun DB lama): markup daftar SATU yang sama (bilah cari + Tambah + Hapus massal, centang baris,
|
||||
kolom Jenis Jawaban, Jawaban (daftar bernilai), Aksi, satu-foot). Tambah/ubah lewat modal formulir dengan daftar
|
||||
jawaban; hapus lewat modal konfirmasi. Data dan simpan lewat JSON (satuJenisJawaban di app.js).
|
||||
--}}
|
||||
@php
|
||||
$config = ['rows' => $rows, 'urls' => $urls, 'token' => csrf_token(), 'ready' => $ready, 'per' => $perPage[0]];
|
||||
@endphp
|
||||
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="$note">
|
||||
<div class="stack" x-data="satuJenisJawaban(@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()" x-bind:disabled="!ready">Tambah</x-ui.button>
|
||||
<x-ui.button variant="danger" icon="trash" size="sm" x-on:click="remove()" x-bind:disabled="!ready">Hapus</x-ui.button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-ui.table :label="'Tabel '.Str::lower($page['title'])">
|
||||
<table class="table satu-table satu-table--wrap" x-bind:aria-busy="saving">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="satu-check"><input type="checkbox" class="check__input" aria-label="Pilih semua baris di halaman ini" x-bind:checked="allPicked" x-on:change="toggleAll()"></th>
|
||||
<th scope="col">Jenis Jawaban</th>
|
||||
<th scope="col">Jawaban</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="satu-check"><input type="checkbox" class="check__input" aria-label="Pilih baris" x-model="picked" x-bind:value="row.id"></td>
|
||||
<td class="table__title" x-text="row.nama"></td>
|
||||
<td>
|
||||
<ul class="satu-answers__list">
|
||||
<template x-for="(a, i) in row.jawaban" x-bind:key="i">
|
||||
<li x-text="a.nilai + '. ' + a.teks"></li>
|
||||
</template>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="table__actions">
|
||||
<x-ui.button variant="ghost" size="sm" icon="eye" :icon-only="true" aria-label="Lihat dan 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.id])" />
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="satu-empty" x-show="filtered.length === 0" x-cloak x-text="rows.length === 0 ? 'Belum ada jenis jawaban.' : '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: nama jenis + daftar jawaban (nilai, teks) --}}
|
||||
<dialog x-ref="form" class="dialog dialog--wide" aria-labelledby="jawaban-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-list-bullet /></span>
|
||||
<p id="jawaban-form-judul" class="dialog__title" x-text="editing === 'new' ? 'Tambah jenis jawaban' : 'Ubah jenis jawaban'"></p>
|
||||
</div>
|
||||
|
||||
<div class="satu-form">
|
||||
<x-form.field name="nama" label="Jenis jawaban" placeholder="Misalnya NETRAL" maxlength="50" required x-model="form.nama" x-ref="nama" />
|
||||
</div>
|
||||
|
||||
<fieldset class="satu-answers">
|
||||
<legend class="satu-answers__legend">Jawaban</legend>
|
||||
<div class="satu-answers__head" aria-hidden="true"><span>Nilai</span><span>Teks jawaban</span><span></span></div>
|
||||
<template x-for="(a, i) in form.jawaban" x-bind:key="a.key">
|
||||
<div class="satu-answers__row">
|
||||
<label class="visually-hidden" x-bind:for="'jawaban-nilai-' + a.key">Nilai jawaban</label>
|
||||
<input type="number" class="field__input" min="0" max="100" x-bind:id="'jawaban-nilai-' + a.key" x-model.number="a.nilai" required>
|
||||
<label class="visually-hidden" x-bind:for="'jawaban-teks-' + a.key">Teks jawaban</label>
|
||||
<input class="field__input" maxlength="100" x-bind:id="'jawaban-teks-' + a.key" x-model="a.teks" placeholder="Teks jawaban" required>
|
||||
<x-ui.button variant="ghost" size="sm" icon="x-mark" :icon-only="true" aria-label="Buang jawaban" x-on:click="removeAnswer(i)" x-bind:disabled="form.jawaban.length === 1" />
|
||||
</div>
|
||||
</template>
|
||||
<div>
|
||||
<x-ui.button variant="secondary" size="sm" icon="plus" x-on:click="addAnswer()">Tambah jawaban</x-ui.button>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<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 (satu baris atau pilihan) --}}
|
||||
<dialog x-ref="dialog" class="dialog dialog--danger" aria-labelledby="jawaban-hapus-judul" aria-describedby="jawaban-hapus-pesan" x-on:click="backdrop($event, 'dialog')" x-on:close="pending = []">
|
||||
<div class="dialog__body">
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-exclamation-triangle /></span>
|
||||
<p id="jawaban-hapus-judul" class="dialog__title">Hapus jenis jawaban?</p>
|
||||
</div>
|
||||
<p id="jawaban-hapus-pesan" class="dialog__message"><span x-text="pendingLabel"></span> beserta daftar jawabannya akan dihapus dari basis data.</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>
|
||||
@@ -0,0 +1,108 @@
|
||||
{{--
|
||||
Kategori Kuesioner Layanan (akun DB lama): markup daftar SATU yang sama (bilah cari + Tambah, kolom No., Nama
|
||||
Kategori, Aksi, satu-foot), tambah/ubah lewat modal formulir dan hapus lewat modal konfirmasi. Data dan simpan
|
||||
lewat JSON (satuKategoriKuesioner di app.js); alamat halaman tidak berubah.
|
||||
--}}
|
||||
@php
|
||||
$config = ['rows' => $rows, 'urls' => $urls, 'token' => csrf_token(), 'ready' => $ready, 'per' => $perPage[0]];
|
||||
@endphp
|
||||
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="$note">
|
||||
<div class="stack" x-data="satuKategoriKuesioner(@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()" x-bind:disabled="!ready">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">No.</th>
|
||||
<th scope="col">Nama Kategori</th>
|
||||
<th scope="col" class="table__actions"><span class="visually-hidden">Aksi</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="(row, i) in view" x-bind:key="row.id">
|
||||
<tr>
|
||||
<td x-text="(page - 1) * per + i + 1"></td>
|
||||
<td class="table__title" x-text="row.nama"></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 x-text="rows.length === 0 ? 'Belum ada kategori.' : '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="kategori-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-clipboard-document-list /></span>
|
||||
<p id="kategori-form-judul" class="dialog__title" x-text="editing === 'new' ? 'Tambah kategori kuesioner' : 'Ubah kategori kuesioner'"></p>
|
||||
</div>
|
||||
|
||||
<div class="satu-form">
|
||||
<x-form.field name="nama" label="Nama kategori" placeholder="Nama kategori kuesioner layanan" maxlength="100" required x-model="form.nama" x-ref="nama" />
|
||||
</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="kategori-hapus-judul" aria-describedby="kategori-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="kategori-hapus-judul" class="dialog__title">Hapus kategori kuesioner?</p>
|
||||
</div>
|
||||
<p id="kategori-hapus-pesan" class="dialog__message"><span x-text="pending ? pending.nama : ''"></span> akan dihapus dari basis data.</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>
|
||||
@@ -0,0 +1,122 @@
|
||||
{{--
|
||||
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>
|
||||
@@ -0,0 +1,155 @@
|
||||
{{--
|
||||
Rincian setting satu prodi pada satu periode (akun DB lama), susunan seperti SATU: kepala (Periode, Program Studi,
|
||||
Kurikulum Mahasiswa Baru), tab KRS & Validasi / KHS & Nilai / Ujian / Lain-lain, tombol Kembali dan Edit (modal).
|
||||
Bidang yang tercatat di DB lama: kurikulum aktif, KRS, pengisian nilai, pengubahan biodata (registrasi); bidang lain "–".
|
||||
--}}
|
||||
@php
|
||||
$tgl = fn (?string $d): string => $d === null ? '–' : \Illuminate\Support\Carbon::parse($d)->translatedFormat('j M Y');
|
||||
$ya = fn (bool $v): string => $v ? 'Ya' : 'Tidak';
|
||||
$none = ['v' => '–', 'note' => 'tidak tercatat di sumber data'];
|
||||
$tabs = [
|
||||
'krs' => ['label' => 'KRS & Validasi', 'kiri' => [
|
||||
['Buka KRS?', $ya($detail['krs']['buka']), $detail['krs']['buka']], ['Tanggal Awal KRS', $tgl($detail['krs']['awal'])], ['Tanggal Akhir KRS', $tgl($detail['krs']['akhir'])], ['Tanggal Cetak KRS', $none], ['Buka Validasi KRS?', $none],
|
||||
], 'kanan' => [
|
||||
['Tanggal Awal Validasi KRS', $none], ['Tanggal Akhir Validasi KRS', $none], ['Dosen Tampil Di KRS', $none], ['Buka Cetak KRS?', $none],
|
||||
]],
|
||||
'khs' => ['label' => 'KHS & Nilai', 'kiri' => [
|
||||
['Buka KHS?', $none], ['Tanggal Awal KHS', $none], ['Tanggal Akhir KHS', $none], ['Tanggal Cetak KHS', $none],
|
||||
], 'kanan' => [
|
||||
['Buka Pengisian Nilai?', $ya($detail['nilai']['buka']), $detail['nilai']['buka']], ['Dosen Bisa Isi Persentase Komponen?', $none], ['Tanggal Awal Pengisian Nilai', $tgl($detail['nilai']['awal'])], ['Tanggal Akhir Pengisian Nilai', $tgl($detail['nilai']['akhir'])],
|
||||
]],
|
||||
'ujian' => ['label' => 'Ujian', 'kiri' => [
|
||||
['Buka Cetak Kartu UTS?', $none], ['Tanggal Awal Cetak UTS', $none], ['Tanggal Akhir Cetak UTS', $none], ['Tanggal Cetak UTS', $none], ['Minimal Presensi UTS (Persentase)', $none],
|
||||
], 'kanan' => [
|
||||
['Minimal Presensi UAS (Persentase)', $none], ['Buka Cetak Kartu UAS?', $none], ['Tanggal Awal Cetak UAS', $none], ['Tanggal Akhir Cetak UAS', $none], ['Tanggal Cetak UAS', $none],
|
||||
]],
|
||||
'lain' => ['label' => 'Lain-lain', 'kiri' => [
|
||||
['Buka Pengubahan Biodata?', $ya($detail['registrasi']['buka']), $detail['registrasi']['buka'], 'Jika diaktifkan, mahasiswa dapat mengubah biodata pribadinya sendiri.'], ['Tanggal Awal Pengubahan Biodata', $tgl($detail['registrasi']['awal'])], ['Tanggal Akhir Pengubahan Biodata', $tgl($detail['registrasi']['akhir'])], ['Buka Kuesioner?', $none], ['Tanggal Awal Kuesioner', $none], ['Tanggal Akhir Kuesioner', $none],
|
||||
], 'kanan' => [
|
||||
['Dosen Bisa Generate Tatap Muka?', $none], ['Jumlah Pertemuan Kuliah', $none], ['Batas Waktu Perubahan Status Kuliah dan Presensi oleh Dosen', $none], ['Buka Setting Ketua Kelas?', $none],
|
||||
]],
|
||||
];
|
||||
$config = [
|
||||
'url' => $updateUrl, 'token' => csrf_token(), 'periode' => $periode,
|
||||
'form' => [
|
||||
'kurikulum' => $detail['kurikulum']['aktif'] ?? '',
|
||||
'krs' => ['buka' => $detail['krs']['buka'], 'awal' => $detail['krs']['awal'] ?? '', 'akhir' => $detail['krs']['akhir'] ?? ''],
|
||||
'nilai' => ['buka' => $detail['nilai']['buka'], 'awal' => $detail['nilai']['awal'] ?? '', 'akhir' => $detail['nilai']['akhir'] ?? ''],
|
||||
'registrasi' => ['buka' => $detail['registrasi']['buka'], 'awal' => $detail['registrasi']['awal'] ?? '', 'akhir' => $detail['registrasi']['akhir'] ?? ''],
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-layouts.app :title="'Setting '.$detail['prodi']['nama']">
|
||||
<x-ui.page-header :title="$page['title']" description="Detail Setting Program Studi" :breadcrumbs="$crumbs" />
|
||||
|
||||
<div class="stack" x-data="satuSettingProdi(@js($config))">
|
||||
<x-glass.panel padding="lg" as="section" aria-labelledby="setting-identitas">
|
||||
<div class="panel-title">
|
||||
<h2 id="setting-identitas">Setting program studi</h2>
|
||||
<div class="setting-detail__tools">
|
||||
<x-ui.button variant="secondary" size="sm" :href="$back" icon="arrow-left">Kembali ke Daftar</x-ui.button>
|
||||
<x-ui.button variant="primary" size="sm" icon="pencil-square" x-on:click="openForm()">Edit</x-ui.button>
|
||||
</div>
|
||||
</div>
|
||||
<dl class="setting-detail__kv">
|
||||
<div><dt>Periode</dt><dd>{{ $periodeLabel }}</dd></div>
|
||||
<div><dt>Program Studi</dt><dd>{{ $detail['prodi']['nama'] }}</dd></div>
|
||||
<div><dt>Kurikulum Mahasiswa Baru</dt><dd>{{ $detail['kurikulum']['label'] }}</dd></div>
|
||||
</dl>
|
||||
|
||||
<nav class="tabs setting-detail__tabs" aria-label="Bagian setting">
|
||||
<div class="tabs__list" role="tablist">
|
||||
@foreach ($tabs as $key => $tab)
|
||||
<button type="button" class="tab" role="tab" id="tab-{{ $key }}" aria-controls="panel-{{ $key }}" x-bind:aria-selected="tab === '{{ $key }}'" x-bind:tabindex="tab === '{{ $key }}' ? 0 : -1" x-on:click="tab = '{{ $key }}'">{{ $tab['label'] }}</button>
|
||||
@endforeach
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@foreach ($tabs as $key => $tab)
|
||||
<div id="panel-{{ $key }}" role="tabpanel" aria-labelledby="tab-{{ $key }}" class="setting-detail__panel" x-show="tab === '{{ $key }}'" x-cloak>
|
||||
@foreach (['kiri', 'kanan'] as $side)
|
||||
<dl class="satu-dl">
|
||||
@foreach ($tab[$side] as $row)
|
||||
<div class="satu-dl__row">
|
||||
<dt>{{ $row[0] }}</dt>
|
||||
<dd>
|
||||
@if (is_array($row[1]))
|
||||
<span class="kv__muted" title="{{ ucfirst($row[1]['note']) }}">{{ $row[1]['v'] }}</span>
|
||||
@elseif (isset($row[2]))
|
||||
<span @class(['badge', 'badge--success' => $row[2]])>{{ $row[1] }}</span>
|
||||
@else
|
||||
{{ $row[1] }}
|
||||
@endif
|
||||
@if (isset($row[3])) <p class="kv__muted setting-detail__hint">{{ $row[3] }}</p> @endif
|
||||
</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
</dl>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</x-glass.panel>
|
||||
|
||||
@foreach ([['id' => 'krs', 'judul' => 'Rincian periode KRS per angkatan', 'rows' => $detail['krs']['angkatan'], 'kosong' => 'KRS belum dibuka untuk periode ini.'], ['id' => 'registrasi', 'judul' => 'Rincian periode pengubahan biodata per angkatan', 'rows' => $detail['registrasi']['angkatan'], 'kosong' => 'Pengubahan biodata belum dibuka untuk periode ini.']] as $bagian)
|
||||
<x-glass.panel padding="none" as="section" :aria-labelledby="'setting-'.$bagian['id']">
|
||||
<div class="panel-title panel-title--inset"><h2 id="setting-{{ $bagian['id'] }}">{{ $bagian['judul'] }}</h2><p class="kv__muted">{{ count($bagian['rows']) }} angkatan</p></div>
|
||||
@if ($bagian['rows'] === [])
|
||||
<p class="satu-empty">{{ $bagian['kosong'] }}</p>
|
||||
@else
|
||||
<x-ui.table :label="$bagian['judul']">
|
||||
<table class="table satu-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Angkatan</th>
|
||||
<th scope="col">Tanggal Awal</th>
|
||||
<th scope="col">Tanggal Akhir</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($bagian['rows'] as $r)
|
||||
<tr>
|
||||
<td class="table__title">{{ $r['angkatan'] }}</td>
|
||||
<td>{{ $tgl($r['awal']) }}</td>
|
||||
<td>{{ $tgl($r['akhir']) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</x-ui.table>
|
||||
@endif
|
||||
</x-glass.panel>
|
||||
@endforeach
|
||||
|
||||
{{-- Modal Edit: hanya bidang yang punya tabelnya di DB lama --}}
|
||||
<dialog x-ref="form" class="dialog dialog--wide" aria-labelledby="setting-form-judul" x-on:click="backdrop($event)">
|
||||
<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="setting-form-judul" class="dialog__title">Edit setting {{ $detail['prodi']['nama'] }} — {{ $periodeLabel }}</p>
|
||||
</div>
|
||||
<p class="dialog__message">Hanya pengaturan yang tercatat di SIAKAD yang bisa diubah: kurikulum mahasiswa baru, KRS, pengisian nilai, dan pengubahan biodata. Tanggal KRS dan biodata berlaku untuk semua angkatan mahasiswa aktif.</p>
|
||||
|
||||
<div class="satu-form">
|
||||
<x-form.select name="kurikulum" label="Kurikulum Mahasiswa Baru" :options="collect($detail['kurikulum']['list'])->mapWithKeys(fn (array $k): array => [$k['id'] => $k['nama'].' ('.$k['program'].')'])->all()" placeholder="-- Tidak diubah --" x-model="form.kurikulum" />
|
||||
</div>
|
||||
|
||||
@foreach (['krs' => 'KRS', 'nilai' => 'Pengisian Nilai', 'registrasi' => 'Pengubahan Biodata'] as $key => $label)
|
||||
<fieldset class="setting-form__group">
|
||||
<legend class="setting-form__legend">{{ $label }}</legend>
|
||||
<x-form.checkbox :name="'buka_'.$key" :label="'Buka '.$label.'?'" x-model="form.{{ $key }}.buka" />
|
||||
<div class="satu-form" x-show="form.{{ $key }}.buka">
|
||||
<x-form.field :name="'awal_'.$key" :label="'Tanggal Awal '.$label" type="date" x-model="form.{{ $key }}.awal" />
|
||||
<x-form.field :name="'akhir_'.$key" :label="'Tanggal Akhir '.$label" type="date" x-model="form.{{ $key }}.akhir" />
|
||||
</div>
|
||||
</fieldset>
|
||||
@endforeach
|
||||
|
||||
<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="closeForm()">Batal</x-ui.button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
@@ -0,0 +1,92 @@
|
||||
{{--
|
||||
Setting Prodi (akun DB lama): filter Periode + Unit/Prodi (formulir GET, dimuat di tempat), tabel pohon
|
||||
fakultas > jurusan > prodi dengan kolom katalog SATU. Kurikulum mahasiswa baru = pilihan kurikulum prodi (aktif terpilih);
|
||||
kolom centang dari tabel periode DB lama; kolom tanpa sumber "–". Hanya baca: ubahan hanya memberi notifikasi.
|
||||
--}}
|
||||
@php
|
||||
$checks = [
|
||||
['key' => 'biodata', 'label' => 'Biodata'], ['key' => 'krs', 'label' => 'KRS'], ['key' => null, 'label' => 'Validasi KRS'], ['key' => null, 'label' => 'Cetak KRS'],
|
||||
['key' => null, 'label' => 'KHS'], ['key' => 'nilai', 'label' => 'Pengisian Nilai'], ['key' => null, 'label' => 'Pengisian Kuesioner'], ['key' => null, 'label' => 'Dosen Generate Pertemuan'],
|
||||
];
|
||||
$readonly = "window.toast('info', 'Pengaturan belum bisa diubah dari halaman ini.')";
|
||||
@endphp
|
||||
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="$note">
|
||||
<x-glass.panel padding="sm" as="section" aria-label="Filter data">
|
||||
<form method="GET" action="{{ route('operator.halaman', $page['slug']) }}" class="filter-bar" x-data x-on:change="$el.requestSubmit()">
|
||||
<x-form.select name="periode" :label="$labels['periode']" :options="$periods->all()" :value="$values['periode']" placeholder="" data-no-clear />
|
||||
<x-form.select name="unit" :label="$labels['unit']" :options="$units" :value="$values['unit']" placeholder="-- Semua Unit --" />
|
||||
<noscript><x-ui.button type="submit" variant="secondary" size="sm">Tampilkan</x-ui.button></noscript>
|
||||
</form>
|
||||
</x-glass.panel>
|
||||
|
||||
@if (! $ready)
|
||||
<x-glass.panel padding="lg" as="section" aria-label="Setting program studi">
|
||||
<x-ui.empty icon="building-library" title="Akun belum terhubung ke program studi" description="Setting prodi tampil setelah akun Anda dipetakan ke program studi oleh Pusat Komputer." />
|
||||
</x-glass.panel>
|
||||
@else
|
||||
<x-glass.panel padding="none" as="section" :aria-label="'Daftar '.$page['title']">
|
||||
<x-ui.table label="Setting program studi">
|
||||
<table class="table satu-table setting-table" x-data>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Program Studi</th>
|
||||
<th scope="col">Kurikulum Mahasiswa Baru</th>
|
||||
@foreach ($checks as $c)
|
||||
<th scope="col" class="setting-table__check">{{ $c['label'] }}</th>
|
||||
@endforeach
|
||||
<th scope="col" class="table__actions"><span class="visually-hidden">Aksi</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($tree as $fak)
|
||||
<tr class="setting-table__unit">
|
||||
<th scope="row" colspan="{{ 3 + count($checks) }}">{{ $fak['nama'] }}</th>
|
||||
</tr>
|
||||
@foreach ($fak['jurusan'] as $jur)
|
||||
@if ($jur['nama'] !== null)
|
||||
<tr class="setting-table__unit setting-table__unit--jurusan">
|
||||
<th scope="row" colspan="{{ 3 + count($checks) }}">Jurusan {{ $jur['nama'] }}</th>
|
||||
</tr>
|
||||
@endif
|
||||
@foreach ($jur['prodi'] as $prodi)
|
||||
<tr>
|
||||
<td class="table__title setting-table__prodi">{{ $prodi['nama'] }}</td>
|
||||
<td>
|
||||
@if ($prodi['kurikulum'] === [])
|
||||
<span class="kv__muted">–</span>
|
||||
@else
|
||||
<label class="visually-hidden" for="kurikulum-{{ $prodi['id'] }}">Kurikulum mahasiswa baru {{ $prodi['nama'] }}</label>
|
||||
<select id="kurikulum-{{ $prodi['id'] }}" class="field__input field__select setting-table__select" data-no-select2 x-on:change="{{ $readonly }}; $event.target.value = '{{ $prodi['kurikulum_aktif'] ?? '' }}'">
|
||||
<option value="" @selected($prodi['kurikulum_aktif'] === null)>–</option>
|
||||
@foreach ($prodi['kurikulum'] as $k)
|
||||
<option value="{{ $k['id'] }}" @selected($k['id'] === $prodi['kurikulum_aktif'])>{{ $k['nama'] }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
</td>
|
||||
@foreach ($checks as $c)
|
||||
<td class="setting-table__check">
|
||||
@if ($c['key'] === null)
|
||||
<span class="kv__muted" aria-label="{{ $c['label'] }} tidak tercatat">–</span>
|
||||
@else
|
||||
<input type="checkbox" class="check__input" aria-label="{{ $c['label'] }} {{ $prodi['nama'] }}" @checked($prodi[$c['key']]) x-on:change="{{ $readonly }}; $event.target.checked = {{ $prodi[$c['key']] ? 'true' : 'false' }}">
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
<td class="table__actions">
|
||||
<a class="btn btn--ghost btn--sm btn--icon" href="{{ route('operator.setting-prodi.show', ['id' => $prodi['id'], 'periode' => $values['periode']]) }}" aria-label="Lihat {{ $prodi['nama'] }}"><x-heroicon-o-eye /></a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</x-ui.table>
|
||||
@if ($tree === [])
|
||||
<p class="satu-empty">Tidak ada program studi pada unit terpilih.</p>
|
||||
@endif
|
||||
</x-glass.panel>
|
||||
@endif
|
||||
</x-satu.frame>
|
||||
Reference in New Issue
Block a user