Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 467 | Rev 469 | 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
        };
352 geraldo 149
    /**
150
     * Add element to question array
151
     */
439 geraldo 152
    this.editQuestion = function(slug_section, slug_question, comment, question_value, status) {
352 geraldo 153
        var renderTable = false;
154
        for (i = 0; i < this.sections.length; i++) {
155
            if (slug_section == this.sections[i].slug_section) {
156
                for (j = 0; j < this.sections[i].questions.length; j++) {
157
                    if (slug_question == this.sections[i].questions[j].slug_question) {
158
                        this.sections[i].questions[j].status = status;
417 geraldo 159
                        this.sections[i].questions[j].comment = comment;
432 geraldo 160
                        this.sections[i].questions[j].question_value = question_value;
395 geraldo 161
                        this.renderSection(slug_section);
394 geraldo 162
                        return true;
345 geraldo 163
                    }
164
                }
165
            }
352 geraldo 166
        }
167
    };
339 geraldo 168
}
251 geraldo 169
jQuery(document).ready(function($) {
170
    var objFormGenerator = new classFormGenerator();
171
    objFormGenerator.render();
172
    var allowEdit = $allowEdit;
173
    /**
174
     * Get rows and set data table
175
     */
176
    var tableForm = $('#gridTable').dataTable({
177
        'processing': true,
178
        'serverSide': true,
179
        'searching': true,
180
        'order': [
181
            [0, 'asc']
182
        ],
183
        'ordering': true,
184
        'ordenable': true,
185
        'responsive': true,
186
        'select': false,
187
        'paging': true,
188
        'pagingType': 'simple_numbers',
189
        'ajax': {
190
            'url': '$routeDatatable',
191
            'type': 'get',
192
            'beforeSend': function(request) {
193
                NProgress.start();
194
            },
195
            'dataFilter': function(response) {
196
                var response = jQuery.parseJSON(response);
197
                var json = {};
198
                json.recordsTotal = 0;
199
                json.recordsFiltered = 0;
200
                json.data = [];
201
                if (response.success) {
202
                    json.recordsTotal = response.data.total;
203
                    json.recordsFiltered = response.data.total;
204
                    json.data = response.data.items;
205
                } else {
206
                    $.fn.showError(response.data)
207
                }
208
                return JSON.stringify(json);
209
            }
210
        },
211
        'language': {
212
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
213
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
214
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
215
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
216
            'sInfo': 'LABEL_DATATABLE_SINFO',
217
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
218
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
219
            'sInfoPostFix': '',
220
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
221
            'sUrl': '',
222
            'sInfoThousands': ',',
223
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
224
            'oPaginate': {
225
                'sFirst': 'LABEL_DATATABLE_SFIRST',
226
                'sLast': 'LABEL_DATATABLE_SLAST',
227
                'sNext': 'LABEL_DATATABLE_SNEXT',
228
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
229
            },
230
            'oAria': {
231
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
232
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
233
            },
234
        },
235
        'drawCallback': function(settings) {
236
            NProgress.done();
237
            $('button.btn-delete').confirmation({
238
                rootSelector: 'button.btn-delete',
239
                title: 'LABEL_ARE_YOU_SURE',
240
                singleton: true,
241
                btnOkLabel: 'LABEL_YES',
242
                btnCancelLabel: 'LABEL_NO',
243
                onConfirm: function(value) {
244
                    action = $(this).data('href');
245
                    NProgress.start();
246
                    $.ajax({
247
                        'dataType': 'json',
248
                        'accept': 'application/json',
249
                        'method': 'post',
250
                        'url': action,
251
                    }).done(function(response) {
252
                        if (response['success']) {
253
                            $.fn.showSuccess(response['data']);
254
                            tableForm.fnDraw();
255
                        } else {
256
                            $.fn.showError(response['data']);
257
                        }
258
                    }).fail(function(jqXHR, textStatus, errorThrown) {
259
                        $.fn.showError(textStatus);
260
                    }).always(function() {
261
                        NProgress.done();
262
                    });
263
                },
264
            });
265
        },
339 geraldo 266
        'aoColumns': [{
294 geraldo 267
                'mDataProp': 'user'
339 geraldo 268
            }, {
251 geraldo 269
                'mDataProp': 'name'
270
            },
271
            {
272
                'mDataProp': 'language'
273
            },
274
            {
275
                'mDataProp': 'status'
276
            },
277
            {
447 geraldo 278
                'mDataProp': 'added_on'
279
            },
280
            {
294 geraldo 281
                'mDataProp': 'link_edit'
251 geraldo 282
            },
283
        ],
339 geraldo 284
        'columnDefs': [{
251 geraldo 285
                'targets': 0,
286
                'className': 'text-vertical-middle',
339 geraldo 287
            }, {
294 geraldo 288
                'targets': 1,
289
                'className': 'text-vertical-middle',
251 geraldo 290
            },
291
            {
294 geraldo 292
                'targets': -1,
251 geraldo 293
                'className': 'text-vertical-middle',
294
            },
295
            {
447 geraldo 296
                'targets': -1,
292 geraldo 297
                'className': 'text-center',
293 geraldo 298
                'className': 'text-vertical-middle',
251 geraldo 299
            },
300
            {
301
                'targets': -1,
447 geraldo 302
                'className': 'text-vertical-middle',
303
            },
304
            {
305
                'targets': -1,
251 geraldo 306
                'orderable': false,
307
                'render': function(data, type, row) {
308
                    s = '';
309
                    if (allowEdit) {
468 geraldo 310
                        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 311
                    }
312
                    return s;
313
                }
314
            }
315
        ],
316
    });
317
    /**
391 geraldo 318
     * Clicked edit question
319
     */
412 geraldo 320
    $('body').on('click', 'button.btn-add-review', function(e) {
391 geraldo 321
        e.preventDefault();
439 geraldo 322
        if ($('#question-value').val() == '') {
432 geraldo 323
            $.fn.showError('ERROR_ENTER_VALUE');
324
            return false;
439 geraldo 325
        } else {
326
            objFormGenerator.editQuestion(
327
                $('#section').val(),
328
                $('#question').val(),
329
                $('#question-comment').val(),
330
                $('#question-value').val(),
331
                $('#question-status').val() == '1' ? true : false
332
            );
333
            renderSectionData(objFormGenerator.sections);
334
            $('#form-review')[0].reset();
335
            $('#modal-review').modal('hide');
336
        }
391 geraldo 337
    });
338
    /**
339
     * Clicked edit question
340
     */
411 geraldo 341
    $('body').on('click', 'button.btn-edit-review', function(e) {
391 geraldo 342
        e.preventDefault();
411 geraldo 343
        e.preventDefault();
344
        var slug_section = $(this).data('section');
412 geraldo 345
        var slug_question = $(this).data('question');
411 geraldo 346
        var showForm = false;
347
        for (i = 0; i < objFormGenerator.sections.length; i++) {
348
            if (slug_section == objFormGenerator.sections[i].slug_section) {
349
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
412 geraldo 350
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
351
                        $('#form-review #section').val(objFormGenerator.sections[i].slug_section);
352
                        $('#form-review #question').val(objFormGenerator.sections[i].questions[j].slug_question);
429 geraldo 353
                        if (objFormGenerator.sections[i].questions[j].status) {
411 geraldo 354
                            $('#form-review #question-status').val('1');
355
                        } else {
356
                            $('#form-review #question-status').val('0');
357
                        }
429 geraldo 358
                        if (objFormGenerator.sections[i].questions[j].comment) {
419 geraldo 359
                            $('#form-review #question-comment').val(objFormGenerator.sections[i].questions[j].comment);
429 geraldo 360
                        } else {
361
                            $('#form-review #question-comment').val('');
411 geraldo 362
                        }
432 geraldo 363
                        if (objFormGenerator.sections[i].questions[j].question_value) {
364
                            $('#form-review #question-value').val(objFormGenerator.sections[i].questions[j].question_value);
365
                        } else {
435 geraldo 366
                            $('#form-review #question-value').val(0);
432 geraldo 367
                        }
412 geraldo 368
                        $('#modal-review').modal('show');
369
                        return true;
411 geraldo 370
                    }
371
                }
372
            }
373
        }
391 geraldo 374
    });
