File indexing completed on 2024-12-29 04:51:03
0001 /* 0002 SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 function parseReservation(pass, node) { 0007 let res = node.result[0]; 0008 0009 const secondary = pass.secondaryFields; 0010 const cardName = secondary.find(item => item.key === "cardName"); 0011 const ausgabestelleName = secondary.find(item => item.key === "ausgabestelleName"); 0012 0013 if (cardName) { 0014 res.underName = JsonLd.newObject("Person"); 0015 res.underName.name = cardName.value; 0016 } 0017 if (ausgabestelleName) { 0018 res.reservationFor.name = ausgabestelleName.value; 0019 } 0020 0021 const aux = pass.auxiliaryFields; 0022 const cardValidFrom = aux.find(item => item.key === "cardValidFrom"); 0023 const cardValidTo = aux.find(item => item.key === "cardValidTo"); 0024 0025 if (cardValidFrom) { 0026 res.reservationFor.startDate = cardValidFrom.value; 0027 } 0028 if (cardValidTo) { 0029 res.reservationFor.endDate = cardValidTo.value; 0030 } 0031 0032 const back = pass.backFields; 0033 const web = back.find(item => item.key === "web"); 0034 0035 if (web) { 0036 res.reservationFor.url = web.value; 0037 } 0038 0039 return res; 0040 }