Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 242 | Rev 16822 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
66 efrain 1
<?php
2
use LeadersLinked\Model\CompanyService;
3
use LeadersLinked\Model\Company;
4
 
5
 
243 geraldo 6
//$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
7
//$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
66 efrain 8
 
86 steven 9
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
10
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
66 efrain 11
 
86 steven 12
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
13
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
14
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
15
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
88 steven 16
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
17
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
18
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
89 steven 19
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
90 steven 20
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
89 steven 21
 
66 efrain 22
$this->inlineScript()->captureStart();
23
echo <<<JS
84 steven 24
		const classFormGenerator = function() {
25
			this.id 				= 0,
26
			this.table				= '',
27
			this.name 				= '',
28
			this.text 				= '',
29
			this.status				= 'a',
30
			this.sections 			= [],
31
			this.clear = function()
32
			{
33
				this.sections = [];
34
				this.render();
35
			},
36
			this.renderSection = function(section_slug)
37
			{
38
 
39
				var s = '';
40
				for(i = 0; i < this.sections.length; i++)
41
				{
42
					if(section_slug !=  this.sections[i].slug) {
43
						continue;
44
					}
45
 
46
					$('span.section-name' + section_slug).html(this.sections[i].name);
47
 
48
					let table = 'table-section-question-option' + this.sections[i].slug;
49
					$('#' + table  + ' tbody').empty();
50
 
51
					s = '<tr class="tr-section" data-slug="' + this.sections[i].slug + '">';
97 steven 52
					s = s  + '<td class="text-left">Seccion</td>';
84 steven 53
					s = s  + '<td class="text-left">' + this.sections[i].name +  '</td>';
54
					s = s  + '<td class="text-right">' + this.sections[i].value + '</td>';
55
					s = s  + '<td>&nbsp</td>';
56
					s = s  + '<td>';
100 steven 57
					s = s  + '<button class="btn btn-default btn-edit-section" data-slug="' + this.sections[i].slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>&nbsp';
58
					s = s  + '<button class="btn btn-default btn-delete-section" data-slug="' + this.sections[i].slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button>&nbsp';
59
					s = s  + '<button class="btn btn-default btn-add-question" data-slug="' + this.sections[i].slug + '" data-toggle="tooltip" title="LABEL_ADD LABEL_QUESTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_QUESTION </button>&nbsp';
84 steven 60
					s = s  + '</td>';
61
					s = s  + '</tr>';
62
					$('#' + table + ' tbody').append(s);
63
 
64
 
65
 
66
					for(j = 0; j < this.sections[i].questions.length; j++)
67
					{
68
						this.sections[i].questions[j].position = j;
69
 
70
						this.drawQuestion( this.sections[i].slug, this.sections[i].questions[j].slug, this.sections[i].questions[j].text, this.sections[i].questions[j].value , this.sections[i].questions[j].type);
71
						if(this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple'|| this.sections[i].questions[j].type == 'rating-open') {
72
 
73
 
74
							this.sections[i].questions[j].options.sort(function(a, b) {
75
										if (a.position > b.position) {
76
												return 1;
77
										}
78
										if (a.position < b.position) {
79
											return -1;
80
										}
81
										return 0;
82
									});
83
 
84
 
85
							for(k = 0; k < this.sections[i].questions[j].options.length; k++)
86
							{
87
								this.sections[i].questions[j].options[k].position = j;
88
								this.drawOption(
89
									this.sections[i].slug,
90
									this.sections[i].questions[j].slug,
91
									this.sections[i].questions[j].type,
92
									this.sections[i].questions[j].options[k].slug,
93
									this.sections[i].questions[j].options[k].text,
94
									this.sections[i].questions[j].options[k].type,
95
									this.sections[i].questions[j].options[k].correct,
96
									this.sections[i].questions[j].options[k].value
97
								);
98
							}
99
						}
100
					}
101
				}
102
 
103
				$('[data-toggle="tooltip"]').tooltip();
104
			},
105
			this.drawSection = function(section_slug, section_name, section_value)
106
			{
107
				let table = 'table-section-question-option' + section_slug;
108
				let collapse = 'collapse-' + section_slug;
109
 
110
				s = '<div class="panel panel-default" id="panel' + section_slug + '">';
111
				s = s + '	<div class="panel-heading">';
112
				s = s + '		<h4 class="panel-title">';
113
				s = s + '			<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#' + collapse + '"><span class="section-name' + section_slug + '">' + section_name + '</span></a>';
114
				s = s + '		</h4>';
115
				s = s + '	</div>';
116
				s = s + '	<div id="' + collapse + '" class="panel-collapse collapse">';
117
				s = s + '		<div class="panel-body">';
118
				s = s + '			<div class="table-responsive">';
119
				s = s + '				<table class="table table-bordered" id="' + table + '">';
120
				s = s + '					<thead>';
121
				s = s + '						<tr>';
100 steven 122
				s = s + '							<th>LABEL_ELEMENT</th>';
123
				s = s + '							<th>LABEL_TEXT</th>';
124
				s = s + '							<th>LABEL_VALUE</th>';
125
				s = s + '							<th>LABEL_TYPE</th>';
126
				s = s + '							<th>LABEL_ACTIONS</th>';
84 steven 127
				s = s + '						</tr>';
128
				s = s + '					</thead>';
129
				s = s + '					<tbody>';
130
				s = s + '					</tbody>';
131
				s = s + '				</table>';
132
				s = s + '			</div>';
133
				s = s + '		</div>';
134
				s = s + '	</div>';
135
				s = s + '</div>';
136
 
137
				$('#accordion').append(s);
138
 
139
 
140
				s = '<tr class="tr-section" data-slug="' + section_slug + '">';
100 steven 141
				s = s  + '<td class="text-left">LABEL_SECTION</td>';
84 steven 142
				s = s  + '<td class="text-left">' + section_name +  '</td>';
143
				s = s  + '<td class="text-right">' + section_value + '</td>';
144
				s = s  + '<td>&nbsp</td>';
145
				s = s  + '<td>';
100 steven 146
				s = s  + '<button class="btn btn-default btn-edit-section" data-slug="' + section_slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>&nbsp';
147
				s = s  + '<button class="btn btn-default btn-delete-section" data-slug="' + section_slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button>&nbsp';
148
				s = s  + '<button class="btn btn-default btn-add-question" data-slug="' + section_slug + '" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION </button>&nbsp';
84 steven 149
				s = s  + '</td>';
150
				s = s  + '</tr>';
151
				$('#' + table + ' tbody').append(s);
152
			},
153
 
154
			this.drawQuestion = function(section_slug, question_slug, question_text, question_value, question_type)
155
			{
156
 
157
 
158
				s = '<tr class="tr-question" data-slug="' + question_slug + '">';
106 steven 159
				s = s  + '<td class="text-left">--LABEL_QUESTION</td>';
84 steven 160
				s = s  + '<td class="text-left">' + question_text +  '</td>';
161
				s = s  + '<td class="text-right"><font color="red">' + question_value + '</font></td>';
162
				s = s  + '<td>' + question_type.substr(0,1).toUpperCase() + question_type.substr(1) +  '</td>';
163
				s = s  + '<td>';
106 steven 164
				s = s  + '<button class="btn btn-default btn-edit-question" data-section="' + section_slug + '" data-slug="' + question_slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_QUESTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_QUESTION</button>&nbsp';
165
				s = s  + '<button class="btn btn-default btn-delete-question" data-section="' + section_slug + '" data-slug="' + question_slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_QUESTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_QUESTION</button>&nbsp';
84 steven 166
				if(question_type == 'simple' || question_type == 'multiple' || question_type == 'rating-open') {
106 steven 167
					s = s  + '<button class="btn btn-default btn-add-option" data-section="' + section_slug + '" data-slug="' + question_slug + '" data-toggle="tooltip" title="LABEL_ADD LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_OPTION</button>&nbsp';
84 steven 168
				}
169
 
170
				s = s  + '</td>';
171
 
172
				let table = 'table-section-question-option' + section_slug;
173
				$('#' + table + ' tbody').append(s);
174
			},
175
 
176
			this.drawOption = function(section_slug, question_slug,  question_type, option_slug, option_text, option_type, option_correct, option_value)
177
			{
178
 
179
 
180
				s = '<tr class="tr-option" data-slug="' + option_slug + '">';
106 steven 181
				s = s  + '<td class="text-left">---LABEL_OPTION</td>';
84 steven 182
				s = s  + '<td class="text-left">' + option_text +  '</td>';
183
				if(question_type == 'multiple' || question_type == 'rating-open') {
184
 
185
					if(question_type == 'multiple') {
186
						if(option_correct == 1) {
187
							s = s  + '<td class="text-right">' + option_value + '</td>';
188
						} else {
189
							s = s  + '<td>&nbsp</td>';
190
						}
191
					} else {
192
						s = s  + '<td class="text-right">' + option_value + '</td>';
193
					}
194
				} else {
195
					s = s  + '<td>&nbsp</td>';
196
				}
197
 
198
				if(question_type == 'simple' || question_type == 'multiple') {
199
					if(option_correct == 1) {
106 steven 200
						s = s  + '<td class="text-left"><font color="green">LABEL_CORRECT</font></td>';
84 steven 201
					} else {
106 steven 202
						s = s  + '<td class="text-left"><font color="red">LABEL_FAIL</font></td>';
84 steven 203
 
204
					}
205
				} else {
206
					s = s  + '<td>&nbsp</td>';
207
				}
208
 
209
 
210
				s = s  + '<td>';
106 steven 211
				s = s  + '<button class="btn btn-default btn-edit-option" data-section="' + section_slug + '" data-question="' + question_slug + '" data-slug="' + option_slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i></button>&nbsp';
212
				s = s  + '<button class="btn btn-default btn-delete-option" data-section="' + section_slug + '" data-question="' + question_slug + '" data-slug="' + option_slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i></button>&nbsp';
84 steven 213
				s = s  + '</td>';
214
 
215
				let table = 'table-section-question-option' + section_slug;
216
				$('#' + table + ' tbody').append(s);
217
 
218
			},
219
 
220
			this.render = function()
221
			{
222
				$('#accordion').empty();
223
 
224
				this.sections.sort(function(a, b) {
225
					if (a.position > b.position) {
226
							return 1;
227
					}
228
					if (a.position < b.position) {
229
						return -1;
230
					}
231
					return 0;
232
				});
233
 
234
				var s = '';
235
				for(i = 0; i < this.sections.length; i++)
236
				{
237
					this.sections[i].position = i;
238
 
239
 
240
					this.drawSection(this.sections[i].slug, this.sections[i].name, this.sections[i].value);
241
 
242
 
243
					this.sections[i].questions.sort(function(a, b) {
244
						if (a.position > b.position) {
245
								return 1;
246
						}
247
						if (a.position < b.position) {
248
							return -1;
249
						}
250
						return 0;
251
					});
252
 
253
 
254
					for(j = 0; j < this.sections[i].questions.length; j++)
255
					{
256
						this.sections[i].questions[j].position = j;
257
 
258
						this.drawQuestion( this.sections[i].slug, this.sections[i].questions[j].slug, this.sections[i].questions[j].text, this.sections[i].questions[j].value , this.sections[i].questions[j].type);
259
						if(this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple'|| this.sections[i].questions[j].type == 'rating-open') {
260
 
261
 
262
							this.sections[i].questions[j].options.sort(function(a, b) {
263
										if (a.position > b.position) {
264
												return 1;
265
										}
266
										if (a.position < b.position) {
267
											return -1;
268
										}
269
										return 0;
270
									});
271
 
272
 
273
							for(k = 0; k < this.sections[i].questions[j].options.length; k++)
274
							{
275
								this.sections[i].questions[j].options[k].position = j;
276
								this.drawOption(
277
									this.sections[i].slug,
278
									this.sections[i].questions[j].slug,
279
									this.sections[i].questions[j].type,
280
									this.sections[i].questions[j].options[k].slug,
281
									this.sections[i].questions[j].options[k].text,
282
									this.sections[i].questions[j].options[k].type,
283
									this.sections[i].questions[j].options[k].correct,
284
									this.sections[i].questions[j].options[k].value
285
								);
286
							}
287
						}
288
 
289
					}
290
 
291
 
292
				}
293
 
294
 
295
				$('[data-toggle="tooltip"]').tooltip();
296
 
297
			},
298
 
299
			this.addSection = function (name, text, value)
300
			{
301
				var d = new Date();
302
					var slug = 'section' + d.getTime();
303
 
304
					var position = 0;
305
					$.each(this.sections, function(index, section) {
306
						if(position < section.position) {
307
							position = section.position;
308
						}
309
					});
310
					position++;
311
 
312
				var section = {
313
					'slug' 		: slug,
314
					'name' 		: name,
315
					'text' 		: text,
316
					'value' 	: value,
317
					'position' 	: position,
318
					'questions' : [],
319
				}
320
 
321
				this.sections.push(section);
322
				this.drawSection(slug, name, text);
323
			},
324
			this.editSection = function (slug, name, text, value)
325
			{
326
				var renderTable = false;
327
				for(i = 0; i < this.sections.length; i++)
328
				{
329
						if(slug == this.sections[i].slug) {
330
							this.sections[i].name = name;
331
							this.sections[i].text = text;
332
							this.sections[i].value = value;
333
							renderTable = true;
334
 
335
							break;
336
						}
337
				}
338
				if(renderTable) {
339
					this.renderSection(slug);
340
				}
341
 
342
 
343
			},
344
			this.deleteSection = function(slug)
345
			{
346
				var renderTable = false;
347
				for(i = 0; i < this.sections.length; i++)
348
				{
349
						if(slug == this.sections[i].slug) {
350
							this.sections.splice(i, 1);
351
 
352
							renderTable = true;
353
							break;
354
					}
355
 
356
 
357
				}
358
				if(renderTable) {
359
					$('#panel' + slug).remove();
360
				}
361
			},
362
			this.addQuestion = function (section_slug, text, value, type, maxlength, multiline, range)
363
			{
364
				var d = new Date();
365
				var slug = 'question' + d.getTime();
366
 
367
				var position = 0;
368
				var renderTable = false;
369
				for(i = 0; i < this.sections.length; i++)
370
				{
371
					if(section_slug == this.sections[i].slug) {
372
						$.each(this.sections[i].questions, function(index, question) {
373
							if(position < question.position) {
374
								position = question.position;
375
							}
376
						});
377
						position++;
378
 
379
						var question = {
380
							'slug' : slug,
381
								'text' : text,
382
								'value' : value,
383
								'type' : type,
384
								'position' : position,
385
								'maxlength' :maxlength,
386
								'multiline' : multiline,
387
								'range' : range,
388
								'options' : [],
389
							}
390
 
391
						this.sections[i].questions.push(question);
392
						renderTable = true;
393
						break;
394
					}
395
				}
396
 
397
				if(renderTable) {
398
					this.renderSection(section_slug);
399
				}
400
			},
401
			this.editQuestion = function(section_slug, question_slug, text, value, type, maxlength, multiline, range)
402
			{
403
				var renderTable = false;
404
				for(i = 0; i < this.sections.length; i++)
405
				{
406
					if(section_slug == this.sections[i].slug) {
407
						for(j = 0; j < this.sections[i].questions.length; j++) {
408
							if(question_slug == this.sections[i].questions[j].slug) {
409
								this.sections[i].questions[j].text 	= text,
410
								this.sections[i].questions[j].value	= value,
411
								this.sections[i].questions[j].type 	= type;
412
 
413
								if(type == 'open') {
414
									this.sections[i].questions[j].maxlength	= maxlength;
415
									this.sections[i].questions[j].multiline	= multiline;
416
									this.sections[i].questions[j].options	= [];
417
								} else {
418
									this.sections[i].questions[j].maxlength	= 0;
419
									this.sections[i].questions[j].multiline	= 0;
420
								}
421
 
422
									if(type == 'rating-range') {
423
										this.sections[i].questions[j].range = range;
424
									} else {
425
										this.sections[i].questions[j].range = 0;
426
									}
427
								renderTable = true;
428
								break;
429
							}
430
						}
431
					}
432
					if(renderTable) {
433
						break;
434
					}
435
				}
436
				if(renderTable) {
437
					this.renderSection(section_slug);
438
				}
439
			},
440
			this.deleteQuestion = function(section_slug, question_slug)
441
			{
442
				var renderTable = false;
443
				for(i = 0; i < this.sections.length; i++)
444
				{
445
						if(section_slug == this.sections[i].slug) {
446
							for(j = 0; j < this.sections[i].questions.length; j++) {
447
							if(question_slug == this.sections[i].questions[j].slug) {
448
									this.sections[i].questions.splice(j, 1);
449
										renderTable = true;
450
										break;
451
							}
452
						}
453
					}
454
 
455
					if(renderTable) {
456
						break;
457
					}
458
				}
459
				if(renderTable) {
460
					this.renderSection(section_slug);
461
				}
462
			},
463
			this.addOption = function (section_slug, question_slug, text, correct, value)
464
			{
465
				var d = new Date();
466
				var slug = 'option' + d.getTime();
467
 
468
				var position = 0;
469
				var renderTable = false;
470
				for(i = 0; i < this.sections.length; i++)
471
				{
472
					if(section_slug == this.sections[i].slug) {
473
						for(j = 0; j < this.sections[i].questions.length; j++) {
474
							if(question_slug == this.sections[i].questions[j].slug) {
475
								$.each(this.sections[i].questions[j].options, function(index, option) {
476
										if(position < option.position) {
477
											position = option.position;
478
										}
479
									});
480
									position++;
481
 
482
									var option = {
483
										'slug' : slug,
484
											'text' : text,
485
											'correct' : correct,
486
											'value' : value
487
										}
488
 
489
										this.sections[i].questions[j].options.push(option);
490
									renderTable = true;
491
									break;
492
							}
493
 
494
									if(renderTable) {
495
								break;
496
							}
497
						}
498
					}
499
				}
500
				if(renderTable) {
501
					this.renderSection(section_slug);
502
				}
503
			},
504
			this.editOption = function(section_slug, question_slug, option_slug, text, correct, value)
505
			{
506
				var renderTable = false;
507
				for(i = 0; i < this.sections.length; i++)
508
				{
509
					if(section_slug == this.sections[i].slug) {
510
						for(j = 0; j < this.sections[i].questions.length; j++) {
511
							if(question_slug == this.sections[i].questions[j].slug) {
512
								for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
513
									if(option_slug == this.sections[i].questions[j].options[k].slug) {
514
										this.sections[i].questions[j].options[k].text = text;
515
										this.sections[i].questions[j].options[k].correct = correct;
516
										this.sections[i].questions[j].options[k].value = value;
517
										renderTable = true;
518
												break;
519
									}
520
								}
521
							}
522
									if(renderTable) {
523
								break;
524
							}
525
						}
526
					}
527
						if(renderTable) {
528
							break;
529
						}
530
				}
531
 
532
				if(renderTable) {
533
					this.renderSection(section_slug);
534
				}
535
			},
