AusweisApp2/resources/qml/Governikus/ProviderView/+ios/+tablet/ProviderView.qml

176 lines
4.2 KiB
QML
Raw Normal View History

2017-07-03 09:30:10 +02:00
import QtQuick 2.6
2017-12-20 14:54:05 +01:00
import Governikus.Global 1.0
import Governikus.Provider 1.0
import Governikus.TitleBar 1.0
import Governikus.Provider 1.0
2017-07-03 09:30:10 +02:00
2017-12-20 14:54:05 +01:00
SectionPage {
2017-07-03 09:30:10 +02:00
id: baseItem
2017-12-20 14:54:05 +01:00
headerTitleBarAction: TitleBarAction { text: qsTr("Provider") + settingsModel.translationTrigger; font.bold: true }
subTitleBarAction: SearchBar {
width: baseItem.width
2017-07-03 09:33:28 +02:00
onSearchTextChanged: providerModel.searchString = searchText
2017-07-03 09:30:10 +02:00
}
2017-12-20 14:54:05 +01:00
titleBarColor: Constants.blue
visible: false
property bool wasVisible: false
onVisibleChanged: wasVisible = true
readonly property var category: providerModel.categories.length === 0 ? "" : providerModel.categories[0]
2017-07-03 09:30:10 +02:00
readonly property int headerHeight: Utils.dp(54)
readonly property int separatorHeight: Utils.dp(2)
2017-12-20 14:54:05 +01:00
ProviderDetailView_tablet {
2017-07-03 09:30:10 +02:00
id: providerDetailView
visible: false
}
2017-07-03 09:33:28 +02:00
function pushProviderDetails(model) {
historyModel.nameFilter.setProviderAddress(model.providerAddress)
2017-12-20 14:54:05 +01:00
firePush(providerDetailView, {providerModelItem: model})
2017-07-03 09:30:10 +02:00
}
Column {
id: content
width: parent.width
Rectangle {
height: baseItem.headerHeight
width: parent.width
color: "white"
Row {
id: checkBoxesItem
height: parent.height
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
padding: Utils.dp(30)
spacing: Utils.dp(30)
2017-07-03 09:33:28 +02:00
transformOrigin: Item.Center
scale: Math.min(parent.width / width, 1)
2017-12-20 14:54:05 +01:00
CategoryCheckbox_tablet {
2017-07-03 09:30:10 +02:00
id: checkBoxCitizen
category: "citizen"
imageSource: Category.imageSource("citizen")
2017-12-20 14:54:05 +01:00
text: qsTr("Citizen services") + settingsModel.translationTrigger
2017-07-03 09:30:10 +02:00
}
2017-12-20 14:54:05 +01:00
CategoryCheckbox_tablet {
2017-07-03 09:30:10 +02:00
id: checkBoxFinance
category: "finance"
imageSource: Category.imageSource("finance")
2017-12-20 14:54:05 +01:00
text: qsTr("Financials") + settingsModel.translationTrigger
}
CategoryCheckbox_tablet {
id: checkBoxInsurance
category: "insurance"
imageSource: Category.imageSource("insurance")
text: qsTr("Insurances") + settingsModel.translationTrigger
2017-07-03 09:30:10 +02:00
}
2017-12-20 14:54:05 +01:00
CategoryCheckbox_tablet {
2017-07-03 09:30:10 +02:00
id: checkBoxOther
category: "other"
imageSource: Category.imageSource("other")
2017-12-20 14:54:05 +01:00
text: qsTr("Other services") + settingsModel.translationTrigger
2017-07-03 09:30:10 +02:00
}
}
}
Rectangle {
height: baseItem.separatorHeight
width: parent.width
color: PlatformConstants.grey_border
}
Rectangle {
id: mainPane
height: baseItem.height - (baseItem.headerHeight + baseItem.separatorHeight)
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
color: Constants.background_color
Text {
id: noResultsText
2018-03-28 15:10:51 +02:00
color: Constants.secondary_text
2017-07-03 09:30:10 +02:00
anchors.centerIn: mainPane
2017-12-20 14:54:05 +01:00
text: qsTr("No match found") + settingsModel.translationTrigger
2017-07-03 09:30:10 +02:00
wrapMode: Text.WordWrap
2017-07-03 09:33:28 +02:00
font.pixelSize: Constants.normal_font_size
2017-07-03 09:30:10 +02:00
visible: !flickable.visible
}
Flickable {
id: flickable
2017-07-03 09:33:28 +02:00
anchors.fill: mainPane
2017-07-03 09:30:10 +02:00
clip: true
flickableDirection: Flickable.VerticalFlick
visible: grid.hasResults
contentHeight: grid.height
contentWidth: parent.width
2017-07-03 09:33:28 +02:00
onContentYChanged: {
if (contentY < 0) { contentY = 0 /* prevent flicking over the top */}
}
2017-07-03 09:30:10 +02:00
Grid {
id: grid
2017-07-03 09:33:28 +02:00
columns: Math.floor((parent.width - Constants.component_spacing) / (Utils.dp(196) + Constants.component_spacing))
padding: Constants.component_spacing
spacing: Constants.component_spacing
2017-07-03 09:30:10 +02:00
width: parent.width
2017-07-03 09:33:28 +02:00
property int cardHeight: (flickable.height - Constants.component_spacing) / 2
property int cardWidth: (flickable.width - (grid.columns + 1) * Constants.component_spacing) / grid.columns
property bool hasResults: gridRepeater.count > 0 || additionalResults.totalHits > 0
2017-07-03 09:30:10 +02:00
Repeater {
id: gridRepeater
2017-07-03 09:33:28 +02:00
model: providerModel
2017-07-03 09:30:10 +02:00
2017-12-20 14:54:05 +01:00
ProviderCard_tablet {
2017-07-03 09:30:10 +02:00
width: grid.cardWidth
2017-07-03 09:33:28 +02:00
headerHeight: width / 1.80
textHeight: Utils.dp(64)
footerHeight: Utils.dp(30)
pushFunction: baseItem.pushProviderDetails
2017-12-20 14:54:05 +01:00
providerModelItem: baseItem.wasVisible ? model : undefined
2017-07-03 09:30:10 +02:00
}
}
2017-12-20 14:54:05 +01:00
AdditionalResultsItem_tablet {
2017-07-03 09:30:10 +02:00
id: additionalResults
width: grid.cardWidth
2017-07-03 09:33:28 +02:00
headerHeight: width / 1.80
textHeight: Utils.dp(64)
footerHeight: Utils.dp(30)
2017-07-03 09:30:10 +02:00
}
}
}
}
}
}