/*!
 *
 * 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    PreTreatmentUltrsafiltration.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      12-Jan-2021
 * \author  (original)  Peter Lucia
 * \date    (original)  03-Aug-2020
 *
 */

// Qt
import QtQuick 2.12

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

/*!
 * \brief   Pre-Treatment ultrafiltration screen
 * \details which contains a slider to let user set the ultratiltration volume.
 */
PreTreatmentBase { id: _root
    objectName: "_PreTreatmentUltrafiltration"

    property alias  ufVolume    : _volumeSlider.value

    signal startClicked()

    QtObject { id: _private
        property real minimum   : 0.000
        property real maximum   : 8.000
    }

    header.stepName        : Variables.preTreatmentStepLabelUltrafiltration

    Text { id: _textTitle
        visible : true
        color   : "white"
        text    : qsTr("Begin Treatment")
        font.pixelSize  : Fonts.fontPixelTitle
        anchors {
            horizontalCenter: parent.horizontalCenter
            top             : parent.top
            topMargin       : 150
        }
    }

    Text { id: _textLabel
        visible : true
        color   : "white"
        text    : qsTr("Ultrafiltration Volume") + " " + Variables.unitTextUltrafiltrationVolume
        font {
            pixelSize  : Fonts.fontPixelCreateTreatment
        }
        anchors {
            left            : _volumeSlider.left
            bottom          : _volumeSlider.top
            bottomMargin    : 45
        }
    }

    Text { id: _textValue
        objectName: "_treatmentBeginUltrafiltrationValue"
        visible : true
        color   : "white"
        text    : _root.ufVolume.toFixed(Variables.ultrafiltrationPrecision)
        font {
            pixelSize  : Fonts.fontPixelCreateTreatment
        }
        anchors {
            right           : _volumeSlider.right
            bottom          : _volumeSlider.top
            bottomMargin    : 45
        }
    }

    Slider { id: _volumeSlider
        objectName: "_volumeSlider"
        anchors {
            horizontalCenter: parent.horizontalCenter
            top: parent.top
            topMargin: 425
        }
        isActive: false
        width   : parent.width / 2
        height  : 5
        step    : 0.100
        stepSnap: true
        ticks   : false
        diameter: Variables.sliderCircleDiameter
        decimal : Variables.ultrafiltrationPrecision
        minimum : _private.minimum
        maximum : _private.maximum
        minText.font.pixelSize: Fonts.fontPixelFluidText
        maxText.font.pixelSize: Fonts.fontPixelFluidText
        onPressed: isActive = true
    }

    TouchRect { id: _startButton
        objectName: "_startButton"
        width   : 515
        height  :  70
        anchors {
            top: parent.top
            topMargin: 650
            horizontalCenter: parent.horizontalCenter
        }
        disabled: ! _volumeSlider.isActive
        backgroundColor: Colors.backgroundButtonSelect
        text {
            text: qsTr("START")
            font.weight   : Font .DemiBold
            font.pixelSize: Fonts.fontPixelUltrafiltrationAdjustmentButton
        }
        onClicked: {
            _root.startClicked()
        }
    }
}
