Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
16701 efrain 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
$routeAdd       = $this->url('fast-survey/add');
9
$routeDatatable = $this->url('fast-survey');
10
 
11
$allowAdd       = $acl->isAllowed($roleName, 'fast-survey/add') ? 1 : 0;
12
$allowEdit      = $acl->isAllowed($roleName, 'fast-survey/edit') ? 1 : 0;
13
$allowDelete    = $acl->isAllowed($roleName, 'fast-survey/delete') ? 1 : 0;
16747 efrain 14
$allowChart    = $acl->isAllowed($roleName, 'fast-survey/chart') ? 1 : 0;
16701 efrain 15
$allowDownload  = $acl->isAllowed($roleName, 'fast-survey/download') ? 1 : 0;
16
 
16822 efrain 17
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
18
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
16701 efrain 19
 
16822 efrain 20
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
21
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
22
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
16701 efrain 23
 
16822 efrain 24
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
16701 efrain 25
 
16822 efrain 26
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
27
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
16701 efrain 28
 
29
 
16822 efrain 30
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
16701 efrain 31
 
32
 
33
 
16747 efrain 34
 
35
 
16822 efrain 36
$this->inlineScript()->appendFile($this->basePath('assets/vendors/chart.js/chart.js'));
37
$this->inlineScript()->appendFile($this->basePath('assets/vendors/chartjs-plugin-datalabels/chartjs-plugin-datalabels.js'));
16747 efrain 38
 
39
 
16822 efrain 40
 
16701 efrain 41
$this->inlineScript()->captureStart();
42
echo <<<JS
16747 efrain 43
 
44
 
45
    var ctxChartResult = document.getElementById("chartResult").getContext("2d");
46
 
47
 
48
    var chartResult = new Chart(ctxChartResult, {
49
        type: 'bar',
50
        data: {
51
            labels: [],
52
            datasets: [
53
                {
54
                	label : 'LABEL_VOTES',
55
         			backgroundColor: '#E69090',
56
                    borderColor: '#E69090',
57
                    borderWidth: 1,
58
                    fill: false,
59
                    data : []
60
              	},
61
            ]
62
        },
63
        options: {
64
            indexAxis: 'y',
65
            tooltips: {
66
                mode: 'index',
67
                intersect: false
68
            },
69
            scales: {
70
                xAxes: [{
71
                    ticks: {
72
                        beginAtZero:true
73
                    }
74
                }]
75
            }
76
        }
77
    });
78
 
