diff --git a/src/common/components/Navbar.vue b/src/common/components/Navbar.vue index 7764d3de0..4986150ea 100644 --- a/src/common/components/Navbar.vue +++ b/src/common/components/Navbar.vue @@ -240,7 +240,7 @@ export default { metamaskWalletAddress() { if (this.metamaskWalletAddress.currentAccount === this.metamaskWalletAddress.accountList[0]) { this.loginStatus = true - this.getActiveMenu() + this.menus.find(menu => menu.active) return } this.loginStatus = false @@ -348,7 +348,7 @@ export default { this.metamaskBalance = balance this.setMetamaskBalance(balance) this.loginStatus = true - this.getActiveMenu() + this.menus.find(menu => menu.active) } this.activeMetamaskAddress = "" this.loginStatus = false diff --git a/src/views/Dashboard/Customer/Home/Emr/Create.vue b/src/views/Dashboard/Customer/Home/Emr/Create.vue index 317d95c63..0a657970c 100644 --- a/src/views/Dashboard/Customer/Home/Emr/Create.vue +++ b/src/views/Dashboard/Customer/Home/Emr/Create.vue @@ -252,7 +252,8 @@ export default { wallet: (state) => state.substrate.wallet, lastEventData: (state) => state.substrate.lastEventData, mnemonicData: (state) => state.substrate.mnemonicData, - web3: (state) => state.metamask.web3 + web3: (state) => state.metamask.web3, + walletBalance: (state) => state.substrate.walletBalance }), computeFiles() { @@ -352,6 +353,14 @@ export default { }, handleNewFile() { + if (Number(this.walletBalance) < Number(this.txWeight.split(" ")[0])) { + this.error = { + title: "Insufficient Balance", + message: "Your transaction cannot succeed due to insufficient balance, check your account balance" + } + return + } + this._touchForms("document") const { title: docTitle, description: docDescription, file: docFile } = this.isDirty?.document if (docTitle || docDescription || docFile) return @@ -437,6 +446,14 @@ export default { }, async handleSubmit() { + if (Number(this.walletBalance) < Number(this.txWeight.split(" ")[0])) { + this.error = { + title: "Insufficient Balance", + message: "Your transaction cannot succeed due to insufficient balance, check your account balance" + } + return + } + this._touchForms("emr") const isEMRValid = Object.values(this.isDirty?.emr).every(v => v !== null && v === false) const isDocumentValid = Object.values(this.isDirty?.document).every(v => v !== null && v === false) diff --git a/src/views/Dashboard/Customer/Home/Emr/Edit.vue b/src/views/Dashboard/Customer/Home/Emr/Edit.vue index 27d0f39db..0760112fa 100644 --- a/src/views/Dashboard/Customer/Home/Emr/Edit.vue +++ b/src/views/Dashboard/Customer/Home/Emr/Edit.vue @@ -259,7 +259,8 @@ export default { wallet: (state) => state.substrate.wallet, lastEventData: (state) => state.substrate.lastEventData, mnemonicData: (state) => state.substrate.mnemonicData, - web3: (state) => state.metamask.web3 + web3: (state) => state.metamask.web3, + walletBalance: (state) => state.substrate.walletBalance }), computeFiles() { @@ -410,6 +411,14 @@ export default { }, handleNewFile() { + if (Number(this.walletBalance) < Number(this.txWeight.split(" ")[0])) { + this.error = { + title: "Insufficient Balance", + message: "Your transaction cannot succeed due to insufficient balance, check your account balance" + } + return + } + this._touchForms("document") const { title: docTitle, description: docDescription, file: docFile } = this.isDirty?.document if (docTitle || docDescription || docFile) return @@ -496,6 +505,14 @@ export default { }, handleModalPassword() { + if (Number(this.walletBalance) < Number(this.txWeight.split(" ")[0])) { + this.error = { + title: "Insufficient Balance", + message: "Your transaction cannot succeed due to insufficient balance, check your account balance" + } + return + } + this._touchForms("emr") const isEMRValid = Object.values(this.isDirty?.emr).every(v => v !== null && v === false) const isDocumentValid = Object.values(this.isDirty?.document).every(v => v !== null && v === false) diff --git a/src/views/Dashboard/Customer/Layout.vue b/src/views/Dashboard/Customer/Layout.vue index 8056cf60c..135c885d7 100644 --- a/src/views/Dashboard/Customer/Layout.vue +++ b/src/views/Dashboard/Customer/Layout.vue @@ -219,6 +219,7 @@ export default { { text: "Payment History", disabled: false, active: false, route: "customer-payment-history", icon: creditCardIcon } ], + switchNetwork: false, networkName: "", currentNetwork: "", network: { @@ -273,7 +274,7 @@ export default { } }, - async mounted() { + async created() { if (!this.mnemonicData) this.showModalPassword = true await this.getListNotification() await this.checkMetamask()