Proyectos de Subversion LeadersLinked - Backend

Rev

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