// Qt
import QtQuick 2.15


//  Qml imports
import "qrc:/globals"
import "qrc:/components"
import "qrc:/compounds"

/*!
 * \brief   Dry Demo menu
 */
ModalDialog { id: _root
    width   : Variables.adjustmentDialogWidth
    height  : Variables.adjustmentDialogHeight

    enum Menu {
        STANDBY         ,
        PRE_TREATMENT   ,
        BLOOD_PRIME     ,
        MAIN_TREATMENT  ,
        RINSEBACK       ,
        RECIRCULATE     ,
        POST_TREATMENT  ,
        DISINFECTION    ,
        COUNT
    }

    TitleText { id : _titleText
        text: qsTr("Demo Mode")
        font {
            pixelSize   : Fonts.fontPixelTitle
            weight      : Font.Medium
        }
        color   : Colors.textMain
        width   : contentWidth
        height  : contentHeight
        anchors {
            top                 : parent.top
            horizontalCenter    : parent.horizontalCenter
            margins             : Variables.defaultMargin * 2
        }
    }

    TouchGrid { id: _grid
        anchors.centerIn    : parent
        rowCount            : itemsText.count / 2 ?? 0
        colCount            : 2
        colSpacing          : Variables.defaultMargin
        itemWidth           : _root.width / 2.5
        itemHeight          : Variables.createRxLabelUnitContainerHeight
        lineThickness       : 0
        arrowWidth          : Variables.iconButtonSize
        arrowHeight         : Variables.iconButtonSize
        arrowRightMargin    : Variables.defaultMargin
        delegateColor       :  Colors.panelBackgroundColor
        delegateBorderWidth : 1
        delegateBorderColor : Colors.panelBorderColor
        itemsHasIndent      : Array(itemsText.length).fill(true) // sets all to true

        onItemClicked       : {
            vConfirm.doDryDemo(vIndex)
            _root.close()
        }

        Component.onCompleted: {
            var model = new Array(DryDemoDialog.COUNT).fill("")
            model[DryDemoDialog.STANDBY]            = qsTr("Standby")
            model[DryDemoDialog.PRE_TREATMENT]      = qsTr("Pre-Treatment")
            model[DryDemoDialog.BLOOD_PRIME]        = qsTr("Blood Prime")
            model[DryDemoDialog.MAIN_TREATMENT]     = qsTr("Main Treatment")
            model[DryDemoDialog.RINSEBACK]          = qsTr("Rinseback")
            model[DryDemoDialog.RECIRCULATE]        = qsTr("Recirculate")
            model[DryDemoDialog.POST_TREATMENT]     = qsTr("Post-Treatment")
            model[DryDemoDialog.DISINFECTION]       = qsTr("Disinfection")
            itemsText = model
        }
    }

    CloseButton { id : _closeButton
        onClicked : {
            _root.close()
        }
    }
}
