Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Admin/User.vue
Show First 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | <div class="container"> | ||||
<small v-if="discount > 0" class="hint"> | <small v-if="discount > 0" class="hint"> | ||||
<hr class="m-0"> | <hr class="m-0"> | ||||
¹ {{ $t('user.discount-hint') }}: {{ discount }}% - {{ discount_description }} | ¹ {{ $t('user.discount-hint') }}: {{ discount }}% - {{ discount_description }} | ||||
</small> | </small> | ||||
<div class="mt-2"> | <div class="mt-2"> | ||||
<button type="button" class="btn btn-danger" id="reset2fa" v-if="has2FA" @click="reset2FADialog"> | <button type="button" class="btn btn-danger" id="reset2fa" v-if="has2FA" @click="reset2FADialog"> | ||||
{{ $t('user.reset-2fa') }} | {{ $t('user.reset-2fa') }} | ||||
</button> | </button> | ||||
<button type="button" class="btn btn-secondary" id="addbetasku" v-if="!hasBeta" @click="addBetaSku"> | |||||
{{ $t('user.add-beta') }} | |||||
</button> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="tab-pane" id="user-domains" role="tabpanel" aria-labelledby="tab-domains"> | <div class="tab-pane" id="user-domains" role="tabpanel" aria-labelledby="tab-domains"> | ||||
<div class="card-body"> | <div class="card-body"> | ||||
<div class="card-text"> | <div class="card-text"> | ||||
<table class="table table-sm table-hover mb-0"> | <table class="table table-sm table-hover mb-0"> | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | export default { | ||||
oneoff_amount: '', | oneoff_amount: '', | ||||
oneoff_description: '', | oneoff_description: '', | ||||
oneoff_negative: false, | oneoff_negative: false, | ||||
discount: 0, | discount: 0, | ||||
discount_description: '', | discount_description: '', | ||||
discounts: [], | discounts: [], | ||||
external_email: '', | external_email: '', | ||||
has2FA: false, | has2FA: false, | ||||
hasBeta: false, | |||||
wallet: {}, | wallet: {}, | ||||
walletReload: false, | walletReload: false, | ||||
distlists: [], | distlists: [], | ||||
domains: [], | domains: [], | ||||
skus: [], | skus: [], | ||||
sku2FA: null, | sku2FA: null, | ||||
users: [], | users: [], | ||||
user: { | user: { | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | export default { | ||||
item.name += ' ' + userSku.count + ' ' + sku.range.unit | item.name += ' ' + userSku.count + ' ' + sku.range.unit | ||||
} | } | ||||
this.skus.push(item) | this.skus.push(item) | ||||
if (sku.handler == 'auth2f') { | if (sku.handler == 'auth2f') { | ||||
this.has2FA = true | this.has2FA = true | ||||
this.sku2FA = sku.id | this.sku2FA = sku.id | ||||
} else if (sku.handler == 'beta') { | |||||
this.hasBeta = true | |||||
} | } | ||||
} | } | ||||
}) | }) | ||||
}) | }) | ||||
// Fetch users | // Fetch users | ||||
// TODO: Multiple wallets | // TODO: Multiple wallets | ||||
axios.get('/api/v4/users?owner=' + user_id) | axios.get('/api/v4/users?owner=' + user_id) | ||||
Show All 14 Lines | export default { | ||||
}) | }) | ||||
}) | }) | ||||
.catch(this.$root.errorHandler) | .catch(this.$root.errorHandler) | ||||
}, | }, | ||||
mounted() { | mounted() { | ||||
$(this.$el).find('ul.nav-tabs a').on('click', this.$root.tab) | $(this.$el).find('ul.nav-tabs a').on('click', this.$root.tab) | ||||
}, | }, | ||||
methods: { | methods: { | ||||
addBetaSku() { | |||||
axios.post('/api/v4/users/' + this.user.id + '/skus/beta') | |||||
.then(response => { | |||||
if (response.data.status == 'success') { | |||||
this.$toast.success(response.data.message) | |||||
this.hasBeta = true | |||||
const sku = response.data.sku | |||||
this.skus.push({ | |||||
id: sku.id, | |||||
name: sku.name, | |||||
cost: sku.cost, | |||||
price: this.$root.priceLabel(sku.cost, this.discount) | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
capitalize(str) { | capitalize(str) { | ||||
return str.charAt(0).toUpperCase() + str.slice(1) | return str.charAt(0).toUpperCase() + str.slice(1) | ||||
}, | }, | ||||
awardDialog() { | awardDialog() { | ||||
this.oneOffDialog(false) | this.oneOffDialog(false) | ||||
}, | }, | ||||
discountEdit() { | discountEdit() { | ||||
if (!this.discount_dialog) { | if (!this.discount_dialog) { | ||||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |