Conversation
|
🔄 AI PR Review sedang antri di server...
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue # #1100
penyesuaian di API Database Gabungan https://github.com/OpenSID/API-Database-Gabungan/pull/452
🎯 Deskripsi
Pull request ini melengkapi fitur dan fungsionalitas pada modul Laporan Desa Aktif (
/laporan/desa-aktif) sesuai dengan ketentuan pada issue, mencakup tiga penambahan utama:.xlsyang disesuaikan dengan parameter filter/pencarian yang sedang aktif.login_terakhir ≤ 7 hari), ATAUperubahan_terakhir ≤ 7 hari).Apabila kedua tanggal tersebut lebih dari 7 hari atau kosong, maka status desa otomatis menjadi Tidak Aktif.
🛠️ Perubahan yang Dilakukan
1.
app/Http/Controllers/LaporanDesaAktifController.phpAdd — Logika pengambilan data tersentralisasi, kalkulasi status, dan export Excel:
getDesaAktifData(Request $request)untuk mengambil data dari API Proxy (desa-aktif) dan memetakan atributstatus_aktifke setiap item data.hitungStatusAktif(array $attributes): stringmenggunakan\Carbon\Carbon::now()->subDays(7)untuk memvalidasi apakahlogin_terakhiratauperubahan_terakhirberada dalam rentang 7 hari terakhir.exportExcel(Request $request)yang merender viewlaporan.desa_aktif.cetakdengan flag$excel = truedan mengembalikan response dengan headerContent-Type: application/vnd.ms-excelsertaContent-Disposition: attachment; filename="laporan-desa-aktif.xls".2.
routes/web.phpAdd — Pendaftaran route untuk export Excel:
GET laporan/desa-aktif/export-exceldengan nama routelaporan.desa-aktif.export-excel.Route::prefix('desa-aktif')->group(function () { Route::get('', [App\Http\Controllers\LaporanDesaAktifController::class, 'index'])->name('laporan.desa-aktif.index'); Route::get('cetak', [App\Http\Controllers\LaporanDesaAktifController::class, 'cetak'])->name('laporan.desa-aktif.cetak'); + Route::get('export-excel', [App\Http\Controllers\LaporanDesaAktifController::class, 'exportExcel'])->name('laporan.desa-aktif.export-excel'); });3.
resources/views/laporan/desa_aktif/index.blade.phpAdd & Modify — Penambahan tombol Excel, kolom Kecamatan & Status, dan kalkulasi client-side DataTables:
#export-excel) pada header card di samping tombol Cetak.Kecamatansetelah kolomDesadan kolomStatuspada akhir tabelthead.attributes.nama_kecamatandan custom renderercolumnDefsuntuk kolomStatus(index ke-7) di dalam konfigurasi DataTables dengan logika pembandingan tanggal di sisi client-side menggunakan JavaScript.#export-exceluntuk membuka URL unduhan Excel dengan membawa parameter pencarian (search) yang sedang diinputkan pengguna.4.
resources/views/laporan/desa_aktif/cetak.blade.phpAdd & Modify — Penambahan kolom pada tampilan cetak/excel dan pengecekan flag excel:
Kecamatan($item['attributes']['nama_kecamatan']) danStatus($item['attributes']['status_aktif']) pada tabeltheaddantbody.window.print()dengan kondisi@if (!isset($excel))agar dialog cetak otomatis (print dialog) hanya muncul saat halaman dibuka untuk cetak biasa dan tidak dijalankan saat dirender sebagai file Excel.@push('scripts') + @if (!isset($excel)) <script nonce="{{ csp_nonce() }}"> window.print(); </script> + @endif @endpush✅ Test Cases yang Diimplementasikan
/laporan/desa-aktif/cetak), serta pada file Excel yang diunduh.login_terakhiratauperubahan_terakhirberjarak maksimal 7 hari dari waktu sekarang.login_terakhirdanperubahan_terakhir) lebih dari 7 hari atau kosong/tidak valid (0000-00-00).laporan-desa-aktif.xlsyang berisi tabel data lengkap tanpa memicu pop-upwindow.print().📸 Cara Menjalankan Uji Coba Manual
/laporan/desa-aktif.laporan-desa-aktif.xlsterunduh dan dapat dibuka di aplikasi spreadsheet dengan data yang konsisten sesuai tabel.window.print().📸 Screenshot atau Video