Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/public_html/web/admin/js/
Upload File :
Current File : /home/caballoscriollos/public_html/web/admin/js/jquery.jsgrid.init.js

var JsDBSource = {
    loadData: function (filter) {
        console.log(filter);
        var d = $.Deferred();
        $.ajax({
            type: "GET",
            url: urlJsonData,
            data: filter,
            success: function(response) {
                /*//static filter on frontend side, you should actually filter data on backend side
                var filtered_data = $.grep(response, function (client) {
                    return (!filter.Nombre || client.Nombre.toLowerCase().indexOf(filter.Nombre.toLowerCase()) > -1)
                    && (!filter.Abreviatura || client.Abreviatura.toLowerCase().indexOf(filter.Abreviatura.toLowerCase()) > -1)
                });*/
                d.resolve(response);
            }
        });
        return d.promise();
    },

    insertItem: function (item) {
        return $.ajax({
            type: "POST",
            url: urlJsonAdd,
            data: item,
            success: function(response) {
            	if (response.Success)
                	$("#jsGrid").jsGrid("loadData");
                else
                	swal({
                		title: "Error!",
                		text: response.Error,
                		type: "error",
                		timer: 2000,
                		showConfirmButton: false
            		});
            }
        });
    },

    updateItem: function (item) {
        return $.ajax({
            type: "POST",
            url: urlJsonMod,
            data: item,
            success: function(response) {
            	$("#jsGrid").jsGrid("loadData");
        	}
        });
    },

    deleteItem: function (item) {
        return $.ajax({
            type: "POST",
            url: urlJsonDel,
            data: item,
            success: function(response) {
                if (response.Success)
                	$("#jsGrid").jsGrid("loadData");
                else
                	swal({
                		title: "Error!",
                		text: response.Error,
                		type: "error",
                		timer: 2000,
                		showConfirmButton: false
            		});
            }
        });
    },

};

!function($) {
    "use strict";

    var GridApp = function() {
        this.$body = $("body")
    };
    var insert = true;
    if (disableInsert)
    	insert = false;
    var edit = true;
    if (disableEdit)
    	edit = false;
    var vdelete = true;
    if (disableDelete)
    	vdelete = false;
    GridApp.prototype.createGrid = function ($element, options) {
        //default options
        var defaults = {
            //height: "450",
            width: "100%",
            filtering: true,
            editing: edit,
            inserting: insert,
            deleting: vdelete,
            sorting: true,
            paging: true,
            pageLoading: true,
            autoload: true,
            pageSize: 50,
            pageButtonCount: 5,
            pageNextText: "Prox",
            pagePrevText: "Prev",
            pageFirstText: "Primero",
            pageLastText: "Ultimo",
            pagerFormat: "Paginas: {first} {prev} {pages} {next} {last}    {pageIndex} de {pageCount}", 
            loadMessage: "Por favor, espere",
            noDataContent: "No data",
            deleteConfirm: "Está seguro de eliminar el registro?",
            confirmDeleting: false,
            onItemDeleting: function (args) {
    			if (!args.item.deleteConfirmed) { // custom property for confirmation
        			args.cancel = true; // cancel deleting
        			swal({
                		title: "Eliminar " + EntidadNombre,
                		text: "Está seguro de eliminar " + args.item.Nombre + "?",
                		type: "warning",
                		showCancelButton: true,
                		showCancelText: 'Cancelar',
                		confirmButtonClass: 'btn-warning',
                		confirmButtonText: "Si, deseo eliminarlo!",
                		closeOnConfirm: false
            		}, function () {
            			args.item.deleteConfirmed = true;
            			$("#jsGrid").jsGrid('deleteItem', args.item); //call deleting once more in callback
                		swal("Eliminado!", EntidadNombre + " " + args.item.Nombre + " ha sido eliminado.", "success");
            		});
        			/*confirm.showConfirm('Are you sure?', function() {
            			args.item.deleteConfirmed = true;
            			$grid.jsGrid('deleteItem', args.item); //call deleting once more in callback
        			});*/
    			}
			},
            invalidNotify: function(args) {
            	var messages = "";
            	for (var i = 0; i < args.errors.length; i++)
        			messages += args.errors[i].message + "\n";
        			
 				swal({
                	title: "Error!",
                	text: messages,
                	type: "error",
                	timer: 2000,
                	showConfirmButton: false
            	});
        	}
        };

        $element.jsGrid($.extend(defaults, options));
    },
    GridApp.prototype.init = function () {
        var $this = this;

        var options = {
            fields: fields_grid,
            controller: JsDBSource,
        };
        $this.createGrid($("#jsGrid"), options);

    },
    //init ChatApp
    $.GridApp = new GridApp, $.GridApp.Constructor = GridApp

}(window.jQuery),

//initializing main application module
function($) {
    "use strict";
    $.GridApp.init();
}(window.jQuery);

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat