Files
orderPRO/resources/views/settings/cron.php
Jacek Pyziak af052e1ff5 feat: add Shoppro payment status synchronization service
- Implemented ShopproPaymentStatusSyncService to handle payment status synchronization between Shoppro and Orderpro.
- Added methods for resolving watched status codes, finding candidate orders, and syncing individual order payments.
- Introduced ShopproStatusMappingRepository for managing status mappings between Shoppro and Orderpro.
- Created ShopproStatusSyncService to facilitate synchronization of order statuses from Shoppro to Orderpro.
2026-03-08 20:41:10 +01:00

174 lines
7.8 KiB
PHP

<?php
$schedulesList = is_array($schedules ?? null) ? $schedules : [];
$futureJobsList = is_array($futureJobs ?? null) ? $futureJobs : [];
$pastJobsList = is_array($pastJobs ?? null) ? $pastJobs : [];
$pastPagination = is_array($pastJobsPagination ?? null) ? $pastJobsPagination : [];
$pastPage = max(1, (int) ($pastPagination['page'] ?? 1));
$pastTotalPages = max(1, (int) ($pastPagination['total_pages'] ?? 1));
$pastTotal = max(0, (int) ($pastPagination['total'] ?? 0));
?>
<section class="card">
<h2 class="section-title"><?= $e($t('settings.cron.title')) ?></h2>
<?php if (!empty($errorMessage)): ?>
<div class="alert alert--danger mt-12" role="alert"><?= $e((string) $errorMessage) ?></div>
<?php endif; ?>
<?php if (!empty($successMessage)): ?>
<div class="alert alert--success mt-12" role="status"><?= $e((string) $successMessage) ?></div>
<?php endif; ?>
<h3 class="section-title mt-16"><?= $e($t('settings.cron.run_on_web_title')) ?></h3>
<p class="muted mt-12"><?= $e($t('settings.cron.run_on_web_description')) ?></p>
<form class="statuses-form mt-12" action="/settings/cron" method="post" novalidate>
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
<label class="field-inline">
<input type="hidden" name="cron_run_on_web" value="0">
<input type="checkbox" name="cron_run_on_web" value="1"<?= !empty($runOnWeb) ? ' checked' : '' ?>>
<span><?= $e($t('settings.cron.run_on_web_label')) ?></span>
</label>
<label class="form-field">
<span class="field-label"><?= $e($t('settings.cron.web_limit')) ?></span>
<input class="form-control" type="number" min="1" max="100" step="1" name="cron_web_limit" value="<?= $e((string) ($webLimit ?? 5)) ?>">
</label>
<div class="form-actions">
<button type="submit" class="btn btn--primary"><?= $e($t('settings.cron.actions.save')) ?></button>
</div>
</form>
</section>
<section class="card mt-16">
<h3 class="section-title"><?= $e($t('settings.cron.schedules_title')) ?></h3>
<div class="table-wrap mt-12">
<table class="table">
<thead>
<tr>
<th><?= $e($t('settings.cron.fields.job_type')) ?></th>
<th><?= $e($t('settings.cron.fields.enabled')) ?></th>
<th><?= $e($t('settings.cron.fields.interval')) ?></th>
<th><?= $e($t('settings.cron.fields.priority')) ?></th>
<th><?= $e($t('settings.cron.fields.last_run_at')) ?></th>
<th><?= $e($t('settings.cron.fields.next_run_at')) ?></th>
</tr>
</thead>
<tbody>
<?php if ($schedulesList === []): ?>
<tr><td class="muted" colspan="6"><?= $e($t('settings.cron.empty_schedules')) ?></td></tr>
<?php else: ?>
<?php foreach ($schedulesList as $item): ?>
<tr>
<td><?= $e((string) ($item['job_type'] ?? '')) ?></td>
<td><?= $e(!empty($item['enabled']) ? $t('settings.cron.enabled.yes') : $t('settings.cron.enabled.no')) ?></td>
<td><?= $e((string) ($item['interval_seconds'] ?? '')) ?></td>
<td><?= $e((string) ($item['priority'] ?? '')) ?></td>
<td><?= $e((string) ($item['last_run_at'] ?? '')) ?></td>
<td><?= $e((string) ($item['next_run_at'] ?? '')) ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</section>
<section class="card mt-16">
<h3 class="section-title"><?= $e($t('settings.cron.future_jobs_title')) ?></h3>
<div class="table-wrap mt-12">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th><?= $e($t('settings.cron.fields.job_type')) ?></th>
<th><?= $e($t('settings.cron.fields.status')) ?></th>
<th><?= $e($t('settings.cron.fields.priority')) ?></th>
<th><?= $e($t('settings.cron.fields.scheduled_at')) ?></th>
<th><?= $e($t('settings.cron.fields.attempts')) ?></th>
<th><?= $e($t('settings.cron.fields.last_error')) ?></th>
</tr>
</thead>
<tbody>
<?php if ($futureJobsList === []): ?>
<tr><td class="muted" colspan="7"><?= $e($t('settings.cron.empty_future_jobs')) ?></td></tr>
<?php else: ?>
<?php foreach ($futureJobsList as $item): ?>
<tr>
<td><?= $e((string) ($item['id'] ?? 0)) ?></td>
<td><?= $e((string) ($item['job_type'] ?? '')) ?></td>
<td><?= $e((string) ($item['status'] ?? '')) ?></td>
<td><?= $e((string) ($item['priority'] ?? '')) ?></td>
<td><?= $e((string) ($item['scheduled_at'] ?? '')) ?></td>
<td><?= $e((string) ($item['attempts'] ?? 0) . '/' . (string) ($item['max_attempts'] ?? 0)) ?></td>
<td><?= $e((string) ($item['last_error'] ?? '')) ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</section>
<section class="card mt-16">
<h3 class="section-title"><?= $e($t('settings.cron.past_jobs_title')) ?></h3>
<div class="table-wrap mt-12">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th><?= $e($t('settings.cron.fields.job_type')) ?></th>
<th><?= $e($t('settings.cron.fields.status')) ?></th>
<th><?= $e($t('settings.cron.fields.priority')) ?></th>
<th><?= $e($t('settings.cron.fields.scheduled_at')) ?></th>
<th><?= $e($t('settings.cron.fields.attempts')) ?></th>
<th><?= $e($t('settings.cron.fields.completed_at')) ?></th>
<th><?= $e($t('settings.cron.fields.last_error')) ?></th>
</tr>
</thead>
<tbody>
<?php if ($pastJobsList === []): ?>
<tr><td class="muted" colspan="8"><?= $e($t('settings.cron.empty_past_jobs')) ?></td></tr>
<?php else: ?>
<?php foreach ($pastJobsList as $item): ?>
<tr>
<td><?= $e((string) ($item['id'] ?? 0)) ?></td>
<td><?= $e((string) ($item['job_type'] ?? '')) ?></td>
<td><?= $e((string) ($item['status'] ?? '')) ?></td>
<td><?= $e((string) ($item['priority'] ?? '')) ?></td>
<td><?= $e((string) ($item['scheduled_at'] ?? '')) ?></td>
<td><?= $e((string) ($item['attempts'] ?? 0) . '/' . (string) ($item['max_attempts'] ?? 0)) ?></td>
<td><?= $e((string) ($item['completed_at'] ?? '')) ?></td>
<td><?= $e((string) ($item['last_error'] ?? '')) ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
<?php if ($pastTotalPages > 1): ?>
<div class="table-list__footer">
<div class="pagination">
<a class="pagination__item<?= $pastPage <= 1 ? ' is-disabled' : '' ?>" href="/settings/cron?past_page=1">&laquo;</a>
<a class="pagination__item<?= $pastPage <= 1 ? ' is-disabled' : '' ?>" href="/settings/cron?past_page=<?= $e((string) max(1, $pastPage - 1)) ?>">&lsaquo;</a>
<?php $startPage = max(1, $pastPage - 2); ?>
<?php $endPage = min($pastTotalPages, $pastPage + 2); ?>
<?php for ($page = $startPage; $page <= $endPage; $page++): ?>
<a class="pagination__item<?= $page === $pastPage ? ' is-active' : '' ?>" href="/settings/cron?past_page=<?= $e((string) $page) ?>">
<?= $e((string) $page) ?>
</a>
<?php endfor; ?>
<a class="pagination__item<?= $pastPage >= $pastTotalPages ? ' is-disabled' : '' ?>" href="/settings/cron?past_page=<?= $e((string) min($pastTotalPages, $pastPage + 1)) ?>">&rsaquo;</a>
<a class="pagination__item<?= $pastPage >= $pastTotalPages ? ' is-disabled' : '' ?>" href="/settings/cron?past_page=<?= $e((string) $pastTotalPages) ?>">&raquo;</a>
</div>
<div class="muted">
<?= $e($t('settings.cron.pagination.summary', ['page' => (string) $pastPage, 'total_pages' => (string) $pastTotalPages, 'total' => (string) $pastTotal])) ?>
</div>
</div>
<?php endif; ?>
</section>