File indexing completed on 2024-12-29 04:51:06

0001 /*
0002    SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseEvent(event) {
0007     let res = JsonLd.newEventReservation();
0008     res.reservationFor.startDate =  JsonLd.readQDateTime(event, 'dtStart');
0009     res.reservationFor.endDate =  JsonLd.readQDateTime(event, 'dtEnd');
0010     res.reservationFor.location.geo.latitude = event.geoLatitude;
0011     res.reservationFor.location.geo.longitude = event.geoLongitude;
0012     res.reservationFor.location.name = event.organizer.name;
0013     const name = event.summary.match(/Appointment at (.*?) for (.*)/);
0014     if (name && name[1].startsWith(event.organizer.name)) {
0015         res.reservationFor.name = name[2];
0016     } else {
0017         res.reservationFor.name = event.summary;
0018     }
0019     res.reservationNumber = event.uid.match(/(.*)@/)[1];
0020     return res;
0021 }
0022 
0023 function parseBarcode(data) {
0024     let res = JsonLd.newEventReservation();
0025     res.reservedTicket.ticketToken = 'qrcode:' + data;
0026     res.reservationNumber = 'BE-vAFCK0UjWR';
0027     return res;
0028 }