78 lines
3.0 KiB
PHP
78 lines
3.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* filter-sidebar.php — sidebar filtri ricerca saloni
|
|
* Variabili opzionali dalla pagina chiamante:
|
|
* $cities (array di stringhe)
|
|
* $allServices (array di ['name'=>...] o stringhe)
|
|
* $q_city, $q_service, $q_price_max valori correnti
|
|
*/
|
|
$cities = $cities ?? [];
|
|
$allServices = $allServices ?? [];
|
|
$q_city = $q_city ?? '';
|
|
$q_service = $q_service ?? '';
|
|
$q_price_max = $q_price_max ?? '';
|
|
?>
|
|
<div class="tp-filter-sidebar">
|
|
<form action="search.php" method="get">
|
|
|
|
<!-- Città -->
|
|
<div class="tp-filter-item">
|
|
<div class="tp-filter-top mb-20">
|
|
<h2 class="tp-filter-title">Città</h2>
|
|
</div>
|
|
<div class="tp-filter-item-content">
|
|
<select class="form-select mb-3" name="city">
|
|
<option value="">Tutte le città</option>
|
|
<?php foreach ($cities as $c): ?>
|
|
<option value="<?= htmlspecialchars($c) ?>" <?= ($q_city === $c ? 'selected' : '') ?>>
|
|
<?= htmlspecialchars($c) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Servizio -->
|
|
<div class="tp-filter-item">
|
|
<div class="tp-filter-top mb-20">
|
|
<h2 class="tp-filter-title">Servizio</h2>
|
|
</div>
|
|
<div class="tp-filter-item-content">
|
|
<select class="form-select mb-3" name="service">
|
|
<option value="">Tutti i servizi</option>
|
|
<?php foreach ($allServices as $s): ?>
|
|
<?php $sn = is_array($s) ? ($s['name'] ?? '') : $s; ?>
|
|
<option value="<?= htmlspecialchars($sn) ?>" <?= ($q_service === $sn ? 'selected' : '') ?>>
|
|
<?= htmlspecialchars($sn) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Prezzo massimo -->
|
|
<div class="tp-filter-item">
|
|
<div class="tp-filter-top mb-20">
|
|
<h2 class="tp-filter-title">Prezzo massimo</h2>
|
|
</div>
|
|
<div class="tp-filter-item-content">
|
|
<div class="input-group mb-3">
|
|
<input type="number" min="0" step="5" name="price_max" class="form-control"
|
|
placeholder="es. 50" value="<?= htmlspecialchars($q_price_max) ?>">
|
|
<span class="input-group-text">€</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php /* Filtro recensioni disattivato per ora — riattivare con tabella reviews
|
|
<div class="tp-filter-item"> ...stelle... </div>
|
|
*/ ?>
|
|
|
|
<div class="tp-filter-item">
|
|
<button type="submit" class="tp-btn-sm w-100">Applica filtri</button>
|
|
<a href="search.php" class="d-block text-center mt-2 small">Azzera filtri</a>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|