This commit is contained in:
jmoya 2018-08-01 14:15:24 +00:00
parent 4f2a0a71a1
commit 23356103f3

View file

@ -5,9 +5,9 @@ var Titulo;
jQuery(document).ready(function () { jQuery(document).ready(function () {
getDataModel(); getDataModel();
}); });
@ -23,8 +23,9 @@ this.getDataModel = function () {
this.CrearEncuesta = function (data) { this.CrearEncuesta = function (data) {
var body = data.questions; var body = data.questions;
var survey = new Survey.Survey(); var survey = new Survey.Survey();
survey.locale = "es"; survey.locale = "es";
survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion; survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion;
survey.showProgressBar = "top"; survey.showProgressBar = "top";
@ -34,7 +35,7 @@ this.CrearEncuesta = function (data) {
$.each(body, function (key, item) { $.each(body, function (key, item) {
if (key % 3 == 0) if (key % 3 == 0)
page = survey.addNewPage("page_"+ ( key + 1 )); page = survey.addNewPage("page_" + (key + 1));
var q = page.addNewQuestion(item.type, item.title) var q = page.addNewQuestion(item.type, item.title)
@ -46,15 +47,47 @@ this.CrearEncuesta = function (data) {
q.colCount = 3; q.colCount = 3;
} }
if (item.type == "rating") if (item.type == "rating") {
{ q.minRateDescription = item.mininumRateDescription,
q.mininumRateDescription = item.RangoMinimo; q.maxRateDescription = item.maximumRateDescription
q.maximumRateDescription = item.RangoMaximo;
} }
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; 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({ $("#surveyElement").Survey({
model: survey model: survey
@ -131,7 +164,7 @@ this.CrearEncuesta = function (data) {
// title: "Digite un comentario" // title: "Digite un comentario"
// } // }
// ] // ]
// }, // },
// { // {
@ -217,7 +250,7 @@ this.CrearEncuesta = function (data) {
// ] // ]
// }; // };
//if (!window["%hammerhead%"]) { //if (!window["%hammerhead%"]) {
// init(); // init();
//} //}