/*!
 *
 * Copyright (c) 2021-2024 Diality Inc. - All Rights Reserved.
 * \copyright
 * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN
 * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER.
 *
 * \file    PostTreatmentReview.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      31-Jul-2024
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  21-Apr-2021
 *
 */

// Qt
import QtQuick 2.12

// Project
//  Qml imports
import "qrc:/globals"
import "qrc:/components"
import "qrc:/compounds"
import "qrc:/pages/posttreatment"

/*!
 * \brief   the post treatment Treatment Log review screen
 */
PostTreatmentBase { id: _root
    Rectangle { id: _rect
        anchors {
            top             : header.bottom
            topMargin       : Variables.defaultMargin * 2
            bottom          : _root.bottom
            bottomMargin    : Variables.notificationHeight + Variables.minVGap
            left            : parent.left
            leftMargin      : Variables.defaultMargin * 4
            right           : parent.right
            rightMargin     : Variables.defaultMargin * 4

        }

        color       : Colors.panelBackgroundColor
        radius      : 9

        border {
            width   : Variables.panelBorderWidth
            color   : Colors.panelBorderColor
        }

        Grid { id: _grid
            property int cellHeight : parent.height / 10
            property int cellWidth  : parent.width / 3 - ( Variables.defaultMargin ) // subtract columnSpacing

            clip: true
            anchors.fill: parent
            anchors.leftMargin: Variables.defaultMargin
            anchors.rightMargin: Variables.defaultMargin

            flow            : Grid.TopToBottom
            columns         : 3
            rows            : _repeater.model.count / columns
            rowSpacing      : 0
            columnSpacing   : Variables.defaultMargin

            Repeater { id: _repeater
                model       : vPostTreatmentAdjustmentTreatmentLog.parametersTitle

                LabelUnitText { id: _container
                    height      : _grid.cellHeight
                    width       : _grid.cellWidth
                    label       : modelData
                    unit        : vPostTreatmentAdjustmentTreatmentLog.parametersUnit[index] ?? ""
                    value       : "123" // vPostTreatmentAdjustmentTreatmentLog.parametersText[index] ?? ""
                    textAlignment: Text.AlignJustify
                    radius      : 0
                    color       : Colors.transparent
                    border.width: 0

                    Line {
                        anchors.bottom: parent.bottom
                        anchors.left : parent.left
                        anchors.right : parent.right
                        visible: index !== 9 && index !== 19 && index !== 29
                        color: Colors.panelBorderColor
                    }
                }
            }
        }
    }

    reasonText      : vPostTreatmentAdjustmentTreatmentLog.text()
    informationText : vPostTreatmentAdjustmentTreatmentLog.notification
}

