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

0001 /*
0002    SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseTicket(html, node) {
0007     var res = JsonLd.newEventReservation();
0008     var ticketNode = html.eval('//img/../../../../..')[1];
0009     res.reservationFor.name = ticketNode.recursiveContent.match(/(.*)\n/)[1];
0010     const text = html.root.recursiveContent;
0011     const dt = text.match(/Geldig op\s+(\d{2}-\d{2}-\d{4}) +(\d+:\d{2}) *- *(\d+:\d{2})/);
0012     res.reservationFor.startDate = JsonLd.toDateTime(dt[1] + dt[2], "dd-MM-yyyyhh:mm", "nl");
0013     res.reservationFor.endDate = JsonLd.toDateTime(dt[1] + dt[3], "dd-MM-yyyyhh:mm", "nl");
0014     res.reservationNumber = text.match(/nummer (\d{10}) /)[1];
0015     res.underName.name = text.match(/naam van\s+(.+)\n/)[1];
0016 
0017     const barcode = node.findChildNodes({ mimeType: "text/plain", match: "[^\s]", scope: "Descendants" })[0];
0018     res.reservedTicket.ticketToken = 'qrCode:' + barcode.content;
0019     return res;
0020 }