536
			this.deleteOption = function(section_slug, question_slug, option_slug)
537
			{
538
				var renderTable = false;
539
				for(i = 0; i < this.sections.length; i++)
540
				{
541
						if(section_slug == this.sections[i].slug) {
542
							for(j = 0; j < this.sections[i].questions.length; j++) {
543
							if(question_slug == this.sections[i].questions[j].slug) {
544
								for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
545
									if(option_slug == this.sections[i].questions[j].options[k].slug) {
546
										this.sections[i].questions[j].options.splice(k, 1);
547
										renderTable = true;
548
												break;
549
									}
550
								}
551
							}
552
									if(renderTable) {
553
								break;
554
							}
555
						}
556
					}
557
 
558
					if(renderTable) {
559
						break;
560
					}
561
				}
562
				if(renderTable) {
563
					this.renderSection(section_slug);
564
				}
565
			}
566
		}
567
 
568
		function htmlEntities(str) {
569
				return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
570
		}
66 efrain 571
    jQuery( document ).ready(function( $ ) {
84 steven 572
			var objFormGenerator = new classFormGenerator();
573
	objFormGenerator.render();
66 efrain 574
 
84 steven 575
 
576
	var tableForm = $('#table-form').dataTable({
577
		select :true,
578
        bProcessing: true,
579
        bServerSide: true,
243 geraldo 580
        sAjaxSource: "ajax.<?php echo $this->module; ?>.php?action=gridview",
84 steven 581
        fnServerData: function (sSource, aoData, fnCallback) {
582
         	$.ajax({
583
               	dataType: 'json',
584
                type: "POST",
585
                url: sSource,
586
                data: aoData,
587
                success: fnCallback
588
          	});
589
        },
590
        aaSorting : [],
591
        aoColumns: [
85 steven 592
					{sName: "checkbox", sTitle : '<input type="checkbox" value="all" data-type="select_all" name="select_all" id="select_all">',bSortable:false,bSearchable:false},
106 steven 593
					{sName: "name", sTitle: 'LABEL_FIRST_NAME'},
594
					{sName: "language", sTitle: 'LABEL_LANGUAGE'},
595
					{sName: "added_on", sTitle : 'LABEL_ADDED_ON'},
596
					{sName: "status", sTitle: 'LABEL_STATUS', bSortable:false, bSearchable:false},
597
					{sName: "operation", sTitle: 'LABEL_OPERATION', bSortable: false, bSearchable: false},
84 steven 598
         ],
87 steven 599
        //  fnServerParams: function(aoData){
600
        //  	setTitle(aoData, this)
601
        //  },
84 steven 602
         fnDrawCallback: function(oSettings) {
85 steven 603
         		$('.make-switch-form').bootstrapSwitch();
84 steven 604
            $('.make-switch-form').bootstrapSwitch('setOnClass', 'success');
605
            $('.make-switch-form').bootstrapSwitch('setOffClass', 'danger');
606
         }
607
	});
66 efrain 608
 
84 steven 609
	$('body').on('click', 'a.btn-delete-form',function(e) {
610
		e.preventDefault();
611
		form_id =  $(this).data('id')
612
 
613
		bootbox.confirm({
107 steven 614
		    title: "LABEL_DELETE LABEL_FORM",
615
		    message: "LABEL_ARE_YOU_SURE",
84 steven 616
		    buttons: {
617
		        cancel: {
107 steven 618
		            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
84 steven 619
		        },
620
		        confirm: {
107 steven 621
		            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
84 steven 622
		        }
623
		    },
624
		    callback: function (result) {
625
			    if(result) {
626
    		    	$.ajax({
627
    	                'dataType': 'json',
628
    	                'method': 'post',
629
    	                'url' :  'ajax.<?php echo $this->module; ?>.php?action=delete',
630
    	                'data' :{
631
    	                    'form-id' : form_id
632
    	                },
633
    	            }).done(function(response) {
634
 
635
    	                if(response['success']) {
94 steven 636
    	                	$.fn.showSuccess(response['message']);
84 steven 637
    	                	tableForm.fnDraw();
638
    	                } else {
94 steven 639
    	                	$.fn.showError(response['message']);
84 steven 640
    	                }
641
    	            }).fail(function( jqXHR, textStatus, errorThrown) {
94 steven 642
    					$.fn.showError(textStatus);
84 steven 643
    	            });
644
			    }
645
		    }
646
		});
647
 
66 efrain 648
 
84 steven 649
    });
66 efrain 650
 
84 steven 651
    $(document).on('click','[data-action="delete"]',function(){
652
 
653
    	bootbox.confirm({
108 steven 654
		    title: "LABEL_DELETE LABEL_FORMS_2",
655
		    message: "LABEL_ARE_YOU_SURE",
84 steven 656
		    buttons: {
657
		        cancel: {
108 steven 658
		            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
84 steven 659
		        },
660
		        confirm: {
108 steven 661
		            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
84 steven 662
		        }
663
		    },
664
		    callback: function (result) {
665
			    if(result) {
666
			    	var d = currentSelected();
667
    		    	$.ajax({
668
    	                'dataType': 'json',
669
    	                'method': 'post',
670
    	                'url' :  'ajax.<?php echo $this->module; ?>.php?action=delete-selected',
671
    	                'data' :{
672
    	                	 selected : d
673
    	                },
674
    	            }).done(function(response) {
675
 
676
    	                if(response['success']) {
94 steven 677
    	                	$.fn.showSuccess(response['message']);
84 steven 678
    	                	tableForm.fnDraw();
679
    	                } else {
94 steven 680
    	                	$.fn.showError(response['message']);
84 steven 681
    	                }
682
    	            }).fail(function( jqXHR, textStatus, errorThrown) {
94 steven 683
    					$.fn.showError(textStatus);
84 steven 684
    	            });
685
			    }
686
		    }
687
		});
688
 
66 efrain 689
    });
84 steven 690
 
691
 
692
    $('body').on('switch-change', 'input[type="checkbox"].make-switch-form', function(e) {
693
		e.preventDefault();
694
		e.stopPropagation();
695
 
696
		form_id =  $(this).data('id')
697
		form_status = $(this).prop('checked') ? 'A' : 'D';
698
 
699
 
700
		$.ajax({
701
        	'dataType': 'json',
702
            'method': 'post',
703
            'url' :  'ajax.<?php echo $this->module; ?>.php?action=status',
704
            'data' :{
705
            	'form-id' : form_id,
706
            	'form-status' : form_status
707
            },
708
        }).done(function(response) {
709
	        if(response['success']) {
94 steven 710
	        	$.fn.showSuccess(response['message']);
84 steven 711
	       } else {
94 steven 712
    	       	$.fn.showError(response['message']);
84 steven 713
            }
714
         }).fail(function( jqXHR, textStatus, errorThrown) {
94 steven 715
			$.fn.showError(textStatus);
84 steven 716
        })
717
    });
718
 
719
	$('body').on('click', 'a.btn-edit-form',function(e) {
720
		e.preventDefault();
721
		form_id =  $(this).data('id')
722
 
723
		$.ajax({
93 steven 724
			'dataType': 'json',
725
			'method': 'post',
726
			'url' :  '/test/method-one',
727
			'data' :{
728
				'form-id' : form_id
729
			},
730
		}).done(function(response) {
731
			if(response['success']) {
732
					validatorForm.resetForm();
84 steven 733
 
93 steven 734
					$('#form-main #form-id' ).val(response['id']),
735
					$('#form-main #form-continue').val('0');
736
					$('#form-main #form-name' ).val(response['name']),
84 steven 737
 
738
 
93 steven 739
					instanceName = 'form-description';
740
					let editor = CKEDITOR.instances[instanceName ];
741
					editor.setData(response['description'], function() {
742
							editor.focus();
743
					});
744
 
745
 
746
					instanceName = 'form-text';
747
					CKEDITOR.instances[instanceName ].setData(response['text']);
84 steven 748
 
93 steven 749
					$( '#form-main #form-language' ).val(response['language']),
750
					$( '#form-main #form-status' ).val(response['status']);
84 steven 751
 
93 steven 752
					objFormGenerator.clear();
753
					objFormGenerator.sections = response['sections'];
754
					objFormGenerator.render();
755
					$('#row-forms').hide();
756
					$('#row-edit').show();
84 steven 757
 
93 steven 758
					$('#form-main #form-name').focus();
759
 
760
				} else {
94 steven 761
					$.fn.showError(response['message']);
93 steven 762
				}
763
			}).fail(function( jqXHR, textStatus, errorThrown) {
94 steven 764
				$.fn.showError(textStatus);
93 steven 765
			});
84 steven 766
    });
767
 
768
	 $(document).on('click','[data-type="select_all"]',function(){
769
 
770
	        if($('input[name="select_all"]:checked').val() == 'all'){
771
	            $('[data-type="select"]').prop('checked', true);
772
	            $('[data-action="delete"]').removeClass('hide');
773
	        }else{
774
	            $('[data-type="select"]').prop('checked', false);
775
	            $('[data-action="delete"]').addClass('hide');
776
	        }
777
	    });
778
 
779
	    function getLength(){
780
	        return $('[data-type="select"]').length;
781
	    }
782
 
783
	    function currentSelected(){
784
	        var selected = [];
785
	        $.each($("input[name='select[]']:checked"), function(){
786
	            selected.push($(this).val());
787
	        });
788
 
789
	        return selected;
790
	    }
791
 
792
	    $(document).on('change',"input[name='select[]']",function(){
793
	        var c = currentSelected();
794
	        var cc = getLength();
795
 
796
 
797
	        if(c.length == cc){
798
	            if($('[data-action="delete"]').hasClass('hide')){
799
	                $('[data-action="delete"]').removeClass('hide');
800
	            }
801
	            return true;
802
	        }else{
803
	            $('input[name="select_all"]').prop('checked', false);
804
	        }
805
 
806
	        if(c.length > 0){
807
	            if($('[data-action="delete"]').hasClass('hide')){
808
	                $('[data-action="delete"]').removeClass('hide');
809
	            }
810
	        }else{
811
	            if(!$('[data-action="delete"]').hasClass('hide')){
812
	                $('[data-action="delete"]').addClass('hide');
813
	            }
814
	        }
815
	    });
816
 
817
	    var form3 = $('#form_sample_3');
818
        var error3 = $('.alert-danger', form3);
819
        var success3 = $('.alert-success', form3);
820
 
821
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
822
 	$( "#form-main" ).on('submit', function() {
823
		for(var instanceName in CKEDITOR.instances) {
824
			CKEDITOR.instances[instanceName].updateElement();
825
		}
826
	})
827
 
828
	var validatorForm = $( "#form-main" ).validate( {
829
        ignore: [],
830
        errorClass: 'help-block',
831
        errorElement: 'span',
832
		rules: {
833
			'form-name':  {
834
				required: true,
835
				minlength: 2,
836
				maxlength: 50
837
			},
838
			'form-description' : {
839
				required: true,
840
			},
841
			'form-text' : {
842
				required: true,
843
			},
844
			'form-language' : {
845
				required: true,
846
			},
847
			'forrm-status' : {
848
				required: true,
849
			},
850
		},
851
        highlight: function (element) {
852
            $(element).closest('.form-group').addClass('has-error');
853
        },
854
        unhighlight: function (element) {
855
            $(element).closest('.form-group').removeClass('has-error');
856
        },
857
        errorPlacement: function (error, element) {
858
            if (element.attr("data-error-container")) {
859
                error.appendTo(element.attr("data-error-container"));
860
            } else {
861
                error.insertAfter(element);
862
            }
863
        },
864
        invalidHandler: function(form, validator) {
865
            if (!validator.numberOfInvalids())
866
                return;
867
            $('html, body').animate({
868
                scrollTop: $(validator.errorList[0].element).offset().top - 100
869
            }, 1000);
870
        },
871
		submitHandler: function(form) {
872
		    // do other things for a valid form
873
		    //form.submit();
874
 
875
 
876
		    var error = false;
877
		    if(objFormGenerator.sections.length == 0) {
94 steven 878
		    	$.fn.showError('There are no sections');
84 steven 879
		    	error = true;
880
		    } else {
881
 
882
		    	for(i = 0; i < objFormGenerator.sections.length; i++)
883
		    	{
884
 
885
		    		if(objFormGenerator.sections[i].questions.length == 0) {
108 steven 886
		    			$.fn.showError('El "' + objFormGenerator.sections[i].name + '" no tiene preguntas');
84 steven 887
		    			break;
888
		    		}
889
 
890
		    		var valueSection = parseInt(objFormGenerator.sections[i].value);
891
		    		var totalValueQuestion = 0;
892
 
893
 
894
		    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++)
895
		    		{
896
		    			valueQuestion = parseInt(objFormGenerator.sections[i].questions[j].value);
897
		    			totalValueQuestion = totalValueQuestion + valueQuestion;
898
		    			if(objFormGenerator.sections[i].questions[j].type == 'simple'
899
			    			|| objFormGenerator.sections[i].questions[j].type == 'multiple'
900
			    			|| objFormGenerator.sections[i].questions[j].type == 'rating-open' ) {
901
 
902
		    				var questionNumber = j + 1;
903
		    				var numberCorrect = 0;
904
 
905
 
906
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
108 steven 907
		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' no tiene opciones');
908
									error = true;
909
									break;
84 steven 910
		    				}
911
 
912
 
913
		    				var totalOption = 0;
914
		    				var maxOption = 0;
915
		    				for(k = 0;  k < objFormGenerator.sections[i].questions[j].options.length; k++)
916
		    				{
917
		    					if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
918
    		    					if(objFormGenerator.sections[i].questions[j].options[k].correct == 1) {
919
    		    						numberCorrect++;
920
    		    					}
921
		    					}
922
 
923
		    					if(objFormGenerator.sections[i].questions[j].type == 'multiple' && objFormGenerator.sections[i].questions[j].options[k].correct == 1) {
924
		    						totalOption = totalOption + parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
925
			    				}
926
 
927
		    					if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
928
		    						if(parseInt(objFormGenerator.sections[i].questions[j].options[k].value) > maxOption) {
108 steven 929
											maxOption = parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
84 steven 930
					    			}
931
			    				}
932
 
933
		    				}
934
 
935
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
936
 
937
    		    				if(numberCorrect == 0) {
108 steven 938
    		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' no tiene una opcion correcta');
84 steven 939
    		    					error = true;
940
    		    					break;
941
    		    				}
942
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
108 steven 943
    		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' tiene más de una opción correcta');
84 steven 944
    		    					error = true;
945
    		    					break;
946
    		    				}
947
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
108 steven 948
    		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' solo tiene una opción correcta');
