Drops the duplicate «Envia-nos uma mensagem» heading (the app form has its own) and gives the narrower form the right half.
127 lines
6.9 KiB
PHP
127 lines
6.9 KiB
PHP
<?php
|
||
// Informações e contactos — partilhado entre a home (site/index.php) e o
|
||
// CrossFit (site/crossfit.php), para as duas páginas darem sempre a mesma
|
||
// informação de contacto em vez de reencaminhar para a home só para isso.
|
||
// $data: whours, work_hours_days (Horário de Funcionamento, opcional),
|
||
// assunto (pré-preenche "Razão" no formulário), show (gym_section_on, default true).
|
||
$whours = $whours ?? [];
|
||
$work_hours_days = $work_hours_days ?? ['Segunda-Sexta' => 'segunda', 'Sábado' => 'sabado', 'Domingo/Feriados' => 'domingo'];
|
||
$assunto = $assunto ?? '';
|
||
$show = $show ?? true;
|
||
$session = session();
|
||
?>
|
||
<?php if ($show): ?>
|
||
<?php /* contacts-bg.jpg never existed — outside2.jpg is the current photo in img/contactos/ */ ?>
|
||
<section id="contactos" class="contact-section set-bg" data-setbg="<?= base_url('site/assets/img/contactos/outside2.jpg') ?>" aria-labelledby="contactos-title">
|
||
<div class="container">
|
||
<?php if (($_GET['agendar'] ?? '') === 'ok'): ?>
|
||
<div class="alert alert-success text-center" role="alert">
|
||
Pedido enviado! Entraremos em contacto para confirmar a tua aula experimental.
|
||
</div>
|
||
<?php elseif (($_GET['agendar'] ?? '') === 'erro'): ?>
|
||
<div class="alert alert-danger text-center" role="alert">
|
||
Não foi possível enviar o pedido. Verifica os dados e tenta novamente.
|
||
</div>
|
||
<?php endif; ?>
|
||
<div class="row">
|
||
<div class="col-lg-6">
|
||
<h2 id="contactos-title" class="contact-title text-center text-md-left">Informações</h2>
|
||
<div class="row">
|
||
<div class="col-sm-6">
|
||
<div class="contact-info-warp text-center text-md-left">
|
||
<h3>Localização</h3>
|
||
<div class="contact-info">
|
||
<a href="<?= htmlspecialchars($info['google_maps_link'] ?? '') ?>" target="_blank" rel="noopener">
|
||
<p><?= htmlspecialchars($info['adress'] ?? '') ?></p>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<div class="contact-info-warp text-center text-md-left">
|
||
<h3>Telefone</h3>
|
||
<div class="contact-info">
|
||
<a href="tel:<?= htmlspecialchars(site_tel($info['phone'] ?? '')) ?>">
|
||
<p><?= htmlspecialchars($info['phone'] ?? '') ?></p>
|
||
</a>
|
||
<?php if (($info['telephone'] ?? '') !== ''): ?>
|
||
<a href="tel:<?= htmlspecialchars(site_tel($info['telephone'])) ?>">
|
||
<p><?= htmlspecialchars($info['telephone']) ?></p>
|
||
</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<div class="contact-info-warp text-center text-md-left">
|
||
<h3>E-mail</h3>
|
||
<div class="contact-info">
|
||
<a href="mailto:<?= htmlspecialchars($info['email'] ?? '') ?>">
|
||
<p><?= htmlspecialchars($info['email'] ?? '') ?></p>
|
||
</a>
|
||
<a href="#contactos">
|
||
<p><?= htmlspecialchars($info['website'] ?? '') ?></p>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php if ($whours): ?>
|
||
<div class="col-sm-6">
|
||
<div class="contact-info-warp text-center text-md-left">
|
||
<h3>Horário de Funcionamento</h3>
|
||
<div class="contact-info wh-text text-center text-md-left">
|
||
<?php foreach ($work_hours_days as $key => $value):
|
||
$ranges = [];
|
||
foreach ($whours as $h) {
|
||
if ($h['week_day'] == $value) {
|
||
$ranges[] = substr($h['open'], 0, 5) . ' – ' . substr($h['close'], 0, 5);
|
||
}
|
||
}
|
||
?>
|
||
<div class="wh-day">
|
||
<strong><?= htmlspecialchars($key) ?></strong>
|
||
<?php if ($ranges): foreach ($ranges as $r): ?><p><?= htmlspecialchars($r) ?></p><?php endforeach; ?>
|
||
<?php else: ?><p class="wh-closed">Encerrado</p><?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<div class="col-lg-6">
|
||
<div id="contact-form">
|
||
<?php /* Formulário da app FitMe (app.fitme3070.pt), em iframe; a altura acompanha o conteúdo via postMessage. */ ?>
|
||
<div id="fitme-form-site-contacto-wrap"></div>
|
||
<script>
|
||
(function () {
|
||
var p = new URLSearchParams(location.search), q = new URLSearchParams({ embed: "1", page: location.href });
|
||
["utm_source","utm_medium","utm_campaign","utm_content","utm_term"].forEach(function (k) { if (p.get(k)) q.set(k, p.get(k)); });
|
||
var f = document.createElement("iframe");
|
||
f.src = "https://app.fitme3070.pt/f/site-contacto?" + q.toString(); f.id = "fitme-form-site-contacto"; f.title = "Envia-nos uma Mensagem";
|
||
f.style.cssText = "width:100%;max-width:480px;border:0;"; f.height = "640"; f.loading = "lazy";
|
||
document.getElementById("fitme-form-site-contacto-wrap").appendChild(f);
|
||
window.addEventListener("message", function (e) {
|
||
if (e.origin === "https://app.fitme3070.pt" && e.data && e.data.type === "fitme-form-height" && e.data.slug === "site-contacto") f.style.height = e.data.height + "px";
|
||
});
|
||
})();
|
||
</script>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php // Mapa a toda a largura, por baixo do grid de informações + formulário ?>
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="map map-full" id="map">
|
||
<?php
|
||
// Defer the Google Maps iframe until the user scrolls near it.
|
||
$maps_embed = $info['google_maps'] ?? '';
|
||
if (strpos($maps_embed, 'loading=') === false) {
|
||
$maps_embed = str_replace('<iframe ', '<iframe loading="lazy" ', $maps_embed);
|
||
}
|
||
echo map_click_to_load(clean_map_embed($maps_embed), (string) ($info['google_maps_link'] ?? ''));
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<?php endif; ?>
|