From 7713666a15085966d56ac2341123f97777a34cd6 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sun, 13 May 2018 20:11:48 +0200 Subject: [PATCH] Add details page for restaurant reservations --- src/app/CMakeLists.txt | 1 + src/app/RestaurantDelegate.qml | 18 +++---- src/app/RestaurantPage.qml | 95 ++++++++++++++++++++++++++++++++++ src/app/qml.qrc | 1 + 4 files changed, 105 insertions(+), 10 deletions(-) create mode 100644 src/app/RestaurantPage.qml diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 18ae030..25295d5 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -65,6 +65,7 @@ qml_lint( PkPassPage.qml PlaceDelegate.qml RestaurantDelegate.qml + RestaurantPage.qml TicketTokenDelegate.qml TimelineDelegate.qml TimelinePage.qml diff --git a/src/app/RestaurantDelegate.qml b/src/app/RestaurantDelegate.qml index ab9dee4..fd3e7e5 100644 --- a/src/app/RestaurantDelegate.qml +++ b/src/app/RestaurantDelegate.qml @@ -61,16 +61,14 @@ App.TimelineDelegate { place: reservation.reservationFor Layout.fillWidth: true } - QQC2.Label { - text: qsTr("Person: %1") - .arg(reservation.partySize) - color: Kirigami.Theme.textColor - } - QQC2.Label { - text: qsTr("End: %1") - .arg(Localizer.formatTime(reservation, "endTime")) - color: Kirigami.Theme.textColor + } + + Component { + id: detailsComponent + App.RestaurantPage { + reservation: root.reservation } } -} + onClicked: applicationWindow().pageStack.push(detailsComponent); +} diff --git a/src/app/RestaurantPage.qml b/src/app/RestaurantPage.qml new file mode 100644 index 0000000..5e324a9 --- /dev/null +++ b/src/app/RestaurantPage.qml @@ -0,0 +1,95 @@ +/* + Copyright (C) 2018 Volker Krause + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.1 as QQC2 +import org.kde.kirigami 2.0 as Kirigami +import org.kde.kitinerary 1.0 +import org.kde.itinerary 1.0 +import "." as App + +App.DetailsPage { + id: root + title: qsTr("Restaurant Reservation") + + GridLayout { + id: grid + width: root.width + columns: 2 + + QQC2.Label { + Layout.columnSpan: 2 + Layout.fillWidth: true + text: reservation.reservationFor.name + horizontalAlignment: Qt.AlignHCenter + font.bold: true + } + + App.PlaceDelegate { + Layout.columnSpan: 2 + Layout.fillWidth: true + place: reservation.reservationFor + } + + // TODO make these interactive + QQC2.Label { + text: qsTr("Telephone:") + } + QQC2.Label { + text: reservation.reservationFor.telephone + } + QQC2.Label { + text: qsTr("Email:") + } + QQC2.Label { + text: reservation.reservationFor.email + } + + QQC2.Label { + text: qsTr("Start time:") + } + QQC2.Label { + text: Localizer.formatDateTime(reservation, "startTime") + } + QQC2.Label { + text: qsTr("End time:") + } + QQC2.Label { + text: Localizer.formatDateTime(reservation, "endTime") + } + QQC2.Label { + text: qsTr("Party size:") + } + QQC2.Label { + text: reservation.partySize + } + + QQC2.Label { + text: qsTr("Booking reference:") + } + QQC2.Label { + text: reservation.reservationNumber + } + QQC2.Label { + text: qsTr("Under name:") + } + QQC2.Label { + text: reservation.underName.name + } + } +} diff --git a/src/app/qml.qrc b/src/app/qml.qrc index 671bec1..e387d24 100644 --- a/src/app/qml.qrc +++ b/src/app/qml.qrc @@ -12,6 +12,7 @@ PkPassPage.qml PlaceDelegate.qml RestaurantDelegate.qml + RestaurantPage.qml TicketTokenDelegate.qml TimelineDelegate.qml TimelinePage.qml -- GitLab