- Generated SEO titles/descriptions per gym; gym seo fields override each on its own - Keywords, author, og:site_name, favicon and JSON-LD logo follow the gym - CrossFit page 404s before output for gyms without a box - Events: «Mostrar em» gym selector; event page uses its gym's brand - Hero event button text colour from the event colour (--ev-on) - Navbar bottom line stops at the other-gym head (--switch-w) - Diagonal hero blur mask; remove the trial link
116 lines
6.6 KiB
PHP
116 lines
6.6 KiB
PHP
<?php
|
|
// Shared event form fields, rendered inside the <form> of both create.php and
|
|
// edit.php. Expects:
|
|
// $data : associative array with every events column (see events_defaults())
|
|
// $item : the existing row on edit (for the current hero preview), or null
|
|
$item = $item ?? null;
|
|
// datetime-local inputs want "YYYY-MM-DDTHH:MM"; DB gives "YYYY-MM-DD HH:MM:SS".
|
|
$dt = static function ($v): string {
|
|
$v = trim((string) $v);
|
|
if ($v === '' || $v === '0000-00-00 00:00:00') return '';
|
|
return substr(str_replace(' ', 'T', $v), 0, 16);
|
|
};
|
|
?>
|
|
<div class="row g-3">
|
|
<div class="col-md-8">
|
|
<label class="form-label">Título <span class="text-danger">*</span></label>
|
|
<input class="form-control" name="title" required maxlength="180" value="<?= htmlspecialchars($data['title'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Cor de destaque</label>
|
|
<input type="color" class="form-control form-control-color" name="cor" value="<?= htmlspecialchars($data['cor'] ?? '#C2D500') ?>">
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label">Mostrar em</label>
|
|
<select class="form-select" name="gym_id">
|
|
<option value="">Todos os ginásios</option>
|
|
<?php foreach (db_gyms_list($pdo) as $g): ?>
|
|
<option value="<?= (int) $g['id'] ?>"<?= (int) ($data['gym_id'] ?? 0) === (int) $g['id'] ? ' selected' : '' ?>><?= htmlspecialchars($g['name']) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<div class="form-text">Ginásio em cujo topo da página inicial o destaque aparece.</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label class="form-label">Subtítulo</label>
|
|
<input class="form-control" name="subtitle" maxlength="255" value="<?= htmlspecialchars($data['subtitle'] ?? '') ?>">
|
|
<div class="form-text">Frase curta mostrada por baixo do título no topo da página.</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label class="form-label">Resumo</label>
|
|
<textarea class="form-control" name="summary" rows="2" maxlength="400"><?= htmlspecialchars($data['summary'] ?? '') ?></textarea>
|
|
<div class="form-text">Texto curto usado no banner da página inicial.</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label class="form-label">Descrição (conteúdo da página)</label>
|
|
<textarea class="form-control js-wysiwyg" data-wysiwyg-height="320" name="description" rows="8"><?= htmlspecialchars($data['description'] ?? '') ?></textarea>
|
|
<div class="form-text">Editor de texto formatado — é o corpo da landing page.</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label">Imagem de destaque (hero)</label>
|
|
<input type="file" class="form-control" name="hero_file" accept=".png,.jpg,.jpeg,.gif,.webp">
|
|
<div class="form-text">Fundo do topo da landing page. Máx. 6 MB.</div>
|
|
<?php if ($item && !empty($item['hero_image'])): ?>
|
|
<div class="mt-2 d-flex align-items-center gap-2">
|
|
<img src="<?= base_url('uploads/events/' . rawurlencode($item['hero_image'])) ?>" alt="" style="height:48px;border-radius:4px;">
|
|
<div class="form-check mb-0">
|
|
<input class="form-check-input" type="checkbox" name="remove_hero" id="remove_hero" value="1">
|
|
<label class="form-check-label small" for="remove_hero">Remover imagem atual</label>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Local</label>
|
|
<input class="form-control" name="location" maxlength="200" value="<?= htmlspecialchars($data['location'] ?? '') ?>">
|
|
<div class="form-text">Onde decorre o evento (opcional).</div>
|
|
</div>
|
|
|
|
<div class="col-12"><hr class="my-1"><span class="small text-uppercase text-muted fw-semibold">Quando decorre o evento</span></div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Início do evento</label>
|
|
<input type="datetime-local" class="form-control" name="event_starts_at" value="<?= htmlspecialchars($dt($data['event_starts_at'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Fim do evento</label>
|
|
<input type="datetime-local" class="form-control" name="event_ends_at" value="<?= htmlspecialchars($dt($data['event_ends_at'] ?? '')) ?>">
|
|
</div>
|
|
|
|
<div class="col-12"><hr class="my-1"><span class="small text-uppercase text-muted fw-semibold">Janela de publicação no site</span></div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Publicar a partir de <span class="text-danger">*</span></label>
|
|
<input type="datetime-local" class="form-control" name="publish_from" required value="<?= htmlspecialchars($dt($data['publish_from'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Publicar até <span class="text-danger">*</span></label>
|
|
<input type="datetime-local" class="form-control" name="publish_until" required value="<?= htmlspecialchars($dt($data['publish_until'] ?? '')) ?>">
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="form-check form-switch">
|
|
<input class="form-check-input" type="checkbox" name="is_active" id="is_active" value="1" <?= (int) ($data['is_active'] ?? 1) === 1 ? 'checked' : '' ?>>
|
|
<label class="form-check-label" for="is_active">Ativo (interruptor manual — só aparece dentro da janela acima)</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12"><hr class="my-1"><span class="small text-uppercase text-muted fw-semibold">Chamada para ação & inscrições</span></div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Texto do botão</label>
|
|
<input class="form-control" name="cta_label" maxlength="80" placeholder="ex: Inscreve-te já!" value="<?= htmlspecialchars($data['cta_label'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Link do botão</label>
|
|
<input class="form-control" name="cta_url" maxlength="255" placeholder="(vazio = ir para o formulário abaixo)" value="<?= htmlspecialchars($data['cta_url'] ?? '') ?>">
|
|
<div class="form-text">URL externo ou âncora. Em branco, o botão desce até ao formulário de inscrição.</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="form-check form-switch">
|
|
<input class="form-check-input" type="checkbox" name="show_lead_form" id="show_lead_form" value="1" <?= (int) ($data['show_lead_form'] ?? 1) === 1 ? 'checked' : '' ?>>
|
|
<label class="form-check-label" for="show_lead_form">Mostrar formulário de inscrição na landing page</label>
|
|
</div>
|
|
</div>
|
|
</div>
|