KOKINIO - MANAGER
Edit File: giro.js
var Giro = { getGiro:function(e){ var token = $('#csrf-token').val(); var giro = $('#giro-input').val(); if(giro == '' | giro == null) $('#giro-input').css('border','1px solid red'); else{ var data = new FormData(); if($(e).data('id')!=''){ var id = $(e).data('id'); data.append('id' , id); } data.append('_token' , token); data.append('giro' , giro); Giro.sendGiro(data); } }, sendGiro:function(data){ $.ajax({ url:main_path+'/catalogo/saveGiro', data:data, cache:false, contentType: false, processData: false, type: 'POST', dataType: "json", success: function( response ) { if(response.status == true ){ $.bootstrapGrowl('Giro Guardado!', { type: "success", delay: 6500, allow_dismiss: true }); if(data.get('id')!=''){ $('#modalGiro').modal('hide'); window.location.assign(main_path+'/catalogo/giroAll'); } Giro.resetFields(); }else{ $.bootstrapGrowl( 'Mensaje:'+response.message , { type: "danger", delay: 7500, allow_dismiss: true }); } }, fail: function( response ) { $.bootstrapGrowl( 'Mensaje:'+response.message , { type: "danger", delay: 7500, allow_dismiss: true }); } }); }, resetFields:function(){ $('#giro-input').val(''); }, tableFilter:function(e){ console.log('clickcc'); var $panel = $(e).parents('.filterable'), $filters = $panel.find('.filters input'), $tbody = $panel.find('.table tbody'); if ($filters.prop('disabled') == true) { $filters.prop('disabled', false); $filters.first().focus(); } else { $filters.val('').prop('disabled', true); $tbody.find('.no-result').remove(); $tbody.find('tr').show(); } }, edit:function(e){ $.ajax({ url:main_path+'/catalogo/getGiro', data:{id:$(e).data('id')}, cache:false, type: 'GET', dataType: "json", success: function( response ){ if(response.status == true){ $('#giro-input').val(response.data.giro); $('#send-button').attr('data-id',$(e).data('id')); $('#modalGiro').modal('show'); } }, fail: function( response ) { alert('Error no encontrado') window.location.assign(main_path+'/catalogo/giroAll'); } }); }, delete:function(){ } }