Warning, /pim/itinerary/src/app/TicketPage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 0007 import QtQuick.Layouts 0008 import QtQuick.Controls as QQC2 0009 import org.kde.kirigami as Kirigami 0010 import org.kde.kirigamiaddons.formcard as FormCard 0011 import org.kde.kitinerary 0012 import org.kde.itinerary 0013 0014 FormCard.FormCardPage { 0015 id: root 0016 0017 title: i18n("Ticket") 0018 0019 property string passId 0020 property var ticket 0021 0022 data: [ 0023 Connections { 0024 target: PassManager 0025 function onPassChanged(passId) { 0026 if (passId == root.passId) 0027 root.ticket = PassManager.pass(passId); 0028 } 0029 }, 0030 0031 BarcodeScanModeButton { 0032 page: root 0033 visible: barcodeContainer.visible 0034 }, 0035 0036 Kirigami.PromptDialog { 0037 id: deleteWarningDialog 0038 0039 title: i18n("Delete Ticket") 0040 subtitle: i18n("Do you really want to delete this ticket?") 0041 parent: applicationWindow() 0042 0043 standardButtons: QQC2.Dialog.Cancel 0044 0045 customFooterActions: [ 0046 Kirigami.Action { 0047 text: i18n("Delete") 0048 icon.name: "edit-delete" 0049 onTriggered: { 0050 PassManager.remove(passId) 0051 applicationWindow().pageStack.pop(); 0052 } 0053 } 0054 ] 0055 } 0056 ] 0057 0058 ColumnLayout { 0059 spacing: 0 0060 0061 CardPageTitle { 0062 emojiIcon: "🎫" 0063 text: root.ticket.name 0064 } 0065 0066 FormCard.FormCard { 0067 BarcodeContainer { 0068 id: barcodeContainer 0069 Layout.alignment: Qt.AlignCenter 0070 Layout.fillWidth: true 0071 Layout.topMargin: Kirigami.Units.largeSpacing 0072 Layout.bottomMargin: Kirigami.Units.largeSpacing 0073 0074 barcodeType: root.ticket.ticketTokenType 0075 barcodeContent: root.ticket.ticketTokenData 0076 onDoubleClicked: scanModeController.toggle() 0077 } 0078 } 0079 0080 FormCard.FormHeader { 0081 title: i18n("Ticket") 0082 } 0083 0084 FormCard.FormCard { 0085 FormCard.FormTextDelegate { 0086 text: i18n("Name") 0087 description: ticket.underName.name 0088 visible: ticket.underName.name !== "" 0089 } 0090 0091 FormCard.FormTextDelegate { 0092 text: i18n("Valid from") 0093 description: Localizer.formatDateOrDateTimeLocal(ticket, "validFrom") 0094 visible: description 0095 } 0096 0097 FormCard.FormTextDelegate { 0098 text: i18n("Valid until") 0099 description: Localizer.formatDateOrDateTimeLocal(ticket, "validUntil") 0100 visible: description 0101 } 0102 0103 FormCard.FormTextDelegate { 0104 text: i18n("Number") 0105 description: ticket.ticketNumber 0106 visible: ticket.ticketNumber !== "" 0107 } 0108 0109 FormCard.FormTextDelegate { 0110 text: i18n("Class") 0111 description: ticket.ticketedSeat.seatingType 0112 visible: ticket.ticketedSeat.seatingType !== "" 0113 } 0114 0115 FormPriceDelegate { 0116 item: root.ticket 0117 } 0118 } 0119 0120 DocumentsCard { 0121 documentIds: PassManager.documentIds(ticket) 0122 onAddDocument: (file) => { 0123 ApplicationController.addDocumentToPass(root.passId, file); 0124 documentIds = Qt.binding(function() { return PassManager.documentIds(ticket) }); 0125 } 0126 onRemoveDocument: (docId) => { ApplicationController.removeDocumentFromPass(root.passId, docId); } 0127 } 0128 0129 FormCard.FormHeader { 0130 title: i18n("Actions") 0131 } 0132 0133 FormCard.FormCard { 0134 FormCard.FormButtonDelegate { 0135 icon.name: "document-edit" 0136 text: i18n("Edit") 0137 onClicked: applicationWindow().pageStack.push(editor, {passId: root.passId, ticket: root.ticket}); 0138 0139 Component { 0140 id: editor 0141 TicketEditor {} 0142 } 0143 } 0144 0145 FormCard.FormDelegateSeparator {} 0146 0147 FormCard.FormButtonDelegate { 0148 icon.name: "edit-delete" 0149 text: i18n("Delete") 0150 onClicked: deleteWarningDialog.open() 0151 } 0152 } 0153 } 0154 }