Vue.http.headers.common['X-CSRF-TOKEN'] = 'EYMAYVO9HVMHh5h4EXXHknIm8N1ZSt6pzrt5e23h'; Vue.options.delimiters = ['<%', '%>']; Vue.http.interceptors.push(function(request, next) { next(function(Request) { if (Request.status == 0 && !Request.ok) { swal.fire({ type: 'error', title: 'Fallo el Internet', text: 'Porfavor verifica tu conexión.', }); } if (Request.status == 500) { swal.fire({ type: 'error', title: 'Error del servidor', text: 'Porfavor contacte al equipo Prianti.', }); } if (Request.status == 401) { swal.fire({ type: 'error', title: 'Tu sesión a expirado', text: 'Inicia sesión para poder continuar.', }).then(function(result) { window.location.reload(); }); } if (Request.status == 422) { app.inputError(Request.body); app.toast({ title: 'Ops!.', body: 'Verifica tus datos.', icon: 'error' }); } }); }); window.app = { SessionUrl: '', taskInterval: null, setInterval: function(_function, interval){ this.taskInterval = setInterval(_function, interval); },addComponent: function(component){ if(this.taskInterval){ clearInterval(this.taskInterval); this.taskInterval = null; } new Vue({ el: (component.el)? component.el : ".app-content", data: component.data, methods: component.methods, created: component.created }) },toast: function(_args_) { toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": true, "positionClass": "toast-top-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "3000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; toastr.error(_args_.body,_args_.title); /*$.toast({ heading: _args_.title, text: _args_.body, showHideTransition: 'slide', icon: _args_.icon, loaderBg: '#596800', position: { right: 10, top: 70 }, });*/ },inputError: function(_data_) { Object.keys(_data_).forEach(function(index) { $('#error_' + index).html(_data_[index]); }); },removeError: function(_data_) { Object.keys(_data_).forEach(function(index) { $('#error_' + index).html(''); }); }, successData:function(_data_){ toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": true, "positionClass": "toast-top-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "3000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; (_data_.Status)? toastr.success(_data_.message) : toastr.error(_data_.message); }, ToastInfo:function(_data_){ console.log(_data_,"sndn"); toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": true, "positionClass": "toast-top-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "3000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; (_data_.Status)? toastr.info(_data_.message) : toastr.warning(_data_.message); }, saveSuccess: function() { toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": false, "positionClass": "toast-top-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "5000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; toastr.success("Datos Guardados Correctamente"); }, jsTreeView: function(_data_){ $('#treeDataPermission').jstree("destroy").jstree({ plugins: ["wholerow", "checkbox", "types"], core: { themes: { responsive: false }, multiple: true, animation: 0, check_callback: true, data: _data_, }, "types" : { "default" : { "icon" : "fa fa-folder kt-font-orange" }, "file" : { "icon" : "fa fa-file kt-font-default" } }, }); }, GetKTDatatable:function(){ $(function(){ var datatable = $('.kt-datatable').KTDatatable({ data: { saveState: {cookie: false}, }, search: { input: $('#generalSearch'), }, columns: [ { field: 'Rol', autoHide: false, }, { field: 'Estado', title: 'Estado', autoHide: false, template: function(row) { var status = { 1: {'title': 'Activo', 'state': 'success'}, 2: {'title': 'Inactivo', 'state': 'danger'}, }; return ' ' + status[row.Estado].title + ''; }, }, ], }); $('#kt_form_type').on('change', function() { datatable.search($(this).val().toLowerCase(), 'Estado'); }); $('#kt_form_type').selectpicker(); }); }, }