Files
citrus-cms/resources/views/admin-ajax/cron-report-builder-status.blade.php
2026-04-28 21:15:09 +03:00

41 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// Genel ilerleme bilgisini al
$overallProgressJson = setting('cron_report_builder_overall_progress', false, '{"last_run":"Never","execution_time":0,"status":"not_started"}');
$overallProgress = json_decode($overallProgressJson, true);
// Aktif template'lerin durumunu al
$documentTemplates = DB::table("document_templates")->where("y", "1")->get();
$templateStatuses = [];
foreach ($documentTemplates as $template) {
$cacheKey = "cron_report_builder_template_{$template->id}";
$progressCacheKey = "cron_report_builder_progress_{$template->id}";
$lastProcessedIndex = (int)setting($cacheKey, false, "0");
$progressJson = setting($progressCacheKey, false, '{"processed_count":0,"error_count":0,"success_count":0,"total_records":0}');
$progress = json_decode($progressJson, true);
// Template'in tamamlanıp tamamlanmadığını kontrol et
$isCompleted = setting($cacheKey) === "0" && $progress['processed_count'] > 0;
$templateStatuses[] = [
'id' => $template->id,
'name' => $template->name ?? $template->title ?? 'N/A',
'last_processed_index' => $lastProcessedIndex,
'processed_count' => $progress['processed_count'],
'error_count' => $progress['error_count'],
'success_count' => $progress['success_count'],
'total_records' => $progress['total_records'],
'is_completed' => $isCompleted,
'progress_percentage' => $progress['total_records'] > 0 ? round(($progress['processed_count'] / $progress['total_records']) * 100, 2) : 0
];
}
// JSON response döndür
echo json_encode([
'overall_progress' => $overallProgress,
'template_statuses' => $templateStatuses,
'timestamp' => now()->toISOString()
]);
?>