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

0001 /*
0002    SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function extractPdf(pdf) {
0007     const text = pdf.text;
0008     let res = JsonLd.newBoatReservation();
0009     res.reservationNumber = text.match(/Booking reference: (\S+)/)[1];
0010     res.underName.name = text.match(/Responsible: (.*)/)[1];
0011     const trip = text.match(/Departure: (.*) \S+ (\d\d\.\d\d\.\d{4} \d\d:\d\d) Arrival: (.*) \S+ (\d\d\.\d\d\.\d{4} \d\d:\d\d)/);
0012     res.reservationFor.departureBoatTerminal.name = trip[1];
0013     res.reservationFor.departureTime = JsonLd.toDateTime(trip[2], 'dd.MM.yyyy hh:mm', 'en');
0014     res.reservationFor.arrivalBoatTerminal.name = trip[3];
0015     res.reservationFor.arrivalTime = JsonLd.toDateTime(trip[4], 'dd.MM.yyyy hh:mm', 'en');
0016     return res;
0017 }