Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
66 efrain 1
<?php
2
use LeadersLinked\Model\JobDescription;
3
 
4
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
5
$currentUser    = $this->currentUserHelper();
6
 
7
$roleName = $currentUser->getUserTypeId();
8
 
9
 
10
$routeAdd       = $this->url('settings/jobs-description/add');
11
$routeDatatable = $this->url('settings/jobs-description');
846 geraldo 12
$routeImport    = $this->url('settings/jobs-description/import');
66 efrain 13
$routeDashboard = $this->url('dashboard');
14
 
15
$allowAdd               = $acl->isAllowed($roleName, 'settings/jobs-description/add') ? 1 : 0;
16
$allowEdit              = $acl->isAllowed($roleName, 'settings/jobs-description/edit') ? 1 : 0;
17
$allowDelete            = $acl->isAllowed($roleName, 'settings/jobs-description/delete') ? 1 : 0;
561 geraldo 18
$allowReport            = $acl->isAllowed($roleName, 'settings/jobs-description/report') ? 1 : 0;
846 geraldo 19
$allowImport            = $acl->isAllowed($roleName, 'settings/jobs-description/import') ? 1 : 0;
66 efrain 20
 
21
 
22
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
23
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
24
 
25
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
26
 
27
 
28
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
29
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
31
 
32
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
33
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
34
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
36
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
37
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
39
 
40
 
41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
42
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
43
 
44
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
45
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
46
 
1175 geraldo 47
// bootbox Alert //
48
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
66 efrain 49
 
1175 geraldo 50
// JsRender //
51
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
52
 
53
 
54
// Page Styles
55
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
56
 
57
 
66 efrain 58
$status_active = JobDescription::STATUS_ACTIVE;
59
 
60
$this->inlineScript()->captureStart();
61
echo <<<JS
1170 geraldo 62
 
63
var competencies = [];
64
var  competencies_type = [];
65
var subordinates = [];
66
var competencies_selected = [];
67
var subordinates_selected = [];
68
 
1167 geraldo 69
jQuery(document).ready(function($) {
935 geraldo 70
    $.validator.setDefaults({
71
        debug: true,
72
        highlight: function(element) {
73
            $(element).addClass('is-invalid');
74
        },
75
        unhighlight: function(element) {
76
            $(element).removeClass('is-invalid');
77
        },
78
        errorElement: 'span',
79
        errorClass: 'error invalid-feedback',
80
        errorPlacement: function(error, element) {
81
            if (element.parent('.form-group').length) {
82
                error.insertAfter(element);
83
            } else if (element.parent('.toggle').length) {
84
                error.insertAfter(element.parent().parent());
85
            } else {
86
                error.insertAfter(element.parent());
87
            }
88
        }
89
    });
90
    $.fn.showFormErrorValidator = function(fieldname, errors) {
91
        var field = $(fieldname);
92
        if (field) {
93
            $(field).addClass('is-invalid');
94
            var error = $('<span id="' + fieldname + '-error" class="error invalid-feedback">' + errors + '</div>');
95
            if (field.parent('.form-group').length) {
96
                error.insertAfter(field);
97
            } else if (field.parent('.toggle').length) {
98
                error.insertAfter(field.parent().parent());
99
            } else {
100
                error.insertAfter(field.parent());
101
            }
102
        }
103
    };
104
    var allowEdit = $allowEdit;
105
    var allowDelete = $allowDelete;
106
    var allowReport = $allowReport;
107
    var gridTable = $('#gridTable').dataTable({
108
        'processing': true,
109
        'serverSide': true,
110
        'searching': true,
111
        'order': [
112
            [0, 'asc']
113
        ],
114
        'ordering': true,
115
        'ordenable': true,
116
        'responsive': true,
117
        'select': false,
118
        'paging': true,
119
        'pagingType': 'simple_numbers',
120
        'ajax': {
121
            'url': '$routeDatatable',
122
            'type': 'get',
123
            'beforeSend': function(request) {
124
                NProgress.start();
66 efrain 125
            },
935 geraldo 126
            'dataFilter': function(response) {
127
                var response = jQuery.parseJSON(response);
128
                var json = {};
129
                json.recordsTotal = 0;
130
                json.recordsFiltered = 0;
131
                json.data = [];
132
                if (response.success) {
133
                    json.recordsTotal = response.data.total;
134
                    json.recordsFiltered = response.data.total;
135
                    json.data = response.data.items;
66 efrain 136
                } else {
935 geraldo 137
                    $.fn.showError(response.data)
66 efrain 138
                }
935 geraldo 139
                return JSON.stringify(json);
66 efrain 140
            }
935 geraldo 141
        },
142
        'language': {
143
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
144
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
145
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
146
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
147
            'sInfo': 'LABEL_DATATABLE_SINFO',
148
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
149
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
150
            'sInfoPostFix': '',
151
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
152
            'sUrl': '',
153
            'sInfoThousands': ',',
154
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
155
            'oPaginate': {
156
                'sFirst': 'LABEL_DATATABLE_SFIRST',
157
                'sLast': 'LABEL_DATATABLE_SLAST',
158
                'sNext': 'LABEL_DATATABLE_SNEXT',
159
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
160
            },
161
            'oAria': {
162
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
163
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
164
            },
165
        },
166
        'drawCallback': function(settings) {
167
            NProgress.done();
168
            $('button.btn-delete').confirmation({
169
                rootSelector: 'button.btn-delete',
170
                title: 'LABEL_ARE_YOU_SURE',
171
                singleton: true,
172
                btnOkLabel: 'LABEL_YES',
173
                btnCancelLabel: 'LABEL_NO',
174
                onConfirm: function(value) {
175
                    action = $(this).data('href');
176
                    NProgress.start();
177
                    $.ajax({
178
                        'dataType': 'json',
179
                        'accept': 'application/json',
180
                        'method': 'post',
181
                        'url': action,
182
                    }).done(function(response) {
183
                        if (response['success']) {
184
                            $.fn.showSuccess(response['data']);
185
                            gridTable.api().ajax.reload(null, false);
186
                        } else {
187
                            $.fn.showError(response['data']);
188
                        }
189
                    }).fail(function(jqXHR, textStatus, errorThrown) {
190
                        $.fn.showError(textStatus);
191
                    }).always(function() {
192
                        NProgress.done();
193
                    });
66 efrain 194
                },
935 geraldo 195
            });
196
        },
197
        'aoColumns': [{
198
                'mDataProp': 'name'
199
            },
200
            {
201
                'mDataProp': 'status'
202
            },
203
            {
204
                'mDataProp': 'actions'
205
            },
206
        ],
207
        'columnDefs': [{
208
                'targets': 0,
209
                'className': 'text-vertical-middle',
210
            },
211
            {
212
                'targets': -2,
213
                'orderable': false,
214
                'className': 'text-center',
215
                'render': function(data, type, row) {
216
                    checked = data == 'a' ? ' checked="checked" ' : '';
217
                    return '<div class="checkbox checkbox-success">' +
218
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
219
                        '<label ></label></div>';
66 efrain 220
                }
221
            },
935 geraldo 222
            {
223
                'targets': -1,
224
                'orderable': false,
225
                'render': function(data, type, row) {
226
                    s = '';
227
                    if (allowEdit) {
228
                        s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
66 efrain 229
                    }
935 geraldo 230
                    if (allowDelete) {
231
                        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;';
66 efrain 232
                    }
935 geraldo 233
                    if (allowReport) {
234
                        s = s + '<a class="btn btn-default btn-pdf" href="' + data['link_report'] + '" target="_blank" data-toggle="tooltip" title="LABEL_PDF"><i class="fa fa-file-o"></i> LABEL_PDF </button>&nbsp;';
235
                    }
236
                    return s;
66 efrain 237
                }
935 geraldo 238
            }
239
        ],
240
    });
241
    var validator = $('#form').validate({
242
        debug: true,
243
        onclick: false,
244
        onkeyup: false,
245
        ignore: [],
246
        rules: {
247
            'name': {
248
                required: true,
249
                maxlength: 64,
250
            },
251
            'functions': {
252
                updateCkeditor: function() {
253
                    CKEDITOR.instances.functions.updateElement();
66 efrain 254
                },
935 geraldo 255
                required: true,
256
            },
257
            'objectives': {
258
                updateCkeditor: function() {
259
                    CKEDITOR.instances.objectives.updateElement();
66 efrain 260
                },
935 geraldo 261
                required: true,
66 efrain 262
            },
935 geraldo 263
            'status': {
264
                required: false,
66 efrain 265
            },
935 geraldo 266
        },
267
        submitHandler: function(form) {
66 efrain 268
            $.ajax({
935 geraldo 269
                'dataType': 'json',
270
                'accept': 'application/json',
271
                'method': 'post',
272
                'url': $('#form').attr('action'),
273
                'data': $('#form').serialize()
66 efrain 274
            }).done(function(response) {
935 geraldo 275
                NProgress.start();
276
                if (response['success']) {
277
                    $.fn.showSuccess(response['data']);
278
                    $('#modal').modal('hide');
279
                    gridTable.api().ajax.reload(null, false);
280
                } else {
281
                    validator.resetForm();
282
                    if (jQuery.type(response['data']) == 'string') {
283
                        $.fn.showError(response['data']);
284
                    } else {
285
                        $.each(response['data'], function(fieldname, errors) {
286
                            $.fn.showFormErrorValidator('#form #' + fieldname, errors);
66 efrain 287
                        });
935 geraldo 288
                    }
66 efrain 289
                }
935 geraldo 290
            }).fail(function(jqXHR, textStatus, errorThrown) {
66 efrain 291
                $.fn.showError(textStatus);
292
            }).always(function() {
293
                NProgress.done();
294
            });
935 geraldo 295
            return false;
296
        },
297
        invalidHandler: function(form, validator) {}
298
    });
299
    $('body').on('click', 'button.btn-add', function(e) {
300
        e.preventDefault();
301
        NProgress.start();
302
        $.ajax({
303
            'dataType': 'json',
304
            'accept': 'application/json',
305
            'method': 'get',
306
            'url': '$routeAdd',
307
        }).done(function(response) {
308
            if (response['success']) {
309
                $('span[id="form-title"]').html('LABEL_ADD');
310
                $('#form').attr('action', '$routeAdd');
311
                $('#form #name').val('');
312
                $('#form #status').bootstrapToggle('on');
313
                CKEDITOR.instances.functions.setData('');
314
                CKEDITOR.instances.objectives.setData('');
1170 geraldo 315
                competencies = response['data']['competencies'];
316
                competencies_type = response['data']['competency_types'];
317
                setCompetencySelect();
935 geraldo 318
                var s = '';
319
                var first = true;
1169 geraldo 320
                $.each(response['data']['competency_types'], function(index, rowCompetencyType) {
321
                    first = true;
322
                    $.each(response['data']['competencies'], function(index, rowCompetency) {
323
                        if (rowCompetencyType['competency_type_id'] == rowCompetency['competency_type_id']) {
324
                            if (first) {
325
                                first = false;
326
                                s = '<tr>' +
327
                                    '<td><big><b>' + rowCompetencyType['name'] + '</b></big></td>' +
328
                                    '</tr>';
329
                                $('#tableCompetencies tbody').append(s)
330
                            }
331
                            s = '<tr>' +
332
                                '<td> ' +
333
                                '<div class="custom-control custom-checkbox">' +
334
                                '<input class="custom-control-input" type="checkbox"  name="competency_level' + rowCompetency['competency_id'] + '" id="competency_level' + rowCompetency['competency_id'] + '" value="1">' +
335
                                '<label for="competency_level' + rowCompetency['competency_id'] + '" class="custom-control-label">' + rowCompetency['name'] + '</label>' +
336
                                '</div>' +
337
                                '<td>';
338
                            $('#tableCompetencies tbody').append(s)
339
                        }
340
                    });
341
                });
935 geraldo 342
                $('#tableSubordinates tbody').empty();
343
                $('#job_description_id_boss option:not(:first)').remove();
344
                $.each(response['data']['jobs_description'], function(index, rowJobDescription) {
345
                    $('#job_description_id_boss').append(new Option(rowJobDescription['name'], rowJobDescription['job_description_id']));
346
                    s = '<tr>' +
347
                        '<td>' +
348
                        '<div class="custom-control custom-checkbox">' +
349
                        '<input class="custom-control-input" type="checkbox" name="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" id="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" value="1">' +
350
                        '<label for="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" class="custom-control-label">' + rowJobDescription['name'] + '</label>' +
351
                        '</div>' +
352
                        '</td>' +
353
                        '</tr>';
354
                    $('#tableSubordinates tbody').append(s)
355
                });
356
                validator.resetForm();
357
                $('#custom-tabs #custom-tabs-general-tab').tab('show');
358
                $('#modal').modal('show');
359
            } else {
360
                $.fn.showError(response['data']);
361
            }
362
        }).fail(function(jqXHR, textStatus, errorThrown) {
363
            $.fn.showError(textStatus);
364
        }).always(function() {
365
            NProgress.done();
66 efrain 366
        });
935 geraldo 367
    });
368
    $('body').on('click', 'button.btn-edit', function(e) {
369
        e.preventDefault();
370
        NProgress.start();
371
        var action = $(this).data('href');
372
        $.ajax({
373
            'dataType': 'json',
374
            'accept': 'application/json',
375
            'method': 'get',
376
            'url': action,
377
        }).done(function(response) {
378
            if (response['success']) {
379
                $('span[id="form-title"]').html('LABEL_EDIT');
380
                $('#form').attr('action', action);
381
                $('#form #name').val(response['data']['name']);
382
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
383
                CKEDITOR.instances.functions.setData(response['data']['functions']);
384
                CKEDITOR.instances.objectives.setData(response['data']['objectives']);
385
                $('#tableCompetencies tbody').empty();
386
                var s = '';
387
                var first = true;
388
                $.each(response['data']['competency_types'], function(index, rowCompetencyType) {
389
                    first = true;
390
                    $.each(response['data']['competencies'], function(index, rowCompetency) {
391
                        if (rowCompetencyType['competency_type_id'] == rowCompetency['competency_type_id']) {
392
                            if (first) {
393
                                first = false;
394
                                s = '<tr>' +
395
                                    '<td><big><b>' + rowCompetencyType['name'] + '</b></big></td>' +
396
                                    '</tr>';
397
                                $('#tableCompetencies tbody').append(s)
66 efrain 398
                            }
936 geraldo 399
                            checked = '';
945 geraldo 400
                            if (rowCompetency['level'] && rowCompetency['level'] != 0) {
938 geraldo 401
                                checked = ' checked="checked" ';
402
                            }
935 geraldo 403
                            s = '<tr>' +
404
                                '<td> ' +
66 efrain 405
                                '<div class="custom-control custom-checkbox">' +
935 geraldo 406
                                '<input class="custom-control-input" type="checkbox" ' + checked + ' name="competency_level' + rowCompetency['competency_id'] + '" id="competency_level' + rowCompetency['competency_id'] + '" value="1">' +
407
                                '<label for="competency_level' + rowCompetency['competency_id'] + '" class="custom-control-label">' + rowCompetency['name'] + '</label>' +
66 efrain 408
                                '</div>' +
935 geraldo 409
                                '<td>';
410
                            $('#tableCompetencies tbody').append(s)
411
                        }
66 efrain 412
                    });
935 geraldo 413
                });
414
                $('#tableSubordinates tbody').empty();
415
                $('#job_description_id_boss option:not(:first)').remove();
416
                $.each(response['data']['jobs_description'], function(index, rowJobDescription) {
417
                    $('#job_description_id_boss').append(new Option(rowJobDescription['name'], rowJobDescription['job_description_id']));
418
                    checked = '';
419
                    if ($.isArray(response['data']['subordinates'])) {
420
                        if ($.inArray(rowJobDescription['job_description_id'], response['data']['subordinates']) != -1) {
421
                            checked = ' checked="checked" ';
422
                        }
423
                    }
424
                    s = '<tr>' +
425
                        '<td>' +
426
                        '<div class="custom-control custom-checkbox">' +
427
                        '<input class="custom-control-input" type="checkbox" ' + checked + ' name="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" id="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" value="1">' +
428
                        '<label for="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" class="custom-control-label">' + rowJobDescription['name'] + '</label>' +
429
                        '</div>' +
430
                        '</td>' +
431
                        '</tr>';
432
                    $('#tableSubordinates tbody').append(s)
433
                });
434
                $('#job_description_id_boss').val(response['data']['job_description_id_boss']);
435
                validator.resetForm();
436
                $('#custom-tabs #custom-tabs-general-tab').tab('show');
437
                $('#modal').modal('show');
438
            } else {
439
                $.fn.showError(response['data']);
440
            }
441
        }).fail(function(jqXHR, textStatus, errorThrown) {
442
            $.fn.showError(textStatus);
443
        }).always(function() {
444
            NProgress.done();
66 efrain 445
        });
935 geraldo 446
    });
447
    $('body').on('click', 'button.btn-refresh', function(e) {
448
        e.preventDefault();
449
        gridTable.api().ajax.reload(null, false);
450
    });
451
    $('body').on('click', 'button.btn-cancel', function(e) {
452
        e.preventDefault();
453
        $('#modal').modal('hide');
454
        $('#div-listing').show();
455
    });
456
    $('body').on('click', 'button.btn-import', function(e) {
457
        e.preventDefault();
458
        NProgress.start();
459
        $.ajax({
460
            'dataType': 'json',
461
            'method': 'post',
462
            'url': '$routeImport',
463
        }).done(function(response) {
464
            if (response['success']) {
465
                $.fn.showSuccess(response['data']);
466
                gridTable.api().ajax.reload(null, false);
467
            } else {
468
                $.fn.showError(response['data']);
469
            }
470
        }).fail(function(jqXHR, textStatus, errorThrown) {
471
            $.fn.showError(textStatus);
472
        }).always(function() {
473
            NProgress.done();
66 efrain 474
        });
935 geraldo 475
        return false;
66 efrain 476
    });
935 geraldo 477
    $('#form #status').bootstrapToggle({
478
        'on': 'LABEL_ACTIVE',
479
        'off': 'LABEL_INACTIVE',
480
        'width': '160px',
481
        'height': '40px'
482
    });
483
    CKEDITOR.replace('functions');
484
    CKEDITOR.replace('objectives');
1170 geraldo 485
 
1175 geraldo 486
 
487
    /**
488
     * Clicked cancel new/edit Form
489
     */
490
    $('body').on('click', 'button[id="btn-select-competency"]', function(e) {
1176 geraldo 491
        console.log('ee')
1175 geraldo 492
        if ($("#select-competency").val() == "") {
493
            $.fn.showError('LABEL_ERROR_SELECT_COMPETENCY');
494
        } else {
1176 geraldo 495
            competencies_selected.push(competencies.filter((item) => item.competency_id == $("#select-competency").val() ? item : false)[0]);
1175 geraldo 496
            renderData(competencies_selected);
1178 geraldo 497
            setCompetencySelect();
1175 geraldo 498
        }
499
    });
500
 
1170 geraldo 501
    const setCompetencySelect = () => {
1177 geraldo 502
        $('#select-competency').children().remove();
503
        $('#select-competency').append($('<option>', {
504
            value: '',
505
            text: 'LABEL_SELECT'
506
        }));
1172 geraldo 507
        $.each(competencies, function(i, item) {
508
            if (!filterItemById(item.competency_id)) {
509
                var type = filterTypeById(item.competency_type_id);
510
                $('#select-competency').append($('<option>', {
511
                    value: item.competency_id,
1175 geraldo 512
                    text: type.name+' - '+item.name
1172 geraldo 513
                }));
514
            }
515
        });
1170 geraldo 516
    }
1175 geraldo 517
 
518
    /**
519
     * Render Competencies data
520
     */
521
    const renderData = (data) => {
1178 geraldo 522
        $("#competencies-job").html($("#sectionTemplate").render(data, {
1179 geraldo 523
        getType: filterTypeById
1178 geraldo 524
    }));
1175 geraldo 525
    }
526
 
1176 geraldo 527
 
528
    /**
529
     * Filter competencies selected
530
     */
1172 geraldo 531
    const filterItemById = (id) => competencies_selected.filter((item) => item.competency_id == id ? item : false)[0];
1175 geraldo 532
 
533
    /**
534
     * Filter competencie type
535
     */
1172 geraldo 536
    const filterTypeById = (id) => competencies_type.filter((item) => item.competency_type_id == id ? item : false)[0];
935 geraldo 537
});
1170 geraldo 538
 
