Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Admin/User.vue
Show First 20 Lines • Show All 448 Lines • ▼ Show 20 Lines | export default { | ||||
this.$root.removeLoader(financesTab) | this.$root.removeLoader(financesTab) | ||||
}) | }) | ||||
// Create subscriptions list | // Create subscriptions list | ||||
axios.get('/api/v4/users/' + user_id + '/skus') | axios.get('/api/v4/users/' + user_id + '/skus') | ||||
.then(response => { | .then(response => { | ||||
// "merge" SKUs with user entitlement-SKUs | // "merge" SKUs with user entitlement-SKUs | ||||
response.data.forEach(sku => { | response.data.forEach(sku => { | ||||
if (sku.id in this.user.skus) { | const userSku = this.user.skus[sku.id] | ||||
let count = this.user.skus[sku.id].count | if (userSku) { | ||||
let cost = userSku.costs.reduce((sum, current) => sum + current) | |||||
let item = { | let item = { | ||||
id: sku.id, | id: sku.id, | ||||
name: sku.name, | name: sku.name, | ||||
cost: sku.cost, | cost: cost, | ||||
units: count - sku.units_free, | price: this.$root.priceLabel(cost, this.discount) | ||||
price: this.$root.priceLabel(sku.cost, count - sku.units_free, this.discount) | |||||
} | } | ||||
if (sku.range) { | if (sku.range) { | ||||
item.name += ' ' + 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 | ||||
} | } | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | export default { | ||||
this.wallet = Object.assign({}, this.wallet, response.data) | this.wallet = Object.assign({}, this.wallet, response.data) | ||||
// Update prices in Subscriptions tab | // Update prices in Subscriptions tab | ||||
if (this.user.wallet.id == response.data.id) { | if (this.user.wallet.id == response.data.id) { | ||||
this.discount = this.wallet.discount | this.discount = this.wallet.discount | ||||
this.discount_description = this.wallet.discount_description | this.discount_description = this.wallet.discount_description | ||||
this.skus.forEach(sku => { | this.skus.forEach(sku => { | ||||
sku.price = this.$root.priceLabel(sku.cost, sku.units, this.discount) | sku.price = this.$root.priceLabel(sku.cost, this.discount) | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
}) | }) | ||||
}, | }, | ||||
submitEmail() { | submitEmail() { | ||||
axios.put('/api/v4/users/' + this.user.id, { external_email: this.external_email }) | axios.put('/api/v4/users/' + this.user.id, { external_email: this.external_email }) | ||||
.then(response => { | .then(response => { | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |