Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
251 geraldo 1
<?php
2
$acl = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
261 geraldo 7
$routeAdd = $this->url('self-evaluation/forms/add');
262 geraldo 8
$routeDatatable = $this->url('self-evaluation/reviews');
251 geraldo 9
$routeDashboard = $this->url('dashboard');
10
 
261 geraldo 11
$allowEdit = $acl->isAllowed($roleName, 'self-evaluation/forms/edit') ? 1 : 0;
251 geraldo 12
 
13
 
14
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
15
 
16
 
17
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
18
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
19
 
20
 
21
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
22
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
23
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
24
 
25
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
26
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
27
 
28
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
29
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
32
 
33
 
34
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
35
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
36
 
37
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
38
 
39
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
40
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
41
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
42
 
43
 
44
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
45
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
46
 
47
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
48
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
49
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
261 geraldo 50
 
251 geraldo 51
// bootbox Alert //
52
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
261 geraldo 53
 
251 geraldo 54
// JsRender //
55
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
56
 
261 geraldo 57
// Page Styles
58
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
251 geraldo 59
 
306 geraldo 60
 
307 geraldo 61
$pending = \LeadersLinked\Model\CompanySelfEvaluationTest::STATUS_PENDING;
308 geraldo 62
$review = \LeadersLinked\Model\CompanySelfEvaluationTest::STATUS_REVIEW;
307 geraldo 63
$completed = \LeadersLinked\Model\CompanySelfEvaluationTest::STATUS_COMPLETED;
306 geraldo 64
 
