133 lines
8.5 KiB
PHP
133 lines
8.5 KiB
PHP
<?php
|
|
// Shared gym form fields (create.php / edit.php). Expects $data (gym row or
|
|
// gym_defaults()) and $galleries (id => name).
|
|
$sections_on = [];
|
|
foreach (array_keys(gym_sections()) as $k) if (gym_section_on($data, $k)) $sections_on[] = $k;
|
|
?>
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Nome <span class="text-danger">*</span></label>
|
|
<input class="form-control" name="name" required maxlength="100" placeholder="ex.: FitMe 3070" value="<?= htmlspecialchars($data['name'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Pasta da URL <span class="text-danger">*</span></label>
|
|
<div class="input-group">
|
|
<span class="input-group-text">/</span>
|
|
<input class="form-control font-monospace" name="slug" required maxlength="20" pattern="[a-z0-9][a-z0-9-]{1,19}" placeholder="3070" value="<?= htmlspecialchars($data['slug'] ?? '') ?>">
|
|
<span class="input-group-text">/</span>
|
|
</div>
|
|
<div class="form-text">O código postal da zona.</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Ordem</label>
|
|
<input type="number" class="form-control" name="item_order" value="<?= (int) ($data['item_order'] ?? 0) ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Localidade</label>
|
|
<input class="form-control" name="locality" maxlength="100" placeholder="ex.: Mira" value="<?= htmlspecialchars($data['locality'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Código postal</label>
|
|
<input class="form-control" name="postal_code" maxlength="20" placeholder="ex.: 3070-xxx" value="<?= htmlspecialchars($data['postal_code'] ?? '') ?>">
|
|
</div>
|
|
|
|
<div class="col-12"><hr class="my-1"><strong>Página</strong></div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Título do header</label>
|
|
<input class="form-control" name="hero_title" maxlength="150" placeholder="Ginásio, Box, Aulas" value="<?= htmlspecialchars($data['hero_title'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Segunda linha do título</label>
|
|
<input class="form-control" name="hero_subtitle" maxlength="150" placeholder="& Acompanhamento" value="<?= htmlspecialchars($data['hero_subtitle'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label" for="hero_file">Imagem do header</label>
|
|
<?php if (($data['hero_image'] ?? '') !== ''): ?>
|
|
<div class="mb-2"><img src="<?= htmlspecialchars(base_url($data['hero_image'])) ?>" alt="" class="rounded border" style="max-width:100%;max-height:110px;object-fit:cover"></div>
|
|
<?php endif; ?>
|
|
<input type="hidden" name="hero_image" value="<?= htmlspecialchars($data['hero_image'] ?? '') ?>">
|
|
<input type="file" class="form-control" id="hero_file" name="hero_file" accept="image/jpeg,image/png,image/webp">
|
|
<div class="form-text">JPG, PNG ou WebP (até 6 MB). Vazio = a do ginásio principal.</div>
|
|
<?php if (($data['hero_image'] ?? '') !== ''): ?>
|
|
<div class="form-check mt-1"><input class="form-check-input" type="checkbox" name="hero_remove" value="1" id="hero_remove"><label class="form-check-label small" for="hero_remove">Remover a imagem atual</label></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Galeria das instalações</label>
|
|
<select class="form-select" name="gallery_id">
|
|
<option value="">— nenhuma —</option>
|
|
<?php foreach ($galleries as $gid => $gname): ?>
|
|
<option value="<?= (int) $gid ?>" <?= (int) ($data['gallery_id'] ?? 0) === (int) $gid ? 'selected' : '' ?>><?= htmlspecialchars($gname) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<div class="form-text">As galerias gerem-se em Gestão → Galerias.</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Título para o Google (SEO)</label>
|
|
<input class="form-control" name="seo_title" maxlength="160" placeholder="FitMe 3070 — Ginásio & CrossFit em Mira" value="<?= htmlspecialchars($data['seo_title'] ?? '') ?>">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Place ID Google (reviews)</label>
|
|
<input class="form-control font-monospace" name="google_place_id" maxlength="120" placeholder="ChIJ…" value="<?= htmlspecialchars($data['google_place_id'] ?? '') ?>">
|
|
<div class="form-text">A chave da API é comum (Gestão → Reviews Google).</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<label class="form-label">Descrição para o Google (SEO)</label>
|
|
<textarea class="form-control" name="seo_description" rows="2" maxlength="300"><?= htmlspecialchars($data['seo_description'] ?? '') ?></textarea>
|
|
</div>
|
|
|
|
<div class="col-12"><hr class="my-1"><strong>Secções visíveis</strong>
|
|
<div class="form-text mt-0">O layout é o mesmo em todos os ginásios; aqui escolhes quais aparecem.</div></div>
|
|
<?php foreach (gym_sections() as $key => $label): ?>
|
|
<div class="col-sm-6 col-lg-4">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="sections[]" value="<?= $key ?>" id="sec_<?= $key ?>" <?= in_array($key, $sections_on, true) ? 'checked' : '' ?>>
|
|
<label class="form-check-label" for="sec_<?= $key ?>"><?= htmlspecialchars($label) ?></label>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<div class="col-sm-6 col-lg-4">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="has_crossfit" value="1" id="has_crossfit" <?= !empty($data['has_crossfit']) ? 'checked' : '' ?>>
|
|
<label class="form-check-label" for="has_crossfit">Página CrossFit</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label class="form-label" for="logo_file">Logótipo (botão no menu dos outros ginásios)</label>
|
|
<?php if (($data['logo'] ?? '') !== ''): ?>
|
|
<div class="mb-2"><img src="<?= htmlspecialchars(base_url($data['logo'])) ?>" alt="" class="rounded border p-2" style="max-width:100%;max-height:70px;background:#e9ecef"></div>
|
|
<?php endif; ?>
|
|
<input type="hidden" name="logo" value="<?= htmlspecialchars($data['logo'] ?? '') ?>">
|
|
<input type="file" class="form-control" id="logo_file" name="logo_file" accept="image/svg+xml,image/png,image/webp,image/jpeg">
|
|
<div class="form-text">SVG, PNG, WebP ou JPG (até 6 MB). Opcional. Aparece a uma só cor (a do texto do botão); funciona melhor com SVG de uma cor.</div>
|
|
<?php if (!_gyms_has_col($pdo, 'gyms', 'logo')): ?>
|
|
<div class="form-text text-warning">Falta aplicar a migração <code>migration_20261013_gym_brand_color.sql</code> (Sistema → Atualizar plataforma) para guardar o logótipo e a cor da marca.</div>
|
|
<?php endif; ?>
|
|
<?php if (($data['logo'] ?? '') !== ''): ?>
|
|
<div class="form-check mt-1"><input class="form-check-input" type="checkbox" name="logo_remove" value="1" id="logo_remove"><label class="form-check-label small" for="logo_remove">Remover o logótipo atual</label></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-sm-6 col-lg-4">
|
|
<label class="form-label" for="brand_color">Cor da marca</label>
|
|
<input type="color" class="form-control form-control-color" id="brand_color" name="brand_color" value="<?= htmlspecialchars(($data['brand_color'] ?? '') !== '' ? $data['brand_color'] : '#C2D500') ?>">
|
|
<div class="form-text">Botões, destaques e links do site deste ginásio.</div>
|
|
</div>
|
|
|
|
<div class="col-12"><hr class="my-1"><strong>Estado</strong></div>
|
|
<div class="col-md-6">
|
|
<div class="form-check form-switch">
|
|
<input class="form-check-input" type="checkbox" name="is_published" value="1" id="is_published" <?= !empty($data['is_published']) ? 'checked' : '' ?>>
|
|
<label class="form-check-label" for="is_published">Publicado</label>
|
|
</div>
|
|
<div class="form-text">Por publicar, só quem tem sessão iniciada no backoffice vê a página (pré-visualização).</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-check form-switch">
|
|
<input class="form-check-input" type="checkbox" name="is_default" value="1" id="is_default" <?= !empty($data['is_default']) ? 'checked' : '' ?>>
|
|
<label class="form-check-label" for="is_default">Ginásio principal</label>
|
|
</div>
|
|
<div class="form-text">É para onde vão os endereços antigos (/home). Só pode haver um.</div>
|
|
</div>
|
|
</div>
|