From 23356103f34068013aac5ebb210043d68c19c9b6 Mon Sep 17 00:00:00 2001 From: jmoya Date: Wed, 1 Aug 2018 14:15:24 +0000 Subject: [PATCH] git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C367 --- .../ResponderEncuesta.js | 55 +++++++++++++++---- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js index 76b587cf6..dafb75f5a 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/ResponderEncuesta.js @@ -5,9 +5,9 @@ var Titulo; jQuery(document).ready(function () { - + getDataModel(); - + }); @@ -23,8 +23,9 @@ this.getDataModel = function () { this.CrearEncuesta = function (data) { var body = data.questions; - + var survey = new Survey.Survey(); + survey.locale = "es"; survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion; survey.showProgressBar = "top"; @@ -34,7 +35,7 @@ this.CrearEncuesta = function (data) { $.each(body, function (key, item) { if (key % 3 == 0) - page = survey.addNewPage("page_"+ ( key + 1 )); + page = survey.addNewPage("page_" + (key + 1)); var q = page.addNewQuestion(item.type, item.title) @@ -46,15 +47,47 @@ this.CrearEncuesta = function (data) { q.colCount = 3; } - if (item.type == "rating") - { - q.mininumRateDescription = item.RangoMinimo; - q.maximumRateDescription = item.RangoMaximo; + if (item.type == "rating") { + q.minRateDescription = item.mininumRateDescription, + q.maxRateDescription = item.maximumRateDescription } + if (item.type == "matrix") { + + + //q.columns = []; + $.each(item.columns, function (index, columna) { + + q.columns.value = columna; + q.columns.text = columna; + //var columna = { value: columna, text: columna }; + //q.columns.push(columna); + }); + + //q.rows = []; + $.each(item.rows, function (index, fila) { + q.rows.value = fila; + q.rows.text = fila; + //var fila = { value: fila, text: fila }; + //q.rows.push(fila); + }); + } + + q.name = item.name; q.isRequired = item.Requerido == true; - + }); + //var q = page.addNewQuestion("matrix", "Por favor indique su nivel de satisfacción con las siguintes preguntas") + // q.columns = [ + // { value: 1, text: "Totalmente desacuerdo" }, + // { value: 2, text: "Desacuerdo" } + // ], + // q.rows = [ + // { value: "affordable", text: "Fácil de usar" }, + // { value: "does what it claims",text: "Mejor que los demás"} + // ] + + $("#surveyElement").Survey({ model: survey @@ -131,7 +164,7 @@ this.CrearEncuesta = function (data) { // title: "Digite un comentario" // } - + // ] // }, // { @@ -217,7 +250,7 @@ this.CrearEncuesta = function (data) { // ] // }; - + //if (!window["%hammerhead%"]) { // init(); //} \ No newline at end of file