16701 efrain 79
    jQuery( document ).ready(function( $ ) {
80
 
81
        $.validator.setDefaults({
82
            debug: true,
83
            highlight: function(element) {
84
                $(element).addClass('is-invalid');
85
            },
86
            unhighlight: function(element) {
87
                $(element).removeClass('is-invalid');
88
            },
89
            errorElement: 'span',
90
            errorClass: 'error invalid-feedback',
91
            errorPlacement: function(error, element) {
92
                if(element.parent('.form-group').length) {
93
                    error.insertAfter(element);
94
                } else if(element.parent('.toggle').length) {
95
                    error.insertAfter(element.parent().parent());
96
                } else {
97
                    error.insertAfter(element.parent());
98
                }
99
            }
100
        });
101
 
102
 
103
        $.fn.showFormErrorValidator = function(fieldname, errors) {
104
            var field = $(fieldname);
105
            if(field) {
106
                $(field).addClass('is-invalid');
107
 
108
 
109
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
110
                if(field.parent('.form-group').length) {
111
                    error.insertAfter(field);
112
                } else  if(field.parent('.toggle').length) {
113
                    error.insertAfter(field.parent().parent());
114
                } else {
115
                    error.insertAfter(field.parent());
116
                }
117
            }
118
        };
119
 
120
 
121
 
122
 
123
        var allowEdit   = $allowEdit;
124
        var allowDelete = $allowDelete;
16747 efrain 125
        var allowChart   = $allowChart;
16701 efrain 126
        var allowDownload = $allowDownload;
127
 
128
        var gridTable = $('#gridTable').dataTable( {
129
            'processing': true,
130
            'serverSide': true,
131
            'searching': true,
132
            'order': [[ 0, 'asc' ]],
133
            'ordering':  true,
134
            'ordenable' : true,
135
            'responsive': true,
136
            'select' : false,
137
        	'paging': true,
138
            'pagingType': 'simple_numbers',
139
    		'ajax': {
140
    			'url' : '$routeDatatable',
141
    			'type' : 'get',
142
                'beforeSend': function (request) {
143
                  NProgress.start();
144
                },
145
                'dataFilter': function(response) {
146
                    var response = jQuery.parseJSON( response );
147
 
148
                    var json                = {};
149
                    json.recordsTotal       = 0;
150
                    json.recordsFiltered    = 0;
151
                    json.data               = [];
152
 
153
 
154
                    if(response.success) {
155
                        json.recordsTotal       = response.data.total;
156
                        json.recordsFiltered    = response.data.total;
157
                        json.data               = response.data.items;
158
                    } else {
159
                        $.fn.showError(response.data)
160
                    }
161
 
162
                    return JSON.stringify( json );
163
                }
164
    		},
165
            'language' : {
166
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
167
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
168
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
169
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
170
                'sInfo':           'LABEL_DATATABLE_SINFO',
171
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
172
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
173
                'sInfoPostFix':    '',
174
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
175
                'sUrl':            '',
176
                'sInfoThousands':  ',',
177
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
178
                'oPaginate': {
179
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
180
                    'sLast':     'LABEL_DATATABLE_SLAST',
181
                    'sNext':     'LABEL_DATATABLE_SNEXT',
182
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
183
                },
184
                'oAria': {
185
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
186
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
187
                },
188
            },
189
            'drawCallback': function( settings ) {
190
                NProgress.done();
16822 efrain 191
 
16701 efrain 192
            },
193
            'aoColumns': [
194
                { 'mDataProp': 'question' },
195
                { 'mDataProp': 'details' },
196
                { 'mDataProp': 'votes' },
197
                { 'mDataProp': 'actions' },
198
    	    ],
199
            'columnDefs': [
200
                {
201
                    'targets': 0,
202
                    'className' : 'text-vertical-middle',
203
                },
204
                {
205
                    'targets': 1,
206
                    'orderable': false,
207
                    'render' : function ( data, type, row ) {
16747 efrain 208
                        var s = 'LABEL_DURATION_FROM : ' + data['added_on'] + '<br>';
16701 efrain 209
                        s = s + 'LABEL_DURATION_UNTIL : ' + data['expire_on'] + '<br>';
210
 
211
                    return s;
212
 
213
                    }
214
                },
215
                {
216
                    'targets': 2,
217
                    'className' : 'text-vertical-middle',
218
                    'orderable': false,
219
                },
220
                {
221
                    'targets': -1,
222
                    'orderable': false,
223
                    'render' : function ( data, type, row ) {
224
                        s = '';
225
 
226
                        if(allowEdit && data['link_edit']) {
16906 efrain 227
                            s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button>&nbsp;';
16701 efrain 228
                        }
229
                        if(allowDelete && data['link_delete']) {
230
                            s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
231
                        }
16747 efrain 232
                        if(allowChart && data['link_chart']) {
233
                            s = s + '<button class="btn btn-danger btn-chart" data-href="' + data['link_chart']+ '" data-toggle="tooltip" title="LABEL_CHART"><i class="fa fa-line-chart"></i> LABEL_CHART </button>&nbsp;';
234
                        }
235
                        if(allowDownload && data['link_download']) {
236
                            s = s + '<button class="btn btn-danger btn-download" data-href="' + data['link_download']+ '" data-toggle="tooltip" title="LABEL_DOWNLOAD"><i class="fa fa-download"></i> LABEL_DOWNLOAD </button>&nbsp;';
237
                        }
16701 efrain 238
                        return s;
239
                    }
240
                }
241
              ],
242
        });
243
 
244
 
245
        var validator = $('#form').validate({
246
            debug: true,
247
            onclick: false,
248
            onkeyup: false,
249
            ignore: [],
250
            rules: {
251
                'question': {
252
                    required: true,
253
                    maxlength: 1024,
254
                },
255
                'number_of_answers' : {
256
                    required: true,
257
                    digits: true,
258
                    min: 2,
259
                    max: 5
260
                },
261
                'answer1': {
262
                    required: true,
263
                    maxlength: 100,
264
                },
265
                'answer2': {
266
                    required: true,
267
                    maxlength: 100,
268
                },
269
                'answer3': {
270
                    required: function (element) {
271
                        return $('#form #number_of_answers').val() >= 3 ? true : false;
272
                    } ,
273
                    maxlength: 100,
274
                },
275
                'answer4': {
276
                    required: function (element) {
277
                        return $('#form #number_of_answers').val() >= 4 ? true : false;
278
                    } ,
279
                    maxlength: 100,
280
                },
281
                'answer5': {
282
                    required: function (element) {
283
                        return $('#form #number_of_answers').val() >= 5 ? true : false;
284
                    } ,
285
                    maxlength: 100,
286
                },
287
                'privacy': {
288
                    required: true,
289
                },
290
                'result_type': {
291
                    required: false,
292
 
293
                },
294
                'duration_days' : {
295
                    required: true,
296
                    digits: true,
297
                    min: 1,
298
                    max: 29
299
                },
300
                'duration_hours' : {
301
                    required: true,
302
                    digits: true,
303
                    min: 0,
304
                    max: 23
305
                },
306
                'duration_minutes' : {
307
                    required: true,
308
                    digits: true,
309
                    min: 0,
310
                    max: 59
311
                },
312
            },
313
            submitHandler: function(form)
314
            {
315
                $.ajax({
316
                    'dataType'  : 'json',
317
                    'accept'    : 'application/json',
318
                    'method'    : 'post',
319
                    'url'       :  $('#form').attr('action'),
320
                    'data'      :  $('#form').serialize(),
321
 
322
                }).done(function(response) {
323
                    NProgress.start();
324
                    if(response['success']) {
325
                        $.fn.showSuccess(response['data']);
326
 
327
                        $('#row-form').hide();
328
                        $('#row-listing').show();
329
 
330
 
331
                        gridTable.api().ajax.reload(null, false);
332
                    } else {
333
                        validator.resetForm();
334
                        if(jQuery.type(response['data']) == 'string') {
335
                            $.fn.showError(response['data']);
336
                        } else  {
337
                            $.each(response['data'], function( fieldname, errors ) {
338
                                $.fn.showFormErrorValidator('#form #' + fieldname, errors);
339
                            });
340
                        }
341
                    }
342
                }).fail(function( jqXHR, textStatus, errorThrown) {
343
                    $.fn.showError(textStatus);
344
                }).always(function() {
345
                    NProgress.done();
346
                });
347
                return false;
348
            },
349
            invalidHandler: function(form, validator) {
350
            }
351
        });
352
 
353
 
354
 
355
        $('body').on('click', 'button.btn-add', function(e) {
356
            e.preventDefault();
357
 
358
            $('#card-form-title').html('LABEL_ADD');
359
            $('#form').attr('action', '$routeAdd');
360
            $('#form #question').val('');
361
            $('#form #number_of_answers').val('2');
362
            $('#form #answer1').val('');
363
            $('#form #answer2').val('');
364
            $('#form #answer3').val('');
365
            $('#form #answer4').val('');
366
            $('#form #answer5').val('');
367
            $('#form #privacy').val($("#form #privacy option:first").val());
368
            $('#form #result_type').val($("#form #result_type option:first").val());
369
            $('#form #duration_days').val('1');
370
            $('#form #duration_hours').val('0');
371
            $('#form #duration_minutes').val('0');
372
 
373
            $('#form-group-answer3').hide();
374
            $('#form-group-answer4').hide();
375
            $('#form-group-answer5').hide();
376
 
377
            validator.resetForm();
378
            $('#row-listing').hide();
379
            $('#row-form').show();
380
 
381
        });
382
 
383
        $('body').on('click', 'button.btn-edit', function(e) {
384
            e.preventDefault();
385
            NProgress.start();
386
            var action = $(this).data('href');
387
 
388
            $.ajax({
389
                'dataType'  : 'json',
390
                'method'    : 'get',
391
                'url'       :  action,
392
            }).done(function(response) {
393
                if(response['success']) {
394
 
395
                    $('#card-form-title').html('LABEL_EDIT');
396
                    $('#form').attr('action', action);
397
                    $('#form #question').val(response['data']['question']);
398
                    $('#form #number_of_answers').val(response['data']['number_of_answers']);
399
                    $('#form #answer1').val(response['data']['answer1']);
400
                    $('#form #answer2').val(response['data']['answer2']);
401
                    $('#form #answer3').val(response['data']['answer3']);
402
                    $('#form #answer4').val(response['data']['answer4']);
403
                    $('#form #answer5').val(response['data']['answer5']);
404
                    $('#form #privacy').val(response['data']['privacy']);
405
                    $('#form #result_type').val(response['data']['result_type']);
406
                    $('#form #duration_days').val(response['data']['duration_days']);
407
                    $('#form #duration_hours').val(response['data']['duration_hours']);
408
                    $('#form #duration_minutes').val(response['data']['duration_minutes']);
409
 
410
                    switch(response['data']['number_of_answers'])
411
                    {
412
                        case 3 :
413
                            $('#form-group-answer3').show();
414
                            $('#form-group-answer4').hide();
415
                            $('#form-group-answer5').hide();
416
                            break;
417
 
418
                        case 4 :
419
                            $('#form-group-answer3').show();
420
                            $('#form-group-answer4').show();
421
                            $('#form-group-answer5').hide();
422
                            break;
423
 
424
                        case 5 :
425
                            $('#form-group-answer3').show();
426
                            $('#form-group-answer4').show();
427
                            $('#form-group-answer5').show();
428
                            break;
429
 
430
                        default :
431
                            $('#form-group-answer3').hide();
432
                            $('#form-group-answer4').hide();
433
                            $('#form-group-answer5').hide();
434
                            break;
435
 
436
                    }
437
 
438
 
439
                    validator.resetForm();
440
                    $('#row-listing').hide();
441
                    $('#row-form').show();
442
 
443
 
444
                } else {
445
                    $.fn.showError(response['data']);
446
                }
447
            }).fail(function( jqXHR, textStatus, errorThrown) {
448
                $.fn.showError(textStatus);
449
            }).always(function() {
450
                NProgress.done();
451
            });
452
        });
453
 
16747 efrain 454
        $('body').on('click', 'button.btn-chart', function(e) {
455
            e.preventDefault();
456
            NProgress.start();
457
            var action = $(this).data('href');
458
 
459
            $.ajax({
460
                'dataType'  : 'json',
461
                'method'    : 'get',
462
                'url'       :  action,
463
            }).done(function(response) {
464
                if(response['success']) {
465
 
466
                    $('#chart-question').html(response['data']['question']);
467
 
468
                    chartResult.data.labels = response['data']['labels'];
469
                    chartResult.data.datasets[0].data = response['data']['values'];
470
                    chartResult.update();
471
 
472
                    $('#row-listing').hide();
473
                    $('#row-chart').show();
474
 
475
 
476
                } else {
477
                    $.fn.showError(response['data']);
478
                }
479
            }).fail(function( jqXHR, textStatus, errorThrown) {
480
                $.fn.showError(textStatus);
481
            }).always(function() {
482
                NProgress.done();
483
            });
484
        });
485
 
486
 
487
        $('body').on('click', 'button.btn-download', function(e) {
488
            e.preventDefault();
489
 
490
            NProgress.start();
491
             var action = $(this).data('href');
492
 
493
 
494
            $.ajax({
495
                'dataType'  : 'json',
496
                'method'    : 'get',
497
                'url'       : action,
498
            }).done(function(response) {
499
                if(response['success']) {
500
                    var anchor = window.document.createElement("a");
501
                    anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
502
                    anchor.download = response['data']['basename'];
503
                    document.body.appendChild(anchor);
504
                    anchor.click();  // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
505
                    document.body.removeChild(anchor);
506
                } else {
507
                    $.fn.showError(response['data']);
508
                }
509
            }).fail(function( jqXHR, textStatus, errorThrown) {
510
                $.fn.showError(textStatus);
511
            }).always(function() {
512
                NProgress.done();
513
            });
514
 
515
 
516
        });
517
 
518
 
519
 
16701 efrain 520
        $('body').on('click', 'button.btn-refresh', function(e) {
521
            e.preventDefault();
522
            gridTable.api().ajax.reload(null, false);
523
        });
524
 
525
 
526
        $('body').on('click', 'button.btn-cancel', function(e) {
527
            e.preventDefault();
16747 efrain 528
            $('#row-chart').hide();
16701 efrain 529
            $('#row-form').hide();
530
            $('#row-listing').show();
531
        });
532
 
16822 efrain 533
    $('body').on('click', 'button.btn-delete', function(e) {
534
        e.preventDefault();
535
        var action = $(this).data('href');
536
 
537
 
538
          swal.fire({
539
            title: 'LABEL_ARE_YOU_SURE',
540
            icon: 'question',
541
            cancelButtonText: 'LABEL_NO',
542
            showCancelButton: true,
543
            confirmButtonText: 'LABEL_YES'
544
          }).then((result) => {
545
            if (result.isConfirmed) {
546
 
547
                    NProgress.start();
548
                    $.ajax({
549
                        'dataType'  : 'json',
550
                        'accept'    : 'application/json',
551
                        'method'    : 'post',
552
                        'url'       :  action,
553
                    }).done(function(response) {
554
                        if(response['success']) {
555
                            $.fn.showSuccess(response['data']);
556
                            gridTable.api().ajax.reload(null, false);
557
                        } else {
558
                            $.fn.showError(response['data']);
559
                        }
560
                    }).fail(function( jqXHR, textStatus, errorThrown) {
561
                        $.fn.showError(textStatus);
562
                    }).always(function() {
563
                        NProgress.done();
564
                    });
565
                }
566
           });
567
        });
568
 
16701 efrain 569
        $('#form #number_of_answers').change(function(e) {
570
            e.preventDefault();
571
 
572
            switch(parseInt($(this).val()))
573
                    {
574
                        case 3 :
575
                            $('#form-group-answer3').show();
576
                            $('#form-group-answer4').hide();
577
                            $('#form-group-answer5').hide();
578
                            break;
579
 
580
                        case 4 :
581
                            $('#form-group-answer3').show();
582
                            $('#form-group-answer4').show();
583
                            $('#form-group-answer5').hide();
584
                            break;
585
 
586
                        case 5 :
587
                            $('#form-group-answer3').show();
588
                            $('#form-group-answer4').show();
589
                            $('#form-group-answer5').show();
590
                            break;
591
 
592
                        default :
593
                            $('#form-group-answer3').hide();
594
                            $('#form-group-answer4').hide();
595
                            $('#form-group-answer5').hide();
596
                            break;
597
 
598
                    }
599
 
600
 
601
        });
602
 
603
 
604
        $('#form #duration_days').inputNumberFormat({decimal: 0});
605
        $('#form #duration_hours').inputNumberFormat({decimal: 0});
606
        $('#form #duration_minutes').inputNumberFormat({decimal: 0});
607
 
608
 
609
 
610
 
611
 
612
    });