66 efrain 539
JS;
540
$this->inlineScript()->captureEnd();
541
?>
542
<!-- Content Header (Page header) -->
543
<section class="content-header">
1170 geraldo 544
   <div class="container-fluid">
545
      <div class="row mb-2">
546
         <div class="col-sm-12">
547
            <h1>LABEL_JOBS_DESCRIPTION</h1>
548
         </div>
549
      </div>
550
   </div>
551
   <!-- /.container-fluid -->
66 efrain 552
</section>
553
<section class="content">
1170 geraldo 554
   <div class="container-fluid">
555
      <div class="row">
556
         <div class="col-12">
557
            <div class="card">
558
               <div class="card-body">
559
                  <table id="gridTable" class="table   table-hover">
560
                     <thead>
561
                        <tr>
562
                           <th>LABEL_NAME</th>
563
                           <th>LABEL_ACTIVE</th>
564
                           <th>LABEL_ACTIONS</th>
565
                        </tr>
566
                     </thead>
567
                     <tbody>
568
                     </tbody>
569
                  </table>
570
               </div>
571
               <div class="card-footer clearfix">
572
                  <div style="float:right;">
573
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
574
                     <?php if($allowAdd) : ?>
575
                     <?php if($allowImport) : ?>
576
                     <button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
577
                     <?php endif; ?>
