mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 06:57:12 +01:00
enrich description in calendar
This commit is contained in:
@@ -2,6 +2,7 @@ import { createEvents, EventStatus } from 'ics'
|
|||||||
import { Booking } from '../db/booking'
|
import { Booking } from '../db/booking'
|
||||||
import { BOOKING_STATUS } from '../db/enums'
|
import { BOOKING_STATUS } from '../db/enums'
|
||||||
import { getBaseURL } from './url'
|
import { getBaseURL } from './url'
|
||||||
|
import { daysFormatFrontend } from './date'
|
||||||
|
|
||||||
function convertDay(value: string): [number, number, number] {
|
function convertDay(value: string): [number, number, number] {
|
||||||
const parts = value.split('-')
|
const parts = value.split('-')
|
||||||
@@ -17,7 +18,14 @@ export function generateBookedCalendar(bookings: Booking[]) {
|
|||||||
start: convertDay(booking.days[0]),
|
start: convertDay(booking.days[0]),
|
||||||
end: convertDay(booking.days[booking.days.length - 1]),
|
end: convertDay(booking.days[booking.days.length - 1]),
|
||||||
title: `Buchung ${booking.booker.name}`,
|
title: `Buchung ${booking.booker.name}`,
|
||||||
description: `Link: ${getBaseURL()}/admin/booking/${booking.uuid}`,
|
description: `Name: ${booking.booker.name}
|
||||||
|
Zeitraum: ${daysFormatFrontend(booking.days)}
|
||||||
|
|
||||||
|
Email: ${booking.booker.email}
|
||||||
|
Telefon: ${booking.booker.phone}
|
||||||
|
|
||||||
|
Link: ${getBaseURL()}/admin/booking/${booking.uuid}
|
||||||
|
`,
|
||||||
status:
|
status:
|
||||||
booking.status === BOOKING_STATUS.CONFIRMED
|
booking.status === BOOKING_STATUS.CONFIRMED
|
||||||
? ('CONFIRMED' as EventStatus)
|
? ('CONFIRMED' as EventStatus)
|
||||||
|
|||||||
Reference in New Issue
Block a user