Files
cleaning-company/public/booking-confirm.html
Владимир ae5ab2554b commit 12.01
2026-01-12 14:25:15 +00:00

184 lines
6.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Бронь создана - КлинСервис</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
background: white;
padding: 60px 40px;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
text-align: center;
max-width: 500px;
width: 90%;
}
.success-icon {
font-size: 80px;
color: #28a745;
margin-bottom: 20px;
}
h1 {
color: #28a745;
font-size: 32px;
margin-bottom: 20px;
}
.booking-number {
background: #d4edda;
padding: 20px;
border-radius: 15px;
margin: 30px 0;
font-size: 28px;
font-weight: bold;
color: #155724;
border: 3px solid #28a745;
}
.booking-details {
background: #f8f9fa;
padding: 25px;
border-radius: 15px;
margin: 20px 0;
text-align: left;
}
.detail-row {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid #e9ecef;
}
.detail-row:last-child { border-bottom: none; margin-bottom: 0; }
.btn {
width: 100%;
padding: 18px;
margin: 10px 0;
border: none;
border-radius: 15px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
text-decoration: none;
display: block;
transition: all 0.3s;
}
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5a67d8; transform: translateY(-2px); }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px solid #e9ecef;
}
</style>
</head>
<body>
<div class="container">
<!-- Хедер -->
<div class="header">
<a href="index.html" style="font-size: 24px; font-weight: bold; color: #667eea;">← Главная</a>
<a href="my-bookings.html" class="btn btn-secondary" style="width: auto; padding: 10px 20px;">Мои брони</a>
</div>
<!-- Успешное подтверждение -->
<div class="success-icon"></div>
<h1>Бронь успешно создана!</h1>
<p style="color: #666; margin-bottom: 30px;">Сохраните номер брони — он понадобится для отмены или связи</p>
<div class="booking-number" id="bookingNumber">CL-2025-0042</div>
<div class="booking-details" id="bookingDetails">
<div class="detail-row">
<span>🧹 Услуга:</span>
<span>Генеральная уборка</span>
</div>
<div class="detail-row">
<span>👨‍💼 Сотрудник:</span>
<span>Иван Петров</span>
</div>
<div class="detail-row">
<span>📅 Дата:</span>
<span>15 июня 2025</span>
</div>
<div class="detail-row">
<span>🕒 Время:</span>
<span>10:0012:00</span>
</div>
<div class="detail-row">
<span>💰 Стоимость:</span>
<span>5000 ₽</span>
</div>
</div>
<a href="services.html" class="btn btn-primary">📋 Забронировать еще</a>
<a href="my-bookings.html" class="btn btn-secondary">📋 Мои брони</a>
</div>
<script>
const token = localStorage.getItem('token');
if (!token) {
window.location.href = 'register-login.html';
}
window.onload = loadBookings;
async function loadBookings() {
try {
const res = await fetch('/api/bookings', {
headers: { 'Authorization': `Bearer ${token}` }
});
const bookings = await res.json();
const list = document.getElementById('bookings-list');
bookings.forEach(b => {
list.innerHTML += `
<div>
<p><strong>${b.booking_number}</strong> — ${b.service.name} (${b.booking_date} ${b.start_time}) — ${b.status}</p>
${b.status === 'confirmed' ? `<button onclick="cancelBooking(${b.id})">Отменить</button>` : ''}
</div>
`;
});
} catch (err) {
alert('Ошибка загрузки бронирований');
}
}
async function cancelBooking(id) {
try {
const reason = prompt('Причина отмены (необязательно):');
const res = await fetch(`/api/bookings/${id}/cancel`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({ reason })
});
if (res.ok) {
alert('Бронь отменена');
window.location.reload();
}
} catch (err) {
alert('Ошибка отмены');
}
}
</script>
</body>
</html>