578
                     <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
579
                     <?php endif; ?>
580
                  </div>
581
               </div>
582
            </div>
583
         </div>
584
      </div>
585
   </div>
586
</section>
66 efrain 587
<!-- The Modal -->
588
<div class="modal" id="modal">
1170 geraldo 589
   <div class="modal-dialog  modal-xl">
590
      <div class="modal-content">
591
         <!-- Modal Header -->
592
         <div class="modal-header">
593
            <h4 class="modal-title">LABEL_JOB_DESCRIPTION - <span id="form-title"></span></h4>
594
            <button type="button" class="close" data-dismiss="modal">&times;</button>
595
         </div>
596
         <!-- Modal body -->
597
         <div class="modal-body">
598
            <div class="card card-primary card-outline card-tabs">
599
               <div class="card-header p-0 pt-1 border-bottom-0">
600
                  <ul class="nav nav-tabs" id="custom-tabs" role="tablist">
601
                     <li class="nav-item">
602
                        <a class="nav-link active" id="custom-tabs-general-tab" data-toggle="pill" href="#custom-tabs-general" role="tab" aria-controls="custom-tabs-general" aria-selected="true">LABEL_GENERAL</a>
603
                     </li>
604
                     <li class="nav-item">
605
                        <a class="nav-link" id="custom-tabs-compentencies-tab" data-toggle="pill" href="#custom-tabs-compentencies" role="tab" aria-controls="custom-tabs-compentencies" aria-selected="false">LABEL_COMPETENCIES</a>
