@@ -105,6 +105,18 @@ export default {
type: Object,
default: null
},
+ adminWallet: {
+ type: Object,
+ default: null
+ },
+ contractDetails: {
+ type: Object,
+ default: null
+ },
+ configuredBudget: {
+ type: Number,
+ default: 0
+ },
loading: {
type: Boolean,
default: false,
@@ -112,11 +124,7 @@ export default {
},
data () {
return {
- loadingWallet: false,
- adminWallet: null,
- contractDetails: null,
walletAdminUri: '/portal/administration/home/rewards/wallet',
- configuredBudget: null
};
},
computed: {
@@ -148,39 +156,5 @@ export default {
return this.lowEtherBalance ? this.$t('wallet.administration.lowEtherBalance') : this.$t('wallet.administration.lowTokenBalance');
}
},
- watch: {
- rewardSettings() {
- this.computeDistributionForecast();
- }
- },
- created() {
- this.init();
- },
- methods: {
- init() {
- this.loadingWallet = true;
- this.error = null;
- return this.walletUtils.initSettings(false, true)
- .then(() => {
- this.contractDetails = window.walletSettings.contractDetail;
- return this.addressRegistry.searchWalletByTypeAndId('admin', 'admin');
- })
- .then((adminWallet) => this.adminWallet = adminWallet)
- .then(() => {
- this.$nextTick().then(() => {
- this.computeDistributionForecast();
- });
- })
- .finally(() => {
- this.loadingWallet = false;
- });
- },
- computeDistributionForecast() {
- return this.$rewardService.computeDistributionForecast(this.rewardSettings)
- .then(distributionForecast => {
- this.configuredBudget = distributionForecast?.budget || 0;
- });
- },
- }
};
\ No newline at end of file
diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetails.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetails.vue
index 52f5e600d..c42aae1e1 100644
--- a/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetails.vue
+++ b/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetails.vue
@@ -54,19 +54,19 @@
{{ rewardsToSend }}
+ :disabled="!disabledSendButton">
{{ $t('wallet.administration.rewardDetails.label.reward') }}
- {{ $t('wallet.administration.rewardCard.status.inPeriod') }}
+ {{ disabledSendButtonLabel }}
this.tokenBalance;
+ },
+ balanceBelowBudget() {
+ return this.lowEtherBalance || this.lowTokenBalance;
+ },
+ balanceBelowBudgetLabel() {
+ return this.lowEtherBalance ? this.$t('wallet.administration.lowEtherBalance') : this.$t('wallet.administration.lowTokenBalance');
+ },
+ disabledSendButton() {
+ return this.isNotPastPeriod || this.balanceBelowBudget;
+ },
+ disabledSendButtonLabel() {
+ return this.isNotPastPeriod ? this.$t('wallet.administration.rewardCard.status.inPeriod') : this.balanceBelowBudgetLabel;
}
},
methods: {
diff --git a/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetailsItem.vue b/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetailsItem.vue
index 683ab9150..abd3adbdf 100644
--- a/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetailsItem.vue
+++ b/wallet-webapps/src/main/webapp/vue-app/wallet-reward/components/reward/RewardDetailsItem.vue
@@ -269,8 +269,10 @@ export default {
return this.success ? 'success' : 'error';
},
statusIconTitle() {
- return this.success ? this.$t('wallet.administration.rewardDetails.successfullyProceeded') :
- this.pending ? this.$t('wallet.administration.rewardDetails.transactionInProgress') : this.$t('wallet.administration.rewardDetails.transactionError');
+ if (this.success) {
+ return this.$t('wallet.administration.rewardDetails.successfullyProceeded');
+ }
+ return this.pending ? this.$t('wallet.administration.rewardDetails.transactionInProgress') : this.$t('wallet.administration.rewardDetails.transactionError');
},
amount() {
return this.completelyProceeded ? this.reward?.tokensSent : this.reward?.amount;