From 99025af4e6497cfe111cd7ce5c9be13ab05fdce0 Mon Sep 17 00:00:00 2001 From: jmoya Date: Fri, 20 Jul 2018 18:46:23 +0000 Subject: [PATCH] Gotitas normativas git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C316 --- AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs | 10 ++ AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs | 49 ++++++ .../AYA.SlnSynor/AYA.SlnSinort.csproj | 4 + .../Controllers/HomeController.cs | 14 +- .../AYA.SlnSynor/Sinort-Scripts/Global.js | 27 +++ .../Sinort-Scripts/GotitasNormativas.js | 1 + .../Sinort-Scripts/GotitasPendientes.js | 88 ++++++++++ .../Views/Home/GotitasNormativas.cshtml | 158 ++++++++++++++++++ .../Views/Home/GotitasPendientes.cshtml | 105 ++++++++++++ .../AYA.SlnSynor/Views/Shared/_Layout.cshtml | 19 ++- .../AYA.SlnSinortModel.DAL.csproj | 1 + .../Sinort/GotitasNormativasDAL.cs | 115 +++++++++++++ .../AYA.SlnSynorModel/Entidades/Json.cs | 2 +- 13 files changed, 587 insertions(+), 6 deletions(-) create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasNormativas.js create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasPendientes.js create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasNormativas.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasPendientes.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/GotitasNormativasDAL.cs diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs index 6d6ac8460..d7243a4ce 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs @@ -80,6 +80,16 @@ namespace AYA.SlnSinort.WCF NotificacionesJSON ObtenerCantidadTareasPendientes(NotificacionesJSON model); #endregion + #region Gotitas Normativas + [OperationContract] + List ObtenerGotitasPendientes(CatalogosPostJSON model); + + [OperationContract] + BaseJson InsertarGotitasNormativas(GotitasNormativas model); + + [OperationContract] + NotificacionesJSON ObtenerCantidadGotitasPendientes(NotificacionesJSON model); + #endregion #region Login [OperationContract] diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs index c61f64562..72a183f7e 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs @@ -572,6 +572,55 @@ namespace AYA.SlnSinort.WCF #endregion + #region Gotitas Normativas + public List ObtenerGotitasPendientes(CatalogosPostJSON model) + { + List respuesta = null; + try + { + respuesta = new GotitasNormativasDAL().ObtenerGotitasPendientes(model); + } + catch (Exception ex) + { + log.Error(ex); + } + return respuesta; + } + + public BaseJson InsertarGotitasNormativas(GotitasNormativas model) + { + BaseJson respuesta = new BaseJson(); + try + { + respuesta = new GotitasNormativasDAL().InsertarGotitasNormativas(model); + } + catch (Exception ex) + { + + log.Error(ex); + } + return respuesta; + } + + + public NotificacionesJSON ObtenerCantidadGotitasPendientes(NotificacionesJSON model) + { + + try + { + model = new GotitasNormativasDAL().ObtenerCantidadGotitasPendientes(model); + } + catch (Exception ex) + { + log.Error(ex); + } + + + return model; + } + + #endregion + #region Login public LoginJSON ObtenerUsuarioAD(LoginJSON model) diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index 0c6722141..2632d087b 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7335,6 +7335,8 @@ + + @@ -7436,6 +7438,8 @@ Designer + + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Controllers/HomeController.cs b/AYA.SlnSynor/AYA.SlnSynor/Controllers/HomeController.cs index e1c903e47..1f3983773 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Controllers/HomeController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/Controllers/HomeController.cs @@ -32,7 +32,17 @@ namespace AYA.SlnSinort.Controllers InitControllers(); return View(); } - - + + public ActionResult GotitasPendientes() + { + InitControllers(); + return View(); + } + + public ActionResult GotitasNormativas() + { + InitControllers(); + return View(); + } } } \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js index 720d880f1..aa3c1eacb 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js @@ -1687,6 +1687,18 @@ this.ObtenerCantidadTareasPendientes = function () { AjaxPostData(uri, model, true, null, DibujarTareasPendientes, null, true); +} + +this.ObtenerCantidadGotitasPendientes = function () { + + var uri = SinortWCF + '/api/ObtenerCantidadGotitasPendientes'; + + var model = { + codigo: UsuarioSistema + } + AjaxPostData(uri, model, true, null, DibujarGotitasPendientes, null, true); + + } this.DibujarTareasPendientes = function (data) { @@ -1704,6 +1716,21 @@ this.DibujarTareasPendientes = function (data) { ENDREQUEST(); } +this.DibujarGotitasPendientes = function (data) { + var gotitas; + gotitas = $("#ucGotitasPendientes").html(); + gotitas = replaceAll('[$0]', data.GotitasNormativas, gotitas); + $('#numGotitasPendientes').empty(); + $('#numGotitasPendientes').append(gotitas); + + gotitas = $("#ucGotitasPendientesHeader").html(); + gotitas = replaceAll('[$0]', data.GotitasNormativas, gotitas); + $('#numGotitasPendientesHeader').empty(); + $('#numGotitasPendientesHeader').append("Tienes " + gotitas + " gotita(s) pendiente(s)"); + + ENDREQUEST(); +} + this.ValidarPermisos = function (opcion) { var validar; validar = $.grep(localStorage['ListaOpciones'].split(","), function (data) { diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasNormativas.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasNormativas.js new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasNormativas.js @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasPendientes.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasPendientes.js new file mode 100644 index 000000000..ced3166b2 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GotitasPendientes.js @@ -0,0 +1,88 @@ + +var model = {}; +var InfoIdGotitaNormativa; +var InfoINombre; +var InfoIDescripcion; +var InfoIFechaCaducidad; + +jQuery(document).ready(function () { + + $('#tableGotitasPendientes').TableInit(0, false, true, true, false, null, null); + $('#tableGotitasPendientes').DataTable().column(0).visible(false); + $('#tableGotitasPendientes').DataTable().column(3).visible(false); + getDataModel(); + +}); +this.getDataModel = function () { + CargarGotitasPendientes(); + $("#btnAgregarNuevaGotita").unbind("click"); + $("#btnAgregarNuevaGotita").click(function () { + RedireccionarGotita(); + }); +} + +this.CargarGotitasPendientes = function () { + + var uri = SinortWCF + '/api/ObtenerGotitasPendientes'; + + var model = { + codigo: 'josnunez' + } + + + AjaxPostData(uri, model, true, false, CargarTablaGotitasPendientes, null, null); +} + +this.CargarTablaGotitasPendientes = function (data) { + + var tableGotitasPendientes = $('#tableGotitasPendientes').DataTable(); + tableGotitasPendientes.clear().draw(); + var lista = data; + + $.each(lista, function (key, item) { + + + var option2 = $("#ucbtnVer").html(); + + tableGotitasPendientes.row.add([item.IdGotitaNormativa, + item.Nombre, + DateFormatNoTime(item.FechaCaducidad), + item.Descripcion, + option2]).draw(); + + }); + + ENDREQUEST(); + +} +this.RedireccionarGotita = function () +{ + url = $("#hiddenHref").val(); + url = url.replace("View", "GotitasNormativas"); + url = url.replace("Controller", "Home"); + document.location.href = url; +} +$('#tableGotitasPendientes').on('click', 'button', function () { + + var data = $('#tableGotitasPendientes').DataTable().row($(this).parents('tr')).data(); + + InfoIdGotitaNormativa = data[0]; + InfoINombre = data[1]; + InfoIDescripcion = data[3]; + InfoIFechaCaducidad = data[2]; + + if (this.id == 'btnver') { + + var gotitas = $("#ucGotita").html(); + gotitas = replaceAll('[$Gotita]', InfoINombre, gotitas); + $('#gotitaVer').empty(); + $('#gotitaVer').append(gotitas); + + $('#modalVer').modal('show'); + + $('#txtTitulo').val(InfoINombre); + $('#txtAreaDescripcion').val(InfoIDescripcion); + $('#txtFechaCaducidad').val(InfoIFechaCaducidad); + } + +}); \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasNormativas.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasNormativas.cshtml new file mode 100644 index 000000000..ca301e6b7 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasNormativas.cshtml @@ -0,0 +1,158 @@ + +@{ + ViewBag.Title = "Gotitas Normativas"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + + +
+

   Gotita Normativa

