This commit is contained in:
jnunez 2018-06-08 15:23:01 +00:00
parent c4093b8f28
commit d006f8e3e4
3 changed files with 103 additions and 42 deletions

View file

@ -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,8 +49,17 @@ 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);
@ -68,7 +70,7 @@ this.obtenerItems = function () {
var option = $("#ucItemsCatalogo").html();
option = replaceAll("[$CodItem]", item.IdEjecutivo, option);
option = replaceAll("[$CodItem]", item.IdTipoEmisor, option);
var stateIcon = $("#ucItemsIcon").html();
@ -99,7 +101,7 @@ this.obtenerItems = function () {
ENDREQUEST();
}
}).fail(function (jqxhr, textStatus, error) {
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde");

View file

@ -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") {
@ -199,3 +200,60 @@ $.fn.TableInit = function (columnOrder, order, bPaginate, bFilter, bInfo, column
});
};
$.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' });
//}
});
}
});
};

View file

@ -89,5 +89,6 @@
@Scripts.Render("~/Script-Global")
@Scripts.Render("~/Script-Catalogos")
@Scripts.Render("~/Sinort-Scripts/EmisorPN.js")