613
JS;
614
$this->inlineScript()->captureEnd();
615
?>
616
 
16822 efrain 617
<div class="container">
16864 efrain 618
	<div class="card" id="row-listing">
619
	 	<div class="card-header">
620
	 		<h6 class="card-title">LABEL_FAST_SURVEYS</h6>
621
	 	</div>
622
	 	<div class="card-body">
623
	 		<div class="row">
624
	 	         <div class="col-12 mt-3">
625
 
16912 efrain 626
	 	          <table id="gridTable" class="table  table-bordered">
16701 efrain 627
                            <thead>
628
                                <tr>
629
                                    <th>LABEL_QUESTION</th>
630
                                    <th>LABEL_DETAILS</th>
631
                                    <th>LABEL_VOTES</th>
632
                                    <th>LABEL_ACTIONS</th>
633
                                </tr>
634
                            </thead>
635
                            <tbody>
636
                            </tbody>
637
                        </table>
16864 efrain 638
 
639
	 	         </div>
640
	 	     </div>
641
	 	</div>
642
	 	<div class="card-footer text-right">
643
	 		<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
644
       		<?php if ($allowAdd) : ?>
645
         	<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
646
        	<?php endif; ?>
647
 
648
	 	</div>
649
	</div>
650
 
651
	<div class="card" id="row-form" style="display: none">