375
    /**
251 geraldo 376
     * Clicked on edit form
377
     */
378
    $('body').on('click', 'button.btn-edit-form', function(e) {
379
        e.preventDefault();
380
        form_id = $(this).data('id')
381
        var action = $(this).data('href');
382
        $.ajax({
383
            'dataType': 'json',
384
            'accept': 'application/json',
385
            'method': 'get',
386
            'url': action,
387
        }).done(function(response) {
388
            if (response['success']) {
389
                $('#form-main').attr('action', action);
390
                $('#form-main #form-id').val(response['data']['id']),
387 geraldo 391
                    $('#name').html(response['data']['name']);
366 geraldo 392
                $('#form-status').val(response['data']['status']);
316 geraldo 393
                $('#text').html(response['data']['text']);
394
                $('#user').html(response['data']['user']);
251 geraldo 395
                /*-------------Render Sections -------*/
396
                objFormGenerator.clear();
397
                objFormGenerator.sections = response['data']['content'] || [];
398
                objFormGenerator.render();
399
                renderSectionData(objFormGenerator.sections);
254 geraldo 400
                $('#row-forms').hide();
251 geraldo 401
                $('#row-edit').show();
402
            } else {
403
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
404
            }
405
        }).fail(function(jqXHR, textStatus, errorThrown) {
406
            $.fn.showError(textStatus);
407
        });
408
    });
