Initial top-reservation app: bookings, objects catalog, statistics, PWA

This commit is contained in:
ogrechko committed 2026-08-29 11:30:46 +00:00
commit 14a849bfb9
62 files changed
+12427

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
export interface BookingSummaryInput {
bookingNumber: number;
contactName: string;
phone: string;
objectNames: string[];
date: Date;
checkIn: string;
checkOut: string;
guestCount: number;
cost: number;
prepayment: number;
comment: string | null;
source: string | null;
bookedByName: string;
}
function formatDate(d: Date): string {
const dd = String(d.getDate()).padStart(2, "0");
const mm = String(d.getMonth() + 1).padStart(2, "0");
return `${dd}.${mm}.${d.getFullYear()}`;
}
/**
* Plain-text booking summary — deliberately mirrors the old Telegram bot's
* "Готово! Вот что я забронировал:" message format so staff can paste it
* anywhere they're used to pasting the bot's output.
*/
export function formatBookingSummary(b: BookingSummaryInput): string {
const lines = [
`Номер бронирования: ${b.bookingNumber}`,
`Контактное лицо: ${b.contactName}`,
b.phone,
`Объект: ${b.objectNames.join("/") || "—"}`,
`Дата: ${formatDate(b.date)}`,
`Время заезда/выезда: ${b.checkIn} - ${b.checkOut}`,
`Количество людей: ${b.guestCount}`,
`Стоимость бронирования: ${b.cost}`,
`Предоплата: ${b.prepayment}`,
`Комментарий: ${b.comment?.trim() || "-"}`,
`Откуда пришли: ${b.source?.trim() || "-"}`,
`Кто забронировал: ${b.bookedByName}`,
];
return lines.join("\n");
}