84 steven 949
    		    					error = true;
950
    		    					break;
951
    		    				}
952
		    				}
953
 
954
			    			//console.log('totalOption = ' + totalOption + ' valueQuestion = ' + valueQuestion );
955
 
956
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
108 steven 957
		     					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' la suma de los valores de las opciones es mayor que el valor de la pregunta');
84 steven 958
		    					error = true;
959
		    					break;
960
			    			}
961
 
962
							//console.log('maxOption = ' + maxOption + ' valueQuestion = ' + valueQuestion );
963
 
964
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
108 steven 965
		     					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' ');
84 steven 966
		    					error = true;
967
		    					break;
968
			    			}
969
						}
970
 
971
 
972
		    		}
973
 
974
		    		if(valueSection != totalValueQuestion) {
108 steven 975
		    			$.fn.showError('El "' + objFormGenerator.sections[i].name + '" sección y las preguntas no son las mismas');
84 steven 976
		    			error = true;
977
		    			break;
978
					}
979
				}
980
 
981
 
982
 
983
    			if(error) {
984
    				return false;
985
    			} else {
986
 
987
 
988
    				var formId		= parseInt($( '#form-main #form-id' ).val());
989
    				var formContinue = parseInt($( '#form-main #form-continue' ).val());
990
 
991
    				var data = {
992
    	    			'form-id'	: formId,
993
        				'form-name' : $( '#form-main #form-name' ).val(),
994
        				'form-description' : $( '#form-main #form-description' ).val(),
995
        				'form-text' : $( '#form-main #form-text' ).val(),
996
        				'form-language' : $( '#form-main #form-language' ).val(),
997
        				'form-status' : $( '#form-main #form-status' ).val(),
998
        				'sections' : objFormGenerator.sections
999
    				}
1000
 
1001
 
1002
    				$.ajax({
1003
                        'dataType': 'json',
1004
                        'method': 'post',
93 steven 1005
                        'url' :  '/test/method-one',
84 steven 1006
                        'data' : data,
1007
                    }).done(function(response) {
1008
 
1009
                        if(response['success']) {
94 steven 1010
                        	$.fn.showSuccess(response['message']);
84 steven 1011
							if(formContinue == 1) {
1012
								$('#form-main #form-id').val(response['form-id']);
1013
								$('#form-main #form-continue').val(0);
1014
							} else {
1015
								$('#row-edit').hide();
1016
                        		$('#row-forms').show();
1017
							}
1018
 
1019
 
1020
							tableForm.fnDraw();
1021
 
1022
                        } else {
94 steven 1023
                        	$.fn.showError(response['message']);
84 steven 1024
                        }
1025
                    }).fail(function( jqXHR, textStatus, errorThrown) {
94 steven 1026
						$.fn.showError(textStatus);
84 steven 1027
                    });
1028
 
1029
                    return false;
1030
 
1031
 
1032
    			}
