Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1245 | Rev 1247 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
977 geraldo 1
<?php
2
$acl = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
985 geraldo 7
$routeAdd = $this->url('performance-evaluation/forms/add');
8
$routeDatatable = $this->url('performance-evaluation/forms');
977 geraldo 9
$routeDashboard = $this->url('dashboard');
10
 
985 geraldo 11
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
13
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
977 geraldo 14
 
15
 
16
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
17
 
18
 
19
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
20
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
21
 
22
 
23
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
24
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
25
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
26
 
27
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
28
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
29
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
34
 
35
 
36
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
37
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
38
 
39
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
40
 
41
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
42
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
44
 
45
 
46
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
47
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
48
 
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
51
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
52
 
53
// bootbox Alert //
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
55
 
56
// JsRender //
57
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
58
 
1050 geraldo 59
 
1088 geraldo 60
// Page Styles
61
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
62
 
63
 
1053 geraldo 64
$status_active = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_ACTIVE;
65
$status_inactive = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_INACTIVE;
1050 geraldo 66
 
977 geraldo 67
$this->inlineScript()->captureStart();
68
echo <<<JS
1085 geraldo 69
jQuery(document).ready(function($) {
70
    var allowEdit = $allowEdit;
71
    var allowDelete = $allowDelete;
72
    var sections = [];
73
    /**
74
     * Get rows and set data table
75
     */
76
    var tableForm = $('#gridTable').dataTable({
77
        'processing': true,
78
        'serverSide': true,
79
        'searching': true,
80
        'order': [
81
            [0, 'asc']
82
        ],
83
        'ordering': true,
84
        'ordenable': true,
85
        'responsive': true,
86
        'select': false,
87
        'paging': true,
88
        'pagingType': 'simple_numbers',
89
        'ajax': {
90
            'url': '$routeDatatable',
91
            'type': 'get',
92
            'beforeSend': function(request) {
93
                NProgress.start();
94
            },
95
            'dataFilter': function(response) {
96
                var response = jQuery.parseJSON(response);
97
                var json = {};
98
                json.recordsTotal = 0;
99
                json.recordsFiltered = 0;
100
                json.data = [];
101
                if (response.success) {
102
                    json.recordsTotal = response.data.total;
103
                    json.recordsFiltered = response.data.total;
104
                    json.data = response.data.items;
977 geraldo 105
                } else {
1085 geraldo 106
                    $.fn.showError(response.data)
977 geraldo 107
                }
1085 geraldo 108
                return JSON.stringify(json);
109
            }
110
        },
111
        'language': {
112
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
113
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
114
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
115
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
116
            'sInfo': 'LABEL_DATATABLE_SINFO',
117
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
118
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
119
            'sInfoPostFix': '',
120
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
121
            'sUrl': '',
122
            'sInfoThousands': ',',
123
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
124
            'oPaginate': {
125
                'sFirst': 'LABEL_DATATABLE_SFIRST',
126
                'sLast': 'LABEL_DATATABLE_SLAST',
127
                'sNext': 'LABEL_DATATABLE_SNEXT',
128
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
129
            },
130
            'oAria': {
131
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
132
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
133
            },
134
        },
135
        'drawCallback': function(settings) {
136
            NProgress.done();
137
            $('button.btn-delete').confirmation({
138
                rootSelector: 'button.btn-delete',
139
                title: 'LABEL_ARE_YOU_SURE',
140
                singleton: true,
141
                btnOkLabel: 'LABEL_YES',
142
                btnCancelLabel: 'LABEL_NO',
143
                onConfirm: function(value) {
144
                    action = $(this).data('href');
145
                    NProgress.start();
977 geraldo 146
                    $.ajax({
147
                        'dataType': 'json',
1085 geraldo 148
                        'accept': 'application/json',
977 geraldo 149
                        'method': 'post',
1085 geraldo 150
                        'url': action,
977 geraldo 151
                    }).done(function(response) {
152
                        if (response['success']) {
153
                            $.fn.showSuccess(response['data']);
154
                            tableForm.fnDraw();
155
                        } else {
1085 geraldo 156
                            $.fn.showError(response['data']);
977 geraldo 157
                        }
1085 geraldo 158
                    }).fail(function(jqXHR, textStatus, errorThrown) {
159
                        $.fn.showError(textStatus);
160
                    }).always(function() {
161
                        NProgress.done();
977 geraldo 162
                    });
1085 geraldo 163
                },
164
            });
165
        },
166
        'aoColumns': [{
167
                'mDataProp': 'name'
168
            },
169
            {
170
                'mDataProp': 'job_description'
171
            },
172
            {
173
                'mDataProp': 'status'
174
            },
175
            {
176
                'mDataProp': 'actions'
177
            },
178
        ],
179
        'columnDefs': [{
180
                'targets': 0,
181
                'className': 'text-vertical-middle',
182
            },
183
            {
184
                'targets': 1,
185
                'className': 'text-vertical-middle',
186
            },
187
            {
188
                'targets': -2,
189
                'orderable': false,
190
                'className': 'text-center',
191
                'render': function(data, type, row) {
192
                    checked = data == 'a' ? ' checked="checked" ' : '';
193
                    return '<div class="checkbox checkbox-success">' +
194
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
195
                        '<label ></label></div>';
1055 geraldo 196
                }
1085 geraldo 197
            },
198
            {
199
                'targets': -1,
200
                'orderable': false,
201
                'render': function(data, type, row) {
202
                    s = '';
203
                    if (allowEdit) {
204
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
205
                    }
206
                    if (allowDelete) {
207
                        s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
208
                    }
209
                    return s;
210
                }
977 geraldo 211
            }
1085 geraldo 212
        ],
213
    });
214
    /**
215
     * Clicked on edit form
216
     */
217
    $('body').on('click', 'button.btn-edit-form', function(e) {
218
        e.preventDefault();
1243 geraldo 219
        renderCompetenciesData([]);
1085 geraldo 220
        form_id = $(this).data('id')
221
        var action = $(this).data('href');
222
        $.ajax({
223
            'dataType': 'json',
224
            'accept': 'application/json',
225
            'method': 'get',
226
            'url': action,
227
        }).done(function(response) {
228
            if (response['success']) {
229
                $("#rows").html('');
230
                sections = [];
231
                $('#form-main').attr('action', action);
1087 geraldo 232
                $('#form-main #form-name').val(response['data']['name']);
1230 geraldo 233
                $('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
1085 geraldo 234
                $('#form-main #form-status').val(response['data']['status']);
1089 geraldo 235
                CKEDITOR.instances['form-description'].setData(response['data']['description']);
236
                CKEDITOR.instances['form-text'].setData(response['data']['text']);
1085 geraldo 237
                sections = response['data']['content'] || [];
1054 geraldo 238
                renderData(sections);
1085 geraldo 239
                $('#row-lists').hide();
240
                $('#row-form').show();
241
            } else {
242
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
977 geraldo 243
            }
1085 geraldo 244
        }).fail(function(jqXHR, textStatus, errorThrown) {
245
            $.fn.showError(textStatus);
246
        });
247
    });
248
    /**
249
     * Clicked add new section
250
     */
251
    $('#btn-add-section').click(function(e) {
252
        $('#form-section #id-section').val('');
253
        $('#form-section #title-section').val('');
254
        $('#form-section #text-section').val('');
255
        $('#form-section #type-section').val($('#form-section #type-section option:first').val());
256
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
257
        $('#modal-section').modal('show');
258
        return;
259
    });
260
    /**
261
     * Clicked edit section
262
     */
263
    /**
264
     * Clicked save section
265
     */
266
    $('#btn-save-section').click(function(e) {
267
        if ($('#title-section').val() == '') {
268
            $.fn.showError('ERROR_ENTER_TITLE');
269
            return;
270
        } else {
271
            $('#id-section').val() == "" ?
272
                addSection($('#title-section').val(), $('#text-section').val(), $('#type-section').val()) :
1086 geraldo 273
                editSection($('#id-section').val(), $('#title-section').val(), $('#text-section').val(), $('#type-section').val())
1085 geraldo 274
            $('#modal-section').modal('hide');
275
            return;
276
        }
277
    });
278
    /**
279
     * Clicked remove section
280
     */
281
    $('body').on('click', 'button.btn-delete-section', function(e) {
282
        var id_section = $(this).data('section');
283
        bootbox.confirm({
284
            title: "LABEL_DELETE LABEL_SECTION",
285
            message: "LABEL_QUESTION_DELETE",
286
            buttons: {
287
                cancel: {
288
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
289
                },
290
                confirm: {
291
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
292
                }
293
            },
294
            callback: function(result) {
295
                if (result) {
296
                    removeSection(id_section);
297
                }
1009 geraldo 298
            }
1085 geraldo 299
        });
300
    });
301
    $('body').on('click', 'button.btn-edit-section', function(e) {
302
        var id = $(this).data('section');
303
        sections.map((item) => {
304
            if (item.id_section == id) {
305
                $('#form-section #id-section').val(item.id_section);
306
                $('#form-section #title-section').val(item.title);
307
                $('#form-section #text-text').val(item.text);
308
                $('#form-section #type-section').val(item.type);
309
                $('#modal-section').modal('show');
310
                return;
977 geraldo 311
            }
1085 geraldo 312
        });
313
    });
314
    /**
315
     * Clicked remove option
316
     */
317
    $('body').on('click', 'button.btn-delete-option', function(e) {
318
        var id_section = $(this).data('section');
319
        var id_option = $(this).data('option');
320
        bootbox.confirm({
321
            title: "LABEL_DELETE LABEL_OPTION",
322
            message: "LABEL_QUESTION_DELETE",
323
            buttons: {
324
                cancel: {
325
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
326
                },
327
                confirm: {
328
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
329
                }
330
            },
331
            callback: function(result) {
332
                if (result) {
333
                    removeOption(id_section, id_option);
334
                    return;
335
                }
336
            }
337
        });
338
    });
339
    /**
340
     * Clicked add new Option
341
     */
342
    $('body').on('click', 'button.btn-add-option', function(e) {
343
        var id = $(this).data('section');
344
        $('#section-option').val(id);
345
        $('#text-option').val('');
346
        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
347
        $('#modal-option').modal('show');
348
        return;
349
    });
350
    /**
351
     * Clicked add new Option
352
     */
353
    $('#btn-save-option').click(function(e) {
354
        if ($('#text-option').val() == '') {
355
            $.fn.showError('ERROR_ENTER_TEXT');
356
            return;
357
        } else {
358
            $('#id-option').val() == "" ?
359
                addOption($('#section-option').val(), $('#text-option').val()) :
360
                editOption($('#section-option').val(), $('#id-option').val(), $('#text-option').val())
361
        }
362
        $('#modal-option').modal('hide');
363
        return;
364
    });
365
    /**
366
     * Clicked edit Option
367
     */
368
    $('body').on('click', 'button.btn-edit-option', function(e) {
369
        var id_section = $(this).data('section');
370
        var id_option = $(this).data('option');
371
        sections.map((item) => {
372
            if (item.id_section == id_section) {
373
                item.options.map((opt) => {
374
                    if (opt.id_option == id_option) {
375
                        $('#id-option').val(opt.id_option);
376
                        $('#section-option').val(opt.id_section);
377
                        $("#text-option").val(opt.title);
378
                        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
379
                        $('#modal-option').modal('show');
380
                        return;
1027 geraldo 381
                    }
382
                });
383
            }
1085 geraldo 384
        });
385
    });
386
    /**
387
     * Clicked new Form
388
     */
389
    $('button.btn-add-form').click(function(e) {
390
        $("#rows").html('');
391
        sections = [];
392
        $('#form-main').attr('action', '$routeAdd');
393
        $('#form-main #form-name').val('');
1230 geraldo 394
        $('#form-main #job_description_id').val('').trigger('change');
1085 geraldo 395
        $('#form-main #form-status').val('$status_active');
1089 geraldo 396
        CKEDITOR.instances['form-text'].setData('');
397
        CKEDITOR.instances['form-description'].setData('');
1243 geraldo 398
        renderCompetenciesData([]);
1085 geraldo 399
        $('#row-lists').hide();
400
        $('#row-form').show();
401
        $('#form-main #form-name').focus();
402
        return;
403
    });
404
    /**
405
     * Clicked cancel new/edit Form
406
     */
407
    $('button.btn-edit-cancel').click(function(e) {
408
        $('#row-form').hide();
409
        $('#row-lists').show();
410
        return;
411
    });
412
    /**
1092 geraldo 413
     * Clicked save and continue new Form
1085 geraldo 414
     */
1092 geraldo 415
    $('button.btn-form-save-continue').click(function(e) {
1091 geraldo 416
        for (var instanceName in CKEDITOR.instances) {
417
            CKEDITOR.instances[instanceName].updateElement();
418
        }
1095 geraldo 419
        saveData(1);
1085 geraldo 420
    });
1093 geraldo 421
    /**
422
     * Clicked save and close new/edit Form
423
     */
424
    $('button.btn-form-save-close').click(function(e) {
425
        for (var instanceName in CKEDITOR.instances) {
426
            CKEDITOR.instances[instanceName].updateElement();
1092 geraldo 427
        }
1095 geraldo 428
        saveData(0);
429
    });
1096 geraldo 430
    /**
431
     * Save Form Data
432
     */
1097 geraldo 433
    const saveData = (action) => {
1093 geraldo 434
        if ($('#form-name').val() == '') {
435
            $.fn.showError('ERROR_ENTER_NAME');
436
        } else if ($('#form-description').val() == '') {
437
            $.fn.showError('ERROR_ENTER_DESCRIPTION');
438
        } else if ($('#form-text').val() == '') {
439
            $.fn.showError('ERROR_ENTER_TEXT');
440
        } else if ($('#form-status').val() == '') {
441
            $.fn.showError('ERROR_SELECT_STATUS');
442
        } else if ($('#job_description_id').val() == '') {
443
            $.fn.showError('ERROR_SELECT_JOB_DESCRIPTION');
444
        } else if (sections.length == 0) {
445
            $.fn.showError('ERROR_NOT_SECTIONS');
446
        } else {
447
            $.ajax({
448
                'dataType': 'json',
449
                'method': 'post',
450
                'url': $('#form-main').attr('action'),
451
                'data': {
452
                    'name': $('#form-main #form-name').val(),
453
                    'job_description_id': $('#form-main #job_description_id').val(),
454
                    'status': $('#form-main #form-status').val(),
455
                    'description': $('#form-main #form-description').val(),
456
                    'text': $('#form-main #form-text').val(),
457
                    'content': JSON.stringify(sections)
458
                },
459
            }).done(function(response) {
460
                if (response['success']) {
461
                    $.fn.showSuccess(response['data']);
1243 geraldo 462
                    if (action == 1) {
1095 geraldo 463
                        $('#form-main').attr('action', response['action_edit']);
464
                    } else {
465
                        $('#row-form').hide();
466
                        $('#row-lists').show();
467
                        /*---------- Reset Form -------- */
468
                        $('#form-main')[0].reset();
469
                        /*--------Reset Sections ----------*/
470
                        sections = [];
471
                        tableForm.fnDraw();
472
                    }
1093 geraldo 473
                    return;
474
                } else {
475
                    $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
476
                    return;
1092 geraldo 477
                }
478
            });
479
        }
1095 geraldo 480
    }
1093 geraldo 481
    /**
482
     * Remove Html Tags
483
     */
484
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
485
    /**
486
     * Render Sections data
487
     */
488
    const renderData = (data) => {
489
        $("#rows").html($("#sectionTemplate").render(data));
490
    }
491
    /**
492
     * Add Section to array
493
     */
494
    const addSection = (title, text, type) => {
495
        sections.push({
496
            'id_section': new Date().getTime(),
497
            'title': title,
498
            'type': type,
499
            'text': text,
1243 geraldo 500
            'answer': '',
1093 geraldo 501
            'options': []
502
        });
503
        return renderData(sections);
504
    }
505
    /**
506
     * Edit item behavior
507
     */
508
    const editSection = (id, title, text, type) => {
509
        sections.map((item) => {
510
            if (item.id_section == id) {
511
                item.title = title;
512
                item.type = type;
513
                item.text = text;
514
            }
515
        });
516
        return renderData(sections);
517
    }
518
    /**
519
     * Remove behavior
520
     */
521
    const removeSection = (id) => {
522
        sections = sections.filter((item) => item.id_section != id);
523
        return renderData(sections);
524
    }
525
    /**
526
     * Add Option to array
527
     */
528
    const addOption = (id_section, title) => {
529
        sections.map((item) => {
530
            if (item.id_section == id_section) {
531
                item.options.push({
532
                    'id_section': id_section,
533
                    'id_option': new Date().getTime(),
534
                    'title': title,
1243 geraldo 535
                    'answer': ''
1093 geraldo 536
                });
537
            }
538
        });
539
        return renderData(sections);
540
    }
541
    /**
542
     * Edit item Option
543
     */
544
    const editOption = (id_section, id, title) => {
545
        sections.map((item) => {
546
            if (item.id_section == id_section) {
547
                item.options.map((opt) => {
548
                    if (opt.id_option == id) {
549
                        opt.title = title
550
                    }
551
                });
552
            }
553
        });
554
        return renderData(sections);
555
    }
556
    /**
557
     * Remove Option
558
     */
559
    const removeOption = (id_section, id) => {
560
        sections.map((item) => {
561
            if (item.id_section == id_section) {
562
                item.options = item.options.filter((opt) => opt.id_option != id) || []
563
            }
564
        });
565
        return renderData(sections);
566
    }
567
    /**
568
     * Clicked refresh button
569
     */
570
    $('button.btn-refresh').click(function(e) {
571
        tableForm.fnDraw();
572
        return;
1092 geraldo 573
    });
1243 geraldo 574
    /**
575
     * Initialize select Jobdescription
576
     */
1229 geraldo 577
    $('#job_description_id').select2({
578
        theme: 'bootstrap4',
579
        width: '100%',
580
    });
1243 geraldo 581
    /**
582
     * On change selecte JobDescription
583
     */
1239 geraldo 584
    $('#job_description_id').on('change', function() {
1243 geraldo 585
        if ($("#job_description_id").val() != '') {
586
            $.getJSON("/settings/jobs-description/edit/" + $("#job_description_id").val(), function(data) {
587
                if (data['success']) {
1244 geraldo 588
                    console.log(data['data']['competencies_selected']);
1243 geraldo 589
                    renderCompetenciesData(data['data']['competencies_selected']);
590
                }
591
            });
592
        }
593
    });
1240 geraldo 594
 
1243 geraldo 595
    /**
596
     * Render Competencies data
597
     */
598
    const renderCompetenciesData = (data) => {
1246 geraldo 599
 
600
        console.log(data.length);
1243 geraldo 601
        data.length > 0 ?
602
            $("#rows-job-competencies").html($("#competencyTemplate").render(data)) :
603
            $("#rows-job-competencies").html('');
604
    }
977 geraldo 605
});
606
JS;
1092 geraldo 607
 
977 geraldo 608
$this->inlineScript()->captureEnd();
609
?>
610
<!-- Content Header (Page header) -->
611
<section class="content-header">
1027 geraldo 612
   <div class="container-fluid">
613
      <div class="row mb-2">
614
         <div class="col-sm-12">
615
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
616
         </div>
617
      </div>
618
   </div>
619
   <!-- /.container-fluid -->
977 geraldo 620
</section>
621
<section class="content">
1056 geraldo 622
   <div class="container-fluid" id="row-lists">
1027 geraldo 623
      <div class="row">
624
         <div class="col-12">
625
            <div class="card">
626
               <div class="card-body">
627
                  <table id="gridTable" class="table   table-hover">
628
                     <thead>
629
                        <tr>
1084 geraldo 630
                           <th style="width:15%">LABEL_NAME</th>
631
                           <th style="width:25%">LABEL_JOB_DESCRIPTION</th>
632
                           <th style="width:15%">LABEL_ACTIVE</th>
633
                           <th style="width:20%">LABEL_ACTIONS</th>
1027 geraldo 634
                        </tr>
635
                     </thead>
636
                     <tbody></tbody>
637
                  </table>
638
               </div>
639
               <div class="card-footer clearfix">
640
                  <div style="float:right;">
641
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
642
                     <?php if ($allowAdd) : ?>
643
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
644
                     <?php endif; ?>
645
                  </div>
646
               </div>
977 geraldo 647
            </div>
1027 geraldo 648
         </div>
649
      </div>
650
   </div>
651
   <!-- Create/Edit Form -->
1051 geraldo 652
   <div class="row" id="row-form" style="display: none; padding: 16px;">
1027 geraldo 653
      <div class="col-xs-12 col-md-12">
654
         <form action="#" name="form-main" id="form-main">
655
            <div class="form-group">
656
               <label for="form-name">LABEL_FIRST_NAME</label>
657
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 658
            </div>
1050 geraldo 659
            <div class="form-group">
1238 geraldo 660
                    <label for="job_description_id">LABEL_POSITION_EVALUATED</label>
1050 geraldo 661
                    <select name="job_description_id" id="job_description_id" class="form-control">
1051 geraldo 662
                        <option value="">LABEL_SELECT</option>
663
                        <?php foreach ($jobsDescription as $rs): ?>
1061 geraldo 664
                            <option value="<?php echo $rs->uuid;?>"><?php echo $rs->name;?></option>
1051 geraldo 665
                        <?php endforeach; ?>
1050 geraldo 666
                    </select>
667
                </div>
1089 geraldo 668
                <div class="form-group">
669
                    <label for="form-description">LABEL_DESCRIPTION</label>
670
                    <!--  ckeditor -->
671
                    <textarea  name="form-description" id="form-description" rows="5" class="ckeditor form-control"></textarea>
672
                </div>
673
                <div class="form-group">
674
                    <label for="form-text">LABEL_TEXT</label>
675
                    <!--  ckeditor -->
676
                    <textarea  name="form-text" id="form-text" rows="5" class="ckeditor form-control"></textarea>
677
                </div>
1050 geraldo 678
            <div class="form-group">
679
                    <label for="form-status">LABEL_STATUS</label>
680
                    <select name="form-status" id="form-status" class="form-control">
681
                        <option value="<?php echo $status_inactive; ?>">LABEL_INACTIVE</option>
682
                        <option value="<?php echo $status_active; ?>">LABEL_ACTIVE</option>
683
                    </select>
684
                </div>
1027 geraldo 685
            <div class="row">
686
               <div class="col-xs-12 col-md-12 text-right">
687
                  <button type="button" class="btn btn-primary" id="btn-add-section" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION</button>
688
               </div>
689
            </div>
690
            <br />
691
            <div class="row">
692
               <div class="col-xs-12 col-md-12">
693
                  <div class="panel-group" id="rows"></div>
694
               </div>
695
            </div>
1239 geraldo 696
            <div class="row">
697
               <div class="col-xs-12 col-md-12">
1245 geraldo 698
                   <h3>Competencias del cargo</h3>
1239 geraldo 699
                  <div class="panel-group" id="rows-job-competencies"></div>
700
               </div>
701
            </div>
1027 geraldo 702
            <div class="form-group">
1094 geraldo 703
            <button type="button" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
1027 geraldo 704
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
705
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
706
            </div>
707
         </form>
708
      </div>
709
   </div>
710
   <!-- Create/Edit Form-->
711
   <!-- section Modal -->
712
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
713
      <div class="modal-dialog modal-lg" role="document">
714
         <form action="#" name="form-section" id="form-section">
715
            <input type="hidden" name="id-section" id="id-section" />
716
            <div class="modal-content">
717
               <div class="modal-header">
718
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
719
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
720
                  <span aria-hidden="true">&times;</span>
721
                  </button>
722
               </div>
723
               <div class="modal-body">
724
                  <div class="form-group">
725
                     <label for="title-section">LABEL_FIRST_NAME</label>
726
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
727
                  </div>
728
                  <div class="form-group">
729
                     <label for="text-section">LABEL_TEXT</label>
730
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
731
                  </div>
732
                  <div class="form-group">
733
                     <label for="type-section">LABEL_TYPE</label>
734
                     <select name="type-section" id="type-section" class="form-control">
735
                        <option value="simple">Simple</option>
736
                        <option value="multiple">Multiple</option>
737
                     </select>
738
                  </div>
739
               </div>
740
               <div class="modal-footer">
741
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
742
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
743
               </div>
744
            </div>
745
         </form>
746
      </div>
747
   </div>
748
   <!-- End Modal section -->
749
   <!-- Modal Options -->
750
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
751
      <div class="modal-dialog modal-lg" role="document">
752
         <form action="#" name="form-option" id="form-option">
753
            <input type="hidden" name="section-option" id="section-option" value="" />
754
            <input type="hidden" name="id-option" id="id-option" value="" />
755
            <div class="modal-content">
756
               <div class="modal-header">
757
                  <h4 class="modal-title">LABEL_OPTION</h4>
758
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
759
                  <span aria-hidden="true">&times;</span>
760
                  </button>
761
               </div>
762
               <div class="modal-body">
763
                  <div class="form-group">
1047 geraldo 764
                     <label for="text-option">LABEL_TEXT</label>
1027 geraldo 765
                     <!--  ckeditor -->
1047 geraldo 766
                     <textarea  name="text-option" id="text-option" rows="5" class="form-control"></textarea>
1027 geraldo 767
                  </div>
768
               </div>
769
               <div class="modal-footer">
770
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
771
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
772
               </div>
773
            </div>
774
         </form>
775
      </div>
776
   </div>
1050 geraldo 777
 
1027 geraldo 778
   <!-- End Modal Options -->
779
   <!---Template Sections --->
780
   <script id="sectionTemplate" type="text/x-jsrender">
1045 geraldo 781
   <div class="panel panel-default" id="panel-{{:id_section}}">
782
   <div class="panel-heading">
783
      <h4 class="panel-title">
784
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
785
         <span class="section-name{{:id_section}}">
1088 geraldo 786
         {{:title}}
1045 geraldo 787
         </span>
788
         </a>
789
      </h4>
790
   </div>
791
   <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
792
      <div class="panel-body">
793
         <div class="table-responsive">
794
            <table class="table table-bordered">
795
               <thead>
796
                  <tr>
797
                     <th style="width: 10%;">LABEL_ELEMENT</th>
798
                     <th style="width: 30%;">LABEL_TEXT</th>
799
                     <th style="width: 10%;">LABEL_TYPE</th>
800
                     <th style="width: 50%;">LABEL_ACTIONS</th>
801
                  </tr>
802
               </thead>
803
               <tbody>
1243 geraldo 804
                  <tr>
1045 geraldo 805
                     <td class="text-left">LABEL_SECTION</td>
806
                     <td class="text-left">{{:title}}</td>
807
                     <td>
808
                        {{if type == 'simple'}} Simple {{/if}}
809
                        {{if type == 'multiple'}} Multiple {{/if}}
810
                     </td>
811
                     <td>
1085 geraldo 812
                        <button  type="button" class="btn btn-default btn-edit-section" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
813
                        <button  type="button" class="btn btn-default btn-delete-section" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button>
1045 geraldo 814
                        {{if type == 'multiple'}}
815
                        <button type="button" class="btn btn-default btn-add-option" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION </button>
816
                        {{/if}}
817
                     </td>
818
                  </tr>
819
                  {{for options}}
820
                  <tr >
821
                     <td class="text-left">--LABEL_OPTION</td>
822
                     <td class="text-left">
823
                        {{:title}}
824
                     </td>
825
                     <td></td>
826
                     <td>
1085 geraldo 827
                        <button type="button"  class="btn btn-default btn-edit-option" data-section="{{:id_section}}" data-option="{{:id_option}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button>
828
                        <button type="button" class="btn btn-default btn-delete-option" data-section="{{:id_section}}" data-option="{{:id_option}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button>
1045 geraldo 829
                     </td>
830
                  </tr>
831
                  {{/for}}
832
               </tbody>
833
            </table>
834
         </div>
1027 geraldo 835
      </div>
1045 geraldo 836
   </div>
837
</div>
1027 geraldo 838
   </script>
839
   <!-- End Template Sections-->
1243 geraldo 840
 
841
  <!---Template Competencies --->
842
   <script id="competencyTemplate" type="text/x-jsrender">
843
   <div class="panel panel-default" id="panel-{{:competency_id}}">
844
   <div class="panel-heading">
845
      <h4 class="panel-title" style="    font-size: 18px;">
846
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:competency_id}}" href="#collapse-{{:competency_id}}">
847
         <span class="competency-name{{:competency_id}}">
848
         {{:~getType(competency_type_id).name}} - {{:name}}
849
         </span>
850
         </a>
851
      </h4>
852
   </div>
853
   <div id="collapse-{{:competency_id}}" class="panel-collapse in collapse show">
854
      <div class="panel-body">
855
         <div class="table-responsive">
856
            <table class="table table-bordered">
857
               <thead>
858
                  <tr>
859
                     <th style="width: 20%;">LABEL_ELEMENT</th>
860
                     <th style="width: 50%;">LABEL_TITLE</th>
861
                     <th style="width: 10%;">LABEL_LEVEL</th>
862
                  </tr>
863
               </thead>
864
               <tbody>
865
                  <tr>
866
                     <td class="text-left">LABEL_COMPETENCY</td>
867
                     <td class="text-left">{{:name}}</td>
868
                     <td></td>
869
                  </tr>
870
                  {{for behaviors}}
871
                  <tr >
872
                     <td class="text-left">--LABEL_CONDUCT</td>
873
                     <td class="text-left">
874
                        {{:description}}
875
                     </td>
876
                     <td>
877
          {{if level == '0'}} LABEL_NA {{/if}}
878
          {{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
879
          {{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
880
          {{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
881
          {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
882
       </td>
883
 
884
                  </tr>
885
                  {{/for}}
886
               </tbody>
887
            </table>
888
         </div>
889
      </div>
890
   </div>
891
</div>
892
   </script>
893
    <!-- End Template Competencies-->
894
 
977 geraldo 895
</section>