fix: update tx modal validity

This commit is contained in:
emizzle 2020-09-17 19:08:31 +10:00 committed by Iuri Matias
parent 2a59ab402d
commit 1fc0e26a0f
5 changed files with 20 additions and 24 deletions

View File

@ -29,7 +29,7 @@ ModalPopup {
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
onGroupActivated: { onGroupActivated: {
root.title = group.headerText root.title = group.headerText
btnNext.label = group.footerText btnNext.text = group.footerText
} }
TransactionFormGroup { TransactionFormGroup {
id: group1 id: group1
@ -166,16 +166,15 @@ ModalPopup {
stack.back() stack.back()
} }
} }
StyledButton { StatusButton {
id: btnNext id: btnNext
anchors.right: parent.right anchors.right: parent.right
//% "Next" //% "Next"
label: qsTrId("next") text: qsTrId("next")
disabled: !stack.currentGroup.isValid enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
onClicked: { onClicked: {
const isValid = stack.currentGroup.validate() const validity = stack.currentGroup.validate()
if (validity.isValid && !validity.isPending) {
if (stack.currentGroup.validate()) {
if (stack.isLastGroup) { if (stack.isLastGroup) {
return root.sendChatCommand(selectFromAccount.selectedAccount.address, return root.sendChatCommand(selectFromAccount.selectedAccount.address,
txtAmount.selectedAmount, txtAmount.selectedAmount,

View File

@ -60,7 +60,7 @@ ModalPopup {
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
onGroupActivated: { onGroupActivated: {
root.title = group.headerText root.title = group.headerText
btnNext.label = group.footerText btnNext.text = group.footerText
} }
TransactionFormGroup { TransactionFormGroup {
id: group1 id: group1
@ -196,16 +196,15 @@ ModalPopup {
stack.back() stack.back()
} }
} }
StyledButton { StatusButton {
id: btnNext id: btnNext
anchors.right: parent.right anchors.right: parent.right
//% "Next" //% "Next"
label: qsTrId("next") text: qsTrId("next")
disabled: !stack.currentGroup.isValid enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
onClicked: { onClicked: {
const isValid = stack.currentGroup.validate() const validity = stack.currentGroup.validate()
if (validity.isValid && !validity.isPending) {
if (stack.currentGroup.validate()) {
if (stack.isLastGroup) { if (stack.isLastGroup) {
return root.sendTransaction() return root.sendTransaction()
} }

View File

@ -214,11 +214,9 @@ ModalPopup {
//% "Next" //% "Next"
text: qsTrId("next") text: qsTrId("next")
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
state: stack.currentGroup.isPending ? "pending" : "default"
onClicked: { onClicked: {
const isValid = stack.currentGroup.validate() const validity = stack.currentGroup.validate()
if (validity.isValid && !validity.isPending) {
if (stack.currentGroup.validate()) {
if (stack.isLastGroup) { if (stack.isLastGroup) {
return root.sendTransaction() return root.sendTransaction()
} }

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import "../../../../../imports" import "../../../../../imports"
import "../../../../../shared" import "../../../../../shared"
import "../../../../../shared/status"
ModalPopup { ModalPopup {
id: root id: root
@ -55,7 +56,7 @@ ModalPopup {
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
onGroupActivated: { onGroupActivated: {
root.title = group.headerText root.title = group.headerText
btnNext.label = group.footerText btnNext.text = group.footerText
} }
TransactionFormGroup { TransactionFormGroup {
id: group1 id: group1
@ -188,12 +189,11 @@ ModalPopup {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
StyledButton { StatusButton {
id: btnNext id: btnNext
anchors.right: parent.right anchors.right: parent.right
//% "Next" text: qsTr("Next")
label: qsTrId("next") enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
disabled: !stack.currentGroup.isValid
onClicked: { onClicked: {
const validity = stack.currentGroup.validate() const validity = stack.currentGroup.validate()
if (validity.isValid && !validity.isPending) { if (validity.isValid && !validity.isPending) {

View File

@ -249,7 +249,7 @@ ModalPopup {
anchors.right: parent.right anchors.right: parent.right
//% "Next" //% "Next"
text: qsTrId("next") text: qsTrId("next")
enabled: !(!stack.currentGroup.isValid || stack.currentGroup.isPending) enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
state: stack.currentGroup.isPending ? "pending" : "default" state: stack.currentGroup.isPending ? "pending" : "default"
onClicked: { onClicked: {
const validity = stack.currentGroup.validate() const validity = stack.currentGroup.validate()