1033
			}
1034
 
1035
 
1036
		}
1037
	});
1038
 
1039
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1040
 	$( "#form-section" ).on('submit', function() {
1041
		for(var instanceName in CKEDITOR.instances) {
1042
			CKEDITOR.instances[instanceName].updateElement();
1043
		}
1044
	})
1045
 
1046
	var validatorFormSection = $( "#form-section" ).validate( {
1047
        ignore: [],
1048
        errorClass: 'help-block',
1049
        errorElement: 'span',
1050
		rules: {
1051
			'section-name':  {
1052
				required: true,
1053
				minlength: 2,
1054
				maxlength: 50
1055
			},
1056
			'section-text' : {
1057
				required: false,
1058
			},
1059
			'section-value' : {
1060
				required: true,
1061
				number: true,
1062
				min: 1
1063
			},
1064
		},
1065
        highlight: function (element) {
1066
            $(element).closest('.form-group').addClass('has-error');
1067
        },
1068
        unhighlight: function (element) {
1069
            $(element).closest('.form-group').removeClass('has-error');
1070
        },
1071
        errorPlacement: function (error, element) {
1072
            if (element.attr("data-error-container")) {
1073
                error.appendTo(element.attr("data-error-container"));
1074
            } else {
1075
                error.insertAfter(element);
1076
            }
1077
        },
1078
        invalidHandler: function(form, validator) {
1079
            if (!validator.numberOfInvalids())
1080
                return;
1081
            $('html, body').animate({
1082
                scrollTop: $(validator.errorList[0].element).offset().top - 100
1083
            }, 1000);
1084
        },
1085
		submitHandler: function(form) {
1086
		    // do other things for a valid form
1087
		    //form.submit();
1088
 
1089
		    var slug = $('#form-section #section-slug').val();
1090
		    if(slug) {
1091
		    	objFormGenerator.editSection(
1092
		    		$('#form-section #section-slug').val(),
1093
			    	$('#form-section #section-name').val(),
1094
			    	$('#form-section #section-text').val(),
1095
			    	$('#form-section #section-value').val()
1096
			  	);
1097
		    } else {
1098
		    	objFormGenerator.addSection(
1099
		    		$('#form-section #section-name').val(),
1100
		    		$('#form-section #section-text').val(),
1101
		    		$('#form-section #section-value').val()
1102
		    	);
1103
		    }
1104
 
1105
 
1106
 
1107
			$('#modal-section').modal('hide');
1108
			return false;
1109
		  }
1110
	} );
