diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js index bcee6d631..89db21bfd 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js @@ -1,4 +1,4 @@ -$("#formCatalogo").EnableValidationToolTip(); + var DataCatalogo; var id_column = 1; var Item = {}; @@ -40,13 +40,6 @@ this.getDataModel = function () { }); - $('#btnFormalizador').unbind('click'); - $('#btnFormalizador').click(function () { - SelectedCatalog = "Formalizador"; - CargarDataCatalogo($('#btnFormalizador').attr('direccion_api'), null, "1"); - }); - - obtenerItems(); @@ -56,50 +49,59 @@ this.obtenerItems = function () { var uri = CatalogosWCF + '/api/ObtenerEmisoresPN'; + var DTO = JSON.stringify(Item); + //$.getJSON(uri).done(function (data) { - $.getJSON(server + uri).done(function (data) { + $.ajax({ + type: 'POST', + url: uri, + cache: false, + data: DTO, + contentType: 'application/json; charset=utf-8', + dataType: 'json', + success: function (response, data) { - $('#TableItems').TableInit(0, false, true, true, false, null, null); + $('#TableItems').TableInit(0, false, true, true, false, null, null); - var TableItems = $('#TableItems').DataTable(); + var TableItems = $('#TableItems').DataTable(); - $.each(data, function (key, item) { + $.each(data, function (key, item) { - var option = $("#ucItemsCatalogo").html(); + var option = $("#ucItemsCatalogo").html(); - option = replaceAll("[$CodItem]", item.IdEjecutivo, option); + option = replaceAll("[$CodItem]", item.IdTipoEmisor, option); - var stateIcon = $("#ucItemsIcon").html(); + var stateIcon = $("#ucItemsIcon").html(); - if (item.Estado == false) { - stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon); - stateIcon = replaceAll("[$state_color]", "muted", stateIcon); + if (item.Estado == false) { + stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon); + stateIcon = replaceAll("[$state_color]", "muted", stateIcon); - option = replaceAll("[$opcion]", "Habilitar", option); - option = replaceAll("[$icon]", "fa-check", option); - option = replaceAll("[$value]", "1", option); + option = replaceAll("[$opcion]", "Habilitar", option); + option = replaceAll("[$icon]", "fa-check", option); + option = replaceAll("[$value]", "1", option); + } + else { + stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon); + stateIcon = replaceAll("[$state_color]", "success", stateIcon); + + option = replaceAll("[$opcion]", "Deshabilitar", option); + option = replaceAll("[$icon]", "fa-times", option); + option = replaceAll("[$value]", "0", option); + } + + TableItems.row.add([stateIcon, + item.IdTipoEmisor, + item.Descripcion, + option]).draw(); + + }); + + + + ENDREQUEST(); } - else { - stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon); - stateIcon = replaceAll("[$state_color]", "success", stateIcon); - - option = replaceAll("[$opcion]", "Deshabilitar", option); - option = replaceAll("[$icon]", "fa-times", option); - option = replaceAll("[$value]", "0", option); - } - - TableItems.row.add([stateIcon, - item.IdTipoEmisor, - item.Descripcion, - option]).draw(); - - }); - - - - ENDREQUEST(); - }).fail(function (jqxhr, textStatus, error) { toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde"); diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js index df797e0f4..b597ff6ca 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js @@ -1,5 +1,6 @@ var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val(); var SinortWCF = $("#hiddenSinortWCF").val(); +var server = "http://" + location.host + "/AYA.SlnSynor.WCF/"; function Mensajes(mensaje) { if (mensaje.CodigoRespuesta === "1") { @@ -198,4 +199,61 @@ $.fn.TableInit = function (columnOrder, order, bPaginate, bFilter, bInfo, column "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], }); +}; + + +$.fn.EnableValidationToolTip = function () { + + this.validate({ + + ignore: "not:hidden", + + showErrors: function (errorMap, errorList) { + + + $.each(this.validElements(), function (index, element) { + var $element = $(element); + + if ($element.prop("type") == "select-one") { + if ($element.attr('required')) { + $element.removeClass("selectWarning").addClass("inputSuccess"); + } + else { + $element.removeClass("selectWarning"); + } + } + else { + + if ($element.attr('required')) { + $element.removeClass("inputWarning").addClass("inputSuccess"); + } + else { + $element.removeClass("inputWarning"); + } + } + + + $element.data("title", "").removeClass("error").tooltip("destroy"); + + }); + + $.each(errorList, function (index, error) { + var $element = $(error.element); + + if ($element.prop("type") == "select-one") { + $element.removeClass("inputSuccess").addClass("selectWarning"); + } + else { + $element.removeClass("inputSuccess").addClass("inputWarning"); + } + + //if ($element.data("role") != undefined) { + // $("#" + $element.data("role")).tooltip("destroy").data("title", error.message).addClass("error").tooltip({ placement: 'right', trigger: 'hover', container: 'body' }); + //} else { + $element.tooltip("destroy").data("title", error.message).addClass("error").tooltip({ placement: 'right', trigger: 'hover', container: 'body' }); + //} + }); + } + }); + }; \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml index 075e39580..943335cc0 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml @@ -89,5 +89,6 @@ +@Scripts.Render("~/Script-Global") +@Scripts.Render("~/Script-Catalogos") -@Scripts.Render("~/Sinort-Scripts/EmisorPN.js") \ No newline at end of file