diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index 9e11abbe4..6f25231a3 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7679,9 +7679,11 @@ + + @@ -7746,6 +7748,8 @@ + + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Controllers/Catalogos/CatalogosController.cs b/AYA.SlnSynor/AYA.SlnSynor/Controllers/Catalogos/CatalogosController.cs index 63d762551..a22e24636 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Controllers/Catalogos/CatalogosController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/Controllers/Catalogos/CatalogosController.cs @@ -55,5 +55,15 @@ namespace AYA.SlnSinort.Controllers.Catalogos InitControllers(); return View(); } + public ActionResult DocumentoTecnico() + { + InitControllers(); + return View(); + } + public ActionResult PalabraClave() + { + InitControllers(); + return View(); + } } } \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js b/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js index b14606e3d..c3718a9f9 100644 Binary files a/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js and b/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js differ diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js new file mode 100644 index 000000000..553b0c93f --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js @@ -0,0 +1,200 @@ +var DataCatalogo; +var id_column = 1; +var Item = {}; + + +jQuery(document).ready(function () { + + getDataModel(); + +}); + +this.getDataModel = function () { + + $('#txtDescripcion').attr('size', 50); + + $('#btnGuardar').hide(); + $('#btnInsertar').show(); + + + $('#btnLimpiarControles').click(function () { + LimpiarControles(); + + $('#btnGuardar').hide(); + $('#btnInsertar').show(); + }); + + $('#btnGuardar').click(function () { + ActualizarItem(); + }); + + $('#btnInsertar').click(function () { + InsertarItem(); + }); + + + $('#TableItems').TableInit(0, false, true, true, false, null, null); + ObtenerDocumentoTecnico(); + +} + +this.CargarGridDocumentoTecnico = function (data) { + + var TableItems = $('#TableItems').DataTable(); + var lista = data; + + $.each(lista, function (key, item) { + + var option = $("#ucItemsCatalogo").html(); + + option = replaceAll("[$CodItem]", item.IdDocumentoTecnico, option); + + var stateIcon = $("#ucItemsIcon").html(); + + 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); + } + 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.column(1).visible(false); + TableItems.row.add([stateIcon, + item.IdDocumentoTecnico, + item.Descripcion, + option]).draw(); + + }); + + ENDREQUEST(); +} + +this.ObtenerDocumentoTecnico = function () { + + var uri = CatalogosWCF + '/api/ObtenerDocumentoTecnico'; + AjaxPostData(uri, null, false, false, CargarGridDocumentoTecnico, null, null); + +} + +this.EditarItem = function (id) { + + TableItems = $('#TableItems').DataTable(); + LimpiarControles(); + var indexes = getRowIndex(TableItems, id_column, id); + + if (indexes != null) { + + $('#hiddenId').val(id) + $('#txtDescripcion').val(TableItems.cell(indexes, 2).data()); + + $("#formCatalogo").validateElement("#txtDescripcion"); + + $('#lbTituloAccion').empty(); + $('#lbTituloAccion').append('Editar Valor de Campo ID: ' + id); + + $('#btnInsertar').hide(); + $('#btnGuardar').show(); + } +} + +this.toggleEnabledItem = function (id, value) { + + var msg = '¿Está seguro que desea habilitar el Documento Técnico ?'; + + if (value == 0) { + msg = '¿Está seguro que desea deshabilitar el Documento Técnico ?'; + } + + if (id == null || value == null) { + toastr.warning("No se pudo obtener el ID del Documento Técnico seleccionado."); + return; + } + + if (!confirm(msg)) + { return; } + + TableItems = $('#TableItems').DataTable(); + + DocumentoTecnico = { + IdDocumentoTecnico: id, + Estado: value + } + + var uri = CatalogosWCF + '/api/InsertarActualizarContenido'; + AjaxPostData(uri, DocumentoTecnico, true, true, CompletarAccion, null, null); +} + +this.ActualizarItem = function () { + + if (!$("#formCatalogo").valid()) { + toastr.warning("Ingresar todos los campos que son requeridos."); + return false; + } + + if (!confirm("Se guardarán los cambios.\n ¿Desea continuar?")) + { return; } + + TableItems = $('#TableItems').DataTable(); + + DocumentoTecnico = { + IdDocumentoTecnico: $('#hiddenId').val(), + Descripcion: $('#txtDescripcion').val() + + } + + var uri = CatalogosWCF + '/api/InsertarActualizarDocumentoTecnico'; + AjaxPostData(uri, DocumentoTecnico, true, true, CompletarAccion, null, null); +} + +this.InsertarItem = function () { + + + if (!$("#formCatalogo").valid()) { + toastr.warning("Ingresar todos los campos que son requeridos."); + return false; + } + + if (!confirm("Va a ingresar un nuevo Documento Técnico .\n ¿Desea continuar?")) + { return; } + + + TableItems = $('#TableItems').DataTable(); + DocumentoTecnico = { + Estado: 1, + Descripcion: $("#txtDescripcion").val() + } + + var uri = CatalogosWCF + '/api/InsertarActualizarDocumentoTecnico'; + AjaxPostData(uri, DocumentoTecnico, true, true, CompletarAccion, null, null); + +} + +this.CompletarAccion = function () { + $('#btnGuardar').hide(); + $('#btnInsertar').show(); + + TableItems.clear().draw(); + ObtenerDocumentoTecnico(); + LimpiarControles(); + ENDREQUEST(); +} + +this.LimpiarControles = function () { + + $('#txtDescripcion').val(''); + $("#formCatalogo").validateElement("#txtDescripcion"); + + $('#lbTituloAccion').empty(); + $('#lbTituloAccion').append('Ingresar Nuevo Documento Técnico'); +} + + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js new file mode 100644 index 000000000..976fcc5a0 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js @@ -0,0 +1,200 @@ +var DataCatalogo; +var id_column = 1; +var Item = {}; + + +jQuery(document).ready(function () { + + getDataModel(); + +}); + +this.getDataModel = function () { + + $('#txtDescripcion').attr('size', 50); + + $('#btnGuardar').hide(); + $('#btnInsertar').show(); + + + $('#btnLimpiarControles').click(function () { + LimpiarControles(); + + $('#btnGuardar').hide(); + $('#btnInsertar').show(); + }); + + $('#btnGuardar').click(function () { + ActualizarItem(); + }); + + $('#btnInsertar').click(function () { + InsertarItem(); + }); + + + $('#TableItems').TableInit(0, false, true, true, false, null, null); + ObtenerPalabraClave(); + +} + +this.CargarGridPalabraClave = function (data) { + + var TableItems = $('#TableItems').DataTable(); + var lista = data; + + $.each(lista, function (key, item) { + + var option = $("#ucItemsCatalogo").html(); + + option = replaceAll("[$CodItem]", item.IdPalabraClave, option); + + var stateIcon = $("#ucItemsIcon").html(); + + 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); + } + 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.column(1).visible(false); + TableItems.row.add([stateIcon, + item.IdPalabraClave, + item.Descripcion, + option]).draw(); + + }); + + ENDREQUEST(); +} + +this.ObtenerPalabraClave = function () { + + var uri = CatalogosWCF + '/api/ObtenerPalabraClave'; + AjaxPostData(uri, null, false, false, CargarGridPalabraClave, null, null); + +} + +this.EditarItem = function (id) { + + TableItems = $('#TableItems').DataTable(); + LimpiarControles(); + var indexes = getRowIndex(TableItems, id_column, id); + + if (indexes != null) { + + $('#hiddenId').val(id) + $('#txtDescripcion').val(TableItems.cell(indexes, 2).data()); + + $("#formCatalogo").validateElement("#txtDescripcion"); + + $('#lbTituloAccion').empty(); + $('#lbTituloAccion').append('Editar Valor de Campo ID: ' + id); + + $('#btnInsertar').hide(); + $('#btnGuardar').show(); + } +} + +this.toggleEnabledItem = function (id, value) { + + var msg = '¿Está seguro que desea habilitar la Palabra Clave ?'; + + if (value == 0) { + msg = '¿Está seguro que desea deshabilitar la Palabra Clave?'; + } + + if (id == null || value == null) { + toastr.warning("No se pudo obtener el ID de la Palabra clave seleccionada."); + return; + } + + if (!confirm(msg)) + { return; } + + TableItems = $('#TableItems').DataTable(); + + PalabraClave = { + IdPalabraClave: id, + Estado: value + } + + var uri = CatalogosWCF + '/api/InsertarActualizarContenido'; + AjaxPostData(uri, PalabraClave, true, true, CompletarAccion, null, null); +} + +this.ActualizarItem = function () { + + if (!$("#formCatalogo").valid()) { + toastr.warning("Ingresar todos los campos que son requeridos."); + return false; + } + + if (!confirm("Se guardarán los cambios.\n ¿Desea continuar?")) + { return; } + + TableItems = $('#TableItems').DataTable(); + + PalabraClave = { + IdPalabraClave: $('#hiddenId').val(), + Descripcion: $('#txtDescripcion').val() + + } + + var uri = CatalogosWCF + '/api/InsertarActualizarPalabraClave'; + AjaxPostData(uri, PalabraClave, true, true, CompletarAccion, null, null); +} + +this.InsertarItem = function () { + + + if (!$("#formCatalogo").valid()) { + toastr.warning("Ingresar todos los campos que son requeridos."); + return false; + } + + if (!confirm("Va a ingresar una nueva Palabra Clave .\n ¿Desea continuar?")) + { return; } + + + TableItems = $('#TableItems').DataTable(); + PalabraClave = { + Estado: 1, + Descripcion: $("#txtDescripcion").val() + } + + var uri = CatalogosWCF + '/api/InsertarActualizarPalabraClave'; + AjaxPostData(uri, PalabraClave, true, true, CompletarAccion, null, null); + +} + +this.CompletarAccion = function () { + $('#btnGuardar').hide(); + $('#btnInsertar').show(); + + TableItems.clear().draw(); + ObtenerPalabraClave(); + LimpiarControles(); + ENDREQUEST(); +} + +this.LimpiarControles = function () { + + $('#txtDescripcion').val(''); + $("#formCatalogo").validateElement("#txtDescripcion"); + + $('#lbTituloAccion').empty(); + $('#lbTituloAccion').append('Ingresar Nueva Palabra Clave'); +} + + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml new file mode 100644 index 000000000..1442b7c07 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml @@ -0,0 +1,107 @@ +@{ + ViewBag.Title = "Contenido"; + Layout = "~/Views/Shared/_Layout.cshtml"; + +} + + + + Documento Técnico + + + + + + + + + + + + ID + Descripción + @*Tipo Emisor*@ + + + + + + + + + + + + + + Opciones + + + Editar + [$opcion] + + + + + + + + + + + Ingresar Nuevo Documento Técnico + + + + + @*Descripción*@ + + + + + Descripción + + + + + + + + + + + Limpiar + + + + + + + Insertar + + + Guardar + + + + + + + + + + + + + + + + +@Scripts.Render("~/Sinort-Scripts/DocumentoTecnico.js") + + + + + + + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml new file mode 100644 index 000000000..f4fb34cab --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml @@ -0,0 +1,107 @@ +@{ + ViewBag.Title = "Contenido"; + Layout = "~/Views/Shared/_Layout.cshtml"; + +} + + + + Palabra Clave + + + + + + + + + + + + ID + Descripción + @*Tipo Emisor*@ + + + + + + + + + + + + + + Opciones + + + Editar + [$opcion] + + + + + + + + + + + Ingresar Nueva Palabra Clave + + + + + @*Descripción*@ + + + + + Descripción + + + + + + + + + + + Limpiar + + + + + + + Insertar + + + Guardar + + + + + + + + + + + + + + + + +@Scripts.Render("~/Sinort-Scripts/PalabraClave.js") + + + + + + +