Commit b8dd697a authored by Volker Krause's avatar Volker Krause

Show hotel checkouts in the timeline view

parent 9e5ad334
......@@ -41,7 +41,9 @@ App.TimelineDelegate {
anchors.margins: Kirigami.Units.largeSpacing
QQC2.Label {
text: qsTr("🏨 %1").arg(reservation.reservationFor.name)
text: root.rangeType == TimelineModel.RangeEnd ?
qsTr("🏨 Check-out %1").arg(reservation.reservationFor.name) :
qsTr("🏨 %1").arg(reservation.reservationFor.name)
color: Kirigami.Theme.textColor
font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale
Layout.fillWidth: true
......@@ -60,10 +62,12 @@ App.TimelineDelegate {
text: qsTr("Check-in time: %1")
.arg(Localizer.formatTime(reservation, "checkinTime"))
color: Kirigami.Theme.textColor
visible: root.rangeType == TimelineModel.RangeBegin
}
QQC2.Label {
text: qsTr("Check-out time: %1")
.arg(Localizer.formatDateTime(reservation, "checkoutTime"))
text: root.rangeType == TimelineModel.RangeBegin ?
qsTr("Check-out time: %1").arg(Localizer.formatDateTime(reservation, "checkoutTime")) :
qsTr("Check-out time: %1").arg(Localizer.formatTime(reservation, "checkoutTime"))
color: Kirigami.Theme.textColor
}
......
......@@ -27,6 +27,7 @@ Kirigami.AbstractCard {
property var reservation
property var pass
property string passId
property var rangeType
readonly property double headerFontScale: 1.25
......
......@@ -40,23 +40,48 @@ Kirigami.ScrollablePage {
// page content
Component {
id: flightDelegate
App.FlightDelegate {}
App.FlightDelegate {
reservation: modelData.reservation
passId: modelData.passId
pass: modelData.pass
rangeType: modelData.rangeType
}
}
Component {
id: hotelDelegate
App.HotelDelegate {}
App.HotelDelegate {
reservation: modelData.reservation
passId: modelData.passId
pass: modelData.pass
rangeType: modelData.rangeType
}
}
Component {
id: trainDelegate
App.TrainDelegate {}
App.TrainDelegate {
reservation: modelData.reservation
passId: modelData.passId
pass: modelData.pass
rangeType: modelData.rangeType
}
}
Component {
id: busDelegate
App.BusDelegate {}
App.BusDelegate {
reservation: modelData.reservation
passId: modelData.passId
pass: modelData.pass
rangeType: modelData.rangeType
}
}
Component {
id: restaurantDelegate
App.RestaurantDelegate {}
App.RestaurantDelegate {
reservation: modelData.reservation
passId: modelData.passId
pass: modelData.pass
rangeType: modelData.rangeType
}
}
Component {
id: todayDelegate
......@@ -93,11 +118,7 @@ Kirigami.ScrollablePage {
}
onLoaded: {
if (modelData.type != TimelineModel.TodayMarker) {
item.reservation = Qt.binding(function() { return modelData.reservation; });
item.passId = Qt.binding(function() { return modelData.passId; });
item.pass = Qt.binding(function() { return modelData.pass; });
} else {
if (modelData.type == TimelineModel.TodayMarker) {
item.visible = modelData.isTodayEmpty;
}
}
......
......@@ -183,9 +183,11 @@ QHash<int, QByteArray> TimelineModel::roleNames() const
names.insert(PassIdRole, "passId");
names.insert(SectionHeader, "sectionHeader");
names.insert(ReservationRole, "reservation");
names.insert(ReservationIdRole, "reservationId");
names.insert(ElementTypeRole, "type");
names.insert(TodayEmptyRole, "isTodayEmpty");
names.insert(IsTodayRole, "isToday");
names.insert(ElementRangeRole, "rangeType");
return names;
}
......
Markdown is supported
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