{"size": 1446, "ext": "js", "max_stars_repo_path": "web/src/resources/js/search.js", "max_stars_repo_name": "matheusmessora/ritmobrasil", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "web/src/resources/js/search.js", "max_issues_repo_name": "matheusmessora/ritmobrasil", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/src/resources/js/search.js", "max_forks_repo_name": "matheusmessora/ritmobrasil", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.1333333333, "max_line_length": 148, "alphanum_fraction": 0.4668049793}
var GPV = GPV || {};

/*=====================================================================================================
 * SYSTEM Module
 *======================================================================================================*/
GPV.SEARCH = function () {

    var page;

    var init = function (pageValue) {
        console.debug("GPV.SEARCH INIT a");

        page = pageValue;
    };

    var search = function(numeroPedido){
        var searchString = numeroPedido;

        GPV.SYSTEM.clearAll();
        $.get('http://' + GPV.SYSTEM.gpvURL() + '/gpv-webservices/resources/filaErro/listarFilaErro', function (filaErro) {

            $.each(filaErro.listaFalhaProcessamento, function (i, falha) {
                var messageID = falha.messageID;

                $.get('http://' + GPV.SYSTEM.gpvURL() + '/gpv-webservices/resources/filaErro/listarPorMessageID/' + messageID, function (mensagem) {


                    var encontrado = JSON.stringify(mensagem.json).indexOf(searchString) > -1;
                    if(encontrado){
                        GPV.SYSTEM.addFalhaProcessamento(i, falha);
                    }
                });
            });
        })
        .fail(function (jqXHR, textStatus, errorThrown) {
            GPV.SYSTEM.consoler("Falha ao buscar listarFilaErro. " +jqXHR.status+ " - " + jqXHR.statusText);
        })
    };

    return {
        init: init,
        search: search
    }

}();