351 geraldo 409
    $('button.btn-form-save-close').click(function(e) {
444 geraldo 410
        var formContinue = parseFloat($('#form-main #form-continue').val());
352 geraldo 411
        var data = {
412
            'status': $('#form-main #form-status').val(),
413
            'content': JSON.stringify(objFormGenerator.sections)
414
        }
415
        $.ajax({
416
            'dataType': 'json',
417
            'method': 'post',
418
            'url': $('#form-main').attr('action'),
419
            'data': data,
420
        }).done(function(response) {
421
            if (response['success']) {
422
                $.fn.showSuccess(response['data']);
423
                $('#row-edit').hide();
424
                $('#row-forms').show();
425
                /*---------- Reset Form -------- */
426
                $('#form-main')[0].reset();
427
                /*--------Reset Sections ----------*/
428
                clearSectionData();
429
                /* ------- Refresh Table -----------*/
430
                tableForm.fnDraw();
431
            } else {
432
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
433
            }
434
        }).fail(function(jqXHR, textStatus, errorThrown) {
435
            $.fn.showError(textStatus);
436
        });
437
        return false;
351 geraldo 438
    });
251 geraldo 439
    /**
440
     * Clicked cancel new/edit Form
441
     */
442
    $('button.btn-edit-cancel').click(function(e) {
443
        e.preventDefault();
444
        $('#row-edit').hide();
254 geraldo 445
        $('#row-forms').show();
251 geraldo 446
    });
447
    /**
339 geraldo 448
     * Get Answers
449
     */
450
    const getAnswer = (type, options, answer) => {
451
        if (type == 'open' || type == 'rating-range') {
328 geraldo 452
            return answer;
251 geraldo 453
        }
339 geraldo 454
        if (type == 'multiple') {
352 geraldo 455
            let opt = '';
339 geraldo 456
            opt += removeTags(options.filter((opt) => answer.includes(opt.slug_option))[0].text) + ' ';
332 geraldo 457
            return opt;
330 geraldo 458
        }
338 geraldo 459
        return removeTags(options.filter((opt) => opt.slug_option == answer)[0].text);
251 geraldo 460
    }
461
    /**
341 geraldo 462
     * Get Status
463
     */
400 geraldo 464
    const getStatus = (options, answer, type) => {
407 geraldo 465
        let status;
409 geraldo 466
        status = type == 'multiple' ?
467
            options.filter((opt) => answer.includes(opt.slug_option) && opt.correct == '1') :
410 geraldo 468
            options.filter((opt) => opt.slug_option == answer && opt.correct == '1');
409 geraldo 469
        return status.length != 0 ? '<font color="green">LABEL_CORRECT</font>' : '<font color="red">LABEL_FAIL</red>';
400 geraldo 470
    }
441 geraldo 471
    const getPtos = (options, answer, type, value, question_value) => {
429 geraldo 472
        let ptos = 0;
473
        if (type == "open" || type == "rating-open" || type == "rating-range") {
441 geraldo 474
            ptos = question_value ? question_value : 0;
429 geraldo 475
        } else {
476
            if (type == 'multiple') {
477
                options.map((opt) => {
478
                    if (answer.includes(opt.slug_option)) {
444 geraldo 479
                        ptos += parseFloat(opt.value);
429 geraldo 480
                    }
481
                })
482
            } else {
483
                options.map((opt) => {
484
                    if (opt.slug_option == answer) {
444 geraldo 485
                        ptos = parseFloat(opt.value);
429 geraldo 486
                    }
487
                });
488
            }
489
        }
445 geraldo 490
        return  parseFloat(ptos).toFixed(2) + '/' + parseFloat(value).toFixed(2);
429 geraldo 491
    }