606
                     </li>
607
                     <li class="nav-item">
608
                        <a class="nav-link" id="custom-tabs-subordinates-tab" data-toggle="pill" href="#custom-tabs-subordinates" role="tab" aria-controls="custom-tabs-subordinates" aria-selected="false">LABEL_SUBORDINATES</a>
609
                     </li>
610
                  </ul>
611
               </div>
612
               <div class="card-body">
613
                  <?php
614
                     $form = $this->form;
615
                     $form->setAttributes([
616
                         'method'    => 'post',
617
                         'name'      => 'form',
618
                         'id'        => 'form'
619
                     ]);
73 steven 620
 
1170 geraldo 621
                     $form->prepare();
622
                     echo $this->form()->openTag($form);
623
                     ?>
624
                  <div class="tab-content" id="custom-tabs-three-tabContent">
625
                     <div class="tab-pane fade show active" id="custom-tabs-general" role="tabpanel" aria-labelledby="custom-tabs-general-tab">
626
                        <div class="row">
627
                           <div class="col-md col-sm-12 col-12">
628
                              <div class="form-group m-0">
629
                                 <?php
630
                                    $element = $form->get('name');
631
                                    $element->setOptions(['label' => 'LABEL_NAME']);
66 efrain 632
                                    $element->setAttributes(['class' => 'form-control']);
