diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs index cffa25169..3b4167336 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs @@ -124,14 +124,20 @@ namespace AYA.SlnSinort.WCF #endregion #region Encuestas - [OperationContract] - List ObtenerDetalleEncuesta(); + //[OperationContract] + //List ObtenerDetalleEncuesta(); [OperationContract] EncuestaJSON GuardarPregunta(EncuestaJSON model); [OperationContract] EncuestaJSON ObtenerEncuestas(EncuestaJSON model); + + [OperationContract] + EncuestaJSON ObtenerEncabezadoEncuesta(EncuestaJSON model); + [OperationContract] + EncuestaJSON ObtenerDetalleEncuesta(EncuestaJSON model); + #endregion } diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs index b5faed845..b16fa19ec 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs @@ -1057,20 +1057,49 @@ namespace AYA.SlnSinort.WCF #endregion #region Encuesta - public List ObtenerDetalleEncuesta() - { - List respuesta = null; + + public EncuestaJSON ObtenerEncabezadoEncuesta(EncuestaJSON model) { + EncuestaJSON registros = new EncuestaJSON(); try { - respuesta = new EncuestaDAL().ObtenerDetalleEncuesta(); - + registros = new EncuestaDAL().ObtenerEncabezadoEncuesta(model); } catch (Exception ex) { + registros.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; log.Error(ex); } - return respuesta; + return registros; } + public EncuestaJSON ObtenerDetalleEncuesta(EncuestaJSON model) + { + + try + { + model = new EncuestaDAL().ObtenerDetalleEncuesta(model); + + } + catch (Exception ex) + { + model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + log.Error(ex); + } + return model; + } + //public List ObtenerDetalleEncuesta() + //{ + // List respuesta = null; + // try + // { + // respuesta = new EncuestaDAL().ObtenerDetalleEncuesta(); + + // } + // catch (Exception ex) + // { + // log.Error(ex); + // } + // return respuesta; + //} public EncuestaJSON GuardarPregunta(EncuestaJSON model) { diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index 610de2d17..81172df5e 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7405,6 +7405,7 @@ + @@ -7525,6 +7526,7 @@ + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs b/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs index 7307b244f..2fb8acc2d 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs @@ -55,5 +55,10 @@ namespace AYA.SlnSinort.Controllers.NormativaReglamentacionTecnica InitControllers(); return View(); } + public ActionResult MisEncuestas() + { + 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 50b5b3a27..b62950d79 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/Scripts/survey.jquery.js b/AYA.SlnSynor/AYA.SlnSynor/Scripts/survey.jquery.js index a7b416125..cf277d5e4 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Scripts/survey.jquery.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Scripts/survey.jquery.js @@ -20725,18 +20725,18 @@ var SurveyTemplateText = /** @class */ (function () { //Uncomment this line on creating a translation file //import { surveyLocalization } from "../surveyStrings"; var englishStrings = { - pagePrevText: "Previous", - pageNextText: "Next", + pagePrevText: "Anterior", + pageNextText: "Siguiente", completeText: "Complete", startSurveyText: "Start", otherItemText: "Other (describe)", noneItemText: "None", - progressText: "Page {0} of {1}", + progressText: "Pagina {0} de {1}", emptySurvey: "There is no visible page or question in the survey.", completingSurvey: "Thank you for completing the survey!", completingSurveyBefore: "Our records show that you have already completed this survey.", loadingSurvey: "Survey is loading...", - optionsCaption: "Choose...", + optionsCaption: "Seleccione una opción...", value: "value", requiredError: "Please answer the question.", requiredErrorInPanel: "Please answer at least one question.", diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/MisEncuestas.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/MisEncuestas.js new file mode 100644 index 000000000..de315212e --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/MisEncuestas.js @@ -0,0 +1,72 @@ +var Item = {}; +var data; + +jQuery(document).ready(function () { + + CargarEncuestas(); +}); + +this.CargarEncuestas = function () { + + var uri = SinortWCF + '/api/ObtenerEncabezadoEncuesta'; + var model = { + UsuarioSistema: UsuarioSistema + } + AjaxPostData(uri, model, false, false, CargarTablaEncuestas, null, null); +} + +this.CargarTablaEncuestas = function (data) { + + if (data != null && data.UsuariosEncuestas != null) { + Encuesta = data.UsuariosEncuestas; + var Seleccionar = $("#ucbtnRespuesta").html(); + + + var columnDefinition = [ + { "data": 'IdEncabezadoEncuesta', "visible": false }, + { "data": "EncabezadoEncuesta.Descripcion" }, + { "data": null, className: "center", defaultContent: Seleccionar } + ]; + + $('#tableEncuestas').DataTable({ + + initComplete: function () { + + $('#tableEncuestas').TableInit(1, false, true, true, true, columnDefinition, Encuesta); + } + }); + + if ($.fn.DataTable.isDataTable('#tableEncuestas')) { + + $('#tableEncuestas').DataTable().search('').draw(); + ENDREQUEST(); + } + + } +} + +$('#tableEncuestas').on('click', 'button', function () { + + + var data = $('#tableEncuestas').DataTable().row($(this).parents('tr')).data(); + + //if (data.PromotorProyecto != UsuarioSistema) { + + // if (ValidarPermisos('Accesar expediente de propuesta normativa').length <= 0 || data.IdEstado == Estados.Contruccion.Codigo) { + // toastr.warning(Message_NoGrants, Message_Warning); + // return; + // } + + + //} + + url = $("#hiddenHref").val(); + url = url.replace("View", "ResponderEncuesta"); + url = url.replace("Controller", "NormativaReglamentacionTecnica"); + url = url.replace("[$ID]", ROT47(data.IdEncabezadoEncuesta.toString())); + + + + document.location.href = url; + +}); diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js index 41a04dc7c..36d531530 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js @@ -1,152 +1,214 @@ var model = {}; +var EncuestaId; +var Titulo; + jQuery(document).ready(function () { - init(); - + + getDataModel(); + }); -function init() { - var json = { - title: "Primera Encuesta", - showProgressBar: "top", - pages: [ - { - questions: [ - { - type: "boolean", - name: "bool", - title: "Please answer the question digite ", - label: "Trabaja en el AYA?", - isRequired: true - }, - { - type: "checkbox", - name: "car", - title: "Cual es su Vehículo?", - isRequired: true, - hasNone: true, - colCount: 4, - choices: [ - "Ford", - "Vauxhall", - "Volkswagen", - "Nissan", - "Audi", - "Mercedes-Benz", - "BMW", - "Peugeot", - "Toyota", - "Citroen" - ] - }, - { - type: "comment", - name: "suggestions", - title: "Digite un comentario" - } +this.getDataModel = function () { + EncuestaId = (IsNullOrEmpty(ObtenerParametros().encuestaid)) ? '' : ROT47(ObtenerParametros().encuestaid); - - ] - }, - { - questions: [ - { - type: "dropdown", - name: "car", - title: "Cual es su Vehículo?", - isRequired: true, - colCount: 0, - choices: [ - "None", - "Ford", - "Vauxhall", - "Volkswagen", - "Nissan", - "Audi", - "Mercedes-Benz", - "BMW", - "Peugeot", - "Toyota", - "Citroen" - ] - }, + var uri = SinortWCF + '/api/ObtenerDetalleEncuesta'; + var model = { + IdEncabezadoEncuesta: EncuestaId + } + AjaxPostData(uri, model, false, false, CrearEncuesta, null, null); +} - { - type: "matrix", - name: "Quality", - title: - "Por favor indique su nivel de satisfacción con las siguintes preguntas", - columns: [ - { value: 1, text: "Totalmente desacuerdo" }, - { value: 2, text: "Desacuerdo" }, - { value: 3, text: "Neutral" }, - { value: 4, text: "Deacuerdo" }, - { value: 5, text: "Totalmente Deacuerdo" } - ], - rows: [ - { value: "affordable", text: "Fácil de usar" }, - { - value: "does what it claims", - text: "Mejor que los demás" - } - ] - }, - { - type: "radiogroup", - name: "price to competitors", - title: "Comparando el producto es", - choices: [ - "Más caro", - "El mismo precio", - "Más barato", - "No estoy seguro" - ] - } +this.CrearEncuesta = function (data) { + var body = data.questions; + + var survey = new Survey.Survey(); + survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion; + survey.showProgressBar = "top"; - ] - }, - { - questions: [ - { - type: "rating", - name: "satisfaction", - title: "Cual es su nivel de satisfacción?", - mininumRateDescription: "No satisfecho", - maximumRateDescription: "Completamente satisfecho" - }, - //{ - // type: "rating", - // name: "recommend friends", - // visibleIf: "{satisfaction} > 3", - // title: - // "How likely are you to recommend the Product to a friend or co-worker?", - // mininumRateDescription: "Will not recommend", - // maximumRateDescription: "I will recommend" - //}, - { - name: "name", - type: "text", - title: "Cual es su nombre:", - isRequired: true - } - ] - } - ] - }; + var page = {}; - window.survey = new Survey.Model(json); - survey.onComplete.add(function (result) { - document.querySelector("#surveyResult").innerHTML = - "result: " + JSON.stringify(result.data); + $.each(body, function (key, item) { + + if (key % 3 == 0) + page = survey.addNewPage("page_"+ ( key + 1 )); + + + var q = page.addNewQuestion(item.type, item.title) + + if (item.type == "dropdown" || item.type == "radiogroup" || item.type == "checkbox") { + q.choices = item.choices + if (q.choices.length % 3 == 0 && q.choices.length > 4) + q.colCount = 3 + } + + }); $("#surveyElement").Survey({ model: survey }); + + //var json = { + // title: data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion, + // showProgressBar: "top", + // pages: [ + // { + // questions: [ + // { + // type: "boolean", + // name: "bool", + // title: "Please answer the question digite ", + // label: "Trabaja en el AYA?", + // isRequired: true + // } + // ] + // } + // ] + //}; + //window.survey = new Survey.Model(json); + //survey.onComplete.add(function (result) { + // document.querySelector("#surveyResult").innerHTML = + // "result: " + JSON.stringify(result.data); + //}); + + //$("#surveyElement").Survey({ + // model: survey + //}); } -if (!window["%hammerhead%"]) { - init(); -} \ No newline at end of file + + + +//function init() { +// var json = { +// title: "Primera Encuesta", +// showProgressBar: "top", +// pages: [ +// { +// questions: [ +// { +// type: "boolean", +// name: "bool", +// title: "Please answer the question digite ", +// label: "Trabaja en el AYA?", +// isRequired: true +// }, +// { +// type: "checkbox", +// name: "car", +// title: "Cual es su Vehículo?", +// isRequired: true, +// hasNone: true, +// colCount: 4, +// choices: [ +// "Ford", +// "Vauxhall", +// "Volkswagen", +// "Nissan", +// "Audi", +// "Mercedes-Benz", +// "BMW", +// "Peugeot", +// "Toyota", +// "Citroen" +// ] +// }, +// { +// type: "comment", +// name: "suggestions", +// title: "Digite un comentario" +// } + + +// ] +// }, +// { +// questions: [ +// { +// type: "dropdown", +// name: "car", +// title: "Cual es su Vehículo?", +// isRequired: true, +// colCount: 0, +// choices: [ +// "None", +// "Ford", +// "Vauxhall", +// "Volkswagen", +// "Nissan", +// "Audi", +// "Mercedes-Benz", +// "BMW", +// "Peugeot", +// "Toyota", +// "Citroen" +// ] +// }, + +// { +// type: "matrix", +// name: "Quality", +// title: +// "Por favor indique su nivel de satisfacción con las siguintes preguntas", +// columns: [ +// { value: 1, text: "Totalmente desacuerdo" }, +// { value: 2, text: "Desacuerdo" }, +// { value: 3, text: "Neutral" }, +// { value: 4, text: "Deacuerdo" }, +// { value: 5, text: "Totalmente Deacuerdo" } +// ], +// rows: [ +// { value: "affordable", text: "Fácil de usar" }, +// { value: "does what it claims",text: "Mejor que los demás"} +// ] +// }, +// { +// type: "radiogroup", +// name: "price to competitors", +// title: "Comparando el producto es", +// choices: [ +// "Más caro", +// "El mismo precio", +// "Más barato", +// "No estoy seguro" +// ] +// } + +// ] +// }, +// { +// questions: [ +// { +// type: "rating", +// name: "satisfaction", +// title: "Cual es su nivel de satisfacción?", +// mininumRateDescription: "No satisfecho", +// maximumRateDescription: "Completamente satisfecho" +// }, +// //{ +// // type: "rating", +// // name: "recommend friends", +// // visibleIf: "{satisfaction} > 3", +// // title: +// // "How likely are you to recommend the Product to a friend or co-worker?", +// // mininumRateDescription: "Will not recommend", +// // maximumRateDescription: "I will recommend" +// //}, +// { +// name: "name", +// type: "text", +// title: "Cual es su nombre:", +// isRequired: true +// } +// ] +// } +// ] +// }; + + +//if (!window["%hammerhead%"]) { +// init(); +//} \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisEncuestas.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisEncuestas.cshtml new file mode 100644 index 000000000..caca79a83 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisEncuestas.cshtml @@ -0,0 +1,45 @@ + +@{ + ViewBag.Title = "MisEncuestas"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + + + +
+ +

   Mis Encuestas

+
+
+
+
+ + + + + + + + + + +
+ +
+ +
+
+ + +
+ +
+ + +@section scripts{ + + @Scripts.Render("~/Sinort-Scripts/NormativaReglamentacionTecnica/MisEncuestas.js") + +} diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/ResponderEncuesta.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/ResponderEncuesta.cshtml index bfa185ae5..25dafe3b1 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/ResponderEncuesta.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/ResponderEncuesta.cshtml @@ -14,7 +14,7 @@
-
+