341 geraldo 492
    /**
251 geraldo 493
     * Remove Html Tags
494
     */
339 geraldo 495
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
251 geraldo 496
    /**
497
     * Render Sections data
498
     */
398 geraldo 499
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
323 geraldo 500
        removeTags: removeTags,
341 geraldo 501
        getAnswer: getAnswer,
429 geraldo 502
        getStatus: getStatus,
503
        getPtos: getPtos
398 geraldo 504
    }));
251 geraldo 505
    /**
506
     * Clear Div Section data
507
     */
508
    const clearSectionData = () => $("#rows").html('');
509
    /**
510
     * Clicked refresh button
511
     */
512
    $('button.btn-refresh').click(function(e) {
513
        tableForm.fnDraw();
514
    });
438 geraldo 515
    /**
516
     * Format input number (Form Option)
517
     */
518
    $('#form-review #question-value').inputNumberFormat({
519
        'decimal': 2
520
    });
251 geraldo 521
});
522
JS;
523
$this->inlineScript()->captureEnd();
524
?>
525
 
526
<!-- Content Header (Page header) -->
527
<section class="content-header">
389 geraldo 528
    <div class="container-fluid">
529
        <div class="row mb-2">
530
            <div class="col-sm-12">
531
                <h1>LABEL_REVIEWS</h1>
532
            </div>
533
        </div>
534
    </div>
535
    <!-- /.container-fluid -->
251 geraldo 536
</section>
314 geraldo 537
<section class="content" style="padding: 13px;">
389 geraldo 538
    <div class="container-fluid" id="row-forms">
539
        <div class="row">
540
            <div class="col-12">
541
                <div class="card">
542
                    <div class="card-body">
543
                        <table id="gridTable" class="table   table-hover">
544
                            <thead>
545
                                <tr>
448 geraldo 546
                                    <th style="width: 16.6%;">LABEL_USER</th>
547
                                    <th style="width: 16.6%;">LABEL_NAME</th>
548
                                    <th style="width: 16.6%;">LABEL_LANGUAGE</th>
549
                                    <th style="width: 16.6%;">LABEL_STATUS</th>
550
                                    <th style="width: 16.6%;">LABEL_REGISTER</th>
551
                                    <th style="width: 16.6%;">LABEL_ACTIONS</th>
389 geraldo 552
                                </tr>
553
                            </thead>
554
                            <tbody></tbody>
555
                        </table>
556
                    </div>
557
                    <div class="card-footer clearfix">
558
                        <div style="float:right;">
559
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
560
                        </div>
561
                    </div>
562
                </div>
251 geraldo 563
            </div>
389 geraldo 564
        </div>
565
    </div>
566
    <!-- Create/Edit Form -->
567
    <div class="row" id="row-edit" style="display: none">
568
        <div class="col-xs-12 col-md-12">
569
            <form action="#" name="form-main" id="form-main">
570
                <div class="form-group">
571
                    <label for="form-status">LABEL_USER:</label>
572
                    <div id="user"></div>
573
                </div>
574
                <div class="form-group">
575
                    <label for="form-status">LABEL_FORM:</label>
576
                    <div id="name"></div>
577
                </div>
578
                <div class="form-group">
579
                    <label for="form-status">LABEL_DESCRIPTION:</label>
580
                    <div id="text"></div>
581
                </div>
582
                <div class="row">
583
                    <div class="col-xs-12 col-md-12">
584
                        <div class="panel-group" id="rows"></div>
585
                    </div>
586
                </div>
587
                <div class="form-group">
588
                    <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE</button>
589
                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
590
                </div>
591
            </form>
592
        </div>
593
    </div>
594
    <!-- Create/Edit Form-->
251 geraldo 595
 
411 geraldo 596
 
597
    <div  id="modal-review" class="modal" tabindex="-1" role="dialog">
598
        <div class="modal-dialog modal-lg" role="document">
599
            <form action="#" name="form-option" id="form-review">
412 geraldo 600
                <input type="hidden" name="section" id="section" value="" />
601
                <input type="hidden" name="question" id="question" value="" />
411 geraldo 602
                <div class="modal-content">
603
                    <div class="modal-header">
423 geraldo 604
                        <h4 class="modal-title">LABEL_RESPONSE_REVIEW</h4>
