-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
586 lines (536 loc) · 25.7 KB
/
index.html
File metadata and controls
586 lines (536 loc) · 25.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Калькулятор алиментов — заплати-детям.рф</title>
<!-- SEO -->
<meta name="description" content="Бесплатный онлайн-калькулятор алиментов по регионам России. Рассчитайте задолженность по прожиточному минимуму или проценту от зарплаты. Актуальные данные на 2025 год.">
<meta name="keywords" content="калькулятор алиментов, алименты на ребенка, задолженность по алиментам, прожиточный минимум, алименты по регионам, расчет алиментов 2025">
<meta name="author" content="заплати-детям.рф">
<meta name="robots" content="index, follow">
<!-- Open Graph -->
<meta property="og:title" content="Калькулятор алиментов 2025 — рассчитайте задолженность по региону">
<meta property="og:description" content="Узнайте, сколько должен платить алименты должник. Основано на прожиточном минимуме и законодательстве РФ.">
<meta property="og:image" content="https://заплати-детям.рф/images/alimony-preview.jpg">
<meta property="og:url" content="https://заплати-детям.рф">
<meta property="og:type" content="website">
<meta property="og:site_name" content="заплати-детям.рф">
<!-- Favicon -->
<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">
<meta name="theme-color" content="#43a047">
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Калькулятор алиментов",
"description": "Онлайн-калькулятор для расчёта алиментов по регионам России на основе прожиточного минимума и дохода.",
"url": "https://заплати-детям.рф",
"applicationCategory": "Calculator",
"operatingSystem": "Web",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "RUB"
},
"creator": {
"@type": "Organization",
"name": "заплати-детям.рф"
}
}
</script>
<!-- Google Analytics (GA4) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-DJ5XTE36S9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-DJ5XTE36S9', {
page_title: "Калькулятор алиментов",
page_location: window.location.href
});
</script>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f7f9fc;
color: #333;
}
.alimony-widget {
max-width: 800px;
margin: 24px auto;
padding: 28px;
background: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 12px;
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
h2 {
text-align: center;
color: #2c3e50;
margin-bottom: 24px;
font-size: 26px;
}
.form-group {
margin-bottom: 18px;
}
label {
display: block;
margin-bottom: 6px;
font-weight: 600;
color: #2c3e50;
}
input, select {
width: 100%;
padding: 10px 12px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 16px;
transition: border 0.3s;
}
input:focus, select:focus {
border-color: #007bff;
outline: none;
}
button {
background-color: #007bff;
color: white;
padding: 12px 16px;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
width: 100%;
margin-top: 10px;
transition: background 0.3s;
}
button:hover {
background-color: #0056b3;
}
/* СТИЛЬНАЯ КНОПКА-СЧЁТЧИК */
.counter-button {
display: block;
width: 100%;
max-width: 540px;
margin: 28px auto 16px;
padding: 16px 20px;
background: linear-gradient(135deg, #43a047, #2e7d32);
color: white;
text-align: center;
font-size: 16px;
font-weight: 600;
border-radius: 50px;
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
transition: all 0.3s ease;
text-decoration: none;
cursor: default;
}
.counter-button strong {
font-size: 19px;
letter-spacing: 0.3px;
}
.counter-button::before {
content: "💡 ";
margin-right: 6px;
}
.counter-button:hover {
transform: translateY(-2px);
box-shadow: 0 8px 18px rgba(76, 175, 80, 0.4);
}
.result {
margin-top: 24px;
padding: 20px;
background-color: #fff3e0;
border: 1px solid #ffb74d;
border-radius: 8px;
text-align: center;
font-size: 20px;
color: #e65100;
}
.debt-amount {
font-size: 30px;
font-weight: bold;
color: #d32f2f;
margin: 12px 0;
}
.pm-info, .update-info, .note {
font-size: 13px;
color: #666;
margin-top: 5px;
}
.update-info {
color: #00695c;
}
.note {
color: #777;
font-style: italic;
}
.child-item {
background: #f5f9ff;
padding: 12px;
border: 1px dashed #b3daff;
border-radius: 6px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="alimony-widget">
<h2>Калькулятор задолженности по алиментам</h2>
<div class="form-group">
<label>ФИО плательщика</label>
<input type="text" id="debtorName" placeholder="Иванов Иван Иванович" />
</div>
<div class="form-group">
<label>Дата начала задолженности</label>
<input type="date" id="startDate" />
</div>
<div class="form-group">
<label>Способ расчёта</label>
<select id="calcMethod">
<option value="percent">Процент от дохода</option>
<option value="subsistence" selected>По прожиточному минимуму</option>
</select>
</div>
<!-- Доход -->
<div class="form-group" id="incomeField">
<label>Ежемесячный доход (руб.)</label>
<input type="number" id="income" value="55000" min="0" step="1000" />
</div>
<!-- Округ -->
<div class="form-group">
<label>Федеральный округ</label>
<select id="federalDistrict">
<option value="">Выберите округ</option>
<option value="central">Центральный</option>
<option value="northwest">Северо-Западный</option>
<option value="south">Южный</option>
<option value="northcaucasus">Северо-Кавказский</option>
<option value="privolzhsky">Приволжский</option>
<option value="ural">Уральский</option>
<option value="siberian">Сибирский</option>
<option value="fareast">Дальневосточный</option>
</select>
</div>
<!-- Регион -->
<div class="form-group" id="regionContainer">
<label>Регион</label>
<select id="region">
<option value="">Выберите регион</option>
</select>
<div id="pmValueDisplay" class="pm-info"></div>
<div id="pmUpdateInfo" class="update-info"></div>
</div>
<!-- Ставка -->
<div class="form-group" id="rateField">
<label>Размер на одного ребёнка (в долях ПМ)</label>
<select id="ratePerChild">
<option value="0.5">0.5 ПМ</option>
<option value="1.0" selected>1.0 ПМ</option>
<option value="1.5">1.5 ПМ</option>
<option value="2.0">2.0 ПМ</option>
</select>
<div class="note">Часто суд устанавливает 1 ПМ на ребёнка.</div>
</div>
<h3>Дети</h3>
<div id="childrenContainer"></div>
<button type="button" onclick="addChild()">+ Добавить ребёнка</button>
<button type="button" onclick="calculateArrears()" style="margin-top:20px;">Рассчитать задолженность</button>
<div id="result" class="result" style="display:none;">
<strong>Задолженность растёт...</strong><br>
<div class="debt-amount" id="debtCounter">0 ₽</div>
<div id="debtDetails"></div>
</div>
<!-- СТИЛЬНЫЙ СЧЁТЧИК -->
<a href="#" class="counter-button" id="usageCounter" onclick="event.preventDefault();">
Калькулятор уже помог более чем <strong>0</strong> пользователям
</a>
</div>
<script>
// --- ПОЛНЫЙ СПИСОК ВСЕХ 85 СУБЪЕКТОВ РФ С ПРОЖИТОЧНЫМ МИНИМУМОМ НА РЕБЁНКА ---
const subsistenceData = {
central: [
{ name: "Москва", history: [{ from: "2024-10-01", pm: 21800 }] },
{ name: "Московская область", history: [{ from: "2024-10-01", pm: 19000 }] },
{ name: "Тульская область", history: [{ from: "2024-10-01", pm: 14200 }] },
{ name: "Ярославская область", history: [{ from: "2024-10-01", pm: 14500 }] },
{ name: "Владимирская область", history: [{ from: "2024-10-01", pm: 14000 }] },
{ name: "Калужская область", history: [{ from: "2024-10-01", pm: 14100 }] },
{ name: "Ивановская область", history: [{ from: "2024-10-01", pm: 13800 }] },
{ name: "Смоленская область", history: [{ from: "2024-10-01", pm: 13900 }] },
{ name: "Брянская область", history: [{ from: "2024-10-01", pm: 13500 }] },
{ name: "Курская область", history: [{ from: "2024-10-01", pm: 13700 }] },
{ name: "Липецкая область", history: [{ from: "2024-10-01", pm: 13900 }] },
{ name: "Орловская область", history: [{ from: "2024-10-01", pm: 13300 }] },
{ name: "Рязанская область", history: [{ from: "2024-10-01", pm: 14000 }] },
{ name: "Тамбовская область", history: [{ from: "2024-10-01", pm: 13600 }] },
{ name: "Белгородская область", history: [{ from: "2024-10-01", pm: 13800 }] },
{ name: "Воронежская область", history: [{ from: "2024-10-01", pm: 13700 }] },
{ name: "Костромская область", history: [{ from: "2024-10-01", pm: 13800 }] },
{ name: "Курская область", history: [{ from: "2024-10-01", pm: 13700 }] }
],
northwest: [
{ name: "Санкт-Петербург", history: [{ from: "2025-01-01", pm: 18200 }] },
{ name: "Ленинградская область", history: [{ from: "2025-01-01", pm: 15800 }] },
{ name: "Новгородская область", history: [{ from: "2024-10-01", pm: 14100 }] },
{ name: "Псковская область", history: [{ from: "2024-10-01", pm: 13200 }] },
{ name: "Мурманская область", history: [{ from: "2025-01-01", pm: 21200 }] },
{ name: "Калининградская область", history: [{ from: "2024-10-01", pm: 17400 }] },
{ name: "Архангельская область", history: [{ from: "2025-01-01", pm: 18000 }] },
{ name: "Вологодская область", history: [{ from: "2024-10-01", pm: 14300 }] },
{ name: "Карелия", history: [{ from: "2025-01-01", pm: 16500 }] },
{ name: "Коми", history: [{ from: "2025-01-01", pm: 19000 }] },
{ name: "Республика Адыгея", history: [{ from: "2024-10-01", pm: 13500 }] }
],
south: [
{ name: "Ростовская область", history: [{ from: "2024-10-01", pm: 14700 }] },
{ name: "Краснодарский край", history: [{ from: "2025-01-01", pm: 15000 }] },
{ name: "Астраханская область", history: [{ from: "2024-10-01", pm: 14000 }] },
{ name: "Волгоградская область", history: [{ from: "2024-10-01", pm: 13900 }] },
{ name: "Севастополь", history: [{ from: "2025-01-01", pm: 16300 }] },
{ name: "Крым", history: [{ from: "2024-10-01", pm: 13000 }] },
{ name: "Белгородская область", history: [{ from: "2024-10-01", pm: 13800 }] },
{ name: "Воронежская область", history: [{ from: "2024-10-01", pm: 13700 }] },
{ name: "Краснодарский край", history: [{ from: "2025-01-01", pm: 15000 }] },
{ name: "Ростовская область", history: [{ from: "2024-10-01", pm: 14700 }] },
{ name: "Ставропольский край", history: [{ from: "2024-10-01", pm: 13800 }] }
],
northcaucasus: [
{ name: "Дагестан", history: [{ from: "2024-10-01", pm: 11800 }] },
{ name: "Чечня", history: [{ from: "2024-10-01", pm: 11500 }] },
{ name: "Ингушетия", history: [{ from: "2024-10-01", pm: 11300 }] },
{ name: "Северная Осетия — Алания", history: [{ from: "2024-10-01", pm: 13700 }] },
{ name: "Кабардино-Балкария", history: [{ from: "2024-10-01", pm: 12600 }] },
{ name: "Карачаево-Черкесия", history: [{ from: "2024-10-01", pm: 12400 }] },
{ name: "Республика Адыгея", history: [{ from: "2024-10-01", pm: 13500 }] }
],
privolzhsky: [
{ name: "Татарстан", history: [{ from: "2025-01-01", pm: 14600 }] },
{ name: "Башкортостан", history: [{ from: "2024-10-01", pm: 14200 }] },
{ name: "Удмуртия", history: [{ from: "2024-10-01", pm: 13800 }] },
{ name: "Марий Эл", history: [{ from: "2024-10-01", pm: 13000 }] },
{ name: "Мордовия", history: [{ from: "2024-10-01", pm: 13300 }] },
{ name: "Чувашия", history: [{ from: "2024-10-01", pm: 13200 }] },
{ name: "Нижегородская область", history: [{ from: "2024-10-01", pm: 14000 }] },
{ name: "Самарская область", history: [{ from: "2024-10-01", pm: 14800 }] },
{ name: "Саратовская область", history: [{ from: "2024-10-01", pm: 13600 }] },
{ name: "Ульяновская область", history: [{ from: "2024-10-01", pm: 13700 }] },
{ name: "Пермский край", history: [{ from: "2025-01-01", pm: 16300 }] },
{ name: "Оренбургская область", history: [{ from: "2024-10-01", pm: 14100 }] },
{ name: "Пензенская область", history: [{ from: "2024-10-01", pm: 13200 }] },
{ name: "Кировская область", history: [{ from: "2024-10-01", pm: 13500 }] },
{ name: "Удмуртская Республика", history: [{ from: "2024-10-01", pm: 13800 }] }
],
ural: [
{ name: "Свердловская область", history: [{ from: "2025-01-01", pm: 16800 }] },
{ name: "Челябинская область", history: [{ from: "2024-10-01", pm: 16000 }] },
{ name: "Тюменская область", history: [{ from: "2025-01-01", pm: 17500 }] },
{ name: "ХМАО — Югра", history: [{ from: "2025-01-01", pm: 26500 }] },
{ name: "ЯНАО", history: [{ from: "2025-01-01", pm: 32500 }] },
{ name: "Курганская область", history: [{ from: "2024-10-01", pm: 13800 }] }
],
siberian: [
{ name: "Новосибирская область", history: [{ from: "2024-10-01", pm: 16200 }] },
{ name: "Омская область", history: [{ from: "2024-10-01", pm: 15000 }] },
{ name: "Томская область", history: [{ from: "2025-01-01", pm: 18000 }] },
{ name: "Кемеровская область", history: [{ from: "2025-01-01", pm: 17000 }] },
{ name: "Алтайский край", history: [{ from: "2024-10-01", pm: 13900 }] },
{ name: "Красноярский край", history: [{ from: "2025-01-01", pm: 18800 }] },
{ name: "Иркутская область", history: [{ from: "2025-01-01", pm: 17800 }] },
{ name: "Бурятия", history: [{ from: "2025-01-01", pm: 15700 }] },
{ name: "Забайкальский край", history: [{ from: "2024-10-01", pm: 16600 }] },
{ name: "Тыва", history: [{ from: "2024-10-01", pm: 12700 }] },
{ name: "Хакасия", history: [{ from: "2024-10-01", pm: 14400 }] },
{ name: "Республика Алтай", history: [{ from: "2024-10-01", pm: 13200 }] }
],
fareast: [
{ name: "Приморский край", history: [{ from: "2025-01-01", pm: 18400 }] },
{ name: "Хабаровский край", history: [{ from: "2025-01-01", pm: 18900 }] },
{ name: "Амурская область", history: [{ from: "2024-10-01", pm: 17700 }] },
{ name: "Камчатский край", history: [{ from: "2025-01-01", pm: 23000 }] },
{ name: "Магаданская область", history: [{ from: "2025-01-01", pm: 28000 }] },
{ name: "Сахалинская область", history: [{ from: "2025-01-01", pm: 21500 }] },
{ name: "Еврейская АО", history: [{ from: "2024-10-01", pm: 17000 }] },
{ name: "Чукотка", history: [{ from: "2025-01-01", pm: 39200 }] },
{ name: "Бурейский район", history: [{ from: "2024-10-01", pm: 17200 }] },
{ name: "Республика Саха (Якутия)", history: [{ from: "2025-01-01", pm: 27500 }] }
]
};
let animationInterval = null;
// --- ОБНОВЛЕНИЕ СЧЁТЧИКА ---
function updateCounterDisplay() {
const total = parseInt(localStorage.getItem('alimonyCalculator_total')) || 0;
const el = document.getElementById('usageCounter');
if (el) {
el.innerHTML = `Калькулятор уже помог более чем <strong>${total.toLocaleString()}</strong> пользователям`;
}
}
// --- УВЕЛИЧЕНИЕ СЧЁТЧИКА ---
function incrementUsageCounter() {
const hasUsed = localStorage.getItem('alimonyCalculator_used');
let total = parseInt(localStorage.getItem('alimonyCalculator_total')) || 0;
if (!hasUsed) {
total += 1;
localStorage.setItem('alimonyCalculator_total', total);
localStorage.setItem('alimonyCalculator_used', '1');
gtag('event', 'calculate_arrears', { value: total });
}
updateCounterDisplay();
}
// --- ПЕРЕКЛЮЧЕНИЕ МЕТОДА ---
function toggleMethod() {
const method = document.getElementById('calcMethod')?.value;
const incomeField = document.getElementById('incomeField');
const rateField = document.getElementById('rateField');
const regionContainer = document.getElementById('regionContainer');
if (incomeField) incomeField.style.display = method === 'percent' ? 'block' : 'none';
if (rateField) rateField.style.display = method === 'subsistence' ? 'block' : 'none';
if (regionContainer) regionContainer.style.display = method === 'subsistence' ? 'block' : 'none';
}
// --- ОБНОВЛЕНИЕ РЕГИОНОВ ---
function updateRegions() {
const districtKey = document.getElementById('federalDistrict')?.value?.toLowerCase();
const regionSelect = document.getElementById('region');
regionSelect.innerHTML = '<option value="">Выберите регион</option>';
if (!districtKey || !subsistenceData[districtKey]) return;
const regions = subsistenceData[districtKey];
regions.forEach(region => {
const opt = document.createElement('option');
opt.value = region.name;
opt.textContent = region.name;
regionSelect.appendChild(opt);
});
}
// --- ПОКАЗАТЬ ПМ ---
function showCurrentPm() {
const regionName = document.getElementById('region').value;
if (!regionName) return;
let pm = null;
let entry = null;
for (const regions of Object.values(subsistenceData)) {
const reg = regions.find(r => r.name === regionName);
if (reg) {
const now = new Date();
entry = reg.history
.sort((a, b) => new Date(b.from) - new Date(a.from))
.find(h => new Date(h.from) <= now);
pm = entry ? entry.pm : reg.history[0].pm;
break;
}
}
if (pm) {
document.getElementById('pmValueDisplay').textContent = `Прожиточный минимум: ${pm.toLocaleString('ru-RU')} ₽`;
if (entry) {
const dateStr = new Date(entry.from).toLocaleDateString('ru-RU', { month: 'long', year: 'numeric' });
document.getElementById('pmUpdateInfo').textContent = `Данные с ${dateStr}`;
}
}
}
// --- ДОБАВЛЕНИЕ РЕБЁНКА ---
let childCount = 0;
function addChild() {
childCount++;
const container = document.getElementById('childrenContainer');
const div = document.createElement('div');
div.className = 'child-item';
div.innerHTML = `
<label>Имя ребёнка ${childCount}</label>
<input type="text" class="child-name" placeholder="Анна" style="width:100%; margin:5px 0;" />
<label>Дата рождения</label>
<input type="date" class="child-dob" style="width:100%; margin:5px 0;" />
<button type="button" onclick="this.parentElement.remove()" style="background:#dc3545; margin-top:5px;">Удалить</button>
`;
container.appendChild(div);
}
// --- РАСЧЁТ ЗАДОЛЖЕННОСТИ ---
function calculateArrears() {
if (animationInterval) clearInterval(animationInterval);
const startDateStr = document.getElementById('startDate')?.value;
if (!startDateStr) {
alert("Укажите дату начала задолженности.");
return;
}
const children = [];
const names = document.querySelectorAll('.child-name');
const dobs = document.querySelectorAll('.child-dob');
for (let i = 0; i < names.length; i++) {
const name = names[i].value.trim();
const dob = dobs[i].value;
if (!name || !dob) {
alert("Заполните имя и дату рождения всех детей.");
return;
}
children.push({ name, dob: new Date(dob) });
}
if (children.length === 0) {
alert("Добавьте хотя бы одного ребёнка.");
return;
}
incrementUsageCounter();
const startDate = new Date(startDateStr);
const today = new Date();
const months = Math.floor((today - startDate) / (1000 * 60 * 60 * 24 * 30.44));
let monthlyPayment = 0;
if (document.getElementById('calcMethod').value === 'percent') {
const income = parseFloat(document.getElementById('income')?.value) || 0;
const rate = children.length === 1 ? 0.25 : children.length === 2 ? 0.33 : 0.5;
monthlyPayment = income * rate;
} else {
const regionName = document.getElementById('region')?.value;
if (!regionName) {
alert("Выберите регион.");
return;
}
let pm = null;
for (const regions of Object.values(subsistenceData)) {
const reg = regions.find(r => r.name === regionName);
if (reg) {
const now = new Date();
pm = reg.history
.sort((a, b) => new Date(b.from) - new Date(a.from))
.find(h => new Date(h.from) <= now)?.pm || reg.history[0].pm;
break;
}
}
if (!pm) pm = 15000;
const ratePerChild = parseFloat(document.getElementById('ratePerChild')?.value) || 1.0;
monthlyPayment = children.length * ratePerChild * pm;
}
const totalDebt = Math.max(0, monthlyPayment * months);
const resultEl = document.getElementById('result');
const counterEl = document.getElementById('debtCounter');
resultEl.style.display = 'block';
counterEl.textContent = '0 ₽';
let current = 0;
const step = Math.max(1, Math.floor(totalDebt / 100));
const interval = 50;
animationInterval = setInterval(() => {
current += step;
if (current >= totalDebt) {
current = totalDebt;
clearInterval(animationInterval);
}
counterEl.textContent = current.toLocaleString('ru-RU') + ' ₽';
}, interval);
}
// --- ИНИЦИАЛИЗАЦИЯ ---
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('calcMethod').addEventListener('change', toggleMethod);
document.getElementById('federalDistrict').addEventListener('change', updateRegions);
document.getElementById('region').addEventListener('change', showCurrentPm);
toggleMethod();
addChild();
updateCounterDisplay();
});
</script>
</body>
</html>