File: /home/muratemr/theotto.tr/index.php
<?php
/**
* index.php
* Müşteri tek sayfa restoran sitesi
*/
declare(strict_types=1);
require_once __DIR__ . '/includes/db.php';
require_once __DIR__ . '/includes/functions.php';
// Site ayarları
$s = [];
$rows = db_rows("SELECT `key`, `value` FROM site_settings");
foreach ($rows as $r) $s[$r['key']] = $r['value'];
$name = $s['restaurant_name'] ?? 'Restoran';
$logo_url = $s['site_logo'] ?? '';
$address = $s['address'] ?? '';
$phone = $s['phone'] ?? '';
$whatsapp = $s['whatsapp'] ?? '';
$menu_link = $s['menu_link'] ?? '#menu';
$hero_title = $s['hero_title'] ?? 'Eşsiz Lezzetler';
$hero_subtitle = $s['hero_subtitle'] ?? '';
$about_text = $s['about_text'] ?? '';
$facebook = $s['facebook'] ?? '';
$instagram = $s['instagram'] ?? '';
$twitter = $s['twitter'] ?? '';
$wa_link = $whatsapp ? whatsapp_link($whatsapp, "Merhaba, bilgi almak istiyorum.") : '';
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= e($name) ?></title>
<meta name="description" content="<?= e($name) ?> – <?= e($hero_subtitle) ?>">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,600;1,400&family=DM+Sans:wght@300;400;500;700&subset=latin-ext&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<style>
:root {
--gold: #c9a84c;
--gold-light:#e2c36f;
--dark: #0d0d0d;
--dark-2: #141414;
--dark-3: #1e1e1e;
--dark-card: #1a1a1a;
--text-muted-custom: #888;
--font-display: 'Cormorant Garamond', Georgia, serif;
--font-body: 'DM Sans', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
background: var(--dark);
color: #ddd;
font-family: var(--font-body);
font-weight: 300;
overflow-x: hidden;
}
/* ── NAVbar ─────────────────────────────────── */
.navbar-custom {
background: rgba(13,13,13,.92);
backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(201,168,76,.15);
padding: .9rem 0;
position: sticky;
top: 0;
z-index: 1000;
transition: background .3s;
}
.navbar-brand {
font-family: var(--font-display);
font-size: 1.5rem;
color: var(--gold) !important;
letter-spacing: .05em;
}
.nav-link-custom {
color: #ccc !important;
text-decoration: none;
font-size: .875rem;
letter-spacing: .1em;
text-transform: uppercase;
padding: .4rem .8rem;
transition: color .25s;
}
.nav-link-custom:hover { color: var(--gold) !important; }
.btn-reservation-nav {
background: transparent;
border: 1px solid var(--gold);
color: var(--gold);
font-size: .8rem;
letter-spacing: .12em;
text-transform: uppercase;
padding: .45rem 1.2rem;
border-radius: 0;
transition: background .25s, color .25s;
}
.btn-reservation-nav:hover {
background: var(--gold);
color: #000;
}
.hamburger-btn {
background: none;
border: none;
color: var(--gold);
font-size: 1.5rem;
cursor: pointer;
}
/* ── HERO ────────────────────────────────────── */
#hero {
position: relative;
min-height: 100vh;
display: flex;
align-items: center;
background: linear-gradient(135deg, #0d0d0d 0%, #1a1205 40%, #0d0d0d 100%);
overflow: hidden;
}
#hero::before {
content: '';
position: absolute;
inset: 0;
background:
radial-gradient(ellipse 60% 50% at 70% 40%, rgba(201,168,76,.07) 0%, transparent 70%),
radial-gradient(ellipse 40% 60% at 20% 70%, rgba(201,168,76,.05) 0%, transparent 70%);
}
.hero-texture {
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a84c' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content {
position: relative;
z-index: 1;
}
.hero-eyebrow {
font-size: .75rem;
letter-spacing: .4em;
text-transform: uppercase;
color: var(--gold);
margin-bottom: 1.2rem;
opacity: 0;
animation: fadeUp .8s .2s forwards;
}
.hero-title {
font-family: var(--font-display);
font-size: clamp(2.5rem, 6vw, 5rem);
color: #f0e8d0;
line-height: 1.1;
margin-bottom: 1.5rem;
opacity: 0;
animation: fadeUp .8s .4s forwards;
}
.hero-title em {
color: var(--gold);
font-style: italic;
}
.hero-subtitle {
font-size: 1.05rem;
color: #999;
max-width: 480px;
line-height: 1.8;
margin-bottom: 2.5rem;
opacity: 0;
animation: fadeUp .8s .6s forwards;
}
.hero-actions {
display: flex;
gap: 1rem;
flex-wrap: wrap;
opacity: 0;
animation: fadeUp .8s .8s forwards;
}
.btn-gold {
background: var(--gold);
color: #000;
border: none;
padding: .85rem 2.2rem;
font-size: .85rem;
letter-spacing: .15em;
text-transform: uppercase;
font-weight: 700;
border-radius: 0;
text-decoration: none;
transition: background .25s, transform .2s;
display: inline-flex;
align-items: center;
gap: .5rem;
}
.btn-gold:hover { background: var(--gold-light); color: #000; transform: translateY(-2px); }
.btn-outline-gold {
background: transparent;
color: var(--gold);
border: 1px solid var(--gold);
padding: .85rem 2.2rem;
font-size: .85rem;
letter-spacing: .15em;
text-transform: uppercase;
font-weight: 400;
border-radius: 0;
text-decoration: none;
transition: background .25s, color .25s;
display: inline-flex;
align-items: center;
gap: .5rem;
}
.btn-outline-gold:hover { background: var(--gold); color: #000; }
.hero-deco {
position: absolute;
right: -60px;
top: 50%;
transform: translateY(-50%);
width: min(50vw, 600px);
height: min(50vw, 600px);
border: 1px solid rgba(201,168,76,.08);
border-radius: 50%;
pointer-events: none;
}
.hero-deco::after {
content: '';
position: absolute;
inset: 40px;
border: 1px solid rgba(201,168,76,.06);
border-radius: 50%;
}
/* ── SECTION HEADER ─────────────────────────── */
.section-header {
text-align: center;
margin-bottom: 3.5rem;
}
.section-eyebrow {
font-size: .7rem;
letter-spacing: .5em;
text-transform: uppercase;
color: var(--gold);
margin-bottom: .6rem;
}
.section-title {
font-family: var(--font-display);
font-size: clamp(1.8rem, 4vw, 2.8rem);
color: #f0e8d0;
margin-bottom: 1rem;
}
.section-line {
width: 60px;
height: 1px;
background: var(--gold);
margin: 0 auto;
}
/* ── ABOUT ───────────────────────────────────── */
#about {
padding: 6rem 0;
background: var(--dark-2);
}
.about-text {
font-size: 1.1rem;
line-height: 2;
color: #bbb;
max-width: 640px;
margin: 0 auto;
text-align: center;
}
/* ── RESERVATION ─────────────────────────────── */
#reservation {
padding: 6rem 0;
background: var(--dark);
}
.res-card {
background: var(--dark-card);
border: 1px solid rgba(201,168,76,.12);
padding: 3rem;
max-width: 720px;
margin: 0 auto;
}
.res-card .form-label {
color: #bbb;
font-size: .8rem;
letter-spacing: .1em;
text-transform: uppercase;
}
.res-card .form-control,
.res-card .form-select {
background: #111;
border: 1px solid #333;
color: #ddd;
border-radius: 0;
padding: .75rem 1rem;
transition: border-color .25s;
}
.res-card .form-control:focus,
.res-card .form-select:focus {
border-color: var(--gold);
box-shadow: 0 0 0 .15rem rgba(201,168,76,.15);
background: #111;
color: #ddd;
}
.res-card .form-control::placeholder { color: #555; }
.res-card .form-select option { background: #1a1a1a; }
#resSuccess {
display: none;
text-align: center;
padding: 2rem 0;
}
.success-icon {
font-size: 4rem;
color: var(--gold);
margin-bottom: 1rem;
}
/* ── FOOTER ──────────────────────────────────── */
#footer {
background: #080808;
border-top: 1px solid rgba(201,168,76,.1);
padding: 3rem 0 1.5rem;
}
.footer-brand {
font-family: var(--font-display);
font-size: 1.6rem;
color: var(--gold);
margin-bottom: .5rem;
}
.footer-text { color: #666; font-size: .875rem; line-height: 1.8; }
.footer-link {
color: #888;
text-decoration: none;
font-size: .875rem;
transition: color .2s;
display: flex;
align-items: center;
gap: .5rem;
}
.footer-link:hover { color: var(--gold); }
.social-link {
width: 36px;
height: 36px;
border: 1px solid #333;
color: #888;
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
transition: border-color .2s, color .2s;
font-size: 1rem;
}
.social-link:hover { border-color: var(--gold); color: var(--gold); }
.footer-copy {
border-top: 1px solid #1a1a1a;
margin-top: 2rem;
padding-top: 1.5rem;
color: #444;
font-size: .8rem;
text-align: center;
}
/* ── SCROLL FADE ─────────────────────────────── */
.fade-in-up {
opacity: 0;
transform: translateY(30px);
transition: opacity .7s ease, transform .7s ease;
}
.fade-in-up.visible {
opacity: 1;
transform: translateY(0);
}
/* ── ANIMATIONS ──────────────────────────────── */
@keyframes fadeUp {
from { opacity: 0; transform: translateY(24px); }
to { opacity: 1; transform: translateY(0); }
}
/* ── TOAST ───────────────────────────────────── */
.toast-container-custom {
position: fixed;
top: 80px;
right: 20px;
z-index: 9999;
}
.toast-item {
background: #1e1e1e;
border: 1px solid rgba(201,168,76,.3);
color: #ddd;
padding: .9rem 1.4rem;
margin-bottom: .5rem;
font-size: .875rem;
animation: fadeUp .3s ease;
max-width: 320px;
}
.toast-item.error { border-color: rgba(220,53,69,.4); }
/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
.hero-deco { display: none; }
.res-card { padding: 1.5rem; }
.hero-actions { flex-direction: column; }
.btn-gold, .btn-outline-gold { text-align: center; justify-content: center; }
}
</style>
</head>
<body>
<!-- ── NAVbar ──────────────────────────────────────── -->
<nav class="navbar-custom">
<div class="container d-flex align-items-center justify-content-between">
<a class="navbar-brand" href="#">
<?php if (!empty($logo_url)): ?>
<img src="<?= e($logo_url) ?>" alt="<?= e($name) ?>"
style="height:40px;max-width:160px;object-fit:contain;vertical-align:middle">
<?php else: ?>
<?= e($name) ?>
<?php endif; ?>
</a>
<!-- Desktop nav -->
<div class="d-none d-md-flex align-items-center gap-3">
<?php if ($menu_link): ?>
<a class="nav-link-custom" href="<?= e($menu_link) ?>" <?= str_starts_with($menu_link, 'http') ? 'target="_blank"' : '' ?>>
Menü
</a>
<?php endif; ?>
<a class="nav-link-custom" href="#about">Hakkımızda</a>
<?php if ($wa_link): ?>
<a class="nav-link-custom" href="<?= e($wa_link) ?>" target="_blank" rel="noopener">
<i class="bi bi-whatsapp"></i> WhatsApp
</a>
<?php endif; ?>
<a class="btn-reservation-nav" href="#reservation">Rezervasyon Yap</a>
</div>
<!-- Mobile -->
<button class="hamburger-btn d-md-none" onclick="toggleMobileMenu()">
<i class="bi bi-list" id="hamburgerIcon"></i>
</button>
</div>
<!-- Mobile menu -->
<div id="mobileMenu" style="display:none; border-top:1px solid rgba(201,168,76,.1)">
<div class="container py-3 d-flex flex-column gap-2">
<?php if ($menu_link): ?>
<a class="nav-link-custom" href="<?= e($menu_link) ?>" <?= str_starts_with($menu_link, 'http') ? 'target="_blank"' : '' ?>>Menü</a>
<?php endif; ?>
<a class="nav-link-custom" href="#about" onclick="toggleMobileMenu()">Hakkımızda</a>
<?php if ($wa_link): ?>
<a class="nav-link-custom" href="<?= e($wa_link) ?>" target="_blank" rel="noopener"><i class="bi bi-whatsapp"></i> WhatsApp</a>
<?php endif; ?>
<a class="btn-reservation-nav mt-1 text-center" href="#reservation" onclick="toggleMobileMenu()">Rezervasyon Yap</a>
</div>
</div>
</nav>
<!-- ── HERO ────────────────────────────────────────── -->
<section id="hero">
<div class="hero-texture"></div>
<div class="hero-deco"></div>
<div class="container">
<div class="hero-content col-lg-7">
<div class="hero-eyebrow"><?= e($name) ?></div>
<h1 class="hero-title">
<?php
$parts = explode(',', $hero_title, 2);
if (count($parts) === 2) {
echo e(trim($parts[0])) . ', <em>' . e(trim($parts[1])) . '</em>';
} else {
echo e($hero_title);
}
?>
</h1>
<?php if ($hero_subtitle): ?>
<p class="hero-subtitle"><?= e($hero_subtitle) ?></p>
<?php endif; ?>
<div class="hero-actions">
<a href="#reservation" class="btn-gold">
<i class="bi bi-calendar-check"></i> Rezervasyon Yap
</a>
<?php if ($menu_link): ?>
<a href="<?= e($menu_link) ?>" class="btn-outline-gold" <?= str_starts_with($menu_link, 'http') ? 'target="_blank"' : '' ?>>
<i class="bi bi-book"></i> Menüyü İncele
</a>
<?php endif; ?>
</div>
</div>
</div>
</section>
<!-- ── ABOUT ───────────────────────────────────────── -->
<?php if ($about_text): ?>
<section id="about">
<div class="container">
<div class="section-header fade-in-up">
<div class="section-eyebrow">Hikayemiz</div>
<h2 class="section-title">Hakkımızda</h2>
<div class="section-line"></div>
</div>
<p class="about-text fade-in-up"><?= nl2br(e($about_text)) ?></p>
</div>
</section>
<?php endif; ?>
<!-- ── RESERVATION ─────────────────────────────────── -->
<section id="reservation">
<div class="container">
<div class="section-header fade-in-up">
<div class="section-eyebrow">Masa Ayırtın</div>
<h2 class="section-title">Rezervasyon</h2>
<div class="section-line"></div>
</div>
<div class="res-card fade-in-up">
<!-- Form -->
<div id="resForm">
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">Ad Soyad</label>
<input type="text" class="form-control" id="rFullName" placeholder="Adınız Soyadınız" required>
</div>
<div class="col-md-6">
<label class="form-label">Telefon</label>
<input type="tel" class="form-control" id="rPhone" placeholder="5XX XXX XX XX" required
oninput="this.value=this.value.replace(/\D/g,'')">
</div>
<div class="col-md-4">
<label class="form-label">Kişi Sayısı</label>
<select class="form-select" id="rGuests">
<?php for ($i = 1; $i <= 15; $i++): ?>
<option value="<?= $i ?>" <?= $i === 2 ? 'selected' : '' ?>><?= $i ?> Kişi</option>
<?php endfor; ?>
<option value="16">15+ Kişi</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label">Tarih</label>
<input type="date" class="form-control" id="rDate" min="<?= date('Y-m-d') ?>" required>
</div>
<div class="col-md-4">
<label class="form-label">Saat</label>
<select class="form-select" id="rTime">
<?php
$start_h = 12; $start_m = 0;
$end_h = 21; $end_m = 30;
for ($h = $start_h; $h <= $end_h; $h++) {
for ($m = 0; $m < 60; $m += 30) {
if ($h === $end_h && $m > $end_m) break;
$t = sprintf('%02d:%02d', $h, $m);
echo "<option value=\"{$t}\">{$t}</option>\n";
}
}
?>
</select>
</div>
<div class="col-12">
<label class="form-label">Özel İstek <small class="text-muted">(opsiyonel)</small></label>
<textarea class="form-control" id="rSpecial" rows="3"
placeholder="Doğum günü, veganlar için masa, vb."></textarea>
</div>
<div class="col-12 mt-1">
<button class="btn-gold w-100 justify-content-center" onclick="submitReservation()" id="resSubmitBtn">
<i class="bi bi-calendar-check me-2"></i>Rezervasyon Talebi Gönder
</button>
</div>
</div>
</div>
<!-- Başarı mesajı -->
<div id="resSuccess">
<div class="success-icon"><i class="bi bi-check-circle-fill"></i></div>
<h4 class="text-light mb-2" style="font-family:var(--font-display)">Rezervasyonunuz Alındı!</h4>
<p class="text-muted mb-4">En kısa sürede onaylanacaktır. WhatsApp üzerinden bildirim göndermek ister misiniz?</p>
<div class="d-flex gap-3 justify-content-center flex-wrap">
<a href="#" id="waBtn" class="btn-gold" target="_blank" rel="noopener">
<i class="bi bi-whatsapp me-2"></i>WhatsApp Gönder
</a>
<button class="btn-outline-gold" onclick="resetReservationForm()">
<i class="bi bi-plus me-2"></i>Yeni Rezervasyon
</button>
</div>
</div>
</div>
</div>
</section>
<!-- ── FOOTER ───────────────────────────────────────── -->
<footer id="footer">
<div class="container">
<div class="row g-4">
<div class="col-md-4">
<div class="footer-brand">
<?php if (!empty($logo_url)): ?>
<img src="<?= e($logo_url) ?>" alt="<?= e($name) ?>"
style="height:36px;max-width:140px;object-fit:contain;filter:brightness(1.1)">
<?php else: ?>
<?= e($name) ?>
<?php endif; ?>
</div>
<?php if ($about_text): ?>
<p class="footer-text"><?= e(mb_substr($about_text, 0, 100)) ?>...</p>
<?php endif; ?>
<div class="d-flex gap-2 mt-3">
<?php if ($facebook): ?>
<a class="social-link" href="<?= e($facebook) ?>" target="_blank" rel="noopener"><i class="bi bi-facebook"></i></a>
<?php endif; ?>
<?php if ($instagram): ?>
<a class="social-link" href="<?= e($instagram) ?>" target="_blank" rel="noopener"><i class="bi bi-instagram"></i></a>
<?php endif; ?>
<?php if ($twitter): ?>
<a class="social-link" href="<?= e($twitter) ?>" target="_blank" rel="noopener"><i class="bi bi-twitter-x"></i></a>
<?php endif; ?>
<?php if ($wa_link): ?>
<a class="social-link" href="<?= e($wa_link) ?>" target="_blank" rel="noopener"><i class="bi bi-whatsapp"></i></a>
<?php endif; ?>
</div>
</div>
<div class="col-md-4">
<h6 class="text-uppercase" style="letter-spacing:.15em;color:var(--gold);font-size:.75rem;margin-bottom:1rem;">İletişim</h6>
<?php if ($address): ?>
<a class="footer-link mb-2" href="https://maps.google.com?q=<?= urlencode($address) ?>" target="_blank" rel="noopener">
<i class="bi bi-geo-alt"></i> <?= e($address) ?>
</a>
<?php endif; ?>
<?php if ($phone): ?>
<a class="footer-link mb-2" href="tel:<?= preg_replace('/\D/','',$phone) ?>">
<i class="bi bi-telephone"></i> <?= e($phone) ?>
</a>
<?php endif; ?>
<?php if ($wa_link): ?>
<a class="footer-link" href="<?= e($wa_link) ?>" target="_blank" rel="noopener">
<i class="bi bi-whatsapp"></i> WhatsApp
</a>
<?php endif; ?>
</div>
<div class="col-md-4">
<h6 class="text-uppercase" style="letter-spacing:.15em;color:var(--gold);font-size:.75rem;margin-bottom:1rem;">Hızlı Bağlantılar</h6>
<?php if ($menu_link): ?>
<a class="footer-link mb-2" href="<?= e($menu_link) ?>" <?= str_starts_with($menu_link, 'http') ? 'target="_blank"' : '' ?>>
<i class="bi bi-book"></i> Menü
</a>
<?php endif; ?>
<a class="footer-link mb-2" href="#reservation">
<i class="bi bi-calendar-check"></i> Rezervasyon
</a>
</div>
</div>
<div class="footer-copy">
© <?= date('Y') ?> <?= e($name) ?> — Tüm hakları saklıdır.
</div>
</div>
</footer>
<!-- Toast container -->
<div class="toast-container-custom" id="toastContainer"></div>
<script>
/* ── MOBILE MENU ──────────────────────────────── */
function toggleMobileMenu() {
const menu = document.getElementById('mobileMenu');
const icon = document.getElementById('hamburgerIcon');
const open = menu.style.display === 'block';
menu.style.display = open ? 'none' : 'block';
icon.className = open ? 'bi bi-list' : 'bi bi-x';
}
/* ── SCROLL ANIMATION ─────────────────────────── */
const observer = new IntersectionObserver(entries => {
entries.forEach(e => {
if (e.isIntersecting) { e.target.classList.add('visible'); observer.unobserve(e.target); }
});
}, { threshold: 0.15 });
document.querySelectorAll('.fade-in-up').forEach(el => observer.observe(el));
/* ── TOAST ────────────────────────────────────── */
function showToast(msg, type = 'success') {
const cont = document.getElementById('toastContainer');
const div = document.createElement('div');
div.className = 'toast-item' + (type === 'error' ? ' error' : '');
div.innerHTML = `<i class="bi bi-${type === 'success' ? 'check-circle' : 'exclamation-circle'} me-2"></i>${msg}`;
cont.appendChild(div);
setTimeout(() => div.remove(), 4000);
}
/* ── RESERVATION FORM ─────────────────────────── */
let lastWaLink = null;
function submitReservation() {
const btn = document.getElementById('resSubmitBtn');
const fullName = document.getElementById('rFullName').value.trim();
const phone = document.getElementById('rPhone').value.trim();
const guests = document.getElementById('rGuests').value;
const date = document.getElementById('rDate').value;
const time = document.getElementById('rTime').value;
const special = document.getElementById('rSpecial').value.trim();
if (!fullName) { showToast('Ad Soyad zorunlu.', 'error'); return; }
if (!phone || phone.length < 10) { showToast('Geçerli bir telefon numarası girin.', 'error'); return; }
if (!date) { showToast('Tarih seçin.', 'error'); return; }
btn.disabled = true;
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-2"></span>Gönderiliyor...';
const body = new FormData();
body.append('full_name', fullName);
body.append('phone', phone);
body.append('guest_count', guests);
body.append('date', date);
body.append('time', time);
body.append('special_request', special);
fetch('/api/reservation.php', { method: 'POST', body })
.then(r => r.json())
.then(data => {
if (data.success) {
lastWaLink = data.whatsapp_link;
document.getElementById('resForm').style.display = 'none';
document.getElementById('resSuccess').style.display = 'block';
if (lastWaLink) {
document.getElementById('waBtn').href = lastWaLink;
// Otomatik aç
setTimeout(() => window.open(lastWaLink, '_blank', 'noopener'), 800);
} else {
document.getElementById('waBtn').style.display = 'none';
}
} else {
showToast(data.message, 'error');
btn.disabled = false;
btn.innerHTML = '<i class="bi bi-calendar-check me-2"></i>Rezervasyon Talebi Gönder';
}
})
.catch(() => {
showToast('Bağlantı hatası. Lütfen tekrar deneyin.', 'error');
btn.disabled = false;
btn.innerHTML = '<i class="bi bi-calendar-check me-2"></i>Rezervasyon Talebi Gönder';
});
}
function resetReservationForm() {
document.getElementById('rFullName').value = '';
document.getElementById('rPhone').value = '';
document.getElementById('rGuests').value = '2';
document.getElementById('rDate').value = '';
document.getElementById('rSpecial').value = '';
const btn = document.getElementById('resSubmitBtn');
btn.disabled = false;
btn.innerHTML = '<i class="bi bi-calendar-check me-2"></i>Rezervasyon Talebi Gönder';
document.getElementById('waBtn').style.display = '';
document.getElementById('resSuccess').style.display = 'none';
document.getElementById('resForm').style.display = '';
}
// Default date = today
document.getElementById('rDate').value = new Date().toISOString().split('T')[0];
</script>
</body>
</html>