411 geraldo 605
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
606
                            <span aria-hidden="true">&times;</span>
607
                        </button>
608
                    </div>
609
                    <div class="modal-body">
610
                        <div class="form-group">
414 geraldo 611
                            <label for="option-text">LABEL_COMMENT</label>
411 geraldo 612
                            <!--  ckeditor -->
423 geraldo 613
                            <textarea  name="question-comment" id="question-comment" rows="5" class="form-control" placeholder="LABEL_ENTER_COMMENT"></textarea>
411 geraldo 614
                        </div>
615
                        <div class="form-group">
616
                            <label for="question-status">LABEL_ANSWER_CORRECT</label>
617
                            <select name="question-status" id="question-status" class="form-control">
618
                                <option value="1">LABEL_YES</option>
619
                                <option value="0">LABEL_NOT</option>
620
                            </select>
621
                        </div>
622
 
434 geraldo 623
 
433 geraldo 624
                    <div class="form-group">
625
                            <label for="question-value">LABEL_VALUE</label>
626
                            <input type="text" name="question-value" id="question-value"  class="form-control" />
627
                        </div>
434 geraldo 628
</div>
629
 
411 geraldo 630
                    <div class="modal-footer">
414 geraldo 631
                        <button type="button" class="btn btn-primary btn-add-review">LABEL_SAVE</button>
411 geraldo 632
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
633
                    </div>
634
                </div>
635
            </form>
636
        </div>
637
    </div>
638
 
251 geraldo 639
    <!---Template Sections --->
640
    <script id="sectionTemplate" type="text/x-jsrender">
460 geraldo 641
    <div class="panel panel-default" id="panel-{{:slug_section}}">
369 geraldo 642
   <div class="panel-heading">
643
      <h4 class="panel-title">
644
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
645
         <span class="section-name{{:slug_section}}">
646
         {{:name}}
647
         </span>
648
         </a>
649
      </h4>
650
   </div>
651
   <div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
652
      <div class="panel-body">
450 geraldo 653
         <div class="table-responsive">
463 geraldo 654
            <table class="table table-bordered table-review">
459 geraldo 655
               <thead>
369 geraldo 656
                  <tr>
399 geraldo 657
                     <th style="width: 30%;">LABEL_QUESTION</th>
428 geraldo 658
                     <th style="width: 30%;">LABEL_ANSWER</th>
399 geraldo 659
                     <th style="width: 10%;">LABEL_STATUS</th>
467 geraldo 660
                     <th style="width: 15%;">LABEL_PTOS</th>
661
                     <th style="width: 15%;">LABEL_ACTIONS</th>
369 geraldo 662
                  </tr>
459 geraldo 663
               </thead>
664
               <tbody>
460 geraldo 665
                  {{for questions}}
369 geraldo 666
                  <tr class="tr-question">
667
                     <td class="text-left">{{:~removeTags(text)}} </td>
668
                     <td>{{:~getAnswer(type,options,answer)}}</td>
669
                     <td>
670
                        {{if type == 'simple'  || type=='multiple' }}
429 geraldo 671
                        {{:~getStatus(options,answer,type)}}
369 geraldo 672
                        {{else}}
399 geraldo 673
                        {{if status}}
460 geraldo 674
                        <font color="green">LABEL_CORRECT</font>
675
                        {{else}}
676
                        <font color="red">LABEL_FAIL</font>
399 geraldo 677
                        {{/if}}
460 geraldo 678
                        {{/if}}
399 geraldo 679
                     </td>
680
                     <td>
460 geraldo 681
                        {{:~getPtos(options,answer,type, value, question_value)}}
682
                     </td>
429 geraldo 683
                     <td>
399 geraldo 684
                        {{if type != 'simple'  && type !='multiple' }}
466 geraldo 685
                        <button class="btn btn-default btn-edit-review"  data-original-title="LABEL_EDIT" data-section="{{:slug_section}}" data-question="{{:slug_question}}">
686
                        <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_EDIT
369 geraldo 687
                        </button>
413 geraldo 688
                        {{/if}}
369 geraldo 689
                     </td>
690
                  </tr>
460 geraldo 691
                  {{/for}}
459 geraldo 692
               </tbody>
369 geraldo 693
            </table>
450 geraldo 694
         </div>
369 geraldo 695
      </div>
696
   </div>
697
</div>
251 geraldo 698
    </script>
699
 
700
    <!-- End Template Sections-->
701
 
702
</section>