2019-11-16 10:21:14 +03:00
|
|
|
/**
|
|
|
|
* First we will load all of this project's JavaScript dependencies which
|
|
|
|
* includes Vue and other libraries. It is a great starting point when
|
|
|
|
* building robust, powerful web applications using Vue and Laravel.
|
|
|
|
*/
|
|
|
|
|
|
|
|
require('./../../bootstrap');
|
|
|
|
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
2020-01-03 12:10:07 +03:00
|
|
|
import DashboardPlugin from './../../plugins/dashboard-plugin';
|
2022-06-01 10:15:55 +03:00
|
|
|
import BulkAction from './../../plugins/bulk-action';
|
2020-01-03 12:10:07 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
import Global from './../../mixins/global';
|
|
|
|
import Form from './../../plugins/form';
|
2019-12-28 14:41:09 +03:00
|
|
|
import CardForm from './../../components/CreditCard/CardForm';
|
2022-06-01 10:15:55 +03:00
|
|
|
import Swiper, { Navigation, Pagination } from 'swiper';
|
|
|
|
|
|
|
|
Swiper.use([Navigation, Pagination]);
|
2019-12-28 14:41:09 +03:00
|
|
|
|
2020-01-03 12:10:07 +03:00
|
|
|
// plugin setup
|
|
|
|
Vue.use(DashboardPlugin);
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
const app = new Vue({
|
|
|
|
el: '#app',
|
|
|
|
|
|
|
|
mixins: [
|
|
|
|
Global
|
|
|
|
],
|
|
|
|
|
2019-12-28 14:41:09 +03:00
|
|
|
components: {
|
|
|
|
CardForm
|
|
|
|
},
|
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
data: function() {
|
2019-11-16 10:21:14 +03:00
|
|
|
return {
|
2022-06-01 10:15:55 +03:00
|
|
|
form: new Form('portal'),
|
|
|
|
bulk_action: new BulkAction('portal'),
|
|
|
|
|
|
|
|
// for profile
|
|
|
|
show_password: false,
|
|
|
|
|
|
|
|
// for payments
|
|
|
|
connect: {
|
|
|
|
show: false,
|
|
|
|
currency: {},
|
|
|
|
documents: [],
|
|
|
|
},
|
|
|
|
|
|
|
|
// for invoices
|
2019-11-16 10:21:14 +03:00
|
|
|
redirectForm: new Form('redirect-form'),
|
2019-12-28 14:41:09 +03:00
|
|
|
method_show_html: '',
|
|
|
|
formData: {
|
|
|
|
cardName: '',
|
|
|
|
cardNumber: '',
|
|
|
|
cardMonth: '',
|
|
|
|
cardYear: '',
|
2021-01-17 17:26:57 +03:00
|
|
|
cardCvv: '',
|
|
|
|
storeCard: false,
|
2021-01-17 23:55:27 +03:00
|
|
|
card_id: 0,
|
2022-06-01 10:15:55 +03:00
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
mounted() {
|
|
|
|
if (typeof this.form.password !== 'undefined') {
|
|
|
|
this.form.password = '';
|
|
|
|
}
|
2022-11-02 11:28:25 +03:00
|
|
|
|
|
|
|
|
|
|
|
if (document.querySelector('[data-tabs-swiper]').childElementCount) {
|
|
|
|
|
|
|
|
document.querySelectorAll('[data-tabs-slide]').forEach((item) => {
|
|
|
|
item.classList.add('swiper-slide');
|
|
|
|
});
|
|
|
|
|
|
|
|
document.querySelector('[data-tabs-swiper]').classList.add('swiper', 'swiper-links');
|
|
|
|
|
|
|
|
let html = `
|
|
|
|
<div class="swiper-wrapper">
|
|
|
|
${document.querySelector('[data-tabs-swiper]').innerHTML}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="swiper-button-next top-3 right-0">
|
|
|
|
<span class="material-icons">chevron_right</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="swiper-button-prev top-3 left-0">
|
|
|
|
<span class="material-icons">chevron_left</span>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
|
|
|
document.querySelector('[data-tabs-swiper]').innerHTML = html;
|
|
|
|
}
|
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
|
|
|
|
new Swiper(".swiper-links", {
|
|
|
|
loop: false,
|
2022-11-02 11:28:25 +03:00
|
|
|
slidesPerView: 1,
|
2022-06-01 10:15:55 +03:00
|
|
|
pagination: {
|
|
|
|
el: ".swiper-pagination",
|
|
|
|
clickable: true
|
|
|
|
},
|
|
|
|
navigation: {
|
|
|
|
nextEl: ".swiper-button-next",
|
|
|
|
prevEl: ".swiper-button-prev",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
// for profile
|
|
|
|
onChangePassword(event) {
|
|
|
|
if (this.show_password == false) {
|
|
|
|
event.target.closest('.grid-rows-4').classList.replace('grid-rows-4', 'grid-rows-5');
|
|
|
|
event.target.closest('.grid-rows-5').nextElementSibling.classList.replace('grid-rows-4', 'grid-rows-5');
|
|
|
|
|
|
|
|
this.show_password = true;
|
|
|
|
} else {
|
|
|
|
event.target.closest('.grid-rows-5').classList.replace('grid-rows-5', 'grid-rows-4');
|
|
|
|
event.target.closest('.grid-rows-4').nextElementSibling.classList.replace('grid-rows-5', 'grid-rows-4');
|
|
|
|
|
|
|
|
this.show_password = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// for payments
|
|
|
|
onConnect(transaction, currency, documents) {
|
|
|
|
this.connect.show = true;
|
|
|
|
|
|
|
|
this.connect.transaction = transaction;
|
|
|
|
|
|
|
|
this.connect.currency = {
|
|
|
|
decimal_mark: currency.decimal_mark,
|
|
|
|
precision: currency.precision,
|
|
|
|
symbol: currency.symbol,
|
|
|
|
symbol_first: currency.symbol_first,
|
|
|
|
thousands_separator: currency.thousands_separator,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.connect.documents = documents;
|
|
|
|
},
|
|
|
|
|
|
|
|
// for invoices
|
2020-10-21 11:28:41 +03:00
|
|
|
onChangePaymentMethod(payment_method) {
|
2022-06-01 10:15:55 +03:00
|
|
|
if (! payment_method) {
|
2020-10-21 11:28:41 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let method = payment_method.split('.');
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2021-04-17 01:29:18 +03:00
|
|
|
let path = url + '/portal/' + method[0] + '/invoices/' + this.form.document_id;
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-12-24 01:28:38 +03:00
|
|
|
this.method_show_html = Vue.component('payment-method-confirm', function (resolve, reject) {
|
|
|
|
resolve({
|
2022-06-01 10:15:55 +03:00
|
|
|
template:'<div id="loading" class="description text-center"><i class="submit-spin absolute w-2 h-2 rounded-full left-0 right-0 -top-3.5 m-auto"></i></div>'
|
2020-12-24 01:28:38 +03:00
|
|
|
})
|
|
|
|
});
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-12-24 01:28:38 +03:00
|
|
|
axios.get(path, {
|
|
|
|
params: {
|
|
|
|
payment_method: payment_method
|
|
|
|
}
|
|
|
|
})
|
2019-11-16 10:21:14 +03:00
|
|
|
.then(response => {
|
|
|
|
this.method_show_html = '';
|
|
|
|
|
|
|
|
if (response.data.redirect) {
|
|
|
|
location = response.data.redirect;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.data.html) {
|
|
|
|
this.method_show_html = Vue.component('payment-method-confirm', function (resolve, reject) {
|
|
|
|
resolve({
|
2019-12-30 18:35:23 +03:00
|
|
|
template: '<div>' + response.data.html + '</div>',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
CardForm
|
|
|
|
},
|
|
|
|
|
2021-01-12 23:45:32 +03:00
|
|
|
created: function() {
|
2021-01-19 14:55:55 +03:00
|
|
|
this.form = new Form('redirect-form');
|
2021-01-12 23:45:32 +03:00
|
|
|
},
|
|
|
|
|
2019-12-30 18:35:23 +03:00
|
|
|
data: function () {
|
|
|
|
return {
|
2021-01-12 23:45:32 +03:00
|
|
|
form: {},
|
2019-12-30 18:35:23 +03:00
|
|
|
formData: {
|
|
|
|
cardName: '',
|
|
|
|
cardNumber: '',
|
|
|
|
cardMonth: '',
|
|
|
|
cardYear: '',
|
2021-01-17 17:26:57 +03:00
|
|
|
cardCvv: '',
|
|
|
|
storeCard: false,
|
2021-01-17 23:55:27 +03:00
|
|
|
card_id: 0,
|
2019-12-30 18:35:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
methods: {
|
|
|
|
onRedirectConfirm() {
|
|
|
|
let redirect_form = new Form('redirect-form');
|
|
|
|
|
|
|
|
this.$emit('interface', redirect_form);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.method_show_html = error.message;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onRedirectConfirm() {
|
|
|
|
this.redirectForm = new Form('redirect-form');
|
|
|
|
|
|
|
|
axios.post(this.redirectForm.action, this.redirectForm.data())
|
|
|
|
.then(response => {
|
|
|
|
if (response.data.redirect) {
|
|
|
|
location = response.data.redirect;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.data.success) {
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.method_show_html = error.message;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-10-21 11:28:41 +03:00
|
|
|
onChangePaymentMethodSigned(payment_method) {
|
2022-06-01 10:15:55 +03:00
|
|
|
if (! payment_method) {
|
2020-10-21 11:28:41 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.form.payment_action = payment_method;
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2021-01-14 12:30:02 +03:00
|
|
|
let method = payment_method.split('.');
|
|
|
|
|
|
|
|
let payment_action = payment_action_path[method[0]];
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-12-24 01:28:38 +03:00
|
|
|
this.method_show_html = Vue.component('payment-method-confirm', function (resolve, reject) {
|
|
|
|
resolve({
|
2022-06-01 10:15:55 +03:00
|
|
|
template:'<div id="loading" class="description text-center"><i class="submit-spin absolute w-2 h-2 rounded-full left-0 right-0 -top-3.5 m-auto"></i></div>'
|
2020-12-24 01:28:38 +03:00
|
|
|
})
|
|
|
|
});
|
|
|
|
|
2021-01-14 12:30:02 +03:00
|
|
|
axios.get(payment_action, {
|
|
|
|
params: {
|
|
|
|
payment_method: payment_method
|
|
|
|
}
|
|
|
|
})
|
2019-11-16 10:21:14 +03:00
|
|
|
.then(response => {
|
|
|
|
this.method_show_html = '';
|
|
|
|
|
|
|
|
if (response.data.redirect) {
|
|
|
|
location = response.data.redirect;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.data.html) {
|
|
|
|
this.method_show_html = Vue.component('payment-method-confirm', function (resolve, reject) {
|
|
|
|
resolve({
|
2019-12-30 18:35:23 +03:00
|
|
|
template: '<div>' + response.data.html + '</div>',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
CardForm
|
|
|
|
},
|
|
|
|
|
2021-01-12 23:45:32 +03:00
|
|
|
created: function() {
|
2021-01-19 14:55:55 +03:00
|
|
|
this.form = new Form('redirect-form');
|
2021-01-12 23:45:32 +03:00
|
|
|
},
|
|
|
|
|
2019-12-30 18:35:23 +03:00
|
|
|
data: function () {
|
|
|
|
return {
|
2021-01-12 23:45:32 +03:00
|
|
|
form: {},
|
2019-12-30 18:35:23 +03:00
|
|
|
formData: {
|
|
|
|
cardName: '',
|
|
|
|
cardNumber: '',
|
|
|
|
cardMonth: '',
|
|
|
|
cardYear: '',
|
2021-01-17 17:26:57 +03:00
|
|
|
cardCvv: '',
|
|
|
|
storeCard: false,
|
2021-01-17 23:55:27 +03:00
|
|
|
card_id: 0,
|
2019-12-30 18:35:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
methods: {
|
|
|
|
onRedirectConfirm() {
|
|
|
|
let redirect_form = new Form('redirect-form');
|
|
|
|
|
|
|
|
this.$emit('interface', redirect_form);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.method_show_html = error.message;
|
|
|
|
});
|
2019-12-28 14:41:09 +03:00
|
|
|
},
|
2022-06-01 10:15:55 +03:00
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
});
|