652
	 	<div class="card-header">
653
	 		<h6 class="card-title" id="card-form-title"></h6>
654
	 	</div>
655
	 	 <?php
16701 efrain 656
                    $form = $this->form;
657
                    $form->setAttributes([
658
                        'method'    => 'post',
659
                        'name'      => 'form',
660
                        'id'        => 'form',
661
                    ]);
662
 
663
                    $form->prepare();
664
                    echo $this->form()->openTag($form);
665
                    ?>
16864 efrain 666
	 	<div class="card-body">
667
	 		<div class="row">
668
	 	         <div class="col-12 mt-3">
16701 efrain 669
                            <?php
670
                            $element = $form->get('question');
671
                            $element->setOptions(['label' => 'LABEL_QUESTION']);
672
                            $element->setAttributes(['class' => 'form-control']);
673
 
674
                            echo $this->formLabel($element);
675
                            echo $this->formText($element);
676
                            ?>
16864 efrain 677
	 	         </div>
678
	 	     </div>
679
	 		<div class="row">
680
	 	         <div class="col-12 mt-3">
16701 efrain 681
                            <?php
682
                            $element = $form->get('number_of_answers');
683
                            $element->setOptions(['label' => 'LABEL_NUMBER_OF_ANSWERS']);
684
                            $element->setAttributes(['class' => 'form-control']);
