akaunting 3.0 (the last dance)
This commit is contained in:
34
resources/assets/js/plugins/bulk-action.js
vendored
34
resources/assets/js/plugins/bulk-action.js
vendored
@ -37,8 +37,9 @@ export default class BulkAction {
|
||||
this.select_all = true;
|
||||
}
|
||||
|
||||
if (!this.count) {
|
||||
if (! this.count) {
|
||||
this.show = false;
|
||||
|
||||
this.hideSearchHTML();
|
||||
}
|
||||
}
|
||||
@ -49,7 +50,7 @@ export default class BulkAction {
|
||||
this.selected = [];
|
||||
this.hideSearchHTML();
|
||||
|
||||
if (!this.select_all) {
|
||||
if (! this.select_all) {
|
||||
this.show = true;
|
||||
|
||||
for (let input of document.querySelectorAll('[data-bulk-action]')) {
|
||||
@ -60,23 +61,23 @@ export default class BulkAction {
|
||||
this.count = this.selected.length;
|
||||
}
|
||||
|
||||
change(event) {
|
||||
this.message = event.target.options[event.target.options.selectedIndex].dataset.message;
|
||||
change(type) {
|
||||
let action = document.getElementById('button-bulk-action-' + type);
|
||||
|
||||
this.value = type;
|
||||
|
||||
this.message = action.getAttribute('data-message');
|
||||
|
||||
if (typeof(this.message) == "undefined") {
|
||||
this.message = '';
|
||||
}
|
||||
|
||||
this.path = document.getElementsByName("bulk_action_path")[0].getAttribute('value');
|
||||
|
||||
if (event.target.options[event.target.options.selectedIndex].dataset.path) {
|
||||
this.path = event.target.options[event.target.options.selectedIndex].dataset.path;
|
||||
}
|
||||
this.path = action.getAttribute('data-path');
|
||||
|
||||
this.type = '*';
|
||||
|
||||
if (event.target.options[event.target.options.selectedIndex].dataset.type) {
|
||||
this.type = event.target.options[event.target.options.selectedIndex].dataset.type;
|
||||
if (action.getAttribute('data-type')) {
|
||||
this.type = action.getAttribute('data-type');
|
||||
}
|
||||
|
||||
return this.message;
|
||||
@ -146,6 +147,7 @@ export default class BulkAction {
|
||||
|
||||
window.location.reload(false);
|
||||
});
|
||||
|
||||
break;
|
||||
default:
|
||||
let type_promise = Promise.resolve(window.axios.post(this.path, {
|
||||
@ -177,12 +179,14 @@ export default class BulkAction {
|
||||
this.show = false;
|
||||
this.select_all = false;
|
||||
this.selected = [];
|
||||
|
||||
this.hideSearchHTML();
|
||||
}
|
||||
|
||||
hideSearchHTML() {
|
||||
setInterval(() => {
|
||||
const search_box_html = document.querySelector('.js-search-box-hidden');
|
||||
|
||||
if (search_box_html) {
|
||||
search_box_html.classList.add('d-none');
|
||||
}
|
||||
@ -191,14 +195,14 @@ export default class BulkAction {
|
||||
|
||||
// Change enabled status
|
||||
status(item_id, event, notify) {
|
||||
var item = event.target;
|
||||
var status = (event.target.checked) ? 'enable' : 'disable';
|
||||
let item = event.target;
|
||||
let status = (event.target.checked) ? 'enable' : 'disable';
|
||||
|
||||
window.axios.get(this.path + '/' + item_id + '/' + status)
|
||||
.then(response => {
|
||||
var type = (response.data.success) ? 'success' : 'warning';
|
||||
let type = (response.data.success) ? 'success' : 'warning';
|
||||
|
||||
if (!response.data.success) {
|
||||
if (! response.data.success) {
|
||||
if (item.checked) {
|
||||
item.checked = false;
|
||||
} else {
|
||||
|
@ -8,8 +8,6 @@ import VeeValidate from 'vee-validate';
|
||||
import GlobalComponents from './globalComponents';
|
||||
// A plugin file where you could register global directives
|
||||
import GlobalDirectives from './globalDirectives';
|
||||
// Sidebar on the right. Used as a local plugin in DashboardLayout.vue
|
||||
import SideBar from './../components/SidebarPlugin';
|
||||
|
||||
// element ui language configuration
|
||||
import lang from 'element-ui/lib/locale/lang/en';
|
||||
@ -18,13 +16,11 @@ import locale from 'element-ui/lib/locale';
|
||||
locale.use(lang);
|
||||
|
||||
// asset imports
|
||||
import './../../sass/argon.scss';
|
||||
|
||||
export default {
|
||||
install(Vue) {
|
||||
Vue.use(GlobalComponents);
|
||||
Vue.use(GlobalDirectives);
|
||||
Vue.use(SideBar);
|
||||
Vue.use(Notifications);
|
||||
Vue.use(VeeValidate, {
|
||||
fieldsBagName: 'veeFields',
|
||||
|
21
resources/assets/js/plugins/form.js
vendored
21
resources/assets/js/plugins/form.js
vendored
@ -122,7 +122,15 @@ export default class Form {
|
||||
this[form_element.getAttribute('data-field')][name] = form_element.value;
|
||||
}
|
||||
} else {
|
||||
this[form_element.getAttribute('data-field')][name] = [];
|
||||
if (form_element.dataset.type != undefined) {
|
||||
if (form_element.dataset.type == 'multiple') {
|
||||
this[form_element.getAttribute('data-field')][name] = [];
|
||||
} else {
|
||||
this[form_element.getAttribute('data-field')][name] = '';
|
||||
}
|
||||
} else {
|
||||
this[form_element.getAttribute('data-field')][name] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -163,7 +171,16 @@ export default class Form {
|
||||
this[name] = form_element.value;
|
||||
}
|
||||
} else {
|
||||
this[name] = [];
|
||||
|
||||
if (form_element.dataset.type != undefined) {
|
||||
if (form_element.dataset.type == 'multiple') {
|
||||
this[name] = [];
|
||||
} else {
|
||||
this[name] = '';
|
||||
}
|
||||
} else {
|
||||
this[name] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
21
resources/assets/js/plugins/globalComponents.js
vendored
21
resources/assets/js/plugins/globalComponents.js
vendored
@ -1,19 +1,10 @@
|
||||
import BaseInput from './../components/Inputs/BaseInput';
|
||||
import BaseDropdown from './../components/BaseDropdown.vue';
|
||||
import Card from './../components/Cards/Card.vue';
|
||||
import Modal from './../components/Modal.vue';
|
||||
import StatsCard from './../components/Cards/StatsCard.vue';
|
||||
import BaseButton from './../components/BaseButton.vue';
|
||||
import Badge from './../components/Badge.vue';
|
||||
import RouteBreadcrumb from './../components/Breadcrumb/RouteBreadcrumb';
|
||||
import BaseCheckbox from './../components/Inputs/BaseCheckbox.vue';
|
||||
import BaseSwitch from './../components/BaseSwitch.vue';
|
||||
import BaseRadio from "./../components/Inputs/BaseRadio";
|
||||
import BaseProgress from "./../components/BaseProgress";
|
||||
import BasePagination from "./../components/BasePagination";
|
||||
import BaseAlert from "./../components/BaseAlert";
|
||||
import BaseNav from "./../components/Navbar/BaseNav";
|
||||
import BaseHeader from './../components/BaseHeader';
|
||||
import BaseAlert from './../components/BaseAlert';
|
||||
import { Input, Tooltip, Popover } from 'element-ui';
|
||||
/**
|
||||
* You can register global components here and use them as a plugin in your main Vue instance
|
||||
@ -24,19 +15,11 @@ const GlobalComponents = {
|
||||
Vue.component(Badge.name, Badge);
|
||||
Vue.component(BaseAlert.name, BaseAlert);
|
||||
Vue.component(BaseButton.name, BaseButton);
|
||||
Vue.component(BaseCheckbox.name, BaseCheckbox);
|
||||
Vue.component(BaseHeader.name, BaseHeader);
|
||||
Vue.component(Badge.name, Badge);
|
||||
Vue.component(BaseInput.name, BaseInput);
|
||||
Vue.component(BaseDropdown.name, BaseDropdown);
|
||||
Vue.component(BaseNav.name, BaseNav);
|
||||
Vue.component(BasePagination.name, BasePagination);
|
||||
Vue.component(BaseProgress.name, BaseProgress);
|
||||
Vue.component(BaseRadio.name, BaseRadio);
|
||||
Vue.component(BaseSwitch.name, BaseSwitch);
|
||||
Vue.component(Card.name, Card);
|
||||
Vue.component(Modal.name, Modal);
|
||||
Vue.component(StatsCard.name, StatsCard);
|
||||
Vue.component(RouteBreadcrumb.name, RouteBreadcrumb);
|
||||
Vue.component(Input.name, Input);
|
||||
Vue.use(Tooltip);
|
||||
Vue.use(Popover);
|
||||
|
57
resources/assets/js/plugins/selecttwo.js
vendored
57
resources/assets/js/plugins/selecttwo.js
vendored
@ -1,57 +0,0 @@
|
||||
import Vue from 'vue';
|
||||
/*
|
||||
// Initialize the annoying-background directive.
|
||||
export const SelectTwo = {
|
||||
twoWay: true,
|
||||
bind(el, binding, vnode) {
|
||||
var variblee = this;
|
||||
var selectbox = el.getAttribute('id');
|
||||
var binding2 = binding;
|
||||
var vnode2 = vnode;
|
||||
|
||||
$(vnode.elm).select2()
|
||||
.on("select2:select", function(e) {
|
||||
//this.$set($(vnode.elm).val());
|
||||
}.bind($(vnode.elm)));
|
||||
},
|
||||
update: function(nv, ov) {
|
||||
$('#' + nv.id).trigger("change");
|
||||
}
|
||||
}
|
||||
|
||||
// You can also make it available globally.
|
||||
Vue.directive('select-two', SelectTwo);
|
||||
*/
|
||||
|
||||
|
||||
Vue.component('select2', {
|
||||
props: ['options', 'value'],
|
||||
template: '#select2-template',
|
||||
mounted: function () {
|
||||
var vm = this
|
||||
$(this.$el)
|
||||
// init select2
|
||||
.select2({ data: this.options })
|
||||
.val(this.value)
|
||||
.trigger('change')
|
||||
// emit event on change.
|
||||
.on('change', function () {
|
||||
vm.$emit('input', this.value)
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
value: function (value) {
|
||||
// update value
|
||||
$(this.$el)
|
||||
.val(value)
|
||||
.trigger('change')
|
||||
},
|
||||
options: function (options) {
|
||||
// update options
|
||||
$(this.$el).empty().select2({ data: options })
|
||||
}
|
||||
},
|
||||
destroyed: function () {
|
||||
$(this.$el).off().select2('destroy')
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user