1111
 
1112
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1113
 	$( "#form-question" ).on('submit', function() {
1114
		for(var instanceName in CKEDITOR.instances) {
1115
			CKEDITOR.instances[instanceName].updateElement();
1116
		}
1117
	})
1118
 
1119
 
1120
	var validatorFormQuestion = $( "#form-question" ).validate( {
1121
        ignore: [],
1122
        errorClass: 'help-block',
1123
        errorElement: 'span',
1124
		rules: {
1125
			'question-text' : {
1126
				required: true,
1127
			},
1128
			'question-value' : {
1129
				required: true,
1130
				number: true,
1131
				min: 1
1132
			},
1133
			'question-type':  {
1134
				required: true,
1135
			},
1136
			'question-max-length' : {
1137
				required: true,
1138
				digits: true,
1139
				min: 0
1140
			},
1141
			'question-range' : {
1142
				required: true,
1143
				number: true,
1144
				min: 1
1145
			},
1146
		},
1147
        highlight: function (element) {
1148
            $(element).closest('.form-group').addClass('has-error');
1149
        },
1150
        unhighlight: function (element) {
1151
            $(element).closest('.form-group').removeClass('has-error');
1152
        },
1153
        errorPlacement: function (error, element) {
1154
            if (element.attr("data-error-container")) {
1155
                error.appendTo(element.attr("data-error-container"));
1156
            } else {
1157
                error.insertAfter(element);
1158
            }
1159
        },
1160
        invalidHandler: function(form, validator) {
1161
 
1162
			//console.log(validator);
1163
 
1164
            if (!validator.numberOfInvalids())
1165
                return;
1166
            $('html, body').animate({
1167
                scrollTop: $(validator.errorList[0].element).offset().top - 100
1168
            }, 1000);
1169
        },
1170
		submitHandler: function(form) {
1171
		    // do other things for a valid form
1172
		    //form.submit();
1173
 
1174
		    /*console.log('submitHandler');
1175
		    console.log('question-section = ' + $('#form-question #question-section').val());
1176
		    console.log('question-text = ' + $('#form-question #question-text').val());
1177
		    console.log('question-value = ' + $('#form-question #question-value').val());
1178
		    console.log('question-type = ' + $('#form-question #question-type').val());
1179
		    console.log('question-max-length = ' + $('#form-question #question-max-length').val());
1180
		    console.log('question-multiline = ' + $('#form-question #question-multiline').val());
1181
		    console.log('question-range = ' + $('#form-question #question-range').val());*/
1182
 
1183
 
1184
 
1185
		    if($('#form-question #question-slug').val()) {
1186
		    	console.log('editQuestion');
1187
 
1188
		    	objFormGenerator.editQuestion(
1189
		    		$('#form-question #question-section').val(),
1190
		    		$('#form-question #question-slug').val(),
1191
		    		$('#form-question #question-text').val(),
1192
		    		$('#form-question #question-value').val(),
1193
			    	$('#form-question #question-type').val(),
1194
			    	$('#form-question #question-max-length').val(),
1195
	    			$('#form-question #question-multiline').val(),
1196
	    			$('#form-question #question-range').val()
1197
			  	);
1198
		    } else {
1199
		    	console.log('addQuestion');
1200
 
1201
		    	objFormGenerator.addQuestion(
1202
			    	$('#form-question #question-section').val(),
1203
			    	$('#form-question #question-text').val(),
1204
			    	$('#form-question #question-value').val(),
1205
				    $('#form-question #question-type').val(),
1206
				    $('#form-question #question-max-length').val(),
1207
		    		$('#form-question #question-multiline').val(),
1208
		    		$('#form-question #question-range').val()
1209
		    	);
1210
		    }
1211
 
1212
			$('#modal-question').modal('hide');
1213
			return false;
1214
		  }
1215
	} );
1216
 
1217
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1218
 	$( "#form-option" ).on('submit', function() {
1219
		for(var instanceName in CKEDITOR.instances) {
1220
			CKEDITOR.instances[instanceName].updateElement();
1221
		}
1222
	})
1223
 
1224
	var validatorFormOption = $( "#form-option" ).validate( {
1225
        ignore: [],
1226
        errorClass: 'help-block',
1227
        errorElement: 'span',
1228
		rules: {
1229
			'option-text' : {
1230
				required: true,
1231
			},
1232
        	'option-value' : {
1233
				required: true,
1234
				number: true,
1235
				min: 1
1236
        	}
1237
		},
1238
        highlight: function (element) {
1239
            $(element).closest('.form-group').addClass('has-error');
1240
        },
1241
        unhighlight: function (element) {
1242
            $(element).closest('.form-group').removeClass('has-error');
1243
        },
1244
        errorPlacement: function (error, element) {
1245
            if (element.attr("data-error-container")) {
1246
                error.appendTo(element.attr("data-error-container"));
1247
            } else {
1248
                error.insertAfter(element);
1249
            }
1250
        },
1251
        invalidHandler: function(form, validator) {
1252
            if (!validator.numberOfInvalids())
1253
                return;
1254
            $('html, body').animate({
1255
                scrollTop: $(validator.errorList[0].element).offset().top - 100
1256
            }, 1000);
1257
        },
1258
		submitHandler: function(form) {
1259
		    // do other things for a valid form
1260
		    //form.submit();
1261
 
1262
 
1263
		    if($('#form-option #option-slug').val()) {
1264
		    	objFormGenerator.editOption(
1265
		    		$('#form-option #option-section').val(),
1266
		    		$('#form-option #option-question').val(),
1267
		    		$('#form-option #option-slug').val(),
1268
		    		$('#form-option #option-text').val(),
1269
		    		$('#form-option #option-correct').val(),
1270
		    		$('#form-option #option-value').val()
1271
			  	);
1272
		    } else {
1273
		    	objFormGenerator.addOption(
1274
			    	$('#form-option #option-section').val(),
1275
			    	$('#form-option #option-question').val(),
1276
			    	$('#form-option #option-text').val(),
1277
			    	$('#form-option #option-correct').val(),
1278
			    	$('#form-option #option-value').val()
1279
		    	);
1280
		    }
1281
 
1282
 
1283
 
1284
 
1285
			$('#modal-option').modal('hide');
1286
			return false;
1287
		  }
1288
	} );
1289
 
1290
	$('body').on('click', 'button[id="btn-add-section"]', function(e){
1291
		e.preventDefault();
1292
 
1293
		validatorFormSection.resetForm();
1294
		$('#form-section #section-slug').val('');
1295
		$('#form-section #section-name').val('');
1296
 
1297
		instanceName = 'section-text';
1298
		let editor = CKEDITOR.instances[instanceName ];
1299
		editor.setData( '', function() {
1300
		    editor.focus();
1301
		});
1302
 
1303
 
1304
		$('#form-section #section-value').val('0');
1305
		$('#modal-section h4[class="modal-title"]').html('New Section');
1306
		$('#modal-section').modal('show');
1307
	});
1308
 
