Commit d2cf3707 authored by Volker Krause's avatar Volker Krause
Browse files

Add basic boat/ferry trip UI elements

parent 06f702a6
Pipeline #207462 passed with stage
in 4 minutes and 59 seconds
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.17 as Kirigami
import org.kde.itinerary 1.0
import "." as App
App.TimelineDelegate {
id: root
headerIconSource: "qrc:///images/ferry.svg"
headerItem: RowLayout {
QQC2.Label {
text: i18n("%1 to %2", reservationFor.departureBoatTerminal.name, reservationFor.arrivalBoatTerminal.name);
color: Kirigami.Theme.textColor
font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale
Layout.fillWidth: true
}
QQC2.Label {
text: Localizer.formatTime(reservationFor, "departureTime")
color: Kirigami.Theme.textColor
font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale
}
}
contentItem: Column {
id: topLayout
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
text: i18n("From: %1", reservationFor.departureBoatTerminal.name)
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.departureBoatTerminal
controller: root.controller
isRangeBegin: true
width: topLayout.width
}
Kirigami.Separator {
width: topLayout.width
}
QQC2.Label {
text: i18n("To: %1", reservationFor.arrivalBoatTerminal.name)
width: topLayout.width
}
App.PlaceDelegate {
place: reservationFor.arrivalBoatTerminal
controller: root.controller
isRangeEnd: true
width: topLayout.width
}
QQC2.Label {
text: i18n("Arrival time: %1", Localizer.formatDateTime(reservationFor, "arrivalTime"))
wrapMode: Text.WordWrap
}
}
onClicked: showDetailsPage(boatDetailsPage, root.batchId)
}
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.17 as Kirigami
import org.kde.kitinerary 1.0
import org.kde.itinerary 1.0
import "." as App
App.DetailsPage {
id: root
title: i18n("Boat Ticket")
actions.main: Kirigami.Action {
icon.name: "view-barcode-qr"
text: i18n("Barcode Scan Mode")
onTriggered: scanModeController.toggle()
visible: ticketToken.hasBarcode
checkable: true
checked: scanModeController.enabled
}
BarcodeScanModeController {
id: scanModeController
page: root
}
ColumnLayout {
width: parent.width
// TODO vessel name not yet available in the data model
/*QQC2.Label {
Layout.fillWidth: true
text: reservationFor.boatName
horizontalAlignment: Qt.AlignHCenter
font.bold: true
}*/
// ticket barcode
App.TicketTokenDelegate {
id: ticketToken
resIds: ReservationManager.reservationsForBatch(root.batchId)
onCurrentReservationIdChanged: {
if (!currentReservationId)
return;
root.currentReservationId = currentReservationId;
}
onScanModeToggled: scanModeController.toggle()
}
Kirigami.FormLayout {
Layout.fillWidth: true
// departure data
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Departure")
}
QQC2.Label {
Kirigami.FormData.label: i18n("Time:")
text: Localizer.formatDateTime(reservationFor, "departureTime")
}
QQC2.Label {
Kirigami.FormData.label: i18n("Terminal:")
text: reservationFor.departureBoatTerminal.name
}
App.PlaceDelegate {
place: reservationFor.departureBoatTerminal
controller: root.controller
isRangeBegin: true
}
// arrival data
Kirigami.Separator {
Kirigami.FormData.label: i18n("Arrival")
Kirigami.FormData.isSection: true
}
QQC2.Label {
Kirigami.FormData.label: i18n("Time:")
text: Localizer.formatDateTime(reservationFor, "arrivalTime")
}
QQC2.Label {
Kirigami.FormData.label: i18n("Terminal:")
text: reservationFor.arrivalBoatTerminal.name
}
App.PlaceDelegate {
place: reservationFor.arrivalBoatTerminal
controller: root.controller
isRangeEnd: true
}
// booking details
Kirigami.Separator {
Kirigami.FormData.label: i18n("Booking")
Kirigami.FormData.isSection: true
visible: referenceLabel.visible || underNameLabel.visible
}
QQC2.Label {
id: referenceLabel
Kirigami.FormData.label: i18n("Reference:")
text: reservation.reservationNumber
visible: reservation.reservationNumber
}
QQC2.Label {
id: underNameLabel
Kirigami.FormData.label: i18n("Under name:")
text: reservation.underName.name
visible: reservation.underName.name !== ""
}
}
}
}
......@@ -181,6 +181,10 @@ Kirigami.ScrollablePage {
id: carRentalDetailsPage
App.CarRentalPage {}
}
Component {
id: boatDetailsPage
App.BoatPage {}
}
Component {
id: touristAttractionDetailsPage
App.TouristAttractionPage {}
......@@ -278,6 +282,13 @@ Kirigami.ScrollablePage {
rangeType: model.rangeType
}
}
Models.DelegateChoice {
roleValue: TimelineElement.BoatTrip
App.BoatDelegate {
batchId: model.batchId
rangeType: model.rangeType
}
}
Models.DelegateChoice {
roleValue: TimelineElement.TodayMarker
QQC2.Label {
......
......@@ -13,6 +13,8 @@
<file>BarcodeScanModeController.qml</file>
<file>BarcodeScannerPage.qml</file>
<file>BoardingPass.qml</file>
<file>BoatDelegate.qml</file>
<file>BoatPage.qml</file>
<file>BusDelegate.qml</file>
<file>BusPage.qml</file>
<file>CalendarImportPage.qml</file>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment