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

0001 /*
0002    SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseTicket(pdf, node, triggerNode) {
0007     const text = pdf.pages[triggerNode.location].text;
0008     if (!text.match(/Fjord Line/))
0009         return;
0010     let res = JsonLd.newBoatReservation();
0011     const trip = text.match(/(\d{2}.\d{2}.\d{4}) +(.*?) +(\d{2}\.\d{2}) +(.*) +(\d{2}\.\d{2}) +(.*?)  +(.*)/);
0012     res.reservationFor.departureBoatTerminal.name = trip[2];
0013     res.reservationFor.departureTime = JsonLd.toDateTime(trip[1] + ' ' + trip[3], 'dd.MM.yyyy hh.mm', 'no');
0014     res.reservationFor.arrivalBoatTerminal.name = trip[4];
0015     res.reservationFor.arrivalTime = JsonLd.toDateTime(trip[1] + ' ' + trip[5], 'dd.MM.yyyy hh.mm', 'no');
0016     res.reservationFor.boatName = trip[6];
0017     res.underName.name = trip[7];
0018     res.reservationNumber = triggerNode.content;
0019     res.reservedTicket.ticketToken = 'qrCode:' + triggerNode.content;
0020     return res;
0021 }