Proyectos de Subversion LeadersLinked - Backend

Rev

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