1309
	$('body').on('click', 'button.btn-edit-section', function(e){
1310
	    e.preventDefault();
1311
 
1312
	    var slug = $(this).data('slug');
1313
	    var section;
1314
	    var showForm = false;
1315
 
1316
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1317
	        section = objFormGenerator.sections[i];
1318
 
1319
	    	if(slug == section.slug) {
1320
 
1321
		    	//console.log('btn-edit-section');
1322
		    	//console.log(section);
1323
 
1324
				validatorFormSection.resetForm();
1325
	    		$('#form-section #section-slug').val(section.slug);
1326
	    		$('#form-section #section-name').val(section.name);
1327
 
1328
	    		instanceName = 'section-text';
1329
	    		let editor = CKEDITOR.instances[instanceName ];
1330
	    		editor.setData( section.text, function() {
1331
	    		    editor.focus();
1332
	    		});
1333
 
1334
				$('#form-section #section-value').val(section.value);
1335
 
1336
				showForm = true;
1337
				break;
1338
	    	}
1339
	    }
1340
 
1341
	    if(showForm) {
1342
	    	$('#modal-section h4[class="modal-title"]').html('Edit Section');
1343
			$('#modal-section').modal('show');
1344
	    }
1345
 
1346
	});
1347
 
1348
	$('body').on('click', 'button.btn-delete-section', function(e){
1349
		e.preventDefault();
1350
		var slug = $(this).data('slug');
1351
 
1352
		bootbox.confirm({
108 steven 1353
		    title: "LABEL_DELETE LABEL_SECTION?",
1354
		    message: "LABEL_ARE_YOU_SURE",
84 steven 1355
		    buttons: {
1356
		        cancel: {
108 steven 1357
		            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
84 steven 1358
		        },
1359
		        confirm: {
108 steven 1360
		            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
84 steven 1361
		        }
1362
		    },
1363
		    callback: function (result) {
1364
		    	if (result) {
1365
					objFormGenerator.deleteSection(slug);
1366
				}
1367
		    }
1368
		});
1369
 
1370
 
1371
 
1372
	});
1373
 
1374
 
1375
	$('body').on('click', 'button.btn-add-question', function(e){
1376
		e.preventDefault();
1377
 
1378
		validatorFormQuestion.resetForm();
1379
		var slug = $(this).data('slug');
1380
 
1381
		$('#form-question #question-section').val(slug);
1382
		$('#form-question #question-slug').val('');
1383
 
1384
		instanceName = 'question-text';
1385
		let editor = CKEDITOR.instances[instanceName ];
1386
		editor.setData( '', function() {
1387
		    editor.focus();
1388
		});
1389
 
1390
 
1391
		$('#form-question #question-value').val('0');
1392
		$('#form-question #question-type').val($('#form-question #question-type option:first').val());
1393
 
1394
		$('#form-question #question-max-length').val('0');
1395
		$('#form-question #question-max-length').parent().show();
1396
 
1397
		$('#form-question #question-multiline').val('0');
1398
		$('#form-question #question-multiline').parent().show();
1399
 
1400
		$('#form-question #question-range').val('10');
1401
		$('#form-question #question-range').parent().hide();
1402
 
1403
		$('#modal-question h4[class="modal-title"]').html('New Question');
1404
		$('#modal-question').modal('show');
1405
 
1406
	});
1407
 
1408
 
1409
 
1410
	$('body').on('click', 'button.btn-edit-question', function(e){
1411
	    e.preventDefault();
1412
 
1413
	    var slug_section	= $(this).data('section');
1414
	    var slug 			= $(this).data('slug');
1415
	    var showForm 		= false;
1416
 
1417
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1418
 
1419
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1420
 
1421
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1422
 
1423
	    			if(slug == objFormGenerator.sections[i].questions[j].slug) {
1424
	    				validatorFormQuestion.resetForm();
1425
 
1426
	    				$('#form-question #question-section').val(objFormGenerator.sections[i].slug);
1427
	    				$('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug);
1428
 
1429
	    	    		instanceName = 'question-text';
1430
	    	    		let editor = CKEDITOR.instances[instanceName ];
1431
	    	    		editor.setData( objFormGenerator.sections[i].questions[j].text, function() {
1432
	    	    		    editor.focus();
1433
	    	    		});
1434
 
1435
 
1436
	        			$('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1437
	        			$('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1438
 
1439
 
1440
 
1441
	        			if(objFormGenerator.sections[i].questions[j].type == 'open') {
1442
		        			$('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
1443
		        			$('#form-question #question-max-length').parent().show();
1444
 
1445
		        			$('#form-question #question-multiline').val(objFormGenerator.sections[i].questions[j].multiline);
1446
							$('#form-question #question-multiline').parent().show();
1447
	        			} else {
1448
		        			$('#form-question #question-max-length').val('0');
1449
		        			$('#form-question #question-max-length').parent().hide();
1450
 
1451
		        			$('#form-question #question-multiline').val('0');
1452
							$('#form-question #question-multiline').parent().hide();
1453
	        			}
1454
 
1455
	        			if(objFormGenerator.sections[i].questions[j].type == 'rating-range') {
1456
	            			$('#form-question #question-range').val(objFormGenerator.sections[i].questions[j].range);
1457
		        			$('#form-question #question-range').parent().show();
1458
 
1459
	        			} else {
1460
	            			$('#form-question #question-range').val('10');
1461
		        			$('#form-question #question-range').parent().hide();
1462
		        		}
1463
 
1464
    					showForm = true;
1465
    					break;
1466
 
1467
	    			}
1468
 
1469
	    		}
1470
 
1471
	    		break;
1472
	    	}
1473
	    }
1474
 
1475
	    if(showForm) {
108 steven 1476
	    	$('#modal-question h4[class="modal-title"]').html('LABEL_EDIT LABEL_QUESTION');
1477
				$('#modal-question').modal('show');
84 steven 1478
	    }
1479
 
1480
	});
1481
 
1482
 
1483
 
1484
 
1485
	$('body').on('click', 'button.btn-delete-question', function(e){
1486
		e.preventDefault();
1487
 
1488
		var slug_section	= $(this).data('section');
1489
		var slug 			= $(this).data('slug');
1490
 
1491
		bootbox.confirm({
108 steven 1492
			title: "LABEL_DELETE LABEL_QUESTION?",
1493
			message: "LABEL_ARE_YOU_SURE",
84 steven 1494
			buttons: {
1495
				cancel: {
108 steven 1496
   					label: '<i class="fa fa-times"></i> LABEL_CANCEL'
84 steven 1497
    			},
1498
			    confirm: {
108 steven 1499
			    	label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
84 steven 1500
			    }
1501
			},
1502
			callback: function (result) {
1503
				if (result) {
1504
					objFormGenerator.deleteQuestion(slug_section, slug);
1505
				}
1506
			}
1507
		});
1508
	});
1509
 
1510
 
1511
	$('body').on('click', 'button.btn-add-option', function(e){
1512
		e.preventDefault();
1513
	    var slug_section	= $(this).data('section');
1514
		var slug_question 	= $(this).data('slug');
1515
		var showForm 		= false;
1516
 
1517
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1518
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1519
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1520
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1521
 
1522
                		validatorFormOption.resetForm();
1523
                		$('#form-option #option-section').val(slug_section);
1524
                		$('#form-option #option-question').val(slug_question);
1525
                		$('#form-option #option-slug').val('');
1526
 
1527
                		instanceName = 'option-text';
1528
	    	    		let editor = CKEDITOR.instances[instanceName ];
1529
	    	    		editor.setData( '', function() {
1530
	    	    		    editor.focus();
1531
	    	    		});
1532
 
1533
 
1534
	    	    		$('#form-option #option-correct').val('0');
1535
                		if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1536
                    		$('#form-option #option-correct').parent().hide();
1537
                        } else {
1538
                    		$('#form-option #option-correct').parent().show();
1539
                        }
1540
 
1541
                		if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1542
                			$('#form-option #option-value').val('0');
1543
                			$('#form-option #option-value').parent().show();
1544
                		} else {
1545
                			$('#form-option #option-value').val('1');
1546
                			$('#form-option #option-value').parent().hide();
1547
 
1548
                       	}
1549
                		showForm = true;
1550
	    			}
1551
	    		}
1552
	    	}
1553
	    }
1554
 
1555
		if(showForm) {
1556
    		$('#modal-option h4[class="modal-title"]').html('New Option');
1557
    		$('#modal-option').modal('show');
1558
		}
1559
 
1560
	});
1561
 
1562
 
1563
 
