96 lines
2.5 KiB
JavaScript
Raw Normal View History

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';
2019-11-16 10:21:14 +03:00
import Global from './../../mixins/global';
import Form from './../../plugins/form';
import BulkAction from './../../plugins/bulk-action';
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',
2019-12-31 17:36:07 +03:00
2019-11-16 10:21:14 +03:00
mixins: [
Global
],
2019-12-31 17:36:07 +03:00
2019-11-16 10:21:14 +03:00
data: function () {
return {
form: new Form('report'),
bulk_action: new BulkAction('reports'),
report_fields: '',
2021-06-15 12:37:13 +03:00
reports_total: [],
2019-11-16 10:21:14 +03:00
}
},
2021-06-15 12:37:13 +03:00
created() {
this.reports_total = reports_total;
},
2019-11-16 10:21:14 +03:00
methods: {
onChangeClass(class_name) {
axios.get(url + '/common/reports/fields', {
2019-11-16 10:21:14 +03:00
params: {
class: class_name
}
})
.then(response => {
let form = this.form;
let html = response.data.html;
2019-11-16 10:21:14 +03:00
this.report_fields = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template : '<div id="report-fields" class="row col-md-12">' + html + '</div>',
mixins: [
Global
],
created: function() {
this.form = form;
},
data: function () {
return {
form: {},
}
},
watch: {
form: function (form) {
this.$emit("change", form);
}
},
})
2019-11-16 10:21:14 +03:00
});
})
.catch(error => {
});
},
onChangeReportFields(event) {
this.form = event;
2021-06-15 12:37:13 +03:00
},
onRefreshTotal(report_id) {
axios.get(url + '/common/reports/' + report_id + '/clear')
.then(response => {
this.reports_total[report_id] = response.data.data;
})
.catch(error => {
});
},
2019-11-16 10:21:14 +03:00
}
});