685
 
686
                            echo $this->formLabel($element);
687
                            echo $this->formSelect($element);
688
                            ?>
16864 efrain 689
	 	         </div>
690
	 	     </div>
691
	 		<div class="row">
692
	 	         <div class="col-12 mt-3">
16701 efrain 693
                            <?php
694
                            $element = $form->get('answer1');
695
                            $element->setOptions(['label' => 'LABEL_ANSWER1']);
696
                            $element->setAttributes(['class' => 'form-control']);
697
 
698
                            echo $this->formLabel($element);
699
                            echo $this->formText($element);
700
                            ?>
16864 efrain 701
	 	         </div>
702
	 	     </div>
703
	 		<div class="row">
704
	 	         <div class="col-12 mt-3">
16701 efrain 705
                            <?php
706
                            $element = $form->get('answer2');
707
                            $element->setOptions(['label' => 'LABEL_ANSWER2']);
708
                            $element->setAttributes(['class' => 'form-control']);
709
 
710
                            echo $this->formLabel($element);
711
                            echo $this->formText($element);
712
                            ?>
16864 efrain 713
	 	         </div>
714
	 	     </div>
715
 
716
	 		<div class="row" id="form-group-answer3">
717
	 	         <div class="col-12 mt-3">
16701 efrain 718
                            <?php