1170 geraldo 633
 
66 efrain 634
                                    echo $this->formLabel($element);
1170 geraldo 635
                                    echo $this->formText($element);
66 efrain 636
                                    ?>
1170 geraldo 637
                              </div>
638
                           </div>
639
                           <div class="col-md col-sm-12 col-12">
640
                              <div class="form-group m-0">
641
                                 <?php
642
                                    $element = $form->get('job_description_id_boss');
643
                                    $element->setOptions(['label' => 'LABEL_BOSS']);
66 efrain 644
                                    $element->setAttributes(['class' => 'form-control']);
1170 geraldo 645
 
66 efrain 646
                                    echo $this->formLabel($element);
1170 geraldo 647
                                    echo $this->formSelect($element);
66 efrain 648
                                    ?>
1170 geraldo 649
                              </div>
650
                           </div>
651
                           <div
652
                              class="col-md col-sm-12 col-12 d-flex align-items-center justify-content-center"
653
                              >
654
                              <div class="form-group m-0">
655
                                 <label>LABEL_STATUS</label>
656
                                 <br />
657
                                 <?php
658
                                    $element = $form->get('status');
659
                                    $element->setOptions(['label' => 'LABEL_STATUS']);
660
                                    // echo $this->formLabel($element);
661
                                    echo $this->formCheckbox($element);