1564
	$('body').on('click', 'button.btn-edit-option', function(e){
1565
	    e.preventDefault();
1566
 
1567
	    var slug_section	= $(this).data('section');
1568
	    var slug_question	= $(this).data('question');
1569
	    var slug 			= $(this).data('slug');
1570
	    var showForm 		= false;
1571
 
1572
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1573
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1574
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1575
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1576
	    				for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
1577
	    					if(slug == objFormGenerator.sections[i].questions[j].options[k].slug) {
1578
	    						validatorFormOption.resetForm();
1579
	    						$('#form-option #option-section').val(objFormGenerator.sections[i].slug);
1580
	    						$('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug);
1581
    		    				$('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug);
1582
 
1583
    		    				instanceName = 'option-text';
1584
    		    	    		let editor = CKEDITOR.instances[instanceName ];
1585
    		    	    		editor.setData( objFormGenerator.sections[i].questions[j].options[k].text, function() {
1586
    		    	    		    editor.focus();
1587
    		    	    		});
1588
 
1589
 
1590
    		    				$('#form-option #option-correct').val(objFormGenerator.sections[i].questions[j].options[k].correct);
1591
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
1592
    		    					$('#form-option #option-correct').parent().show();
1593
    		    				} else {
1594
    		    					$('#form-option #option-correct').parent().hide();
1595
            		    		}
1596
 
1597
    		    				$('#form-option #option-value').val(objFormGenerator.sections[i].questions[j].options[k].value);
1598
 
1599
								if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1600
    		    					$('#form-option #option-value').parent().show();
1601
								} else {
1602
									$('#form-option #option-value').parent().hide();
1603
								}
1604
 
1605
 
1606
 
1607
    		    				showForm = true;
1608
    	    					break;
1609
	    					}
1610
	    				}
1611
	    			}
1612
	    			if(showForm) {
1613
		    			break;
1614
		    		}
1615
	    		}
1616
	    	}
1617
			if(showForm) {
1618
    			break;
1619
    		}
1620
	    }
1621
 
1622
	    if(showForm) {
108 steven 1623
	    	$('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
1624
				$('#modal-option').modal('show');
84 steven 1625
	    }
1626
	});
1627
 
1628
	$('body').on('click', 'button.btn-delete-option', function(e){
1629
		e.preventDefault();
1630
		var slug_section	= $(this).data('section');
1631
		var slug_question	= $(this).data('question');
1632
		    var slug 			= $(this).data('slug');
1633
 
1634
 
1635
		bootbox.confirm({
108 steven 1636
			title: "LABEL_DELETE LABEL_OPTION?",
1637
			message: "LABEL_ARE_YOU_SURE",
84 steven 1638
			buttons: {
1639
				cancel: {
108 steven 1640
	   				label: '<i class="fa fa-times"></i> LABEL_CANCEL'
84 steven 1641
	    		},
1642
				confirm: {
108 steven 1643
					label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
84 steven 1644
				}
1645
			},
1646
			callback: function (result) {
1647
				if (result) {
1648
					objFormGenerator.deleteOption(slug_section, slug_question, slug);
1649
				}
1650
			}
1651
		});
1652
	})
1653
 
1654
	$('#form-section #section-value').inputNumberFormat({'decimal' : 2});
1655
 
1656
	$('#form-question #question-value').inputNumberFormat({'decimal' : 2});
1657
	$('#form-question #question-max-length').inputNumberFormat({'decimal' : 0});
1658
 
1659
	$('#form-option #option-value').inputNumberFormat({'decimal' : 2});
1660
 
1661
	$('#form-question #question-type').change(function(e) {
1662
		e.preventDefault();
1663
 
1664
		if($('#form-question #question-type').val() == 'open') {
1665
			$('#form-question #question-max-length').parent().show();
1666
			$('#form-question #question-multiline').parent().show();
1667
 
1668
		} else {
1669
			$('#form-question #question-max-length').val('0');
1670
			$('#form-question #question-max-length').parent().hide();
1671
 
1672
			$('#form-question #question-multiline').val('0');
1673
			$('#form-question #question-multiline').parent().hide();
1674
		}
1675
 
1676
		$('#form-question #question-range').val('10');
1677
		if($('#form-question #question-type').val() == 'rating-range') {
1678
			$('#form-question #question-range').parent().show();
1679
		} else {
1680
			$('#form-question #question-range').parent().hide();
1681
		}
1682
 
1683
 
1684
 
1685
	});
1686
 
1687
	$('button.btn-add-form').click(function(e) {
1688
		e.preventDefault();
1689
 
1690
		objFormGenerator.clear();
1691
		objFormGenerator.render();
1692
		validatorForm.resetForm();
1693
 
1694
		$('#form-main #form-id').val('0');
1695
		$('#form-main #form-continue').val('0');
1696
		$('#form-main #form-name').val('');
1697
 
1698
		instanceName = 'form-text';
1699
		let editor = CKEDITOR.instances[instanceName ];
1700
		editor.setData('', function() {
1701
		    editor.focus();
1702
		});
1703
 
1704
 
1705
		instanceName = 'form-description';
1706
		CKEDITOR.instances[instanceName ].setData('');
1707
 
1708
		$( '#form-main #form-language' ).val('EN'),
1709
		$( '#form-main #form-status' ).val('D');
1710
 
1711
		$('#row-forms').hide();
1712
		$('#row-edit').show();
1713
		$('#form-main #form-name').focus();
1714
 
1715
        /*$('html, body').animate({
1716
            scrollTop: $('#form-main #form-name').offset().top - 100
1717
        }, 1000);*/
1718
	});
1719
 
1720
	$('button.btn-edit-cancel').click(function(e) {
1721
		e.preventDefault();
1722
		$('#row-edit').hide();
1723
		$('#row-forms').show();
1724
 
1725
	});
1726
 
1727
 
1728
	$('button.btn-form-save-continue').click(function(e) {
1729
		e.preventDefault();
1730
		$('#form-main #form-continue').val('1')
1731
		$('#form-main').submit();
1732
	});
1733
 
1734
	$('button.btn-form-save-close').click(function(e) {
1735
		e.preventDefault();
1736
		$('#form-main #form-continue').val('0')
1737
		$('#form-main').submit();
1738
 
1739
	});
1740
 
1741
	$('#modal-section, #modal-question, #modal-option').modal({
108 steven 1742
			backdrop: 'static',
1743
			keyboard: false,
1744
			show: false
1745
		});
84 steven 1746
	});
66 efrain 1747
JS;
1748
$this->inlineScript()->captureEnd();
1749
?>
83 steven 1750
<style type="text/css">
1751
    /*#uniform-select_all{0
1752
        margin-left: 15px;
1753
    }*/
66 efrain 1754
 
83 steven 1755
    tbody input[type="checkbox"]{
1756
        margin-left: 14px;
1757
    }
1758
 
101 steven 1759
   .panel-heading .accordion-toggle:after {
83 steven 1760
        /* symbol for "opening" panels */
100 steven 1761
        display: inline-block;
1762
				font: normal normal normal 14px/1 FontAwesome;
1763
				font-size: inherit;
105 steven 1764
				content: "\f077" ;
101 steven 1765
				float: right;        /* adjust as needed */
1766
        color: grey;         /* adjust as needed */
102 steven 1767
				text-rendering: auto;
100 steven 1768
				-webkit-font-smoothing: antialiased;
83 steven 1769
    }
102 steven 1770
    .panel-heading .accordion-toggle.collapsed:after {
1771
        /* symbol for "collapsed" panels */
105 steven 1772
        content: "\f078";    /* adjust as needed, taken from bootstrap.css */
102 steven 1773
    }
83 steven 1774
 
1775
 
1776
</style>
66 efrain 1777
<!-- Content Header (Page header) -->
1778
<section class="content-header">
1779
	<div class="container-fluid">
1780
    	<div class="row mb-2">
1781
        	<div class="col-sm-12">
1782
            	<h1>LABEL_TEST</h1>
1783
			</div>
1784
		</div>
1785
	</div><!-- /.container-fluid -->
1786
</section>
1787
 
1788
<section class="content">
1789
	<div class="container-fluid">
1790
		<div class="row">
1791
			<div class="col-md-12 col-sm-12">
79 steven 1792
				<!-- Content -->
1793
				<div class="row" id="row-forms">
1794
					<div class="col-md-12">
1795
							<!-- Begin: life time stats -->
80 steven 1796
						<div class="portlet box blue-dark">
1797
								<div class="portlet-title ">
1798
										<div class="caption">
109 steven 1799
												<i class="fa fa-dot-circle-o"></i>LABEL_PERFORMANCE_EVALUATION
80 steven 1800
										</div>
1801
										<div class="actions portlet-toggler">
113 steven 1802
												<button class="btn blue btn-add-form"  data-toggle="tooltip" title="LABEL_ADD">
109 steven 1803
													<i class="fa fa-plus"></i> LABEL_ADD
80 steven 1804
													</button>
118 steven 1805
												<button class="btn red hide btn-delete-forms" data-action="delete" data-toggle="tooltip" title="LABEL_DELETE LABEL_SELECTED">
1806
													<i class="fa fa-minus"></i> LABEL_DELETE LABEL_SELECTED
1807
												</button>
80 steven 1808
												<div class="btn-group"></div>
1809
										</div>
79 steven 1810
 
80 steven 1811
								</div>
1812
								<div class="portlet-body portlet-toggler">
1813
									<table id="table-form" class="table table-striped table-bordered table-hover">
1814
 
1815
									</table>
1816
								</div>
1817
								<div class="portlet-body portlet-toggler pageform" style="display:none;"></div>
1818
						</div>
1819
					</div>
1820
				</div>
1821
				<!-- End Content -->
1822
				<!-- Row Edit -->
91 steven 1823
				<div class="row" id="row-edit" style="display: none">
80 steven 1824
					<div class="col-xs-12 col-md-12">
1825
						<form action="#" name="form-main" id="form-main">
1826
							<input type="hidden" name="form-id" id="form-id" value="0" />
