Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 444 | Rev 447 | 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
            {
294 geraldo 278
                'mDataProp': 'link_edit'
251 geraldo 279
            },
280
        ],
339 geraldo 281
        'columnDefs': [{
251 geraldo 282
                'targets': 0,
283
                'className': 'text-vertical-middle',
339 geraldo 284
            }, {
294 geraldo 285
                'targets': 1,
286
                'className': 'text-vertical-middle',
251 geraldo 287
            },
288
            {
294 geraldo 289
                'targets': -1,
251 geraldo 290
                'className': 'text-vertical-middle',
291
            },
292
            {
292 geraldo 293
                'targets': -2,
294
                'orderable': false,
295
                'className': 'text-center',
293 geraldo 296
                'className': 'text-vertical-middle',
251 geraldo 297
            },
298
            {
299
                'targets': -1,
300
                'orderable': false,
301
                'render': function(data, type, row) {
302
                    s = '';
303
                    if (allowEdit) {
426 geraldo 304
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_REVIEW"><i class="fa fa-pencil"></i> LABEL_EDIT LABEL_REVIEW</button>&nbsp;';
251 geraldo 305
                    }
306
                    return s;
307
                }
308
            }
309
        ],
310
    });
311
    /**
391 geraldo 312
     * Clicked edit question
313
     */
412 geraldo 314
    $('body').on('click', 'button.btn-add-review', function(e) {
391 geraldo 315
        e.preventDefault();
439 geraldo 316
        if ($('#question-value').val() == '') {
432 geraldo 317
            $.fn.showError('ERROR_ENTER_VALUE');
318
            return false;
439 geraldo 319
        } else {
320
            objFormGenerator.editQuestion(
321
                $('#section').val(),
322
                $('#question').val(),
323
                $('#question-comment').val(),
324
                $('#question-value').val(),
325
                $('#question-status').val() == '1' ? true : false
326
            );
327
            renderSectionData(objFormGenerator.sections);
328
            $('#form-review')[0].reset();
329
            $('#modal-review').modal('hide');
330
        }
391 geraldo 331
    });
332
    /**
333
     * Clicked edit question
334
     */
411 geraldo 335
    $('body').on('click', 'button.btn-edit-review', function(e) {
391 geraldo 336
        e.preventDefault();
411 geraldo 337
        e.preventDefault();
338
        var slug_section = $(this).data('section');
412 geraldo 339
        var slug_question = $(this).data('question');
411 geraldo 340
        var showForm = false;
341
        for (i = 0; i < objFormGenerator.sections.length; i++) {
342
            if (slug_section == objFormGenerator.sections[i].slug_section) {
343
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
412 geraldo 344
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
345
                        $('#form-review #section').val(objFormGenerator.sections[i].slug_section);
346
                        $('#form-review #question').val(objFormGenerator.sections[i].questions[j].slug_question);
429 geraldo 347
                        if (objFormGenerator.sections[i].questions[j].status) {
411 geraldo 348
                            $('#form-review #question-status').val('1');
349
                        } else {
350
                            $('#form-review #question-status').val('0');
351
                        }
429 geraldo 352
                        if (objFormGenerator.sections[i].questions[j].comment) {
419 geraldo 353
                            $('#form-review #question-comment').val(objFormGenerator.sections[i].questions[j].comment);
429 geraldo 354
                        } else {
355
                            $('#form-review #question-comment').val('');
411 geraldo 356
                        }
432 geraldo 357
                        if (objFormGenerator.sections[i].questions[j].question_value) {
358
                            $('#form-review #question-value').val(objFormGenerator.sections[i].questions[j].question_value);
359
                        } else {
435 geraldo 360
                            $('#form-review #question-value').val(0);
432 geraldo 361
                        }
412 geraldo 362
                        $('#modal-review').modal('show');
363
                        return true;
411 geraldo 364
                    }
365
                }
366
            }
367
        }
391 geraldo 368
    });
369
    /**
251 geraldo 370
     * Clicked on edit form
371
     */
372
    $('body').on('click', 'button.btn-edit-form', function(e) {
373
        e.preventDefault();
374
        form_id = $(this).data('id')
375
        var action = $(this).data('href');
376
        $.ajax({
377
            'dataType': 'json',
378
            'accept': 'application/json',
379
            'method': 'get',
380
            'url': action,
381
        }).done(function(response) {
382
            if (response['success']) {
383
                $('#form-main').attr('action', action);
384
                $('#form-main #form-id').val(response['data']['id']),
387 geraldo 385
                    $('#name').html(response['data']['name']);
366 geraldo 386
                $('#form-status').val(response['data']['status']);
316 geraldo 387
                $('#text').html(response['data']['text']);
388
                $('#user').html(response['data']['user']);
251 geraldo 389
                /*-------------Render Sections -------*/
390
                objFormGenerator.clear();
391
                objFormGenerator.sections = response['data']['content'] || [];
392
                objFormGenerator.render();
393
                renderSectionData(objFormGenerator.sections);
254 geraldo 394
                $('#row-forms').hide();
251 geraldo 395
                $('#row-edit').show();
396
            } else {
397
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
398
            }
399
        }).fail(function(jqXHR, textStatus, errorThrown) {
400
            $.fn.showError(textStatus);
401
        });
402
    });
351 geraldo 403
    $('button.btn-form-save-close').click(function(e) {
444 geraldo 404
        var formContinue = parseFloat($('#form-main #form-continue').val());
352 geraldo 405
        var data = {
406
            'status': $('#form-main #form-status').val(),
407
            'content': JSON.stringify(objFormGenerator.sections)
408
        }
409
        $.ajax({
410
            'dataType': 'json',
411
            'method': 'post',
412
            'url': $('#form-main').attr('action'),
413
            'data': data,
414
        }).done(function(response) {
415
            if (response['success']) {
416
                $.fn.showSuccess(response['data']);
417
                $('#row-edit').hide();
418
                $('#row-forms').show();
419
                /*---------- Reset Form -------- */
420
                $('#form-main')[0].reset();
421
                /*--------Reset Sections ----------*/
422
                clearSectionData();
423
                /* ------- Refresh Table -----------*/
424
                tableForm.fnDraw();
425
            } else {
426
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
427
            }
428
        }).fail(function(jqXHR, textStatus, errorThrown) {
429
            $.fn.showError(textStatus);
430
        });
431
        return false;
351 geraldo 432
    });
251 geraldo 433
    /**
434
     * Clicked cancel new/edit Form
435
     */
436
    $('button.btn-edit-cancel').click(function(e) {
437
        e.preventDefault();
438
        $('#row-edit').hide();
254 geraldo 439
        $('#row-forms').show();
251 geraldo 440
    });
441
    /**
339 geraldo 442
     * Get Answers
443
     */
444
    const getAnswer = (type, options, answer) => {
445
        if (type == 'open' || type == 'rating-range') {
328 geraldo 446
            return answer;
251 geraldo 447
        }
339 geraldo 448
        if (type == 'multiple') {
352 geraldo 449
            let opt = '';
339 geraldo 450
            opt += removeTags(options.filter((opt) => answer.includes(opt.slug_option))[0].text) + ' ';
332 geraldo 451
            return opt;
330 geraldo 452
        }
338 geraldo 453
        return removeTags(options.filter((opt) => opt.slug_option == answer)[0].text);
251 geraldo 454
    }
455
    /**
341 geraldo 456
     * Get Status
457
     */
400 geraldo 458
    const getStatus = (options, answer, type) => {
407 geraldo 459
        let status;
409 geraldo 460
        status = type == 'multiple' ?
461
            options.filter((opt) => answer.includes(opt.slug_option) && opt.correct == '1') :
410 geraldo 462
            options.filter((opt) => opt.slug_option == answer && opt.correct == '1');
409 geraldo 463
        return status.length != 0 ? '<font color="green">LABEL_CORRECT</font>' : '<font color="red">LABEL_FAIL</red>';
400 geraldo 464
    }
441 geraldo 465
    const getPtos = (options, answer, type, value, question_value) => {
429 geraldo 466
        let ptos = 0;
467
        if (type == "open" || type == "rating-open" || type == "rating-range") {
441 geraldo 468
            ptos = question_value ? question_value : 0;
429 geraldo 469
        } else {
470
            if (type == 'multiple') {
471
                options.map((opt) => {
472
                    if (answer.includes(opt.slug_option)) {
444 geraldo 473
                        ptos += parseFloat(opt.value);
429 geraldo 474
                    }
475
                })
476
            } else {
477
                options.map((opt) => {
478
                    if (opt.slug_option == answer) {
444 geraldo 479
                        ptos = parseFloat(opt.value);
429 geraldo 480
                    }
481
                });
482
            }
483
        }
445 geraldo 484
        return  parseFloat(ptos).toFixed(2) + '/' + parseFloat(value).toFixed(2);
429 geraldo 485
    }
341 geraldo 486
    /**
251 geraldo 487
     * Remove Html Tags
488
     */
339 geraldo 489
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
251 geraldo 490
    /**
491
     * Render Sections data
492
     */
398 geraldo 493
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
323 geraldo 494
        removeTags: removeTags,
341 geraldo 495
        getAnswer: getAnswer,
429 geraldo 496
        getStatus: getStatus,
497
        getPtos: getPtos
398 geraldo 498
    }));
251 geraldo 499
    /**
500
     * Clear Div Section data
501
     */
502
    const clearSectionData = () => $("#rows").html('');
503
    /**
504
     * Clicked refresh button
505
     */
506
    $('button.btn-refresh').click(function(e) {
507
        tableForm.fnDraw();
508
    });
438 geraldo 509
    /**
510
     * Format input number (Form Option)
511
     */
512
    $('#form-review #question-value').inputNumberFormat({
513
        'decimal': 2
514
    });
251 geraldo 515
});
516
JS;
517
$this->inlineScript()->captureEnd();
518
?>
519
 
520
<!-- Content Header (Page header) -->
521
<section class="content-header">
389 geraldo 522
    <div class="container-fluid">
523
        <div class="row mb-2">
524
            <div class="col-sm-12">
525
                <h1>LABEL_REVIEWS</h1>
526
            </div>
527
        </div>
528
    </div>
529
    <!-- /.container-fluid -->
251 geraldo 530
</section>
314 geraldo 531
<section class="content" style="padding: 13px;">
389 geraldo 532
    <div class="container-fluid" id="row-forms">
533
        <div class="row">
534
            <div class="col-12">
535
                <div class="card">
536
                    <div class="card-body">
537
                        <table id="gridTable" class="table   table-hover">
538
                            <thead>
539
                                <tr>
540
                                    <th>LABEL_USER</th>
541
                                    <th>LABEL_NAME</th>
542
                                    <th>LABEL_LANGUAGE</th>
543
                                    <th>LABEL_STATUS</th>
544
                                    <th>LABEL_ACTIONS</th>
545
                                </tr>
546
                            </thead>
547
                            <tbody></tbody>
548
                        </table>
549
                    </div>
550
                    <div class="card-footer clearfix">
551
                        <div style="float:right;">
552
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
553
                        </div>
554
                    </div>
555
                </div>
251 geraldo 556
            </div>
389 geraldo 557
        </div>
558
    </div>
559
    <!-- Create/Edit Form -->
560
    <div class="row" id="row-edit" style="display: none">
561
        <div class="col-xs-12 col-md-12">
562
            <form action="#" name="form-main" id="form-main">
563
                <div class="form-group">
564
                    <label for="form-status">LABEL_USER:</label>
565
                    <div id="user"></div>
566
                </div>
567
                <div class="form-group">
568
                    <label for="form-status">LABEL_FORM:</label>
569
                    <div id="name"></div>
570
                </div>
571
                <div class="form-group">
572
                    <label for="form-status">LABEL_DESCRIPTION:</label>
573
                    <div id="text"></div>
574
                </div>
575
                <div class="form-group">
576
                    <label for="form-status">LABEL_STATUS:</label>
577
                    <select name="form-status" id="form-status" class="form-control">
578
                        <option value="<?php echo $pending; ?>">LABEL_PENDING</option>
579
                        <option value="<?php echo $review; ?>">LABEL_REVIEW</option>
580
                        <option value="<?php echo $completed; ?>">LABEL_COMPLETED</option>
581
                    </select>
582
                </div>
583
                <div class="row">
584
                    <div class="col-xs-12 col-md-12">
585
                        <div class="panel-group" id="rows"></div>
586
                    </div>
587
                </div>
588
                <div class="form-group">
589
                    <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE</button>
590
                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
591
                </div>
592
            </form>
593
        </div>
594
    </div>
595
    <!-- Create/Edit Form-->
251 geraldo 596
 
411 geraldo 597
 
598
    <div  id="modal-review" class="modal" tabindex="-1" role="dialog">
599
        <div class="modal-dialog modal-lg" role="document">
600
            <form action="#" name="form-option" id="form-review">
412 geraldo 601
                <input type="hidden" name="section" id="section" value="" />
602
                <input type="hidden" name="question" id="question" value="" />
411 geraldo 603
                <div class="modal-content">
604
                    <div class="modal-header">
423 geraldo 605
                        <h4 class="modal-title">LABEL_RESPONSE_REVIEW</h4>
411 geraldo 606
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
607
                            <span aria-hidden="true">&times;</span>
608
                        </button>
609
                    </div>
610
                    <div class="modal-body">
611
                        <div class="form-group">
414 geraldo 612
                            <label for="option-text">LABEL_COMMENT</label>
411 geraldo 613
                            <!--  ckeditor -->
423 geraldo 614
                            <textarea  name="question-comment" id="question-comment" rows="5" class="form-control" placeholder="LABEL_ENTER_COMMENT"></textarea>
411 geraldo 615
                        </div>
616
                        <div class="form-group">
617
                            <label for="question-status">LABEL_ANSWER_CORRECT</label>
618
                            <select name="question-status" id="question-status" class="form-control">
619
                                <option value="1">LABEL_YES</option>
620
                                <option value="0">LABEL_NOT</option>
621
                            </select>
622
                        </div>
623
 
434 geraldo 624
 
433 geraldo 625
                    <div class="form-group">
626
                            <label for="question-value">LABEL_VALUE</label>
627
                            <input type="text" name="question-value" id="question-value"  class="form-control" />
628
                        </div>
434 geraldo 629
</div>
630
 
411 geraldo 631
                    <div class="modal-footer">
414 geraldo 632
                        <button type="button" class="btn btn-primary btn-add-review">LABEL_SAVE</button>
411 geraldo 633
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
634
                    </div>
635
                </div>
636
            </form>
637
        </div>
638
    </div>
639
 
251 geraldo 640
    <!---Template Sections --->
641
    <script id="sectionTemplate" type="text/x-jsrender">
389 geraldo 642
        <div class="panel panel-default" id="panel-{{:slug_section}}">
369 geraldo 643
   <div class="panel-heading">
644
      <h4 class="panel-title">
645
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
646
         <span class="section-name{{:slug_section}}">
647
         {{:name}}
648
         </span>
649
         </a>
650
      </h4>
651
   </div>
652
   <div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
653
      <div class="panel-body">
654
         <div class="table-responsive">
655
            <table class="table table-bordered">
656
               <thead>
657
                  <tr>
399 geraldo 658
                     <th style="width: 30%;">LABEL_QUESTION</th>
428 geraldo 659
                     <th style="width: 30%;">LABEL_ANSWER</th>
399 geraldo 660
                     <th style="width: 10%;">LABEL_STATUS</th>
428 geraldo 661
                     <th style="width: 10%;">LABEL_PTOS</th>
662
                     <th style="width: 20%;">LABEL_ACTIONS</th>
369 geraldo 663
                  </tr>
664
               </thead>
665
               {{for questions}}
666
               <tbody>
667
                  <tr class="tr-question">
668
                     <td class="text-left">{{:~removeTags(text)}} </td>
669
                     <td>{{:~getAnswer(type,options,answer)}}</td>
670
                     <td>
671
                        {{if type == 'simple'  || type=='multiple' }}
429 geraldo 672
                        {{:~getStatus(options,answer,type)}}
369 geraldo 673
                        {{else}}
399 geraldo 674
 
675
                        {{if status}}
676
                                    <font color="green">LABEL_CORRECT</font>
677
                                    {{else}}
678
                                    <font color="red">LABEL_FAIL</font>
679
                                    {{/if}}
680
 
681
 
682
                        {{/if}}
683
 
684
                     </td>
685
                     <td>
441 geraldo 686
                     {{:~getPtos(options,answer,type, value, question_value)}}
429 geraldo 687
               </td>
688
                     <td>
399 geraldo 689
                        {{if type != 'simple'  && type !='multiple' }}
690
 
411 geraldo 691
 
425 geraldo 692
                        <button class="btn btn-default btn-edit-review"  data-original-title="LABEL_EDIT LABEL_REVIEW" data-section="{{:slug_section}}" data-question="{{:slug_question}}">
693
                        <i class="fa fa-pencil" aria-hidden="true"></i> LABEL_EDIT LABEL_REVIEW
369 geraldo 694
                        </button>
411 geraldo 695
 
413 geraldo 696
                        {{/if}}
697
 
369 geraldo 698
                     </td>
699
                  </tr>
700
               </tbody>
701
               {{/for}}
702
            </table>
703
         </div>
704
      </div>
705
   </div>
706
</div>
251 geraldo 707
    </script>
708
 
709
    <!-- End Template Sections-->
710
 
711
</section>