/*!
 *
 * Copyright (c) 2021-2026 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    TimeEntry.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      20-May-2021
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  20-May-2021
 *
 */

// Qt
import QtQuick 2.12

// Project
import Gui.Actions 0.1;

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

/*!
 * \brief   The Time entry that contains Hour:Minunte
 */
Row { id: _root
    property int    entryWidth  : 100

    property alias  firstInput  : _hour
    property alias  nextInput   : _minute.nextInput
    property alias  labelWidth  : _label.width
    property string label       : qsTr("Time")
    property string format      : "(HH:MM)"
    property alias  hour        : _hour.text
    property alias  minute      : _minute.text

    readonly property bool  isValid     :
        _hour  .isValid &&
        _minute.isValid


    Label { id           : _label
        text            : _root.label + " " + _root.format
    }

    TextEntry { id      : _hour
        text            : _root.hour
        nextInput       : _minute
        label.visible   : false
        width           : entryWidth
        height          : parent.height
        validator       : IntValidator {
            bottom      : 0
            top         : 23
        }
    }

    Text { id           : _colon
        height          : parent.height
        text            : " " + qsTr(":") + " "
        color           : Colors.textMain
        font.pixelSize  : Fonts.fontPixelTextRectExtra
    }

    TextEntry { id      : _minute
        text            : _root.minute
        label.visible   : false
        width           : entryWidth
        height          : parent.height
        validator       : IntValidator {
            bottom      : 0
            top         : 59
        }
    }
}

