feat(webstatement): tambah stmt_entry_detail migrasi, model, dan job processing
Menambahkan fitur pengelolaan data stmt_entry_detail untuk integrasi transaksi dengan detail yang lebih lengkap. Perubahan yang dilakukan: - Membuat migrasi create_stmt_entry_detail_table dengan struktur field sesuai kebutuhan bisnis - Menambahkan index pada kolom penting untuk meningkatkan performa query - Membuat model StmtEntryDetail dengan relasi ke: - Account - TempFundsTransfer - TempTransaction - Teller - DataCapture - TempArrangement - Mengimplementasikan $fillable dan $casts sesuai struktur tabel - Menambahkan relasi untuk memudahkan integrasi antar modul - Membuat job ProcessStmtEntryDetailDataJob untuk memproses file CSV dengan batch processing - Mengimplementasikan chunking untuk menangani file besar secara efisien - Membersihkan trans_reference dari karakter tidak valid sebelum penyimpanan - Menggunakan updateOrCreate untuk mencegah duplikasi primary key - Menggunakan database transaction untuk menjaga konsistensi data - Menambahkan logging komprehensif untuk monitoring dan debugging - Mengimplementasikan error handling yang robust untuk menghindari job failure tanpa informasi - Memastikan penggunaan resource memory tetap optimal saat memproses data besar - Menambahkan case baru di MigrasiController untuk memproses stmt_entry_detail - Konsisten dengan pattern migrasi data yang sudah ada di sistem Tujuan perubahan: - Menyediakan sistem import dan pengolahan data stmt_entry_detail dengan proses yang aman dan efisien - Memudahkan integrasi transaksi dengan detail tambahan di modul Webstatement - Menjamin integritas data dengan penggunaan transaction, logging, dan error handling yang komprehensif
This commit is contained in:
@@ -6,8 +6,10 @@
|
||||
|
||||
@section('content')
|
||||
<div class="grid">
|
||||
<div class="card card-grid min-w-full" data-datatable="false" data-datatable-page-size="10" data-datatable-state-save="false" id="laporan-closing-balance-table" data-api-url="{{ route('laporan-closing-balance.datatables') }}">
|
||||
<div class="card-header py-5 flex-wrap">
|
||||
<div class="min-w-full card card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||
data-datatable-state-save="false" id="laporan-closing-balance-table"
|
||||
data-api-url="{{ route('laporan-closing-balance.datatables') }}">
|
||||
<div class="flex-wrap py-5 card-header">
|
||||
<h3 class="card-title">
|
||||
Laporan Closing Balance
|
||||
</h3>
|
||||
@@ -16,93 +18,73 @@
|
||||
<div class="flex flex-wrap gap-2.5 items-end">
|
||||
<!-- Nomor Rekening Filter -->
|
||||
<div class="flex flex-col">
|
||||
<label class="text-sm font-medium text-gray-700 mb-1">Nomor Rekening</label>
|
||||
<input type="text" id="account-number-filter" class="input w-[200px]" placeholder="Masukkan nomor rekening">
|
||||
<input type="text" id="account-number-filter" class="input w-[200px]"
|
||||
placeholder="Masukkan nomor rekening">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Tanggal Mulai Filter -->
|
||||
<div class="flex flex-col">
|
||||
<label class="text-sm font-medium text-gray-700 mb-1">Tanggal Mulai</label>
|
||||
<input type="date" id="start-date-filter" class="input w-[150px]">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Tanggal Akhir Filter -->
|
||||
<div class="flex flex-col">
|
||||
<label class="text-sm font-medium text-gray-700 mb-1">Tanggal Akhir</label>
|
||||
<input type="date" id="end-date-filter" class="input w-[150px]">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Tombol Filter -->
|
||||
<button type="button" id="apply-filter" class="btn btn-primary">
|
||||
<i class="ki-filled ki-magnifier"></i>
|
||||
Filter
|
||||
</button>
|
||||
|
||||
|
||||
<!-- Tombol Reset -->
|
||||
<button type="button" id="reset-filter" class="btn btn-light">
|
||||
<i class="ki-filled ki-arrows-circle"></i>
|
||||
Reset
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2.5">
|
||||
<div class="h-[24px] border border-r-gray-200"></div>
|
||||
<a class="btn btn-light" href="{{ route('laporan-closing-balance.export') }}" id="export-btn">
|
||||
<i class="ki-filled ki-file-down"></i>
|
||||
Export to CSV
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="scrollable-x-auto">
|
||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm" data-datatable-table="true">
|
||||
<table class="table text-sm font-medium text-gray-700 align-middle table-auto table-border"
|
||||
data-datatable-table="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-14">
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||
</th>
|
||||
<th class="min-w-[200px]" data-datatable-column="account_number">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Nomor Rekening</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="period">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Periode</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="cleared_balance">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Saldo Cleared</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="actual_balance">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Saldo Akhir</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="updated_at">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Tanggal Update</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[100px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="w-14">
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
||||
</th>
|
||||
<th class="min-w-[200px]" data-datatable-column="account_number">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Nomor Rekening</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="period">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Periode</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="updated_at">
|
||||
<span class="sort">
|
||||
<span class="sort-label">Tanggal Update</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[100px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
||||
<div class="flex items-center gap-2">
|
||||
<div
|
||||
class="flex-col gap-3 justify-center font-medium text-gray-600 card-footer md:justify-between md:flex-row text-2sm">
|
||||
<div class="flex gap-2 items-center">
|
||||
Show
|
||||
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"></select> per page
|
||||
<select class="w-16 select select-sm" data-datatable-size="true" name="perpage"></select> per page
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex gap-4 items-center">
|
||||
<span data-datatable-info="true"></span>
|
||||
<div class="pagination" data-datatable-pagination="true">
|
||||
</div>
|
||||
@@ -135,11 +117,11 @@
|
||||
*/
|
||||
function formatPeriod(period) {
|
||||
if (!period || period.length !== 8) return period;
|
||||
|
||||
|
||||
const year = period.substring(0, 4);
|
||||
const month = period.substring(4, 6);
|
||||
const day = period.substring(6, 8);
|
||||
|
||||
|
||||
return `${day}/${month}/${year}`;
|
||||
}
|
||||
|
||||
@@ -150,7 +132,7 @@
|
||||
*/
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return '-';
|
||||
|
||||
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('id-ID', {
|
||||
year: 'numeric',
|
||||
@@ -171,11 +153,25 @@
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
|
||||
const apiUrl = element.getAttribute('data-api-url');
|
||||
|
||||
// Konfigurasi DataTable
|
||||
|
||||
// Set default date range (last 30 days) SEBELUM inisialisasi DataTable
|
||||
const today = new Date();
|
||||
const thirtyDaysAgo = new Date(today.getTime() - (30 * 24 * 60 * 60 * 1000));
|
||||
|
||||
endDateFilter.value = today.toISOString().split('T')[0];
|
||||
startDateFilter.value = thirtyDaysAgo.toISOString().split('T')[0];
|
||||
|
||||
// Prepare initial filters
|
||||
let initialFilters = {
|
||||
start_date: startDateFilter.value,
|
||||
end_date: endDateFilter.value
|
||||
};
|
||||
|
||||
// Konfigurasi DataTable dengan filter awal
|
||||
const dataTableOptions = {
|
||||
apiEndpoint: apiUrl,
|
||||
pageSize: 10,
|
||||
searchParams: initialFilters, // Set filter awal di sini
|
||||
columns: {
|
||||
select: {
|
||||
render: (item, data, context) => {
|
||||
@@ -199,36 +195,26 @@
|
||||
return `<span class="text-gray-700">${formatPeriod(data.period)}</span>`;
|
||||
}
|
||||
},
|
||||
cleared_balance: {
|
||||
title: 'Saldo Cleared',
|
||||
render: (item, data) => {
|
||||
const amount = parseFloat(data.cleared_balance) || 0;
|
||||
return `<span class="text-blue-600 font-medium">${formatCurrency(amount)}</span>`;
|
||||
}
|
||||
},
|
||||
actual_balance: {
|
||||
title: 'Saldo Akhir',
|
||||
render: (item, data) => {
|
||||
const amount = parseFloat(data.actual_balance) || 0;
|
||||
return `<span class="text-green-600 font-medium">${formatCurrency(amount)}</span>`;
|
||||
}
|
||||
},
|
||||
updated_at: {
|
||||
title: 'Tanggal Update',
|
||||
render: (item, data) => {
|
||||
return `<span class="text-gray-600 text-sm">${formatDate(data.updated_at)}</span>`;
|
||||
return `<span class="text-sm text-gray-600">${formatDate(data.created_at)}</span>`;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
title: 'Action',
|
||||
render: (item, data) => {
|
||||
const downloadUrl =
|
||||
`{{ route('laporan-closing-balance.download', ['accountNumber' => '__ACCOUNT__', 'period' => '__PERIOD__']) }}`
|
||||
.replace('__ACCOUNT__', data.account_number)
|
||||
.replace('__PERIOD__', data.period);
|
||||
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-info"
|
||||
href="{{ route('laporan-closing-balance.show', ['accountNumber' => '__ACCOUNT__', 'period' => '__PERIOD__']) }}"
|
||||
.replace('__ACCOUNT__', data.account_number)
|
||||
.replace('__PERIOD__', data.period)
|
||||
title="Lihat Detail">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-success"
|
||||
href="${downloadUrl}"
|
||||
title="Download Laporan"
|
||||
download>
|
||||
<i class="ki-outline ki-file-down"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
},
|
||||
@@ -236,9 +222,11 @@
|
||||
},
|
||||
};
|
||||
|
||||
// Inisialisasi DataTable
|
||||
// Inisialisasi DataTable dengan filter awal sudah terset
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
dataTable.showSpinner();
|
||||
|
||||
// Update export URL dengan filter awal
|
||||
updateExportUrl(initialFilters);
|
||||
|
||||
/**
|
||||
* Fungsi untuk menerapkan filter
|
||||
@@ -260,7 +248,7 @@
|
||||
|
||||
console.log('Applying filters:', filters);
|
||||
dataTable.search(filters);
|
||||
|
||||
|
||||
// Update export URL dengan filter
|
||||
updateExportUrl(filters);
|
||||
}
|
||||
@@ -272,7 +260,7 @@
|
||||
accountNumberFilter.value = '';
|
||||
startDateFilter.value = '';
|
||||
endDateFilter.value = '';
|
||||
|
||||
|
||||
dataTable.search({});
|
||||
updateExportUrl({});
|
||||
}
|
||||
@@ -281,15 +269,15 @@
|
||||
* Fungsi untuk update URL export dengan parameter filter
|
||||
*/
|
||||
function updateExportUrl(filters) {
|
||||
const baseUrl = '{{ route("laporan-closing-balance.export") }}';
|
||||
const baseUrl = '{{ route('laporan-closing-balance.export') }}';
|
||||
const params = new URLSearchParams();
|
||||
|
||||
|
||||
Object.keys(filters).forEach(key => {
|
||||
if (filters[key]) {
|
||||
params.append(key, filters[key]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const newUrl = params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl;
|
||||
exportBtn.href = newUrl;
|
||||
}
|
||||
@@ -297,7 +285,7 @@
|
||||
// Event listeners
|
||||
applyFilterBtn.addEventListener('click', applyFilters);
|
||||
resetFilterBtn.addEventListener('click', resetFilters);
|
||||
|
||||
|
||||
// Auto apply filter saat enter di input
|
||||
[accountNumberFilter, startDateFilter, endDateFilter].forEach(input => {
|
||||
input.addEventListener('keypress', function(e) {
|
||||
@@ -307,16 +295,9 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Set default date range (last 30 days)
|
||||
const today = new Date();
|
||||
const thirtyDaysAgo = new Date(today.getTime() - (30 * 24 * 60 * 60 * 1000));
|
||||
|
||||
endDateFilter.value = today.toISOString().split('T')[0];
|
||||
startDateFilter.value = thirtyDaysAgo.toISOString().split('T')[0];
|
||||
|
||||
// Apply default filter
|
||||
setTimeout(() => {
|
||||
applyFilters();
|
||||
}, 100);
|
||||
// HAPUS bagian ini yang menyebabkan double API call:
|
||||
// setTimeout(() => {
|
||||
// applyFilters();
|
||||
// }, 100);
|
||||
</script>
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user