719
                            $element = $form->get('answer3');
720
                            $element->setOptions(['label' => 'LABEL_ANSWER3']);
721
                            $element->setAttributes(['class' => 'form-control']);
722
 
723
                            echo $this->formLabel($element);
724
                            echo $this->formText($element);
725
                            ?>
16864 efrain 726
	 	         </div>
727
	 	     </div>
728
	 		<div class="row" id="form-group-answer4">
729
	 	         <div class="col-12 mt-3">
16701 efrain 730
                            <?php
731
                            $element = $form->get('answer4');
732
                            $element->setOptions(['label' => 'LABEL_ANSWER4']);
733
                            $element->setAttributes(['class' => 'form-control']);
734
 
735
                            echo $this->formLabel($element);
736
                            echo $this->formText($element);
737
                            ?>
16864 efrain 738
	 	         </div>
739
	 	     </div>
740
	 		<div class="row" id="form-group-answer5">
741
	 	         <div class="col-12 mt-3">
16701 efrain 742
                            <?php
743
                            $element = $form->get('answer5');
744
                            $element->setOptions(['label' => 'LABEL_ANSWER5']);
745
                            $element->setAttributes(['class' => 'form-control']);
746
 
747
                            echo $this->formLabel($element);
748
                            echo $this->formText($element);
