/** * 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'; import DashboardPlugin from './../../plugins/dashboard-plugin'; import Global from './../../mixins/global'; import Form from './../../plugins/form'; import { Progress } from 'element-ui'; import AkauntingSlider from './../../components/AkauntingSlider.vue'; // plugin setup Vue.use(DashboardPlugin, Progress); const app = new Vue({ el: '#app', mixins: [ Global ], components: { [Progress.name]: Progress, AkauntingSlider }, created() { document.addEventListener('click', this.closeIfClickedOutside); }, mounted() { if (typeof app_slug !== 'undefined') { this.onReleases(1); this.onReviews(1); } }, data: function () { return { keyword: '', form: new Form('form-app'), page: 2, current_page: 1, releases: { status: false, html: '', pagination: { current_page: 1, last_page: 1 } }, reviews: { status: false, html: '', pagination: { current_page: 1, last_page: 1 } }, page: { reviews: 2, releases: 2, }, reviewPage: 2, faq: false, installation: { show: false, steps: [], steps_total: 0, total: 0, path: '', alias: '', version: '', status: 'success', html: '' }, addToCartLoading: false, loadMoreLoading: false, live_search_modal: false, live_search_data: [], route_url: url } }, methods: { addToCart(alias, subscription_type) { this.addToCartLoading = true; let add_to_cart_promise = Promise.resolve(axios.get(url + '/apps/' + alias + '/' + subscription_type +'/add')); add_to_cart_promise.then(response => { if (response.data.success) { this.$notify({ message: response.data.message, timeout: 0, icon: "shopping_cart_checkout", type: 'success' }); } this.addToCartLoading = false; }) .catch(error => { this.addToCartLoading = false; }); }, async onloadMore() { this.loadMoreLoading = true; this.current_page++; let path = document.getElementById('see_more_path').value; let alias = ''; let keyword = ''; if (document.getElementById('see_more_alias')) { alias = document.getElementById('see_more_alias').value; } if (document.getElementById('see_more_keyword')) { keyword = document.getElementById('see_more_keyword').value; } if (this.keyword !== '') { keyword = this.keyword; } document.getElementById("button-pre-load").setAttribute("disabled", true); let more_promise = Promise.resolve(window.axios.post(path, { page: this.current_page, alias: alias, keyword: keyword, })); more_promise.then(response => { if (response.data.success) { document.querySelector("[data-apps-content]").innerHTML += response.data.html; } if (response.data.last_page == this.current_page) { document.getElementById("button-pre-load").remove(); } this.loadMoreLoading = false; }) .catch(error => { this.loadMoreLoading = false; }); }, async onReleases(page) { let releases_promise = Promise.resolve(window.axios.post(url + '/apps/' + app_slug + '/releases', { page: page })); releases_promise.then(response => { if (response.data.success) { this.releases.status= true; this.releases.html = response.data.html; this.releases.pagination.current_page = page; this.releases.pagination.last_page = response.data.data.last_page; } }) .catch(error => { }); }, async onReviews(page) { let reviews_promise = Promise.resolve(window.axios.post(url + '/apps/' + app_slug + '/reviews', { page: page })); reviews_promise.then(response => { if (response.data.success) { this.reviews.status= true; this.reviews.html = response.data.html; this.reviews.pagination.current_page = page; this.reviews.pagination.last_page = response.data.data.last_page; } }) .catch(error => { }); }, onShowFaq() { this.faq = true; }, async onInstall(path, alias, name, version) { this.installation.alias = alias; this.installation.show = true; this.installation.total = 0; this.installation.path = path; this.installation.version = version; let steps_promise = Promise.resolve(axios.post(url + '/apps/steps', { name: name, alias: alias, version: version })); steps_promise.then(response => { if (response.data.error) { this.installation.status = 'exception'; this.installation.html = '