1827
							<input type="hidden" name="form-continue" id="form-continue" value="0" />
1828
									<div class="form-group">
109 steven 1829
										<label for="form-name">LABEL_FIRST_NAME</label>
80 steven 1830
										<input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
79 steven 1831
									</div>
80 steven 1832
									<div class="form-group">
109 steven 1833
										<label for="form-description">LABEL_DESCRIPTION</label>
80 steven 1834
										<!--  ckeditor -->
1835
										<textarea  name="form-description" id="form-description" rows="5" class="ckeditor form-control"></textarea>
1836
									</div>
1837
									<div class="form-group">
109 steven 1838
										<label for="form-text">LABEL_TEXT</label>
80 steven 1839
										<!--  ckeditor -->
1840
										<textarea  name="form-text" id="form-text" rows="5" class="ckeditor form-control"></textarea>
79 steven 1841
									</div>
80 steven 1842
									<div class="form-group">
109 steven 1843
										<label for="form-language">LABEL_LANGUAGES</label>
80 steven 1844
										<select name="form-language" id="form-language" class="form-control">
109 steven 1845
											<option value="EN">LABEL_ENGLISH</option>
1846
											<option value="SP">LABEL_SPANISH</option>
80 steven 1847
										</select>
1848
									</div>
1849
									<div class="form-group">
109 steven 1850
										<label for="form-status">LABEL_STATUS</label>
80 steven 1851
										<select name="form-status" id="form-status" class="form-control">
109 steven 1852
											<option value="D">LABEL_INACTIVE</option>
1853
											<option value="A">LABEL_ACTIVE</option>
80 steven 1854
										</select>
1855
									</div>
1856
									<br/>
1857
									<div class="row">
1858
								<div class="col-xs-12 col-md-12 text-right">
111 steven 1859
									<button class="btn btn-primary" id="btn-add-section" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION</button>
80 steven 1860
								</div>
79 steven 1861
							</div>
85 steven 1862
							<br />
80 steven 1863
							<div class="row">
1864
								<div class="col-xs-12 col-md-12">
1865
									<div class="panel-group" id="accordion">
1866
 
1867
 
1868
 
1869
									</div>
1870
								</div>
1871
							</div>
1872
 
1873
 
1874
							<div class="form-group">
109 steven 1875
								<button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
1876
								<button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
1877
								<button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
80 steven 1878
							</div>
1879
						</form>
79 steven 1880
					</div>
1881
				</div>
80 steven 1882
				<!-- End Row Edit -->
82 steven 1883
				<!-- Modals -->
119 steven 1884
					<!-- Section Modal -->
82 steven 1885
					<div  id="modal-section" class="modal" tabindex="-1" role="dialog">
1886
						<div class="modal-dialog" role="document">
1887
								<form action="#" name="form-section" id="form-section">
1888
									<input type="hidden" name="section-slug" id="section-slug" value="" />
1889
									<div class="modal-content">
1890
											<div class="modal-header">
109 steven 1891
												<!-- <h4 class="modal-title">Modal title</h4> -->
82 steven 1892
												<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
1893
											<span aria-hidden="true">&times;</span>
1894
												</button> -->
1895
											</div>
1896
											<div class="modal-body">
1897
										<div class="form-group">
109 steven 1898
											<label for="section-name">LABEL_FIRST_NAME</label>
82 steven 1899
													<input type="text" name="section-name" id="section-name" class="form-control" maxlength="50" value="" />
1900
												</div>
1901
												<div class="form-group">
109 steven 1902
													<label for="section-text">LABEL_TEXT</label>
82 steven 1903
													<!--  ckeditor -->
1904
													<textarea  name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
1905
												</div>
1906
												<div class="form-group">
109 steven 1907
													<label for="section-value">LABEL_VALUE</label>
82 steven 1908
													<input type="text" name="section-value" id="section-value"  class="form-control" value="0" />
1909
												</div>
1910
											</div>
1911
											<div class="modal-footer">
109 steven 1912
												<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1913
												<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
82 steven 1914
											</div>
1915
									</div>
1916
								</form>
1917
						</div>
1918
					</div>
1919
					<!-- End Modal Section -->
1920
					<!-- Question Modal -->
1921
						<div  id="modal-question" class="modal" tabindex="-1" role="dialog">
1922
							<div class="modal-dialog" role="document">
1923
								<form action="#" name="form-question" id="form-question">
1924
									<input type="hidden" name="question-section" id="question-section" />
1925
									<input type="hidden" name="question-slug" id="question-slug" />
1926
										<div class="modal-content">
1927
											<div class="modal-header">
109 steven 1928
													<h4 class="modal-title">LABEL_ADD LABEL_QUESTION</h4>
82 steven 1929
													<button type="button" class="close" data-dismiss="modal" aria-label="Close">
109 steven 1930
														<span aria-hidden="true">&times;</span>
82 steven 1931
													</button>
1932
												</div>
1933
											<div class="modal-body">
1934
													<div class="form-group">
109 steven 1935
														<label for="question-text">LABEL_TEXT</label>
82 steven 1936
														<!--  ckeditor -->
1937
														<textarea  name="question-text" id="question-text" rows="5" class="ckeditor form-control"></textarea>
1938
													</div>
1939
													<div class="form-group">
109 steven 1940
														<label for="question-value">LABEL_VALUE</label>
82 steven 1941
														<input type="text" name="question-value" id="question-value"  class="form-control" />
1942
													</div>
1943
													<div class="form-group">
109 steven 1944
														<label for="question-type">LABEL_TYPE</label>
82 steven 1945
														<select name="question-type" id="question-type" class="form-control">
109 steven 1946
															<option value="open">LABEL_OPEN</option>
82 steven 1947
															<option value="simple">Simple</option>
1948
															<option value="multiple">Multiple</option>
109 steven 1949
															<option value="rating-open">LABEL_RATING_OPEN</option>
1950
															<option value="rating-range">LABEL_RATING_RANGE</option>
82 steven 1951
														</select>
1952
													</div>
1953
													<div class="form-group">
109 steven 1954
														<label for="question-max-length">LABEL_MAXLENGTH</label>
82 steven 1955
														<input type="text" name="question-max-length" id="question-max-length"  class="form-control" />
1956
													</div>
1957
													<div class="form-group">
109 steven 1958
														<label for="question-multiline">LABEL_MULTI_LINE</label>
82 steven 1959
														<select name="question-multiline" id="question-multiline" class="form-control">
109 steven 1960
															<option value="1">LABEL_YES</option>
82 steven 1961
															<option value="0">No</option>
1962
														</select>
1963
													</div>
1964
													<div class="form-group">
109 steven 1965
														<label for="question-range">LABEL_RANGE</label>
82 steven 1966
														<select name="question-range" id="question-range" class="form-control">
1967
															<option value="10">1-10</option>
1968
															<option value="6">1-6</option>
1969
															<option value="5">1-5</option>
1970
														</select>
1971
													</div>
1972
												</div>
1973
												<div class="modal-footer">
109 steven 1974
													<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1975
													<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
82 steven 1976
												</div>
1977
										</div>
1978
									</form>
1979
							</div>
1980
						</div>
1981
					<!-- End Modal Question -->
83 steven 1982
					<!-- MOdal Options -->
1983
					<div  id="modal-option" class="modal" tabindex="-1" role="dialog">
1984
						<div class="modal-dialog" role="document">
1985
							<form action="#" name="form-option" id="form-option">
1986
									<input type="hidden" name="option-section" id="option-section" value="" />
1987
									<input type="hidden" name="option-question" id="option-question" value="" />
1988
									<input type="hidden" name="option-slug" id="option-slug" value="" />
1989
										<div class="modal-content">
1990
											<div class="modal-header">
110 steven 1991
												<h4 class="modal-title">LABEL_OPTION</h4>
83 steven 1992
												<button type="button" class="close" data-dismiss="modal" aria-label="Close">
110 steven 1993
													<span aria-hidden="true">&times;</span>
83 steven 1994
												</button>
1995
											</div>
1996
											<div class="modal-body">
1997
												<div class="form-group">
110 steven 1998
													<label for="option-text">LABEL_TEXT</label>
83 steven 1999
													<!--  ckeditor -->
2000
													<textarea  name="option-text" id="option-text" rows="5" class="ckeditor form-control"></textarea>
2001
												</div>
2002
												<div class="form-group">
110 steven 2003
													<label for="option-correct">LABEL_ANSWER_CORRECT</label>
83 steven 2004
													<select name="option-correct" id="option-correct" class="form-control">
110 steven 2005
														<option value="1">LABEL_YES</option>
83 steven 2006
														<option value="0">No</option>
2007
													</select>
2008
												</div>
2009
												<div class="form-group">
110 steven 2010
													<label for="option-value">LABEL_VALUE</label>
2011
													<input type="text" name="option-value" id="option-value" class="form-control" />
83 steven 2012
												</div>
2013
											</div>
2014
											<div class="modal-footer">
110 steven 2015
												<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2016
												<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
83 steven 2017
											</div>
2018
									</div>
2019
								</form>
2020
						</div>
2021
					</div>
2022
					<!-- End Modal Options -->
82 steven 2023
				<!-- End Modals -->
66 efrain 2024
			</div>
2025
		</div>
2026
 	</div>
2027
</section>