662
                                    ?>
663
                              </div>
664
                           </div>
665
                        </div>
666
                        <div class="form-group">
667
                           <?php
668
                              $element = $form->get('objectives');
669
                              $element->setOptions(['label' => 'LABEL_OBJECTIVES']);
670
                              $element->setAttributes(['class' => 'form-control']);
671
 
672
                              echo $this->formLabel($element);
673
                              echo $this->formTextArea($element);
674
                              ?>
675
                        </div>
676
                        <div class="form-group">
677
                           <?php
678
                              $element = $form->get('functions');
679
                              $element->setOptions(['label' => 'LABEL_FUNCTIONS']);
680
                              $element->setAttributes(['class' => 'form-control']);
681
 
682
                              echo $this->formLabel($element);
683
                              echo $this->formTextArea($element);
684
                              ?>
685
                        </div>
686
                     </div>
687
                     <div class="tab-pane fade" id="custom-tabs-compentencies" role="tabpanel" aria-labelledby="custom-tabs-compentencies-tab">
688
                        <div class="row">
689
                           <div class="col-md-8 col-sm-8 col-xs-12">
690
                              <select name="select-competency" id="select-competency" class="form-control">
691
                              </select>
692
                           </div>
693
                           <div class="col-md-4 col-sm-4 col-xs-12">
694
                              <button type="button" class="btn btn-primary" id="btn-select-competency" data-toggle="tooltip" title="LABEL_ADD LABEL_COMPETENCY">LABEL_ADD LABEL_COMPETENCY</button>
695
                           </div>
696
                        </div>
697
                        <div class="row">
1175 geraldo 698
                           <div class="col-md-12 col-sm-12 col-xs-12" id="competencies-job">
699
 
1170 geraldo 700
                           </div>
701
                        </div>
702
                     </div>
703
                     <div class="tab-pane fade" id="custom-tabs-subordinates" role="tabpanel" aria-labelledby="custom-tabs-subordinates-tab">
704
                        <table class="table table-hover"  id="tableSubordinates">
705
                           <thead>
706
                              <tr>
707
                                 <th>LABEL_SUBORDINATE</th>
708
                              </tr>
709
                           </thead>
710
                           <tbody>
711
                           </tbody>
712
                        </table>
713
                     </div>
714
                  </div>
715
               </div>
716
               <?php echo $this->form()->closeTag($form); ?>
717
               <!-- /.card -->
718
            </div>
719
         </div>
720
         <!-- Modal footer -->
721
         <div class="modal-footer">
722
            <button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
723
            <button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
724
         </div>
725
      </div>
726
   </div>
727
</div>
1169 geraldo 728
 
1175 geraldo 729
 <!---Template Competencies --->
730
 <script id="sectionTemplate" type="text/x-jsrender">
731
   <div class="panel panel-default" id="panel-{{:competency_id}}">
732
   <div class="panel-heading">
733
      <h4 class="panel-title">
734
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:competency_id}}" href="#collapse-{{:competency_id}}">
735
         <span class="section-name{{:competency_id}}">
1178 geraldo 736
         {{:~getType(competency_type_id).name}} - {{:name}}
1175 geraldo 737
         </span>
738
         </a>
739
      </h4>
740
   </div>
741
   <div id="collapse-{{:competency_id}}" class="panel-collapse in collapse show">
742
      <div class="panel-body">
743
         <div class="table-responsive">
744
            <table class="table table-bordered">
745
               <thead>
746
                  <tr>
747
                     <th style="width: 10%;">LABEL_ELEMENT</th>
748
                     <th style="width: 30%;">LABEL_TITLE</th>
749
                     <th style="width: 10%;">LABEL_LEVEL</th>
750
                     <th style="width: 50%;">LABEL_ACTIONS</th>
751
                  </tr>
752
               </thead>
753
               <tbody>
754
                  <tr class="tr-section">
755
                     <td class="text-left">LABEL_COMPETENCY</td>
1177 geraldo 756
                     <td class="text-left">{{:name}}</td>
1175 geraldo 757
                     <td>
758
                        {{if type == 'simple'}} Simple {{/if}}
759
                        {{if type == 'multiple'}} Multiple {{/if}}
760
                     </td>
761
                     <td>
762
 
763
                        <button  type="button" class="btn btn-default btn-delete-section" data-section="{{:competency_id}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_COMPETENCY"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_COMPETENCY </button>
764
 
765
                     </td>
766
                  </tr>
1177 geraldo 767
                  {{for behaviors}}
1175 geraldo 768
                  <tr >
769
                     <td class="text-left">--LABEL_CONDUCT</td>
770
                     <td class="text-left">
771
                        {{:description}}
772
                     </td>
773
                     <td>
774
                     </td>
775
                     <td>
776
                        <button type="button"  class="btn btn-default btn-edit-option" data-section="{{:competency_id}}" data-option="{{:conduct_id}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_CONDUCT"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_CONDUCT</button>
777
 
778
                     </td>
779
                  </tr>
780
                  {{/for}}
781
               </tbody>
782
            </table>
783
         </div>
784
      </div>
785
   </div>
786
</div>
787
   </script>
788
   <!-- End Template Competencies-->
1169 geraldo 789
 
66 efrain 790
 
791
 
792
 
793
 
794
 
795
 
796
 
797