Index: sources/gui/qml/pages/treatment/sections/TreatmentHeparin.qml =================================================================== diff -u -r43ae56f762e6f3e1416d39e3d16f9103fc597e41 -r93b7d7da5dea9e0392e139b59117eb0315d6c343 --- sources/gui/qml/pages/treatment/sections/TreatmentHeparin.qml (.../TreatmentHeparin.qml) (revision 43ae56f762e6f3e1416d39e3d16f9103fc597e41) +++ sources/gui/qml/pages/treatment/sections/TreatmentHeparin.qml (.../TreatmentHeparin.qml) (revision 93b7d7da5dea9e0392e139b59117eb0315d6c343) @@ -17,16 +17,17 @@ import QtQuick 2.12 // Project -import VTreatmentHeparin 0.1; // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" +import "qrc:/pages/treatment" /*! * \brief Treatment Screen Heparin Management section */ -TreatmentFluid { id: _root +ScreenItem { id: _root readonly property bool isOff : vTDTreatmentStates.hpOff readonly property bool isStopped : vTDTreatmentStates.hpStopped readonly property bool isPaused : vTDTreatmentStates.hpPaused @@ -35,79 +36,304 @@ readonly property bool isCompleted : vTDTreatmentStates.hpCompleted readonly property bool isEmpty : vTDTreatmentStates.hpEmpty readonly property bool isRejected : vTreatmentAdjustmentHeparin.adjustment_Accepted - readonly property bool displayReason : _private.displayReason - +// readonly property bool displayReason : _private.displayReason readonly property bool isTxRunning : vTDTreatmentStates.txDialysis - QtObject { id: _private - readonly property string textHeparin : qsTr("HEPARIN DELIVERY") - readonly property string textOff : qsTr("OFF") - readonly property string textPause : qsTr("PAUSE HEPARIN") - readonly property string textResume : qsTr("RESUME DELIVERY") - readonly property string textComplete : qsTr("OFF") - readonly property string textVolumeTarget : "(" + valueTarget + unit + ")" - readonly property string mesgCompleted : qsTr("Maximum Cumulative Heparin Volume Delivered") - readonly property string mesgBolus : qsTr("Bolus Active") - readonly property string mesgEmpty : qsTr("Syringe Empty") - readonly property string mesgOff : qsTr("") // it is redundant since the button text is now display OFF - readonly property string mesgStopped : qsTr("Delivery Stopped") - readonly property string mesgPaused : qsTr("Delivery Paused") - readonly property string mesgDispensing : qsTr("Dispensing Active") + readonly property color heparinColor : _root.deliveryOff ? Colors.transparent : + isDispensing ? Colors.heparinActive : + isPaused ? Colors.heparinPaused : + isCompleted ? Colors.heparinComplete : Colors.transparent + readonly property bool deliveryOff : vTreatmentCreate.heparinDispensingRate === 0 + readonly property string buttonText : isDispensing ? qsTr("Pause") : + isPaused ? qsTr("Resume") : qsTr("Pause") - property bool displayReason : false - readonly property string mesgRejectReason : vTreatmentAdjustmentHeparin.adjustment_ReasonText + readonly property string statusText : isDispensing ? qsTr("Active") : + isPaused ? qsTr("Pause") : + isCompleted ? qsTr("Complete") : qsTr("Active") + + readonly property var titles : [ "Heparin Type", "Dispensing Rate", "Bolus Volume", "Stop Time" ] + readonly property var units : [ Variables.unitHeparinType, Variables.unitTextDispensingRate, Variables.unitTextDispensingRate, Variables.unitTextDuration ] + readonly property var values : [ "Unfractionated 1000", vTreatmentCreate.heparinDispensingRate, vTreatmentCreate.heparinBolusVolume, vTreatmentCreate.heparinStopTime ] + + readonly property real cumulative : 0.23 // vTreatmentHeparin.cumulative + readonly property real target : 1.0 // vTreatmentHeparin.target + readonly property string timeRemaining : "01:39" // vTreatmentHeparin.timeRemaining + + + onHeparinColorChanged : _headerBar.statusColor = heparinColor + + enum HeparinPrescription{ + HeparinType, + DispensingRate, + BolusVolume, + StopTime } - title : qsTr("HEPARIN") - cumulativeVisible : false - targetVisible : false - progressBarVisible : false + component HeparinContainer: TreatmentSection { id: _heparinContainer + color : Colors.panelBackgroundColor + header.color : Colors.heparinSectionHeader + enableDropShadow: false + header { + showEdit : false + titleLeftMargin: Variables.defaultMargin * 3 + } + contentArea.anchors { + topMargin : 0 + leftMargin : Variables.defaultMargin * 2 + rightMargin : Variables.defaultMargin * 2 + } + border { + width: 1 + color: Colors.heparinPanelBorderColor + } + header.border { + width: 1 + color: Colors.heparinPanelBorderColor + } + } - hasArrow : false - isTouchable : false - buttonEnabled : ! (isOff || isStopped || isBolus || isEmpty - || isCompleted // decided to not to enable user to resume the heparin while completed (1/Apr/2021 - I,Sean,Nick) - ) && ! isSBInProgress && isTxRunning - buttonText : ! isTxRunning ? _private.textHeparin : - isDispensing ? _private.textPause : - isPaused ? _private.textResume : - isCompleted ? _private.textComplete : // decided to not to enable user to resume the heparin while completed (1/Apr/2021 - I,Sean,Nick) - isOff ? _private.textOff : - _private.textHeparin - unit : Variables.unitTextSaline + Row { id: _row + objectName : "_row" + spacing : Variables.defaultMargin * 5 - valueDecimal : Variables.heparinPrecision - valueDelivered : vTreatmentHeparin.cumulative // this is the cumulative volume of the Heparin bolus and despensing. + anchors { + fill : parent + topMargin : Variables.defaultMargin * 5 + leftMargin : Variables.defaultMargin * 5 + rightMargin : Variables.defaultMargin * 5 + } - VTreatmentHeparin { id: vTreatmentHeparin } + readonly property int cellWidth : width / 2 - ( spacing / 2 ) // 2 items for the row and subtract spacing for widths + readonly property int cellHeight : height / 2 + readonly property int prescriptionCount : _root.titles.length - onClicked: { - // if ( isCompleted ) vTreatmentAdjustmentHeparin.doResume() // decided to not to enable user to resume the heparin while completed (1/Apr/2021 - I,Sean,Nick) - if ( isPaused ) vTreatmentAdjustmentHeparin.doResume() - if ( isDispensing ) vTreatmentAdjustmentHeparin.doPause () + HeparinContainer { id: _heparinPrescription + objectName : "_heparinPrescription" + header.title : qsTr("Heparin Prescription" ) + width : _row.cellWidth + height : _row.cellHeight + + contentItem : Column { id :_heparinPrescriptionContent + Repeater { + model: _row.prescriptionCount + delegate: LabelUnitContainer { + width : parent.width + height : parent.height / _row.prescriptionCount + border.width : 0 + color : Colors.transparent + text : _root.titles[index] + unitText : _root.units[index] + titleFontSize : Fonts.fontPixelContainerTitleSmall + unitFontSize : Fonts.fontPixelContainerUnitSmall + + contentItem : Text{ id: _value + anchors.centerIn: parent + color : Colors.offWhite + font.pixelSize : Fonts.fontPixelHeparin + text : _root.deliveryOff ? "OFF" : index === TreatmentHeparin.DispensingRate || + index === TreatmentHeparin.BolusVolume ? _root.values[index].toFixed(Variables.heparinPrecision) : + _root.values[index] + } + // Bottom border, except for last item + Rectangle { id: _separator + anchors { + left : parent.left + leftMargin : Variables.defaultMargin + right : parent.right + rightMargin : Variables.defaultMargin + bottom : parent.bottom + } + height : 1 + color : Colors.panelBorderColor + visible : index < titles.length - 1 // hide for last item + } + } + } + } + } + + HeparinContainer { id: _heparinDelivery + objectName : "_heparinDelivery" + header.title : qsTr("Heparin Delivery" ) + width : _row.cellWidth + height : _row.cellHeight + + contentItem : Item { id: _content + anchors.fill : parent + + TouchRect { id: _heparinButton + anchors { + left : parent.left + leftMargin : Variables.defaultMargin + bottom : parent.bottom + bottomMargin : Variables.defaultMargin * 1.5 + } + + width : Variables.defaultButtonWidth + height : Variables.defaultButtonHeight + radius : 9 + text.textFormat : Text.RichText + text.text : _root.buttonText + isDefault : true + visible : ! _root.deliveryOff && ( _root.isDispensing || _root.isPaused ) + text.font.weight: Font.DemiBold + + onPressed : { + if ( _root.isPaused ) vTreatmentAdjustmentHeparin.doResume() + if ( _root.isDispensing ) vTreatmentAdjustmentHeparin.doPause () + } + } + + Rectangle { id: _status + anchors { + top : parent.top + topMargin : Variables.defaultMargin * 1.5 + right : parent.right + } + visible : ! _root.deliveryOff && ( _root.isDispensing || _root.isPaused || _root.isCompleted ) + width : 100 + height : 30 + radius : height + color : _root.heparinColor + Text { id: _statusText + anchors.centerIn: parent + text : _root.statusText + color : Colors.white + font.pixelSize : Fonts.fontPixelContainerUnitSmall + font.weight : Font.DemiBold + } + } + + Item { + anchors { + top : parent.top + topMargin : Variables.defaultMargin * 1.5 + left : parent.left + leftMargin : Variables.defaultMargin + } + + Text { id: _timeRemainingTitle + anchors { + top : parent.top + left : parent.left + } + text : qsTr("Time Remaining") + color : Colors.white + font.pixelSize : Fonts.fontPixelHeparin + font.weight : Font.Medium + } + + Text { id: _timeRemaining + anchors { + top : _timeRemainingTitle.bottom + topMargin : _root.deliveryOff ? Variables.defaultMargin : Variables.defaultMargin / 2 + left : parent.left + } + text : _root.deliveryOff ? ("%1 : %2").arg(Variables.emptyEntry).arg(Variables.emptyEntry) : _root.timeRemaining + color : _root.deliveryOff ? Colors.white : _root.isPaused ? Colors.heparinPaused : Colors.white + font.pixelSize : _root.deliveryOff ? Fonts.fontPixelHeparin : Fonts.fontPixelHeparinTime + font.weight : Font.DemiBold + } + + Text { id: _hrsMinsText + anchors { + top : _timeRemaining.bottom + left : parent.left + leftMargin : 5 + } + width : _timeRemaining.contentWidth / 2 + text : Variables.unitTextHrs + color : Colors.white + font.pixelSize : Fonts.fontPixelContainerUnit + font.weight : Font.Thin + } + + Text { id: _hrsMinsText1 + anchors { + top : _timeRemaining.bottom + left : _hrsMinsText.right + leftMargin : 5 + } + width : _timeRemaining.contentWidth / 2 + text : Variables.unitTextMins + color : Colors.white + font.pixelSize : Fonts.fontPixelContainerUnit + font.weight : Font.Thin + } + } + + Column { id: _deliveryColumn + anchors { + right: parent.right + top : parent.top + } + topPadding : Variables.defaultMargin * 9.5 + width : parent.width * 0.7 + height : _content.height * 0.7 + + ProgressBar { id: _progressbar + width : parent.width + height : 20 + decimal : Variables.heparinDeliveryPrecision + minimum : 0 + maximum : _root.deliveryOff ? 0 : _root.target + value : _root.deliveryOff ? 0 : _root.cumulative + unitText : Variables.unitTextFluid + color : _root.isPaused ? Colors.heparinPaused : Colors.progressBarUltrafiltration + radius : height + showMarker : false + progress.opacity: _root.isPaused ? 0.5 : 1 + + minText.color: "#818181" + minText.font { + pixelSize : 18 + weight : Font.Normal + } + + maxText.color: "#818181" + maxText.font { + pixelSize : 18 + weight : Font.Normal + } + + Text { id: _valueText + anchors { + bottom : parent.top + bottomMargin: Variables.defaultMargin + right : parent.right + } + text : ("%1 %2").arg(_root.deliveryOff ? Variables.emptyEntry : + _root.cumulative.toFixed(Variables.heparinDeliveryPrecision)).arg(qsTr(Variables.unitTextFluid)) + color : _root.deliveryOff ? Colors.white : _root.isPaused ? Colors.heparinPaused : Colors.white + font.pixelSize : Fonts.fontPixelHeparin + font.weight : Font.DemiBold + } + + Text { id: _heparinDeliveredText + anchors { + top : parent.bottom + topMargin : Variables.defaultMargin * 2.5 + right : parent.right + } + text : qsTr("Heparin Delivered") + color : Colors.textTextRectLabel + font.pixelSize : 20 + font.weight : Font.Medium + } + } + } + } + } } Connections { target: vTreatmentAdjustmentHeparin function onAdjustmentTriggered ( vValue ) { - _private.displayReason = ! vTreatmentAdjustmentHeparin.adjustment_Accepted +// _private.displayReason = ! vTreatmentAdjustmentHeparin.adjustment_Accepted } } Connections { target: vTDTreatmentStates function onHeparinChanged ( vValue ) { - _private.displayReason = false +// _private.displayReason = false } - } - - notification { - visible : true - text : displayReason ? _private.mesgRejectReason : - isBolus ? _private.mesgBolus : - isOff ? _private.mesgOff : - isStopped ? _private.mesgStopped : - isPaused ? _private.mesgPaused : - isCompleted ? _private.mesgCompleted : - isEmpty ? _private.mesgEmpty : - isDispensing ? _private.mesgDispensing : "" - } }