749
                            ?>
16864 efrain 750
	 	         </div>
751
	 	     </div>
752
	 		<div class="row">
753
	 	         <div class="col-12 mt-3">
16701 efrain 754
                            <?php
755
                            $element = $form->get('privacy');
756
                            $element->setOptions(['label' => 'LABEL_PRIVACY']);
757
                            $element->setAttributes(['class' => 'form-control']);
758
 
759
                            echo $this->formLabel($element);
760
                            echo $this->formSelect($element);
761
                            ?>
16864 efrain 762
	 	         </div>
763
	 	     </div>
764
	 		<div class="row">
765
	 	         <div class="col-12 mt-3">
16701 efrain 766
                            <?php
767
                            $element = $form->get('result_type');
768
                            $element->setOptions(['label' => 'LABEL_RESULT_TYPE']);
769
                            $element->setAttributes(['class' => 'form-control']);
770
 
771
                            echo $this->formLabel($element);
772
                            echo $this->formSelect($element);
773
                            ?>
16864 efrain 774
	 	         </div>
775
	 	     </div>
776
	 		<div class="row">
777
	 	         <div class="col-12 mt-3">
16701 efrain 778
                            <?php
779
                            $element = $form->get('duration_days');
780
                            $element->setOptions(['label' => 'LABEL_DURATION_DAYS']);
781
                            $element->setAttributes(['class' => 'form-control']);
782
 
783
                            echo $this->formLabel($element);
784
                            echo $this->formNumber($element);
785
                            ?>
16864 efrain 786
	 	         </div>
787
	 	     </div>
788
	 		<div class="row">
789
	 	         <div class="col-12 mt-3">
16701 efrain 790
                            <?php
791
                            $element = $form->get('duration_hours');
792
                            $element->setOptions(['label' => 'LABEL_DURATION_HOURS']);
793
                            $element->setAttributes(['class' => 'form-control']);
794
 
795
                            echo $this->formLabel($element);
796
                            echo $this->formNumber($element);
797
                            ?>
16864 efrain 798
	 	         </div>
799
	 	     </div>
800
	 		<div class="row">
801
	 	         <div class="col-12 mt-3">
16701 efrain 802
                            <?php
803
                            $element = $form->get('duration_minutes');
804
                            $element->setOptions(['label' => 'LABEL_DURATION_MINUTES']);
805
                            $element->setAttributes(['class' => 'form-control']);
806
 
807
                            echo $this->formLabel($element);
808
                            echo $this->formNumber($element);
809
                            ?>
16864 efrain 810
	 	         </div>
811
	 	     </div>
812
	 	</div>
813
	 	<div class="card-footer text-right">
814
                 		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
16701 efrain 815
                        <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
16864 efrain 816
 
817
	 	</div>
818
	 	 <?php echo $this->form()->closeTag($form); ?>
819
	</div>
820
 
821
 
822
	<div class="card"  id="row-chart" style="display: none">
823
	 	<div class="card-header">
824
	 		<h6 class="card-title" id="chart-question"></h6>
825
	 	</div>
826
	 	<div class="card-body">
827
	 		<div class="row">
828
	 	         <div class="col-12 mt-3">
829
	 	         	<div class="col-lg-12 col-12 chart">
16747 efrain 830
                                <canvas id="chartResult" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
831
                            </div>
16864 efrain 832
	 	         </div>
833
	 	     </div>
834
	 	</div>
835
	 	<div class="card-footer text-right">
836
			<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
837
	 	</div>
838
	</div>
839
 
840
 
841
</div>
842
 
16701 efrain 843
 
844
 
16822 efrain 845