OrdersView.qml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. import ru.ded.beerlog 1.0
  5. Page {
  6. title: qsTr("Orders")
  7. OrdersViewModel {
  8. id: ordersModel
  9. }
  10. ListView {
  11. id: ordersList
  12. anchors.fill: parent
  13. anchors.margins: 10
  14. model: ordersModel
  15. section.criteria: ViewSection.FullString
  16. section.property: "date"
  17. section.delegate: Label {
  18. text: section
  19. font.bold: true
  20. }
  21. delegate: Column {
  22. width: ordersList.width
  23. height: productsList.heigt
  24. ListView {
  25. id: productsList
  26. width: ordersList.width
  27. height: contentHeight
  28. model: products
  29. header: Label {
  30. padding: 10
  31. font.bold: true
  32. text: "%1 (%2), %3".arg(userName).arg(storeName).arg(time.toLocaleTimeString(Qt.locale(), Locale.ShortFormat))
  33. }
  34. delegate: Label {
  35. width: ordersList.width
  36. leftPadding: 20
  37. text: "%1 x%2, %3".arg(modelData.product).arg(modelData.quantity.toLocaleString(Qt.locale())).arg(modelData.price.toLocaleCurrencyString(Qt.locale()))
  38. }
  39. footer: Label {
  40. padding: 10
  41. font.bold: true
  42. text: qsTr("Summary: %1").arg(amount.toLocaleCurrencyString(Qt.locale()))
  43. }
  44. }
  45. }
  46. }
  47. }