Ajout specialiste.php choisir_abb.php
This commit is contained in:
1 parent
bd311da711
commit
f852c0516a
5 files changed
+171
-137
No files matched your search
+49
-47
@@ -1,35 +1,36 @@
|
||||
<?php
|
||||
// /choisir_abb.php (BLOC EMBED - pas de <html>, pas de <body>, pas de form Stripe)
|
||||
require_once __DIR__ . '/../includes/bootstrap_global.php';
|
||||
// /choisir_abb.php (BLOC EMBED - pas de <html>, pas de <body>, pas de form Stripe)
|
||||
require_once __DIR__ . '/../includes/bootstrap_global.php';
|
||||
|
||||
// Abonnement gratuit (id=1)
|
||||
$FREE_PLAN_ID = 1;
|
||||
// Abonnement gratuit (id=1)
|
||||
$FREE_PLAN_ID = 1;
|
||||
|
||||
// (Optionnel) Déjà utilisé ? -> on retire le gratuit
|
||||
$hasUsedFree = false;
|
||||
$praticien_id = (int)($_SESSION['praticien_id'] ?? 0); // si tu as déjà un id en session, sinon 0
|
||||
// (Optionnel) Déjà utilisé ? -> on retire le gratuit
|
||||
$hasUsedFree = false;
|
||||
$praticien_id = (int) ($_SESSION['praticien_id'] ?? 0); // si tu as déjà un id en session, sinon 0
|
||||
|
||||
if ($praticien_id > 0) {
|
||||
$sql = "SELECT 1
|
||||
if ($praticien_id > 0) {
|
||||
$sql = "SELECT 1
|
||||
FROM paiement
|
||||
WHERE praticien_id = ?
|
||||
AND abonnement_id = ?
|
||||
AND (statut IS NULL OR statut <> 'échoué')
|
||||
LIMIT 1";
|
||||
$st = $pdo->prepare($sql);
|
||||
$st->execute([$praticien_id, $FREE_PLAN_ID]);
|
||||
$hasUsedFree = (bool)$st->fetchColumn();
|
||||
}
|
||||
$st = $pdo->prepare($sql);
|
||||
$st->execute([$praticien_id, $FREE_PLAN_ID]);
|
||||
$hasUsedFree = (bool) $st->fetchColumn();
|
||||
}
|
||||
|
||||
// Abonnements actifs
|
||||
$stmt = $pdo->query("SELECT * FROM abonnement WHERE actif = 1 ORDER BY prix ASC, duree_jours ASC");
|
||||
$abonnements = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// Abonnements actifs
|
||||
$stmt = $pdo->query("SELECT * FROM abonnement WHERE actif = 1 ORDER BY prix ASC, duree_jours ASC");
|
||||
$abonnements = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($hasUsedFree) {
|
||||
$abonnements = array_values(array_filter($abonnements, fn($ab) => (int)$ab['id'] !== 1));
|
||||
}
|
||||
if ($hasUsedFree) {
|
||||
$abonnements = array_values(array_filter($abonnements, fn($ab) => (int) $ab['id'] !== 1));
|
||||
}
|
||||
|
||||
function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
|
||||
function h($s)
|
||||
{return htmlspecialchars((string) $s, ENT_QUOTES, 'UTF-8');}
|
||||
?>
|
||||
|
||||
<style>
|
||||
@@ -42,8 +43,8 @@ function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
|
||||
box-shadow:0 8px 20px rgba(0,0,0,.06);
|
||||
padding:18px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@media (min-width: 768px){ .abo-grid{ grid-template-columns:1fr 1fr; } }
|
||||
|
||||
.abo-item{
|
||||
@@ -63,63 +64,64 @@ function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
|
||||
.abo-name{ font-weight:700; color:#38378B; margin:0; font-size:16px;}
|
||||
.abo-desc{ margin:6px 0 0; color:#555; font-size:13px; line-height:1.35; }
|
||||
.abo-meta{ margin-top:8px; font-size:14px; font-weight:700; color:#38378B; display:flex; gap:10px; flex-wrap:wrap; }
|
||||
|
||||
|
||||
.abo-error{ display:none; margin-top:10px; color:#E03C3F; font-size:13px; text-align:center; }
|
||||
</style>
|
||||
|
||||
<div class="abo-wrap" id="abo-block">
|
||||
<h3 class="mb-4 text-center"><?= h($translations['choisissez_votre_abonnement'] ?? 'Выберите ваш тариф') ?></h4>
|
||||
<p class="abo-sub"><?= h($translations['abo_obligatoire_inscription'] ?? "Выберите тариф: без этого регистрация невозможна.") ?></p>
|
||||
<h3 class="mb-4 text-center"><?php echo h($translations['choisissez_votre_abonnement'] ?? 'Выберите ваш тариф') ?></h4>
|
||||
<p class="abo-sub"><?php echo h($translations['abo_obligatoire_inscription'] ?? "Выберите тариф: без этого регистрация невозможна.") ?></p>
|
||||
|
||||
<?php if (!$abonnements): ?>
|
||||
<div class="alert alert-warning text-center mb-0"><?= h($translations['aucun_abonnement_dispo'] ?? 'Нет доступных тарифов.') ?></div>
|
||||
<?php if (! $abonnements): ?>
|
||||
<div class="alert alert-warning text-center mb-0"><?php echo h($translations['aucun_abonnement_dispo'] ?? 'Нет доступных тарифов.') ?></div>
|
||||
<?php else: ?>
|
||||
<div class="abo-grid" role="radiogroup" aria-label="<?= h($translations['choisissez_votre_abonnement'] ?? 'Выберите ваш тариф') ?>">
|
||||
<div class="abo-grid" role="radiogroup" aria-label="<?php echo h($translations['choisissez_votre_abonnement'] ?? 'Выберите ваш тариф') ?>">
|
||||
<?php foreach ($abonnements as $ab): ?>
|
||||
<?php
|
||||
$isFree = ((float)$ab['prix'] == 0.0);
|
||||
$isFree = ((float) $ab['prix'] == 0.0);
|
||||
|
||||
$prixTxt = $isFree
|
||||
? ($translations['gratuit'] ?? 'Бесплатно')
|
||||
: number_format((float)$ab['prix'], 2, ',', ' ') . ' €';
|
||||
$prixTxt = $isFree
|
||||
? ($translations['gratuit'] ?? 'Бесплатно')
|
||||
: number_format((float) $ab['prix'], 2, ',', ' ') . ' €';
|
||||
|
||||
$nomKey = trim((string)($ab['nom'] ?? ''));
|
||||
$descKey = trim((string)($ab['description'] ?? ''));
|
||||
$nomKey = trim((string) ($ab['nom'] ?? ''));
|
||||
$descKey = trim((string) ($ab['description'] ?? ''));
|
||||
|
||||
$nomTxt = $translations[$nomKey] ?? $nomKey;
|
||||
$descTxt = $translations[$descKey] ?? $descKey;
|
||||
$nomTxt = $translations[$nomKey] ?? $nomKey;
|
||||
$descTxt = $translations[$descKey] ?? $descKey;
|
||||
|
||||
$id = (int)$ab['id'];
|
||||
$id = (int) $ab['id'];
|
||||
?>
|
||||
|
||||
<label class="abo-item" data-abo-item="1">
|
||||
<input class="abo-radio"
|
||||
type="radio"
|
||||
name="abonnement_id_ui"
|
||||
value="<?= $id ?>"
|
||||
aria-label="<?= h($nomTxt) ?>">
|
||||
value="<?php echo $id ?>"
|
||||
aria-label="<?php echo h($nomTxt) ?>">
|
||||
<div>
|
||||
<p class="abo-name"><?= h($nomTxt) ?></p>
|
||||
<p class="abo-name"><?php echo h($nomTxt) ?></p>
|
||||
|
||||
<?php if ($descKey !== ''): ?>
|
||||
<p class="abo-desc"><?= nl2br(h($descTxt)) ?></p>
|
||||
<p class="abo-desc"><?php echo nl2br(h($descTxt)) ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="abo-meta">
|
||||
|
||||
<?= h($translations['col_duree'] ?? 'Длительность:') ?>
|
||||
<?= (int)$ab['duree_jours'] ?> <?= h($translations['dnei'] ?? 'дней') ?><br>
|
||||
|
||||
<?= h($prixTxt) ?>
|
||||
|
||||
<?php echo h($translations['col_duree'] ?? 'Длительность:') ?>
|
||||
<?php echo (int) $ab['duree_jours'] ?> <?php echo h($translations['dnei'] ?? 'дней') ?><br>
|
||||
|
||||
<?php echo h($prixTxt) ?>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<a href="\specialiste.php" target="_blank" class="btn btn-outline-secondary w-100"><?php echo h($translations['uznat_bolche'] ?? 'Узнать преимущества') ?></a>
|
||||
</div>
|
||||
|
||||
<div class="abo-error" id="abo-error">
|
||||
<?= h($translations['abonnement_obligatoire'] ?? "Пожалуйста, выберите тариф.") ?>
|
||||
<?php echo h($translations['abonnement_obligatoire'] ?? "Пожалуйста, выберите тариф.") ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user