Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Admin/User.vue
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | <div class="container"> | ||||
<span>{{ wallet.discount ? (wallet.discount + '% - ' + wallet.discount_description) : 'none' }}</span> | <span>{{ wallet.discount ? (wallet.discount + '% - ' + wallet.discount_description) : 'none' }}</span> | ||||
<button type="button" class="btn btn-secondary btn-sm" @click="discountEdit">Edit</button> | <button type="button" class="btn btn-secondary btn-sm" @click="discountEdit">Edit</button> | ||||
</span> | </span> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="form-group row" v-if="wallet.mandate && wallet.mandate.id"> | <div class="form-group row" v-if="wallet.mandate && wallet.mandate.id"> | ||||
<label class="col-sm-4 col-form-label">Auto-payment</label> | <label class="col-sm-4 col-form-label">Auto-payment</label> | ||||
<div class="col-sm-8"> | <div class="col-sm-8"> | ||||
<span class="form-control-plaintext" id="autopayment"> | <span id="autopayment" :class="'form-control-plaintext' + (wallet.mandateState ? ' text-danger' : '')"> | ||||
Fill up by <b>{{ wallet.mandate.amount }} CHF</b> | Fill up by <b>{{ wallet.mandate.amount }} CHF</b> | ||||
when under <b>{{ wallet.mandate.balance }} CHF</b> | when under <b>{{ wallet.mandate.balance }} CHF</b> | ||||
using {{ wallet.mandate.method }}<span v-if="wallet.mandate.isDisabled"> (disabled)</span>. | using {{ wallet.mandate.method }} | ||||
<span v-if="wallet.mandateState">({{ wallet.mandateState }})</span>. | |||||
</span> | </span> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="form-group row" v-if="wallet.providerLink"> | <div class="form-group row" v-if="wallet.providerLink"> | ||||
<label class="col-sm-4 col-form-label">{{ capitalize(wallet.provider) }} ID</label> | <label class="col-sm-4 col-form-label">{{ capitalize(wallet.provider) }} ID</label> | ||||
<div class="col-sm-8"> | <div class="col-sm-8"> | ||||
<span class="form-control-plaintext" v-html="wallet.providerLink"></span> | <span class="form-control-plaintext" v-html="wallet.providerLink"></span> | ||||
</div> | </div> | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | export default { | ||||
// TODO: currencies, multi-wallets, accounts | // TODO: currencies, multi-wallets, accounts | ||||
// Get more info about the wallet (e.g. payment provider related) | // Get more info about the wallet (e.g. payment provider related) | ||||
this.$root.addLoader(financesTab) | this.$root.addLoader(financesTab) | ||||
axios.get('/api/v4/wallets/' + this.user.wallets[0].id) | axios.get('/api/v4/wallets/' + this.user.wallets[0].id) | ||||
.then(response => { | .then(response => { | ||||
this.$root.removeLoader(financesTab) | this.$root.removeLoader(financesTab) | ||||
this.wallet = response.data | this.wallet = response.data | ||||
this.setMandateState() | |||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
this.$root.removeLoader(financesTab) | this.$root.removeLoader(financesTab) | ||||
}) | }) | ||||
// Create subscriptions list | // Create subscriptions list | ||||
axios.get('/api/v4/skus') | axios.get('/api/v4/skus') | ||||
.then(response => { | .then(response => { | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | export default { | ||||
this.$root.clearFormValidation($('#email-dialog')) | this.$root.clearFormValidation($('#email-dialog')) | ||||
$('#email-dialog') | $('#email-dialog') | ||||
.on('shown.bs.modal', e => { | .on('shown.bs.modal', e => { | ||||
$(e.target).find('input').focus() | $(e.target).find('input').focus() | ||||
}) | }) | ||||
.modal() | .modal() | ||||
}, | }, | ||||
setMandateState() { | |||||
let mandate = this.wallet.mandate | |||||
if (mandate && mandate.id) { | |||||
if (!mandate.isValid) { | |||||
this.wallet.mandateState = mandate.isPending ? 'pending' : 'invalid' | |||||
} else if (mandate.isDisabled) { | |||||
this.wallet.mandateState = 'disabled' | |||||
} | |||||
} | |||||
}, | |||||
oneOffDialog(negative) { | oneOffDialog(negative) { | ||||
this.oneoff_negative = negative | this.oneoff_negative = negative | ||||
this.dialog = $('#oneoff-dialog').on('shown.bs.modal', event => { | this.dialog = $('#oneoff-dialog').on('shown.bs.modal', event => { | ||||
this.$root.clearFormValidation(event.target) | this.$root.clearFormValidation(event.target) | ||||
$(event.target).find('#oneoff_amount').focus() | $(event.target).find('#oneoff_amount').focus() | ||||
}).modal() | }).modal() | ||||
}, | }, | ||||
penalizeDialog() { | penalizeDialog() { | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |