Proyectos de Subversion LeadersLinked - Backend

Rev

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