Proyectos de Subversion LeadersLinked - Backend

Rev

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