From c6f5baae6ee0afb1fa4963fab55f73113631e863 Mon Sep 17 00:00:00 2001 From: Zholdas Date: Mon, 10 Aug 2026 09:26:56 +0000 Subject: [PATCH] add print codes button --- index.html | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 3fdf0d3..ddb03e7 100644 --- a/index.html +++ b/index.html @@ -123,7 +123,10 @@ body{font:17px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s -

Зарегистрированные родители:

+
+

Зарегистрированные родители:

+ +
@@ -456,6 +459,35 @@ function deleteParent(id) { } } +function printCodes() { + if (parents.length === 0) { + alert('Пока нет зарегистрированных родителей!'); + return; + } + const content = parents.map(p => + `${p.name} (${p.phone}) — КОД: ${p.code} (лимит ${p.limit}₸)` + ).join('\n\n'); + + const printWindow = window.open('', '', 'width=600,height=400'); + printWindow.document.write(` + Коды родителей + + +

🏪 Школьный магазин — Коды родителей

+

Распечатайте этот список и повесьте на кассе для проверки

+ ${parents.map(p => `
КОД: ${p.code}
${p.name} (${p.phone})
Лимит: ${p.limit}₸
`).join('')} +

Распечатано: ${new Date().toLocaleString('ru-RU')}

+ + `); + printWindow.document.close(); + printWindow.print(); +} + // === Добавление/удаление === document.getElementById('add-form').addEventListener('submit', (e) => { e.preventDefault();