[Operator] Perbaikan Laman Portal -> Konsultasi
This commit is contained in:
+9
-4
@@ -1048,11 +1048,11 @@ Alpine.data('satuRemoteTable', (config) => ({
|
||||
}));
|
||||
|
||||
/*
|
||||
* Detail mahasiswa (Portal operator > Mahasiswa): biodata per bagian yang bisa diubah di tempat. Tiap bagian punya nilai
|
||||
* Detail mahasiswa dan pegawai (Portal operator): biodata per bagian yang bisa diubah di tempat. Tiap bagian punya nilai
|
||||
* isian (values) dan teks tampil (display); Simpan mengirim PUT JSON untuk satu bagian lalu memakai nilai segar dari server.
|
||||
* config: { tab, saveUrl ("__SECTION__"), token, values: { bagian: { kolom: nilai } }, display: { bagian: { kolom: teks } } }.
|
||||
*/
|
||||
Alpine.data('studentBiodata', (config) => ({
|
||||
Alpine.data('bioDetail', (config) => ({
|
||||
tab: config.tab,
|
||||
values: config.values,
|
||||
display: config.display,
|
||||
@@ -1061,8 +1061,12 @@ Alpine.data('studentBiodata', (config) => ({
|
||||
saving: false,
|
||||
reloading: false,
|
||||
|
||||
// Nama lengkap dari bagian pribadi: gelar depan + nama, gelar belakang setelah koma (mahasiswa tidak punya gelar)
|
||||
get nama() {
|
||||
return this.display.pribadi?.nama ?? '';
|
||||
const v = this.values.pribadi ?? {};
|
||||
const name = [String(v.gelardepan ?? '').trim(), String(v.nama ?? '').trim()].filter(Boolean).join(' ');
|
||||
const back = String(v.gelarbelakang ?? '').trim().replace(/^[,\s]+/, '');
|
||||
return back ? name + ', ' + back : name;
|
||||
},
|
||||
|
||||
// Inisial seperti ui.avatar: gelar bertitik dan bagian setelah koma dilewati
|
||||
@@ -1112,7 +1116,8 @@ Alpine.data('studentBiodata', (config) => ({
|
||||
return;
|
||||
}
|
||||
this.values[key] = data.values;
|
||||
this.display[key] = data.display;
|
||||
// Gabung: keterangan hanya-baca (bukan isian) di display tetap dipertahankan
|
||||
this.display[key] = { ...this.display[key], ...data.display };
|
||||
this.editing = null;
|
||||
window.toast('success', data.message);
|
||||
} catch (error) {
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{{--
|
||||
Navigasi bagian + panel biodata (lihat/ubah di tempat) untuk halaman detail operator. Dipakai di dalam elemen ber-x-data
|
||||
`bioDetail` (resources/js/app.js). $sections: bagian dari StudentBiodata/EmployeeBiodata (+ opsional `readonly`).
|
||||
--}}
|
||||
@props(['sections'])
|
||||
|
||||
<div class="bio">
|
||||
<x-glass.panel padding="sm" as="nav" class="bio__nav" aria-label="Bagian biodata">
|
||||
<div class="bio__tabs" role="tablist" aria-orientation="vertical">
|
||||
@foreach ($sections as $key => $section)
|
||||
<button type="button" role="tab" id="bio-tab-{{ $key }}" class="bio__tab" aria-controls="bio-panel-{{ $key }}" data-no-busy
|
||||
x-bind:aria-selected="tab === '{{ $key }}'" x-bind:tabindex="tab === '{{ $key }}' ? 0 : -1" x-on:click="show('{{ $key }}')">
|
||||
<x-dynamic-component :component="'heroicon-o-'.$section['icon']" />
|
||||
<span>{{ $section['title'] }}</span>
|
||||
</button>
|
||||
@endforeach
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
|
||||
<div class="bio__panels">
|
||||
@foreach ($sections as $key => $section)
|
||||
<x-glass.panel padding="lg" as="section" role="tabpanel" id="bio-panel-{{ $key }}" aria-labelledby="bio-tab-{{ $key }}" x-ref="panel-{{ $key }}" x-show="tab === '{{ $key }}'" x-cloak>
|
||||
<div class="bio-head">
|
||||
<span class="bio-head__icon" aria-hidden="true"><x-dynamic-component :component="'heroicon-o-'.$section['icon']" /></span>
|
||||
<div class="bio-head__text">
|
||||
<h2 class="bio-head__title">{{ $section['title'] }}</h2>
|
||||
<p class="bio-head__hint">{{ $section['description'] }}</p>
|
||||
</div>
|
||||
<x-ui.button variant="secondary" size="sm" icon="pencil-square" x-show="editing !== '{{ $key }}'" x-on:click="edit('{{ $key }}')">Ubah</x-ui.button>
|
||||
</div>
|
||||
|
||||
<dl class="bio-list" x-show="editing !== '{{ $key }}'">
|
||||
@foreach ($section['readonly'] ?? [] as $item)
|
||||
<div class="bio-list__item">
|
||||
<dt>{{ $item['label'] }}</dt>
|
||||
<dd x-text="display.{{ $key }}.{{ $item['name'] }}" x-bind:class="{ 'bio-list__empty': display.{{ $key }}.{{ $item['name'] }} === '–' }">{{ $section['display'][$item['name']] }}</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
@foreach ($section['fields'] as $field)
|
||||
<div @class(['bio-list__item', 'bio-list__item--wide' => $field['wide'] ?? false])>
|
||||
<dt>{{ $field['label'] }}</dt>
|
||||
<dd x-text="display.{{ $key }}.{{ $field['name'] }}" x-bind:class="{ 'bio-list__empty': display.{{ $key }}.{{ $field['name'] }} === '–' }">{{ $section['display'][$field['name']] }}</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
</dl>
|
||||
|
||||
<form class="satu-form bio-form" novalidate data-no-busy x-bind:aria-busy="saving" x-show="editing === '{{ $key }}'" x-cloak x-on:submit.prevent="save()" x-on:keydown.escape="cancel()">
|
||||
@foreach ($section['fields'] as $field)
|
||||
@php
|
||||
$type = $field['type'] ?? 'text';
|
||||
$id = 'bio_'.$field['name'];
|
||||
$wide = ($field['wide'] ?? false) ? 'col-span-full' : null;
|
||||
@endphp
|
||||
@if ($type === 'select')
|
||||
<x-form.select :name="$id" :label="$field['label']" :options="$field['options']" :placeholder="($field['blank'] ?? false) ? '' : null" :required="$field['required'] ?? false" x-model="form.{{ $field['name'] }}" />
|
||||
@elseif ($type === 'textarea')
|
||||
<x-form.textarea :name="$id" :label="$field['label']" :rows="3" :maxlength="$field['max']" :class="$wide" x-model="form.{{ $field['name'] }}" />
|
||||
@else
|
||||
<x-form.field :name="$id" :label="$field['label']" :type="$type" :maxlength="$type === 'number' ? null : ($field['max'] ?? null)" :min="$type === 'number' ? ($field['min'] ?? null) : null" :max="$type === 'number' ? ($field['max'] ?? null) : null" :required="$field['required'] ?? false" :placeholder="$field['placeholder'] ?? null" :class="$wide" x-model="form.{{ $field['name'] }}" />
|
||||
@endif
|
||||
@endforeach
|
||||
<div class="satu-form__actions">
|
||||
<x-ui.button type="submit" variant="primary" icon="check" x-bind:disabled="saving" x-bind:data-busy="saving ? '' : false" x-bind:aria-busy="saving"><span x-text="saving ? 'Menyimpan...' : 'Simpan'">Simpan</span></x-ui.button>
|
||||
<x-ui.button variant="secondary" data-no-busy x-bind:disabled="saving" x-on:click="cancel()">Batal</x-ui.button>
|
||||
</div>
|
||||
</form>
|
||||
</x-glass.panel>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
</x-slot:actions>
|
||||
</x-ui.page-header>
|
||||
|
||||
<div class="stack" x-data="studentBiodata(@js($config))">
|
||||
<div class="stack" x-data="bioDetail(@js($config))">
|
||||
<x-glass.panel padding="lg" as="section" aria-labelledby="mhs-nama">
|
||||
<div class="bio-hero">
|
||||
<span class="avatar avatar--xl" role="img" x-bind:aria-label="nama" x-text="initials">{{ \Illuminate\Support\Str::of($student['nama'])->before(',')->squish()->substr(0, 1)->upper() }}</span>
|
||||
@@ -47,69 +47,6 @@
|
||||
<x-ui.figure label="IPK" :value="$student['ipk'] === null ? '–' : number_format($student['ipk'], 2, ',', '')" hint="Indeks prestasi kumulatif" />
|
||||
</x-ui.figures>
|
||||
|
||||
<div class="bio">
|
||||
<x-glass.panel padding="sm" as="nav" class="bio__nav" aria-label="Bagian biodata">
|
||||
<div class="bio__tabs" role="tablist" aria-orientation="vertical">
|
||||
@foreach ($sections as $key => $section)
|
||||
<button type="button" role="tab" id="bio-tab-{{ $key }}" class="bio__tab" aria-controls="bio-panel-{{ $key }}" data-no-busy
|
||||
x-bind:aria-selected="tab === '{{ $key }}'" x-bind:tabindex="tab === '{{ $key }}' ? 0 : -1" x-on:click="show('{{ $key }}')">
|
||||
<x-dynamic-component :component="'heroicon-o-'.$section['icon']" />
|
||||
<span>{{ $section['title'] }}</span>
|
||||
</button>
|
||||
@endforeach
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
|
||||
<div class="bio__panels">
|
||||
@foreach ($sections as $key => $section)
|
||||
<x-glass.panel padding="lg" as="section" role="tabpanel" id="bio-panel-{{ $key }}" aria-labelledby="bio-tab-{{ $key }}" x-ref="panel-{{ $key }}" x-show="tab === '{{ $key }}'" x-cloak>
|
||||
<div class="bio-head">
|
||||
<span class="bio-head__icon" aria-hidden="true"><x-dynamic-component :component="'heroicon-o-'.$section['icon']" /></span>
|
||||
<div class="bio-head__text">
|
||||
<h2 class="bio-head__title">{{ $section['title'] }}</h2>
|
||||
<p class="bio-head__hint">{{ $section['description'] }}</p>
|
||||
</div>
|
||||
<x-ui.button variant="secondary" size="sm" icon="pencil-square" x-show="editing !== '{{ $key }}'" x-on:click="edit('{{ $key }}')">Ubah</x-ui.button>
|
||||
</div>
|
||||
|
||||
<dl class="bio-list" x-show="editing !== '{{ $key }}'">
|
||||
@foreach ($section['readonly'] ?? [] as $item)
|
||||
<div class="bio-list__item">
|
||||
<dt>{{ $item['label'] }}</dt>
|
||||
<dd x-text="display.{{ $key }}.{{ $item['name'] }}" x-bind:class="{ 'bio-list__empty': display.{{ $key }}.{{ $item['name'] }} === '–' }">{{ $section['display'][$item['name']] }}</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
@foreach ($section['fields'] as $field)
|
||||
<div @class(['bio-list__item', 'bio-list__item--wide' => $field['wide'] ?? false])>
|
||||
<dt>{{ $field['label'] }}</dt>
|
||||
<dd x-text="display.{{ $key }}.{{ $field['name'] }}" x-bind:class="{ 'bio-list__empty': display.{{ $key }}.{{ $field['name'] }} === '–' }">{{ $section['display'][$field['name']] }}</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
</dl>
|
||||
|
||||
<form class="satu-form bio-form" novalidate data-no-busy x-bind:aria-busy="saving" x-show="editing === '{{ $key }}'" x-cloak x-on:submit.prevent="save()" x-on:keydown.escape="cancel()">
|
||||
@foreach ($section['fields'] as $field)
|
||||
@php
|
||||
$type = $field['type'] ?? 'text';
|
||||
$id = 'bio_'.$field['name'];
|
||||
$wide = ($field['wide'] ?? false) ? 'col-span-full' : null;
|
||||
@endphp
|
||||
@if ($type === 'select')
|
||||
<x-form.select :name="$id" :label="$field['label']" :options="$field['options']" :required="$field['required'] ?? false" x-model="form.{{ $field['name'] }}" />
|
||||
@elseif ($type === 'textarea')
|
||||
<x-form.textarea :name="$id" :label="$field['label']" :rows="3" :maxlength="$field['max']" :class="$wide" x-model="form.{{ $field['name'] }}" />
|
||||
@else
|
||||
<x-form.field :name="$id" :label="$field['label']" :type="$type" :maxlength="$type === 'number' ? null : ($field['max'] ?? null)" :min="$type === 'number' ? ($field['min'] ?? null) : null" :max="$type === 'number' ? ($field['max'] ?? null) : null" :required="$field['required'] ?? false" :class="$wide" x-model="form.{{ $field['name'] }}" />
|
||||
@endif
|
||||
@endforeach
|
||||
<div class="satu-form__actions">
|
||||
<x-ui.button type="submit" variant="primary" icon="check" x-bind:disabled="saving" x-bind:data-busy="saving ? '' : false" x-bind:aria-busy="saving"><span x-text="saving ? 'Menyimpan...' : 'Simpan'">Simpan</span></x-ui.button>
|
||||
<x-ui.button variant="secondary" data-no-busy x-bind:disabled="saving" x-on:click="cancel()">Batal</x-ui.button>
|
||||
</div>
|
||||
</form>
|
||||
</x-glass.panel>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<x-satu.bio-sections :sections="$sections" />
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
{{--
|
||||
Detail pegawai (akun DB lama): ringkasan + biodata per bagian yang bisa diubah di tempat. Dibuka dari aksi Lihat di
|
||||
Portal > Pegawai. Bagian diatur EmployeeBiodata::sections(); bagian Data dosen hanya untuk dosen.
|
||||
--}}
|
||||
@php
|
||||
$config = [
|
||||
'tab' => 'pribadi',
|
||||
'saveUrl' => $saveUrl,
|
||||
'token' => csrf_token(),
|
||||
'values' => collect($sections)->map(fn (array $s): array => $s['values'])->all(),
|
||||
'display' => collect($sections)->map(fn (array $s): array => $s['display'])->all(),
|
||||
];
|
||||
$kep = $sections['kepegawaian']['values'];
|
||||
$initial = \Illuminate\Support\Str::of($sections['pribadi']['values']['nama'])->squish()->substr(0, 1)->upper();
|
||||
@endphp
|
||||
|
||||
<x-layouts.app :title="'Pegawai '.$name">
|
||||
<x-ui.page-header title="Detail Pegawai" description="Biodata lengkap pegawai. Pilih bagian biodata, lalu ubah langsung di halaman ini." :breadcrumbs="$crumbs">
|
||||
<x-slot:actions>
|
||||
<x-ui.button variant="secondary" size="sm" :href="$back" icon="arrow-left">Kembali ke daftar</x-ui.button>
|
||||
</x-slot:actions>
|
||||
</x-ui.page-header>
|
||||
|
||||
<div class="stack" x-data="bioDetail(@js($config))">
|
||||
<x-glass.panel padding="lg" as="section" aria-labelledby="peg-nama">
|
||||
<div class="bio-hero">
|
||||
<span class="avatar avatar--xl" role="img" x-bind:aria-label="nama" x-text="initials">{{ $initial }}</span>
|
||||
<div class="bio-hero__id">
|
||||
<h2 id="peg-nama" class="bio-hero__name" x-text="nama">{{ $name }}</h2>
|
||||
<p class="bio-hero__nim" x-text="values.kepegawaian.nip">{{ $kep['nip'] }}</p>
|
||||
<p class="bio-hero__prodi" x-text="display.dosen?.idprogdi ?? 'Staf'">{{ $sections['dosen']['display']['idprogdi'] ?? 'Staf' }}</p>
|
||||
</div>
|
||||
<div class="cluster cluster--sm">
|
||||
<x-ui.badge tone="accent">{{ $extra['jenis'] ?? 'Pegawai' }}</x-ui.badge>
|
||||
<span class="badge" x-bind:class="values.kepegawaian.statusaktif === 0 ? 'badge--danger' : 'badge--success'" x-text="values.kepegawaian.statusaktif === 0 ? 'Tidak aktif' : 'Aktif'">{{ $kep['statusaktif'] === 0 ? 'Tidak aktif' : 'Aktif' }}</span>
|
||||
<span class="badge" x-show="display.kepegawaian.idstatuspegawai !== '–'" x-text="display.kepegawaian.idstatuspegawai" @if ($sections['kepegawaian']['display']['idstatuspegawai'] === '–') style="display: none" @endif>{{ $sections['kepegawaian']['display']['idstatuspegawai'] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</x-glass.panel>
|
||||
|
||||
<x-ui.figures label="Ringkasan kepegawaian">
|
||||
<x-ui.figure label="Mahasiswa bimbingan" :value="$extra['bimbingan']" hint="Mahasiswa aktif sebagai dosen PA" />
|
||||
<x-ui.figure label="Kelas diampu" :value="$extra['kelas']" hint="Kelas yang tercatat" />
|
||||
<x-ui.figure label="Jabatan aktif" :value="count($extra['jabatan'])" hint="Jabatan saat ini" />
|
||||
</x-ui.figures>
|
||||
|
||||
<x-satu.bio-sections :sections="$sections" />
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
@@ -5,6 +5,7 @@
|
||||
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'].
|
||||
Opsional: $tools (kunci tombol bilah yang boleh tampil, [] = tanpa tombol), $selectable (false = tanpa kotak centang),
|
||||
$editable (false = tanpa aksi Ubah di baris; $form hanya untuk Tambah),
|
||||
$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
|
||||
@@ -16,6 +17,7 @@
|
||||
$destroyUrl ??= null;
|
||||
$form ??= null;
|
||||
$selectable ??= true;
|
||||
$editable ??= true;
|
||||
$destroy = ($destroy ?? []) + ['title' => 'Hapus data terpilih?', 'message' => 'Data yang dipilih akan dihapus.'];
|
||||
$allTools = [
|
||||
'T' => ['Tambah', 'plus', 'primary', 'startInsert()'],
|
||||
@@ -43,7 +45,7 @@
|
||||
'data' => $data,
|
||||
'viewUrl' => $viewUrl,
|
||||
'destroyUrl' => $destroyUrl,
|
||||
'form' => $form ? ['storeUrl' => $form['storeUrl'], 'updateUrl' => $form['updateUrl'], 'fields' => array_map(fn (array $f): array => ['name' => $f['name'], 'default' => $f['default'] ?? (($f['multiple'] ?? false) ? [] : '')], $form['fields'])] : null,
|
||||
'form' => $form ? ['storeUrl' => $form['storeUrl'], 'updateUrl' => $form['updateUrl'] ?? null, 'fields' => array_map(fn (array $f): array => ['name' => $f['name'], 'default' => $f['default'] ?? (($f['multiple'] ?? false) ? [] : '')], $form['fields'])] : null,
|
||||
'columns' => collect($columns)->map(fn (array $c): array => ['key' => $c['key'], 'label' => $c['label']])->values()->all(),
|
||||
'token' => csrf_token(),
|
||||
];
|
||||
@@ -129,7 +131,7 @@
|
||||
@else
|
||||
<x-ui.button variant="ghost" size="sm" icon="eye" :icon-only="true" aria-label="Lihat" x-on:click="startView(row)" />
|
||||
@endif
|
||||
@if ($form)
|
||||
@if ($form && $editable)
|
||||
<template x-if="row.form">
|
||||
<x-ui.button variant="ghost" size="sm" icon="pencil-square" :icon-only="true" aria-label="Ubah" x-on:click="startEdit(row)" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user