Files
orderPRO/resources/views/settings/cron.php
Jacek Pyziak 7ac4293df4 feat: Implement Allegro Order Sync and Status Management
- Added AllegroOrderSyncStateRepository for managing sync state with Allegro orders.
- Introduced AllegroOrdersSyncService to handle the synchronization of orders from Allegro.
- Created AllegroStatusDiscoveryService to discover and store order statuses from Allegro.
- Developed AllegroStatusMappingRepository for managing status mappings between Allegro and OrderPro.
- Implemented AllegroStatusSyncService to facilitate status synchronization.
- Added CronSettingsController for managing cron job settings related to Allegro integration.
2026-03-04 23:21:35 +01:00

148 lines
6.1 KiB
PHP

<?php
$schedulesList = is_array($schedules ?? null) ? $schedules : [];
$futureJobsList = is_array($futureJobs ?? null) ? $futureJobs : [];
$pastJobsList = is_array($pastJobs ?? null) ? $pastJobs : [];
?>
<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>
</section>