Rewrite guest confirmation text; add discount and multi-day checkout
Copy button text now matches the exact guest-facing template requested — "Ваше бронирование подтверждено!", Гость/Номер для связи/Объект бронирования/Количество гостей/Дополнительные пожелания/Скидка — dropping the internal-only fields (source, who booked it) since this text gets pasted straight to the client, not kept for internal records (those still show on the on-screen summary card). New checkOutDate column (nullable — null means same-day, the common case) lets a booking span multiple days; the Google Calendar link and copy text both show the date range when set. New discount column (same shape as prepayment) feeds the new "Скидка" line. Statistics page gains a money row for the selected month: total booked, prepayments collected, amount still outstanding, and total discount given. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
This commit is contained in:
1 parent
4f206c2ddc
commit
006d108f54
15 files changed
+600
-35
No files matched your search
+16
-12
@@ -4,11 +4,13 @@ export interface BookingSummaryInput {
|
||||
phone: string;
|
||||
objectNames: string[];
|
||||
date: Date;
|
||||
checkOutDate: Date | null;
|
||||
checkIn: string;
|
||||
checkOut: string;
|
||||
guestCount: number;
|
||||
cost: number;
|
||||
prepayment: number;
|
||||
discount: number;
|
||||
comment: string | null;
|
||||
source: string | null;
|
||||
bookedByName: string;
|
||||
@@ -21,24 +23,26 @@ function formatDate(d: Date): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Guest-facing confirmation text for the "Скопировать бронирование" button
|
||||
* — meant to be pasted straight to the client (WhatsApp/Telegram/SMS), so
|
||||
* it deliberately excludes internal-only fields (source, who booked it).
|
||||
* Field set and order match exactly what was asked for; a multi-day stay's
|
||||
* date line shows both days ("дд.мм.гггг - дд.мм.гггг").
|
||||
*/
|
||||
export function formatBookingSummary(b: BookingSummaryInput): string {
|
||||
const dateLine = b.checkOutDate ? `${formatDate(b.date)} - ${formatDate(b.checkOutDate)}` : formatDate(b.date);
|
||||
const lines = [
|
||||
`Номер бронирования: ${b.bookingNumber}`,
|
||||
`Контактное лицо: ${b.contactName}`,
|
||||
b.phone,
|
||||
`Объект: ${b.objectNames.join("/") || "—"}`,
|
||||
`Дата: ${formatDate(b.date)}`,
|
||||
`Ваше бронирование подтверждено! Номер бронирования: ${b.bookingNumber}`,
|
||||
`Гость: ${b.contactName}`,
|
||||
`Номер для связи: ${b.phone}`,
|
||||
`Объект бронирования: ${b.objectNames.join("/") || "—"}`,
|
||||
`Дата: ${dateLine}`,
|
||||
`Время заезда/выезда: ${b.checkIn} - ${b.checkOut}`,
|
||||
`Количество людей: ${b.guestCount}`,
|
||||
`Количество гостей: ${b.guestCount}`,
|
||||
`Стоимость бронирования: ${b.cost}`,
|
||||
`Предоплата: ${b.prepayment}`,
|
||||
`Комментарий: ${b.comment?.trim() || "-"}`,
|
||||
`Откуда пришли: ${b.source?.trim() || "-"}`,
|
||||
`Кто забронировал: ${b.bookedByName}`,
|
||||
`Дополнительные пожелания: ${b.comment?.trim() || "-"}`,
|
||||
`Скидка: ${b.discount}`,
|
||||
];
|
||||
return lines.join("\n");
|
||||
}
|
||||
Reference in new issue
Block a user