/*!
 *
 * Copyright (c) 2019-2020 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 TreatmentBegin.qml
 * \author (last) Peter Lucia
 * \date (last) 05-Oct-2020
 * \author (original) Peter Lucia
 * \date (original) 03-Aug-2020
 *
 */

// Qt
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12

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

/*!
 * \brief   ManagerHome is the screen
 * which is the default screen in the "Manager" stack
 */
ScreenItem { id: _root
    signal backClicked()
    signal startClicked()
    backgroundRect.color: Colors.backgroundMainMenu

    TopMenuBarCreateTreatment { id: _topMenuBar
        anchors.top: parent.top
        anchors.left: parent.left
        width: parent.width
        onBackClicked: {
            _root.backClicked();

        }
        state: "begin"
    }


    Flickable { id: _flickable
        anchors.top: _topMenuBar.bottom
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        width: parent.width
        contentWidth: parent.width
        contentHeight: _column.implicitHeight
        clip: true

        ScrollBar.vertical: ScrollBar { id: _scrollBar
            anchors.right: _flickable.right
            anchors.rightMargin: 3
            contentItem: Rectangle {
                color: Colors.backgroundRangeRect
                implicitWidth: 6
                radius: width / 2
                width: 3
            }
        }

        Column { id: _column
            spacing: Variables.treatmentSpacing
            anchors.horizontalCenter: parent.horizontalCenter;
            anchors.fill: parent;

            Text { id: _titleText
                anchors.horizontalCenter: parent.horizontalCenter;
                text: qsTr("Begin Treatment")
                color: Colors.textMain
                font.pixelSize: Fonts.fontPixelTitle
            }

            TouchRect { id : _continueRect
                anchors.horizontalCenter: parent.horizontalCenter
                text.text: qsTr("START")
                button.onClicked: {
                    _root.startClicked()
                }
            }
        }
    }

    onVisibleChanged: {
        if (visible) {
            _mainMenu.hidden = true
        }
    }
}