251 geraldo 65
$this->inlineScript()->captureStart();
66
echo <<<JS
339 geraldo 67
const classFormGenerator = function() {
251 geraldo 68
    this.id = 0,
69
        this.table = '',
70
        this.name = '',
71
        this.text = '',
72
        this.status = 'a',
73
        this.sections = [],
74
        this.clear = function() {
75
            this.sections = [];
76
            this.render();
77
        },
78
        /**
79
         * Render array sections
80
         */
81
        this.renderSection = function(slug_section) {
82
            var s = '';
83
            for (i = 0; i < this.sections.length; i++) {
84
                if (slug_section != this.sections[i].slug_section) {
85
                    continue;
86
                }
87
                for (j = 0; j < this.sections[i].questions.length; j++) {
88
                    this.sections[i].questions[j].position = j;
89
                    if (this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple' || this.sections[i].questions[j].type == 'rating-open') {
90
                        this.sections[i].questions[j].options.sort(function(a, b) {
91
                            if (a.position > b.position) {
92
                                return 1;
93
                            }
94
                            if (a.position < b.position) {
95
                                return -1;
96
                            }
97
                            return 0;
98
                        });
99
                        for (k = 0; k < this.sections[i].questions[j].options.length; k++) {
100
                            this.sections[i].questions[j].options[k].position = j;
101
                        }
102
                    }
103
                }
104
            }
105
            $('[data-toggle="tooltip"]').tooltip();
106
        },
107
        this.render = function() {
108
            this.sections.sort(function(a, b) {
109
                if (a.position > b.position) {
110
                    return 1;
111
                }
112
                if (a.position < b.position) {
113
                    return -1;
114
                }
115
                return 0;
116
            });
117
            var s = '';
118
            for (i = 0; i < this.sections.length; i++) {
119
                this.sections[i].position = i;
120
                this.sections[i].questions.sort(function(a, b) {
121
                    if (a.position > b.position) {
122
                        return 1;
123
                    }
124
                    if (a.position < b.position) {
125
                        return -1;
126
                    }
127
                    return 0;
128
                });
129
                for (j = 0; j < this.sections[i].questions.length; j++) {
130
                    this.sections[i].questions[j].position = j;
131
                    if (this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple' || this.sections[i].questions[j].type == 'rating-open') {
132
                        this.sections[i].questions[j].options.sort(function(a, b) {
133
                            if (a.position > b.position) {
134
                                return 1;
135
                            }
136
                            if (a.position < b.position) {
137
                                return -1;
138
                            }
139
                            return 0;
140
                        });
141
                        for (k = 0; k < this.sections[i].questions[j].options.length; k++) {
142
                            this.sections[i].questions[j].options[k].position = j;
143
                        }
144
                    }
145
                }
146
            }
147
            $('[data-toggle="tooltip"]').tooltip();
266 geraldo 148
        };
339 geraldo 149
}
251 geraldo 150
jQuery(document).ready(function($) {
151
    var objFormGenerator = new classFormGenerator();
152
    objFormGenerator.render();
153
    var allowEdit = $allowEdit;
154
    /**
155
     * Get rows and set data table
156
     */
157
    var tableForm = $('#gridTable').dataTable({
158
        'processing': true,
159
        'serverSide': true,
160
        'searching': true,
161
        'order': [
162
            [0, 'asc']
163
        ],
164
        'ordering': true,
165
        'ordenable': true,
166
        'responsive': true,
167
        'select': false,
168
        'paging': true,
169
        'pagingType': 'simple_numbers',
170
        'ajax': {
171
            'url': '$routeDatatable',
172
            'type': 'get',
173
            'beforeSend': function(request) {
174
                NProgress.start();
175
            },
176
            'dataFilter': function(response) {
177
                var response = jQuery.parseJSON(response);
178
                var json = {};
179
                json.recordsTotal = 0;
180
                json.recordsFiltered = 0;
181
                json.data = [];
182
                if (response.success) {
183
                    json.recordsTotal = response.data.total;
184
                    json.recordsFiltered = response.data.total;
185
                    json.data = response.data.items;
186
                } else {
187
                    $.fn.showError(response.data)
188
                }
189
                return JSON.stringify(json);
190
            }
191
        },
192
        'language': {
193
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
194
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
195
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
196
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
197
            'sInfo': 'LABEL_DATATABLE_SINFO',
198
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
199
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
200
            'sInfoPostFix': '',
201
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
202
            'sUrl': '',
203
            'sInfoThousands': ',',
204
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
205
            'oPaginate': {
206
                'sFirst': 'LABEL_DATATABLE_SFIRST',
207
                'sLast': 'LABEL_DATATABLE_SLAST',
208
                'sNext': 'LABEL_DATATABLE_SNEXT',
209
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
210
            },
211
            'oAria': {
212
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
213
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
214
            },
215
        },
216
        'drawCallback': function(settings) {
217
            NProgress.done();
218
            $('button.btn-delete').confirmation({
219
                rootSelector: 'button.btn-delete',
220
                title: 'LABEL_ARE_YOU_SURE',
221
                singleton: true,
222
                btnOkLabel: 'LABEL_YES',
223
                btnCancelLabel: 'LABEL_NO',
224
                onConfirm: function(value) {
225
                    action = $(this).data('href');
226
                    NProgress.start();
227
                    $.ajax({
228
                        'dataType': 'json',
229
                        'accept': 'application/json',
230
                        'method': 'post',
231
                        'url': action,
232
                    }).done(function(response) {
233
                        if (response['success']) {
234
                            $.fn.showSuccess(response['data']);
235
                            tableForm.fnDraw();
236
                        } else {
237
                            $.fn.showError(response['data']);
238
                        }
239
                    }).fail(function(jqXHR, textStatus, errorThrown) {
240
                        $.fn.showError(textStatus);
241
                    }).always(function() {
242
                        NProgress.done();
243
                    });
244
                },
245
            });
246
        },
339 geraldo 247
        'aoColumns': [{
294 geraldo 248
                'mDataProp': 'user'
339 geraldo 249
            }, {
251 geraldo 250
                'mDataProp': 'name'
251
            },
252
            {
253
                'mDataProp': 'language'
254
            },
255
            {
256
                'mDataProp': 'status'
257
            },
258
            {
294 geraldo 259
                'mDataProp': 'link_edit'
251 geraldo 260
            },
261
        ],
339 geraldo 262
        'columnDefs': [{
251 geraldo 263
                'targets': 0,
264
                'className': 'text-vertical-middle',
339 geraldo 265
            }, {
294 geraldo 266
                'targets': 1,
267
                'className': 'text-vertical-middle',
251 geraldo 268
            },
269
            {
294 geraldo 270
                'targets': -1,
251 geraldo 271
                'className': 'text-vertical-middle',
272
            },
273
            {
292 geraldo 274
                'targets': -2,
275
                'orderable': false,
276
                'className': 'text-center',
293 geraldo 277
                'className': 'text-vertical-middle',
251 geraldo 278
            },
279
            {
280
                'targets': -1,
281
                'orderable': false,
282
                'render': function(data, type, row) {
283
                    s = '';
284
                    if (allowEdit) {
293 geraldo 285
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
251 geraldo 286
                    }
287
                    return s;
288
                }
289
            }
290
        ],
291
    });
292
    /**
293
     * Clicked on edit form
294
     */
295
    $('body').on('click', 'button.btn-edit-form', function(e) {
296
        e.preventDefault();
297
        form_id = $(this).data('id')
298
        var action = $(this).data('href');
299
        $.ajax({
300
            'dataType': 'json',
301
            'accept': 'application/json',
302
            'method': 'get',
303
            'url': action,
304
        }).done(function(response) {
305
            if (response['success']) {
306
                validatorForm.resetForm();
307
                $('#form-main').attr('action', action);
308
                $('#form-main #form-id').val(response['data']['id']),
339 geraldo 309
                    $('#name').html(response['data']['name']);
316 geraldo 310
                $('#text').html(response['data']['text']);
311
                $('#user').html(response['data']['user']);
251 geraldo 312
                /*-------------Render Sections -------*/
313
                objFormGenerator.clear();
314
                objFormGenerator.sections = response['data']['content'] || [];
315
                objFormGenerator.render();
316
                renderSectionData(objFormGenerator.sections);
254 geraldo 317
                $('#row-forms').hide();
251 geraldo 318
                $('#row-edit').show();
319
                $('#form-main #form-name').focus();
320
            } else {
321
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
322
            }
323
        }).fail(function(jqXHR, textStatus, errorThrown) {
324
            $.fn.showError(textStatus);
325
        });
326
    });
327
    //IMPORTANT: update CKEDITOR textarea with actual content before submit
328
    $("#form-main").on('submit', function() {
329
        for (var instanceName in CKEDITOR.instances) {
330
            CKEDITOR.instances[instanceName].updateElement();
331
        }
332
    })
333
    /**
334
     * Validate rules form
335
     */
336
    var validatorForm = $("#form-main").validate({
337
        ignore: [],
338
        errorClass: 'help-block',
339
        errorElement: 'span',
340
        rules: {
341
            'form-name': {
342
                required: true,
343
                minlength: 2,
344
                maxlength: 50
345
            },
346
            'form-description': {
347
                required: true,
348
            },
349
            'form-text': {
350
                required: true,
351
            },
352
            'form-language': {
353
                required: true,
354
            },
355
            'forrm-status': {
356
                required: true,
357
            },
358
        },
359
        highlight: function(element) {
360
            $(element).closest('.form-group').addClass('has-error');
361
        },
362
        unhighlight: function(element) {
363
            $(element).closest('.form-group').removeClass('has-error');
364
        },
365
        errorPlacement: function(error, element) {
366
            if (element.attr("data-error-container")) {
367
                error.appendTo(element.attr("data-error-container"));
368
            } else {
369
                error.insertAfter(element);
370
            }
371
        },
372
        invalidHandler: function(form, validator) {
373
            if (!validator.numberOfInvalids())
374
                return;
375
            $('html, body').animate({
376
                scrollTop: $(validator.errorList[0].element).offset().top - 100
377
            }, 1000);
378
        },
379
        submitHandler: function(form) {
380
            var error = false;
381
            if (objFormGenerator.sections.length == 0) {
382
                $.fn.showError('ERROR_SECCTIONS');
383
                return false;
384
            } else {
385
                for (i = 0; i < objFormGenerator.sections.length; i++) {
386
                    if (objFormGenerator.sections[i].questions.length == 0) {
387
                        $.fn.showError('ERROR_QUESTIONS'.replace('%s', objFormGenerator.sections[i].name));
388
                        return false;
389
                    }
390
                    var valueSection = parseInt(objFormGenerator.sections[i].value);
391
                    var totalValueQuestion = 0;
392
                    for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
393
                        valueQuestion = parseInt(objFormGenerator.sections[i].questions[j].value);
394
                        totalValueQuestion = totalValueQuestion + valueQuestion;
395
                        if (objFormGenerator.sections[i].questions[j].type == 'simple' ||
396
                            objFormGenerator.sections[i].questions[j].type == 'multiple' ||
397
                            objFormGenerator.sections[i].questions[j].type == 'rating-open') {
398
                            var questionNumber = j + 1;
399
                            var numberCorrect = 0;
400
                            if (objFormGenerator.sections[i].questions[j].options.length == 0) {
401
                                $.fn.showError('ERROR_OPTIONS'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
402
                                return false;
403
                            }
404
                            var totalOption = 0;
405
                            var maxOption = 0;
406
                            for (k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
407
                                if (objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple') {
408
                                    if (objFormGenerator.sections[i].questions[j].options[k].correct == 1) {
409
                                        numberCorrect++;
410
                                    }
411
                                }
412
                                if (objFormGenerator.sections[i].questions[j].type == 'multiple' && objFormGenerator.sections[i].questions[j].options[k].correct == 1) {
413
                                    totalOption = totalOption + parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
414
                                }
415
                                if (objFormGenerator.sections[i].questions[j].type == 'rating-open') {
416
                                    if (parseInt(objFormGenerator.sections[i].questions[j].options[k].value) > maxOption) {
417
                                        maxOption = parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
418
                                    }
419
                                }
420
                            }
421
                            if (objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple') {
422
                                if (numberCorrect == 0) {
423
                                    $.fn.showError('ERROR_OPTIONS_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
424
                                    return false;
425
                                }
426
                                if (
427
                                    objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
428
                                    $.fn.showError('ERROR_OPTIONS_DUPLICATE_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
429
                                    return false;
430
                                }
431
                                if (objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
432
                                    $.fn.showError('ERROR_OPTIONS_ONE_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
433
                                    return false;
434
                                }
435
                            }
436
                            if (objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption != valueQuestion) {
437
                                $.fn.showError('ERROR_OPTIONS_SUM_VALUES'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
438
                                return false;
439
                            }
440
                            if (objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion) {
441
                                $.fn.showError('ERROR_OPTIONS_MAX_OPTION'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
442
                                return false;
443
                            }
444
                        }
445
                    }
446
                    if (valueSection != totalValueQuestion) {
447
                        $.fn.showError('ERROR_VALUE_SECTIONS'.replace('%s', objFormGenerator.sections[i].name));
448
                        return false;
449
                    }
450
                }
451
                var formId = parseInt($('#form-main #form-id').val());
452
                var formContinue = parseInt($('#form-main #form-continue').val());
453
                var data = {
454
                    'id': formId,
455
                    'name': $('#form-main #form-name').val(),
456
                    'description': $('#form-main #form-description').val(),
457
                    'text': $('#form-main #form-text').val(),
458
                    'language': $('#form-main #form-language').val(),
459
                    'status': $('#form-main #form-status').val(),
460
                    'content': JSON.stringify(objFormGenerator.sections)
461
                }
462
                $.ajax({
463
                    'dataType': 'json',
464
                    'method': 'post',
465
                    'url': $('#form-main').attr('action'),
466
                    'data': data,
467
                }).done(function(response) {
468
                    if (response['success']) {
469
                        $.fn.showSuccess(response['data']);
470
                        if (formContinue == 1) {
339 geraldo 471
                            $('#form-main').attr('action', response['action_edit']);
251 geraldo 472
                            $('#form-main #form-id').val(response['id']);
473
                            $('#form-main #form-continue').val(0);
474
                        } else {
475
                            $('#row-edit').hide();
254 geraldo 476
                            $('#row-forms').show();
339 geraldo 477
                            /*---------- Reset Form -------- */
478
                            $('#form-main')[0].reset();
479
                            /*--------Reset Sections ----------*/
480
                            clearSectionData();
481
                            /* ------- Refresh Table -----------*/
251 geraldo 482
                        }
483
                        tableForm.fnDraw();
484
                    } else {
485
                        $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
486
                    }
487
                }).fail(function(jqXHR, textStatus, errorThrown) {
488
                    $.fn.showError(textStatus);
489
                });
490
                return false;
491
            }
492
        }
493
    });
494
    /**
495
     * Clicked cancel new/edit Form
496
     */
497
    $('button.btn-edit-cancel').click(function(e) {
498
        e.preventDefault();
499
        $('#row-edit').hide();
254 geraldo 500
        $('#row-forms').show();
251 geraldo 501
    });
502
    /**
503
     * Clicked save and continue new Form
504
     */
505
    $('button.btn-form-save-continue').click(function(e) {
506
        e.preventDefault();
507
        $('#form-main #form-continue').val('1')
508
        $('#form-main').submit();
509
    });
510
    /**
511
     * Clicked save and close new/edit Form
512
     */
513
    $('button.btn-form-save-close').click(function(e) {
514
        e.preventDefault();
515
        $('#form-main #form-continue').val('0')
516
        $('#form-main').submit();
517
    });
339 geraldo 518
    /**
519
     * Get Answers
520
     */
521
    const getAnswer = (type, options, answer) => {
522
        if (type == 'open' || type == 'rating-range') {
328 geraldo 523
            return answer;
251 geraldo 524
        }
339 geraldo 525
        if (type == 'multiple') {
526
            var opt = '';
527
            opt += removeTags(options.filter((opt) => answer.includes(opt.slug_option))[0].text) + ' ';
332 geraldo 528
            return opt;
330 geraldo 529
        }
338 geraldo 530
        return removeTags(options.filter((opt) => opt.slug_option == answer)[0].text);
251 geraldo 531
    }
341 geraldo 532
 
533
 
251 geraldo 534
    /**
341 geraldo 535
     * Get Status
536
     */
537
    const getStatus = (options, answer) => {
538
 
539
 
540
 
342 geraldo 541
        return  options.filter((opt) => ( opt.slug_option == answer || answer.includes(opt.slug_option))  &&
341 geraldo 542
 
543
 
342 geraldo 544
        opt.correct ==1) ?  LABEL_CORRECT : LABEL_FAIL
341 geraldo 545
 
546
 
547
    }
548
 
549
 
550
 
551
 
552
    /**
251 geraldo 553
     * Remove Html Tags
554
     */
339 geraldo 555
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
251 geraldo 556
    /**
557
     * Render Sections data
558
     */
559
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
323 geraldo 560
        removeTags: removeTags,
341 geraldo 561
        getAnswer: getAnswer,
562
        getStatus: getStatus
251 geraldo 563
    }));
564
    /**
565
     * Clear Div Section data
566
     */
567
    const clearSectionData = () => $("#rows").html('');
568
    /**
569
     * Clicked refresh button
570
     */
571
    $('button.btn-refresh').click(function(e) {
572
        tableForm.fnDraw();
573
    });
574
});
575
JS;
576
$this->inlineScript()->captureEnd();
577
?>
578
 
579
<!-- Content Header (Page header) -->
580
<section class="content-header">
581
    <div class="container-fluid">
582
        <div class="row mb-2">
583
            <div class="col-sm-12">
264 geraldo 584
                <h1>LABEL_REVIEWS</h1>
251 geraldo 585
            </div>
586
        </div>
587
    </div>
588
    <!-- /.container-fluid -->
589
</section>
314 geraldo 590
<section class="content" style="padding: 13px;">
254 geraldo 591
    <div class="container-fluid" id="row-forms">
251 geraldo 592
        <div class="row">
593
            <div class="col-12">
594
                <div class="card">
595
                    <div class="card-body">
596
                        <table id="gridTable" class="table   table-hover">
597
                            <thead>
598
                                <tr>
294 geraldo 599
                                <th>LABEL_USER</th>
251 geraldo 600
                                    <th>LABEL_NAME</th>
601
                                    <th>LABEL_LANGUAGE</th>
294 geraldo 602
                                    <th>LABEL_STATUS</th>
251 geraldo 603
                                    <th>LABEL_ACTIONS</th>
604
                                </tr>
605
                            </thead>
606
                            <tbody></tbody>
607
                        </table>
608
                    </div>
609
                    <div class="card-footer clearfix">
610
                        <div style="float:right;">
611
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
612
                        </div>
613
                    </div>
614
                </div>
615
            </div>
616
        </div>
617
    </div>
618
 
619
    <!-- Create/Edit Form -->
620
 
621
    <div class="row" id="row-edit" style="display: none">
622
        <div class="col-xs-12 col-md-12">
623
            <form action="#" name="form-main" id="form-main">
261 geraldo 624
                <input type="hidden" name="form-id" id="form-id" value="0" />
251 geraldo 625
                <div class="form-group">
318 geraldo 626
                <label for="form-status">LABEL_USER:</label>
317 geraldo 627
                <div id="user"></div>
628
                </div>
629
                <div class="form-group">
318 geraldo 630
                <label for="form-status">LABEL_FORM:</label>
317 geraldo 631
                <div id="name"></div>
632
                </div>
633
                <div class="form-group">
318 geraldo 634
                <label for="form-status">LABEL_DESCRIPTION:</label>
317 geraldo 635
                <div id="text"></div>
636
                </div>
637
                <div class="form-group">
318 geraldo 638
                    <label for="form-status">LABEL_STATUS:</label>
261 geraldo 639
                    <select name="form-status" id="form-status" class="form-control">
306 geraldo 640
                        <option value="<?php echo $pending; ?>">LABEL_PENDING</option>
641
                        <option value="<?php echo $review; ?>">LABEL_REVIEW</option>
642
                        <option value="<?php echo $completed; ?>">LABEL_COMPLETED</option>
261 geraldo 643
                    </select>
303 geraldo 644
                </div>
261 geraldo 645
                <div class="row">
646
                    <div class="col-xs-12 col-md-12">
647
                        <div class="panel-group" id="rows"></div>
648
                    </div>
649
                </div>
650
                <div class="form-group">
319 geraldo 651
                    <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE</button>
251 geraldo 652
                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
653
                </div>
654
            </form>
655
        </div>
656
    </div>
657
 
261 geraldo 658
    <!-- Create/Edit Form-->
251 geraldo 659
 
264 geraldo 660
 
261 geraldo 661
 
251 geraldo 662
    <!---Template Sections --->
663
    <script id="sectionTemplate" type="text/x-jsrender">
664
    <div class="panel panel-default" id="panel-{{:slug_section}}">
665
        <div class="panel-heading">
666
            <h4 class="panel-title">
667
                <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
668
                    <span class="section-name{{:slug_section}}">
669
                        {{:name}}
670
                    </span>
671
                </a>
672
            </h4>
673
        </div>
674
        <div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
675
            <div class="panel-body">
676
                <div class="table-responsive">
310 geraldo 677
                {{for questions}}
251 geraldo 678
                    <table class="table table-bordered">
679
                        <thead>
680
                            <tr>
329 geraldo 681
                                <th style="width: 70%;">LABEL_QUESTION</th>
682
                                <th style="width: 30%;">LABEL_STATUS</th>
312 geraldo 683
 
251 geraldo 684
                            </tr>
685
                        </thead>
686
                        <tbody>
687
                            <tr class="tr-question">
303 geraldo 688
                                <td class="text-left">{{:~removeTags(text)}} </td>
339 geraldo 689
                                <td>
340 geraldo 690
 
691
                                {{if type == 'simple'  || type=='multiple' }}
341 geraldo 692
 
693
                                {{:~getStatus( options,answer)}}
694
 
340 geraldo 695
                                {{/if}}
696
 
697
                                {{if type == 'open' || type == 'rating-open' || type=='rating-range' }}
339 geraldo 698
<select class="form-control">
340 geraldo 699
    <option value="true">LABEL_CORRECT </option>
339 geraldo 700
    <option value="false">LABEL_FAIL</option>
701
</select>
340 geraldo 702
{{/if}}
339 geraldo 703
 
704
                                </td>
251 geraldo 705
                            </tr>
706
                        </tbody>
310 geraldo 707
                        <thead>
708
                            <tr>
329 geraldo 709
                                <th colspan="2">LABEL_ANSWER</th>
310 geraldo 710
                            </tr>
711
                        </thead>
712
                        <tbody>
713
                            <tr class="tr-question">
329 geraldo 714
                                <td colspan="2" class="text-left">{{:~getAnswer(
327 geraldo 715
                                    type,
326 geraldo 716
                                    options,
717
                                    answer
718
                                    )}} </td>
310 geraldo 719
                            </tr>
720
                        </tbody>
251 geraldo 721
                    </table>
310 geraldo 722
 
723
                    {{/for}}
251 geraldo 724
                </div>
725
            </div>
726
        </div>
727
    </div>
728
    </script>
729
 
730
    <!-- End Template Sections-->
731
 
732
</section>