Files
beerlog/qml/Views/OrdersView.qml

64 lines
1.5 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import ru.ded.beerlog 1.0
Page {
title: qsTr("Orders")
OrdersViewModel {
id: ordersModel
}
ListView {
id: ordersList
anchors.fill: parent
anchors.margins: 10
model: ordersModel
section.criteria: ViewSection.FullString
section.property: "date"
section.delegate: Label {
text: section
font.bold: true
}
delegate: Column {
width: ordersList.width
height: productsList.heigt
ListView {
id: productsList
width: ordersList.width
height: contentHeight
model: products
header: Label {
padding: 10
font.bold: true
text: "%1 (%2), %3".arg(userName).arg(storeName).arg(time.toLocaleTimeString(Qt.locale(), Locale.ShortFormat))
}
delegate: Label {
width: ordersList.width
leftPadding: 20
text: "%1 x%2, %3".arg(modelData.product).arg(modelData.quantity.toLocaleString(Qt.locale())).arg(modelData.price.toLocaleCurrencyString(Qt.locale()))
}
footer: Label {
padding: 10
font.bold: true
text: qsTr("Summary: %1").arg(amount.toLocaleCurrencyString(Qt.locale()))
}
}
}
}
}