Proyectos de Subversion LeadersLinked - Backend

Rev

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