Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Admin/User.vue
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | <div class="container"> | ||||
<div class="row plaintext"> | <div class="row plaintext"> | ||||
<label for="country" class="col-sm-4 col-form-label">{{ $t('user.country') }}</label> | <label for="country" class="col-sm-4 col-form-label">{{ $t('user.country') }}</label> | ||||
<div class="col-sm-8"> | <div class="col-sm-8"> | ||||
<span class="form-control-plaintext" id="country">{{ user.country }}</span> | <span class="form-control-plaintext" id="country">{{ user.country }}</span> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</form> | </form> | ||||
<div class="mt-2 buttons"> | <div class="mt-2 buttons"> | ||||
<btn v-if="!user.isSuspended" id="button-suspend" class="btn-warning" @click="suspendUser"> | <btn :id="'button-' + (user.isSuspended ? 'unsuspend' : 'suspend')" class="btn-outline-primary" @click="setSuspendState"> | ||||
{{ $t('btn.suspend') }} | {{ $t(user.isSuspended ? 'btn.unsuspend' : 'btn.suspend') }} | ||||
</btn> | </btn> | ||||
<btn v-if="user.isSuspended" id="button-unsuspend" class="btn-warning" @click="unsuspendUser"> | <btn id="button-resync" class="btn-outline-primary" @click="resyncUser"> | ||||
{{ $t('btn.unsuspend') }} | {{ $t('btn.resync') }} | ||||
</btn> | </btn> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<tabs class="mt-3" :tabs="tabs" ref="tabs"></tabs> | <tabs class="mt-3" :tabs="tabs" ref="tabs"></tabs> | ||||
<div class="tab-content"> | <div class="tab-content"> | ||||
<div class="tab-pane show active" id="finances" role="tabpanel" aria-labelledby="tab-finances"> | <div class="tab-pane show active" id="finances" role="tabpanel" aria-labelledby="tab-finances"> | ||||
▲ Show 20 Lines • Show All 469 Lines • ▼ Show 20 Lines | export default { | ||||
axios.post('/api/v4/users/' + this.user.id + '/resetGeoLock') | axios.post('/api/v4/users/' + this.user.id + '/resetGeoLock') | ||||
.then(response => { | .then(response => { | ||||
if (response.data.status == 'success') { | if (response.data.status == 'success') { | ||||
this.$toast.success(response.data.message) | this.$toast.success(response.data.message) | ||||
this.user.config.limit_geo = [] | this.user.config.limit_geo = [] | ||||
} | } | ||||
}) | }) | ||||
}, | }, | ||||
resyncUser() { | |||||
axios.post('/api/v4/users/' + this.user.id + '/resync') | |||||
.then(response => { | |||||
if (response.data.status == 'success') { | |||||
this.$toast.success(response.data.message) | |||||
} | |||||
}) | |||||
}, | |||||
submitDiscount() { | submitDiscount() { | ||||
this.$refs.discountDialog.hide() | this.$refs.discountDialog.hide() | ||||
axios.put('/api/v4/wallets/' + this.user.wallets[0].id, { discount: this.wallet.discount_id }) | axios.put('/api/v4/wallets/' + this.user.wallets[0].id, { discount: this.wallet.discount_id }) | ||||
.then(response => { | .then(response => { | ||||
if (response.data.status == 'success') { | if (response.data.status == 'success') { | ||||
this.$toast.success(response.data.message) | this.$toast.success(response.data.message) | ||||
this.wallet = Object.assign({}, this.wallet, response.data) | this.wallet = Object.assign({}, this.wallet, response.data) | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | export default { | ||||
this.$toast.success(response.data.message) | this.$toast.success(response.data.message) | ||||
this.wallet = Object.assign({}, this.wallet, {balance: response.data.balance}) | this.wallet = Object.assign({}, this.wallet, {balance: response.data.balance}) | ||||
this.oneoff_amount = '' | this.oneoff_amount = '' | ||||
this.oneoff_description = '' | this.oneoff_description = '' | ||||
this.reload() | this.reload() | ||||
} | } | ||||
}) | }) | ||||
}, | }, | ||||
suspendUser() { | setSuspendState() { | ||||
axios.post('/api/v4/users/' + this.user.id + '/suspend') | axios.post('/api/v4/users/' + this.user.id + '/' + (this.user.isSuspended ? 'unsuspend' : 'suspend')) | ||||
.then(response => { | |||||
if (response.data.status == 'success') { | |||||
this.$toast.success(response.data.message) | |||||
this.user = Object.assign({}, this.user, { isSuspended: true }) | |||||
} | |||||
}) | |||||
}, | |||||
unsuspendUser() { | |||||
axios.post('/api/v4/users/' + this.user.id + '/unsuspend') | |||||
.then(response => { | .then(response => { | ||||
if (response.data.status == 'success') { | if (response.data.status == 'success') { | ||||
this.$toast.success(response.data.message) | this.$toast.success(response.data.message) | ||||
this.user = Object.assign({}, this.user, { isSuspended: false }) | this.user = Object.assign({}, this.user, { isSuspended: !this.user.isSuspended }) | ||||
} | } | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |