Compare commits

..

No commits in common. "pages" and "main" have entirely different histories.
pages ... main

View File

@ -36,7 +36,7 @@
<section class="kt-ai-hero" data-align="center">
<div class="kt-ai-wrap">
<h1 class="reveal" style="color: var(--kt-ai-ok)">Рассчитайте стоимость подключения</h1>
<h1 class="reveal">Рассчитайте стоимость подключения</h1>
<p class="kt-ai-hero-sub reveal">Выберите тариф, скорость и оборудование — сумма обновится автоматически</p>
</div>
</section>
@ -67,10 +67,6 @@
<div class="total-block reveal">
<span style="font-size: var(--kt-ai-text-lg); color: var(--kt-ai-fg-muted)">Итого в месяц</span>
<div class="total-amount" id="totalAmount">0 ₸</div>
<label class="kt-ai-card" style="display: inline-flex; align-items: center; gap: var(--kt-ai-space-3); padding: var(--kt-ai-space-4) var(--kt-ai-space-5); margin: var(--kt-ai-space-5) 0; cursor: pointer">
<input type="checkbox" id="discountCheck" style="width: 18px; height: 18px">
<span style="font-weight: var(--kt-ai-weight-medium)">Скидка 10% для сотрудников КТ</span>
</label>
<button class="kt-ai-btn" data-variant="primary" data-size="lg" id="copyBtn">
<svg class="kt-icon" style="margin-right: 8px"><use href="#copy"></use></svg>
Скопировать расчёт
@ -118,8 +114,7 @@ const EQUIPMENT = [
let state = {
tariff: null,
speed: null,
equipment: null,
discount: false
equipment: null
};
// Инициализация
@ -129,7 +124,6 @@ function init() {
updateTotal();
renderJournal();
setupReveal();
setupDiscount();
}
// Рендер опций
@ -189,10 +183,7 @@ function updateTotal() {
const e = EQUIPMENT.find(x => x.id === state.equipment);
total += e.price;
}
if (state.discount) {
total = total * 0.9;
}
document.getElementById('totalAmount').textContent = Math.round(total).toLocaleString() + ' ₸';
document.getElementById('totalAmount').textContent = total.toLocaleString() + ' ₸';
}
// LocalStorage
@ -209,18 +200,6 @@ function loadState() {
} catch (e) {}
}
// Скидка
function setupDiscount() {
const check = document.getElementById('discountCheck');
check.checked = state.discount;
check.addEventListener('change', () => {
state.discount = check.checked;
saveState();
updateTotal();
logAction();
});
}
// Журнал
function logAction() {
const entry = {
@ -246,8 +225,7 @@ function calculateTotal() {
if (state.tariff) total += TARIFFS.find(x => x.id === state.tariff).price;
if (state.speed) total += SPEEDS.find(x => x.id === state.speed).price;
if (state.equipment) total += EQUIPMENT.find(x => x.id === state.equipment).price;
if (state.discount) total = total * 0.9;
return Math.round(total);
return total;
}
function renderJournal() {
@ -290,12 +268,11 @@ document.getElementById('copyBtn').addEventListener('click', () => {
const e = EQUIPMENT.find(x => x.id === state.equipment);
const total = calculateTotal();
const discountText = state.discount ? '\n🎁 Скидка 10% (сотрудник КТ): применена' : '';
const text = `📊 Расчёт стоимости подключения:
🔹 Тариф: ${t.name} — ${t.price.toLocaleString()} ₸
🔹 Скорость: ${s.name} — ${s.price === 0 ? 'Бесплатно' : '+' + s.price.toLocaleString() + ' ₸'}
🔹 Оборудование: ${e.name} — ${e.price === 0 ? 'Бесплатно' : '+' + e.price.toLocaleString() + ' ₸/мес'}${discountText}
🔹 Оборудование: ${e.name} — ${e.price === 0 ? 'Бесплатно' : '+' + e.price.toLocaleString() + ' ₸/мес'}
💰 Итого: ${total.toLocaleString()} ₸ в месяц`;