added cron and waiting

This commit is contained in:
2026-09-18 15:36:44 +02:00
parent c9a0cc6034
commit 9a423414a7
8 changed files with 406 additions and 514 deletions
+22
View File
@@ -74,6 +74,8 @@ $val = [
'reminder_enabled' => $ev['reminder_enabled'] ?? null,
'reminder_hours' => $ev['reminder_hours'] ?? '',
'offer_expiry_hours' => $ev['offer_expiry_hours'] ?? '',
'schedule_enabled' => (($ev['status'] ?? '') === 'scheduled') || !empty($ev['publish_at']),
'publish_at' => !empty($ev['publish_at']) ? date('Y-m-d H:i', strtotime($ev['publish_at'])) : '',
];
$isEdit = $id > 0;
@@ -555,6 +557,22 @@ $pageTitle = $isEdit ? 'Modifica evento' : 'Nuovo evento';
</div>
</div>
<!-- Apertura programmata -->
<div class="row">
<div class="col-md-5 mb-3">
<label class="form-label">Apertura prenotazioni</label>
<div class="form-check form-switch" style="padding-top:8px;">
<input class="form-check-input" type="checkbox" role="switch" id="schedule_enabled" name="schedule_enabled" value="Y" <?php echo $val['schedule_enabled'] ? 'checked' : ''; ?>>
<label class="form-check-label" for="schedule_enabled" style="font-weight:400;">Apri in una data futura (programmato)</label>
</div>
</div>
<div class="col-md-4 mb-3" id="publish-at-wrap" style="<?php echo $val['schedule_enabled'] ? '' : 'display:none;'; ?>">
<label class="form-label">Data/ora apertura</label>
<input type="text" class="form-control" id="publish_at" name="publish_at" value="<?php echo e($val['publish_at']); ?>" placeholder="Quando aprire le prenotazioni" autocomplete="off">
</div>
</div>
<p class="hint" style="margin-top:-8px;">Se attivo, l'evento resta "Programmato" (visibile ma non prenotabile) finché il cron non lo apre alla data indicata.</p>
<!-- Promemoria e lista d'attesa (override per evento) -->
<div class="row">
<div class="col-md-4 mb-3">
@@ -612,6 +630,10 @@ $pageTitle = $isEdit ? 'Modifica evento' : 'Nuovo evento';
};
var endPicker = flatpickr("#ends_at", fpOpts);
flatpickr("#publish_at", fpOpts);
document.getElementById('schedule_enabled').addEventListener('change', function() {
document.getElementById('publish-at-wrap').style.display = this.checked ? '' : 'none';
});
var startPicker = flatpickr("#starts_at", Object.assign({}, fpOpts, {
onChange: function(dates) {
if (!dates[0]) return;