Warning, /pim/itinerary/src/app/EventEditor.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Layouts 0009 import QtQuick.Controls as QQC2 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.kirigamiaddons.formcard as FormCard 0012 import org.kde.i18n.localeData 0013 import org.kde.kitinerary 0014 import org.kde.itinerary 0015 0016 EditorPage { 0017 id: root 0018 0019 title: i18nc("event as in concert/conference/show, not as in appointment", "Edit Event") 0020 0021 isValidInput: eventName.text !== "" && startDateEdit.hasValue && (!endDateEdit.hasValue || startDateEdit.value < endDateEdit.value) 0022 0023 function apply(reservation) { 0024 let event = reservation.reservationFor; 0025 event.name = eventName.text; 0026 let loc = address.save(reservation.reservationFor.location ? reservation.reservationFor.location : Factory.makePlace()); 0027 loc.name = venueName.text; 0028 event.location = loc; 0029 event.url = urlEdit.text; 0030 0031 if (entranceTimeEdit.isModified) 0032 event = Util.setDateTimePreserveTimezone(event, "doorTime", entranceTimeEdit.value); 0033 if (startDateEdit.isModified) 0034 event = Util.setDateTimePreserveTimezone(event, "startDate", startDateEdit.value); 0035 if (endDateEdit.isModified) 0036 event = Util.setDateTimePreserveTimezone(event, "endDate", endDateEdit.value); 0037 0038 let newRes = reservation; 0039 newRes.reservationFor = event; 0040 bookingEdit.apply(newRes); 0041 return newRes; 0042 } 0043 0044 ColumnLayout { 0045 spacing: 0 0046 0047 FormCard.FormHeader { 0048 title: i18nc("event as in concert/conference/show, not as in appointment", "Event") 0049 } 0050 0051 FormCard.FormCard { 0052 FormCard.FormTextFieldDelegate { 0053 id: eventName 0054 label: i18nc("event name", "Name") 0055 text: reservation.reservationFor.name 0056 status: Kirigami.MessageType.Error 0057 statusMessage: text === "" ? i18n("Name must not be empty.") : "" 0058 } 0059 FormCard.FormDelegateSeparator {} 0060 FormDateTimeEditDelegate { 0061 id: entranceTimeEdit 0062 text: i18nc("time of entrance", "Entrance") 0063 obj: reservation.reservationFor 0064 propertyName: "doorTime" 0065 initialValue: { 0066 let d = new Date(startDateEdit.value); 0067 d.setHours(d.getHours() - 2); 0068 return d; 0069 } 0070 status: Kirigami.MessageType.Warning 0071 statusMessage: { 0072 if (entranceTimeEdit.hasValue && entranceTimeEdit.value > startDateEdit.value) 0073 return i18n("Entrance time has to be before the start time.") 0074 return ''; 0075 } 0076 } 0077 FormCard.FormDelegateSeparator {} 0078 FormDateTimeEditDelegate { 0079 id: startDateEdit 0080 text: i18n("Start Time") 0081 obj: reservation.reservationFor 0082 propertyName: "startDate" 0083 status: Kirigami.MessageType.Error 0084 statusMessage: startDateEdit.hasValue ? '' : i18n("Start time has to be set.") 0085 } 0086 FormCard.FormDelegateSeparator {} 0087 FormDateTimeEditDelegate { 0088 id: endDateEdit 0089 text: i18n("End Time") 0090 obj: reservation.reservationFor 0091 propertyName: "endDate" 0092 initialValue: { 0093 let d = new Date(startDateEdit.value); 0094 d.setHours(d.getHours() + 2); 0095 return d; 0096 } 0097 status: Kirigami.MessageType.Error 0098 statusMessage: { 0099 if (endDateEdit.hasValue && endDateEdit.value < startDateEdit.value) 0100 return i18n("End time has to be after the start time.") 0101 return ''; 0102 } 0103 } 0104 FormCard.FormDelegateSeparator {} 0105 FormCard.FormTextFieldDelegate { 0106 id: urlEdit 0107 label: i18n("Website") 0108 text: root.reservation.reservationFor.url 0109 inputMethodHints: Qt.ImhUrlCharactersOnly 0110 } 0111 } 0112 0113 FormCard.FormHeader { 0114 title: i18n("Venue") 0115 } 0116 0117 FormCard.FormCard { 0118 FormCard.FormTextFieldDelegate { 0119 id: venueName 0120 label: i18nc("venue name", "Name") 0121 text: reservation.reservationFor.location ? reservation.reservationFor.location.name : "" 0122 } 0123 FormCard.FormDelegateSeparator {} 0124 FormPlaceEditorDelegate { 0125 id: address 0126 place: { 0127 if (root.reservation.reservationFor.location) 0128 return root.reservation.reservationFor.location; 0129 return cityAtTime(root.reservation.reservationFor.startDate); 0130 } 0131 } 0132 } 0133 0134 // TODO seat 0135 0136 BookingEditorCard { 0137 id: bookingEdit 0138 item: reservation 0139 defaultCurrency: Country.fromAlpha2(address.currentCountry).currencyCode 0140 } 0141 } 0142 }