diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs index 46e43ead0..760ec3ef5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs @@ -48,8 +48,17 @@ namespace AYA.SlnSinort.WCF #region Pantallas [OperationContract] - List ObtenerPantallas(Usuario model); + List ObtenerPantallas(CatalogosPostJSON model); + + [OperationContract] + List ObtenerPantallasRol(CatalogosPostJSON model); + #endregion + #region RolesPantallas + [OperationContract] + RolesPantallasJSON InsertarActualizarRolesPantallas(RolesPantallasJSON model); + #endregion + } } diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs index fed42f71b..7eb5695d5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs @@ -132,7 +132,7 @@ namespace AYA.SlnSinort.WCF #endregion #region Pantallas - public List ObtenerPantallas(Usuario model) + public List ObtenerPantallas(CatalogosPostJSON model) { List respuesta = new List(); try @@ -146,6 +146,33 @@ namespace AYA.SlnSinort.WCF } return respuesta; } + + public List ObtenerPantallasRol(CatalogosPostJSON model) + { + return new PantallasDAL().ObtenerPantallasRol(model); + } + #endregion + + #region RolesPantallas + + public RolesPantallasJSON InsertarActualizarRolesPantallas(RolesPantallasJSON model) + { + var rolesDAL = new RolesDAL(); + try + { + foreach(var rolPantalla in model.ListaRolesPantallas) + rolesDAL.InsertarActualizarRolesPantallas(rolPantalla); + + model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO; + } + catch (Exception ex) + { + model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + throw; + } + + return model; + } #endregion } diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index 4e3aaac17..e181f82f9 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7680,7 +7680,6 @@ - Web.config @@ -7712,7 +7711,6 @@ - diff --git a/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css b/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css index f5bf1ebfd..1fe4b8baf 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css +++ b/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css @@ -27,6 +27,7 @@ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); filter: alpha(opacity=80); } + .toast-close-button:hover, .toast-close-button:focus { color: #000000; diff --git a/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js b/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js index 6ec38e427..27444dbe2 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/Rol.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js index 90f2e52da..271360696 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js @@ -1,7 +1,7 @@ //$("#formCatalogo").EnableValidationToolTip(); var DataCatalogo; var id_column = 1; -var Item = {}; +var model = {}; //#region READY @@ -40,8 +40,9 @@ this.getDataModel = function () { }); $('#TableItems').TableInit(0, false, true, true, false, null, null); + $('#GridRolesPantallas').TableInit(0, false, true, true, false, null, null); ObtenerRoles(); - + } this.CargarGridRoles = function (data) { @@ -56,6 +57,7 @@ this.CargarGridRoles = function (data) { var pantallas = $("#ucbtnVistaPantallas").html(); var usuarios = $("#ucbtnVistaUsuarios").html(); option = replaceAll("[$CodItem]", item.IdRol, option); + pantallas = replaceAll("[$CodItem]", item.IdRol, pantallas); var stateIcon = $("#ucItemsIcon").html(); @@ -216,33 +218,82 @@ this.LimpiarControles = function () { $('#lbTituloAccion').append('Ingresar Nuevo Rol'); } -this.AbrirRolesPantallas = function () { +this.AbrirRolesPantallas = function (id) { $("#modalRolesPantallas").modal('show'); - CargarPantallas(); + CargarPantallas(id); } -this.CargarPantallas = function () { +this.CargarPantallas = function (id) { + + $('#hiddenIdRol').val(id) + var uri = CatalogosWCF + '/api/ObtenerPantallasRol'; + model = { + codigo: id + }; + + AjaxPostData(uri, model, true, false, CargarTablaPantallas, null, null); - var uri = CatalogosWCF + '/api/ObtenerPantallas'; - AjaxPostData(uri, Item, true, false, CargarTablaPantallas, null, null); } this.CargarTablaPantallas = function (data) { - if (data != null) { - lista = data; - var Seleccionar = $("#ucbtnCheck").html(); - var columnDefinition = [ - { "data": "Descripcion" }, - { "data": null, className: "center", defaultContent: Seleccionar } - ]; + var TableItems = $('#GridRolesPantallas').DataTable(); + TableItems.clear().draw(); + var lista = data; + + $.each(lista, function (key, item) { + + var pantallas = $("#ucbtnCheck").html(); + var id = item.IdPantalla; + + TableItems.row.add([id, + item.Descripcion, + '']).draw(); + }); + + ENDREQUEST(); + +} + +this.GuardarRolesPantallas = function () { + + if (!confirm("Va registrar las pantallas.\n ¿Desea continuar?")) + { return; } + + TablePantallas = $('#GridRolesPantallas').DataTable(); + var IdRoles = $('#hiddenIdRol').val(); + var ArrayRolesPantallas = []; + var data = TablePantallas + .rows() + .data(); + + $.each(data, function (key, item) { + + + var cheched = $("#chkSeleccionar_" + item[0]).prop("checked") ? true : false + + + RolesPantallas = { + IdRol: IdRoles, + IdPantalla: item[0], + Estado: cheched + + } + ArrayRolesPantallas.push(RolesPantallas); + }); + + var uri = CatalogosWCF + '/api/InsertarActualizarRolesPantallas'; + var model = { + ListaRolesPantallas: ArrayRolesPantallas + }; + + AjaxPostData(uri, model, true, true, null, null, null); + + + + ENDREQUEST(); + - $('#GridRolesPantallas').TableInit(1, true, true, true, true, columnDefinition, lista); - if ($.fn.DataTable.isDataTable('#GridRolesPantallas')) { - $('#GridRolesPantallas').DataTable().search('').draw(); - ENDREQUEST(); - } - } } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js deleted file mode 100644 index 989961ec7..000000000 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js +++ /dev/null @@ -1,46 +0,0 @@ - -var Item = {}; -jQuery(document).ready(function () { - CargarPantallas(); -}); - - -this.CargarPantallas = function () { - - var uri = CatalogosWCF + '/api/ObtenerPantallas'; - AjaxPostData(uri, Item, true, false, CargarTablaPantallas, null, null); -} - -this.CargarTablaPantallas = function (data) { - - if (data != null) { - lista = data; - var Seleccionar = $("#ucbtnVista").html(); - var columnDefinition = [ - { "data": "Descripcion" }, - { "data": null, className: "center", defaultContent: Seleccionar } - ]; - - $('#tablePantallas').TableInit(1, true, true, true, true, columnDefinition, lista); - - if ($.fn.DataTable.isDataTable('#tablePantallas')) { - - $('#tablePantallas').DataTable().search('').draw(); - ENDREQUEST(); - } - } -} - -$('#tablePantallas').on('click', 'button', function () { - - var data = $('#tablePantallas').DataTable().row($(this).parents('tr')).data(); - - var mtzView = data.Vista.split('/') - - url = $("#hiddenHref").val(); - url = url.replace("View", mtzView[1]); - url = url.replace("Controller", mtzView[0]); - - document.location.href = url; - -}); \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml index a0e08420b..5e0a973f6 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml @@ -7,11 +7,13 @@
+