+
+ +
+
+ + @*---------------------Titulo---------------------------------------------------------*@ +
+ +
+ +
+
+ + @*---------------------Cuerpo---------------------------------------------------------*@ +
+ +
+ +
+
+ + @*---------------------Fecha caducidad---------------------------------------------*@ +
+ + +
+ + +
+
+ + @*---------------------Documento Adjunto---------------------------------------------------------*@ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ + + + + +@section Modals{ + + @*---------------------Adjuntar documentos ---------------------------------------------------------*@ + + +} + +@Scripts.Render("~/Sinort-Scripts/GotitasNormativas.js") + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasPendientes.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasPendientes.cshtml new file mode 100644 index 000000000..8c97b5716 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Home/GotitasPendientes.cshtml @@ -0,0 +1,105 @@ + +@{ + ViewBag.Title = "Gotitas Pendientes"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + + +
+ +

   Mis gotitas pendientes

+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + +
+ +
+ + + +
+
+
+
+ + + +@section Modals{ + +@*---------------------Ver Gotita---------------------------------------------------------*@ + +} + +@Scripts.Render("~/Sinort-Scripts/GotitasPendientes.js") \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml index 1c9ff803e..6b12ea08a 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml @@ -79,12 +79,12 @@ - 0 + [$0] @@ -238,6 +238,18 @@ + + + +