feat(webstatement): tambahkan fitur retry laporan transaksi ATM
- Menambahkan method baru `retry` pada `AtmTransactionReportController` untuk memproses ulang laporan transaksi ATM:
- Mengizinkan retry untuk laporan dengan status `failed` atau `pending`.
- Mereset status laporan menjadi `processing` dan membersihkan informasi error sebelumnya.
- Dispatch ulang job `GenerateAtmTransactionReportJob`.
- Menambahkan mekanisme error handling dengan memperbarui status laporan jika terjadi kegagalan.
- Memperbarui view `atm-reports/index.blade.php`:
- Menambahkan tombol `Retry Job` pada baris laporan dengan status `failed` atau `pending`.
- Menyediakan fungsi JavaScript untuk memproses retry dengan AJAX:
- Menampilkan konfirmasi sebelum retry.
- Reload halaman setelah retry selesai.
- Memperbarui view `atm-reports/show.blade.php`:
- Menambahkan tombol `Retry Job` untuk laporan dengan status `failed`, `pending`, atau `completed` yang kehilangan file.
- Menampilkan form retry dalam pesan error jika file laporan tidak tersedia.
- Memperbarui routing pada `web.php`:
- Menambahkan route baru `atm-reports.retry` untuk endpoint retry dengan HTTP POST.
- Mendaftarkan ulang command `GenerateAtmTransactionReport` pada provider:
- Memastikan job untuk retry sudah terdaftar pada sistem.
Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -241,6 +241,31 @@
|
||||
</a>`;
|
||||
}
|
||||
|
||||
// Di bagian JavaScript untuk action buttons
|
||||
if (data.status === 'failed' || data.status === 'pending' || (data.status === 'completed' && !data.file_path)) {
|
||||
buttons += `<button class="btn btn-sm btn-icon btn-clear btn-warning" onclick="retryReport(${data.id})" title="Retry Job">
|
||||
<i class="ki-duotone ki-arrows-circle fs-5"></i>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
// Tambahkan function untuk retry
|
||||
function retryReport(id) {
|
||||
if (confirm('Are you sure you want to retry generating this report?')) {
|
||||
$.ajax({
|
||||
url: `atm-reports/${id}/retry`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr) {
|
||||
alert('Error: ' + xhr.responseJSON.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
buttons += `</div>`;
|
||||
return buttons;
|
||||
},
|
||||
|
||||
@@ -14,6 +14,15 @@
|
||||
<i class="ki-duotone ki-document fs-2"></i>Download Report
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (in_array($atmReport->status, ['failed', 'pending']) || ($atmReport->status === 'completed' && !$atmReport->file_path))
|
||||
<form action="{{ route('atm-reports.retry', $atmReport->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to retry generating this report?')">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm btn-warning me-2">
|
||||
<i class="ki-duotone ki-arrows-circle fs-2"></i>Retry Job
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -91,6 +100,15 @@
|
||||
<div class="fw-bold fs-6">
|
||||
@if ($atmReport->file_path)
|
||||
<div>Path: {{ $atmReport->file_path }}</div>
|
||||
@else
|
||||
<div class="text-warning">File not available -
|
||||
<form action="{{ route('atm-reports.retry', $atmReport->id) }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
<button type="submit" class="p-0 btn btn-link text-warning" onclick="return confirm('File is missing. Retry generating the report?')">
|
||||
Click here to retry
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
@if ($atmReport->file_size)
|
||||
<div>Size: {{ number_format($atmReport->file_size / 1024, 2) }} KB</div>
|
||||
|
||||
Reference in New Issue
Block a user