Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15074 | Rev 16320 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15074 Rev 15443
Línea 10... Línea 10...
10
 
10
 
11
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
11
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
13
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
13
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
-
 
14
$allowReport = $acl->isAllowed($roleName, 'performance-evaluation/forms/report') ? 1 : 0;
-
 
15
$allowActive = $acl->isAllowed($roleName, 'performance-evaluation/forms/active') ? 1 : 0;
Línea 14... Línea -...
14
$allowReport = $acl->isAllowed($roleName, 'performance-evaluation/forms/report') ? 1 : 0;
-
 
15
 
-
 
Línea 16... Línea 16...
16
// Page Styles
16
$allowInactive = $acl->isAllowed($roleName, 'performance-evaluation/forms/inactive') ? 1 : 0;
Línea -... Línea 17...
-
 
17
 
-
 
18
 
-
 
19
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-maxlenght/bootstrap-maxlength.min.js'));
-
 
20
 
-
 
21
 
-
 
22
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
-
 
23
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
-
 
24
 
-
 
25
 
-
 
26
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
-
 
27
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
-
 
28
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
-
 
29
 
-
 
30
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
-
 
31
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
-
 
32
 
-
 
33
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
-
 
34
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
-
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
-
 
36
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
-
 
37
 
-
 
38
 
-
 
39
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
-
 
40
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
-
 
41
 
-
 
42
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
-
 
43
 
-
 
44
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
-
 
45
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
-
 
46
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
-
 
47
 
-
 
48
 
-
 
49
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
-
 
50
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
-
 
51
 
-
 
52
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
-
 
53
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
-
 
54
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
-
 
55
 
-
 
56
 
-
 
57
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
-
 
58
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
-
 
59
 
-
 
60
 
-
 
61
 
-
 
62
$status_active = \LeadersLinked\Model\PerformanceEvaluationForm::STATUS_ACTIVE;
-
 
63
$status_inactive = \LeadersLinked\Model\PerformanceEvaluationForm::STATUS_INACTIVE;
-
 
64
 
-
 
65
$vars = "var jobs_description = new Array(); \r\n";
-
 
66
 
-
 
67
foreach($jobsDescription as $uuid => $link)
-
 
68
{
-
 
69
    $vars .= "jobs_description.push({uuid: '$uuid', link: '$link'}); \r\n";
-
 
70
}
-
 
71
 
17
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
72
 
18
 
73
 
-
 
74
 
19
$jsonJobsDescription = json_encode($jobsDescription);
75
$this->inlineScript()->captureStart();
20
 
76
echo <<<JS
-
 
77
jQuery(document).ready(function($) {
-
 
78
   $vars
-
 
79
    var allowEdit = $allowEdit;
-
 
80
    var allowDelete = $allowDelete;
-
 
81
    var allowReport = $allowReport;
-
 
82
    var allowActive = $allowActive;
-
 
83
    var allowInactive = $allowInactive;
-
 
84
 
-
 
85
 
-
 
86
    var competencies_selected = new Array(); 
-
 
87
    var subordinates_selected = new Array();
21
$js = <<<JS
88
 
-
 
89
    var competency_types = new Array();
-
 
90
    var competencies = new Array();
-
 
91
    var behaviors = new Array(); 
-
 
92
    var subordinates = new Array();
-
 
93
 
-
 
94
 
-
 
95
 
22
	const backendVariables= {
96
 
-
 
97
    $.fn.renderCompetencies = function() {
-
 
98
 
-
 
99
        if(competencies_selected.length > 0) {
-
 
100
             $('#competencies-to-job').show();
-
 
101
             $('#rows-job-competencies').html($('#competencyTemplate').render(competencies_selected, {
23
        add_link: "$routeAdd",
102
                getCompetencyType: (uuid) => competency_types.filter((item) => item.uuid == uuid ? item : false)[0],
-
 
103
                getCompetency: (uuid) => competencies.filter((item) => item.uuid == uuid ? item : false)[0],
24
        table_link: "$routeDatatable",
104
                getBehavior: (uuid) => behaviors.filter((item) => item.uuid == uuid ? item : false)[0]
25
        dashboard_link: "$routeDashboard",
105
            }));
-
 
106
        } else {
-
 
107
 
-
 
108
             $('#competencies-to-job').hide();
-
 
109
             $('#rows-job-competencies').empty();
-
 
110
        }
-
 
111
    }
26
        jobsDescription: $jsonJobsDescription,
112
 
-
 
113
    $.fn.renderSubordinates = function() {
-
 
114
  
-
 
115
 
-
 
116
        if(subordinates_selected.length > 0) {
-
 
117
            $('#renderSubordinates').html($('#subordinateTemplate').render(subordinates_selected, {
27
        permisions: {
118
                getSubordinate: (uuid) => subordinates.filter((item) => item.uuid == uuid ? item : false)[0],
28
            allowAdd: $allowAdd,
119
 
-
 
120
            }));
-
 
121
        } else {
-
 
122
            $('#renderSubordinates').html('');
-
 
123
        }
-
 
124
    }
-
 
125
 
-
 
126
 
-
 
127
    $.validator.setDefaults({
-
 
128
        debug: true,
-
 
129
        highlight: function(element) {
-
 
130
            $(element).addClass('is-invalid');
-
 
131
        },
-
 
132
        unhighlight: function(element) {
-
 
133
            $(element).removeClass('is-invalid');
-
 
134
        },
-
 
135
        errorElement: 'span',
-
 
136
        errorClass: 'error invalid-feedback',
-
 
137
        errorPlacement: function(error, element) {
-
 
138
            if (element.parent('.form-group').length) {
-
 
139
                error.insertAfter(element);
-
 
140
            } else if (element.parent('.toggle').length) {
-
 
141
                error.insertAfter(element.parent().parent());
-
 
142
            } else {
-
 
143
                error.insertAfter(element.parent());
-
 
144
            }
-
 
145
        }
-
 
146
    });
-
 
147
 
-
 
148
    $.fn.showFormErrorValidator = function(fieldname, errors) {
-
 
149
        var field = $(fieldname);
-
 
150
        if (field) {
-
 
151
            $(field).addClass('is-invalid');
-
 
152
            var error = $('<span id="' + fieldname + '-error" class="error invalid-feedback">' + errors + '</div>');
-
 
153
            if (field.parent('.form-group').length) {
-
 
154
                error.insertAfter(field);
-
 
155
            } else if (field.parent('.toggle').length) {
-
 
156
                error.insertAfter(field.parent().parent());
-
 
157
            } else {
-
 
158
                error.insertAfter(field.parent());
-
 
159
            }
-
 
160
        }
-
 
161
    };
-
 
162
 
-
 
163
    var gridTable = $('#gridTable').dataTable({
-
 
164
        'processing': true,
-
 
165
        'serverSide': true,
-
 
166
        'searching': true,
-
 
167
        'order': [
-
 
168
            [0, 'asc']
-
 
169
        ],
-
 
170
        'ordering': false,
-
 
171
        'ordenable': false,
-
 
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
                             gridTable.api().ajax.reload(null, false);
-
 
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
        },
-
 
253
        'aoColumns': [{
-
 
254
                'mDataProp': 'name'
-
 
255
            },
-
 
256
            {
-
 
257
                'mDataProp': 'tests'
-
 
258
            },
-
 
259
            {
-
 
260
                'mDataProp': 'date'
-
 
261
            },
-
 
262
            {
-
 
263
                'mDataProp': 'status'
-
 
264
            },
-
 
265
            {
-
 
266
                'mDataProp': 'actions'
-
 
267
            },
-
 
268
        ],
-
 
269
        'columnDefs': [
-
 
270
            {
-
 
271
                'targets': 0,
-
 
272
                'orderable': false,
-
 
273
                'render': function(data, type, row) {
-
 
274
                    return row['name'] + '<br>' + row['job_description'];
-
 
275
                }
-
 
276
            },
-
 
277
            {
-
 
278
                'targets': 1,
-
 
279
                'orderable': false,
-
 
280
                'className': 'text-right',
29
            allowDelete: $allowDelete,
281
            },
-
 
282
            {
-
 
283
                'targets': 2,
-
 
284
                'orderable': false,
-
 
285
 
-
 
286
            },
-
 
287
            {
-
 
288
                'targets': -2,
-
 
289
                'orderable': false,
-
 
290
                'className': 'text-center',
-
 
291
                'render': function(data, type, row) {
-
 
292
                    checked = data == 'a' ? ' checked="checked" ' : '';
-
 
293
                    return '<div class="checkbox checkbox-success">' +
-
 
294
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
-
 
295
                        '<label ></label></div>';
-
 
296
                }
-
 
297
            },
-
 
298
            {
-
 
299
                'targets': -1,
-
 
300
                'orderable': false,
-
 
301
                'render': function(data, type, row) {
-
 
302
                    s = '';
-
 
303
                    if (allowEdit && data['link_edit']) {
-
 
304
                        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;';
-
 
305
                    }
-
 
306
                    if (allowDelete && data['link_delete']) {
-
 
307
                        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;';
-
 
308
                    }
-
 
309
                    if (allowActive && data['link_active']) {
-
 
310
                        s = s + '<button class="btn btn-default btn-active" data-href="' + data['link_active'] + '" data-toggle="tooltip" title="LABEL_ACTIVE"><i class="fa fa-check"></i> LABEL_ACTIVE </button>&nbsp;';
-
 
311
                    }
-
 
312
                    if (allowInactive && data['link_inactive']) {
-
 
313
                        s = s + '<button class="btn btn-default btn-inactive" data-href="' + data['link_inactive'] + '" data-toggle="tooltip" title="LABEL_INACTIVE"><i class="fa fa-times"></i> LABEL_INACTIVE </button>&nbsp;';
-
 
314
                    }
-
 
315
                    if (allowReport && data['link_report'] ) {
-
 
316
                        s = s + '<button class="btn btn-primary btn-pdf"  data-href="' + data['link_report'] + '"  data-toggle="tooltip" title="LABEL_PDF"><i class="fa fa-file-o"></i> LABEL_PDF </button>&nbsp;';
-
 
317
                    }
-
 
318
                    return s;
-
 
319
                }
-
 
320
            }
-
 
321
        ],
-
 
322
    });
-
 
323
 
-
 
324
 
-
 
325
    var validator = $('#form').validate({
-
 
326
        debug: true,
-
 
327
        onclick: false,
-
 
328
        onkeyup: false,
-
 
329
        ignore: [],
-
 
330
        rules: {
-
 
331
            'name': {
-
 
332
                required: true,
-
 
333
                maxlength: 128,
-
 
334
            },
-
 
335
            'description': {
-
 
336
                required: true,
-
 
337
                maxlength: 1024,
-
 
338
            },
-
 
339
 
-
 
340
            'job_description_id' : {
-
 
341
                 required: true,
-
 
342
            },
-
 
343
            'status': {
-
 
344
                required: false,
-
 
345
            },       
-
 
346
         },
-
 
347
        submitHandler: function(form) {
-
 
348
 
-
 
349
   
-
 
350
            NProgress.start();
-
 
351
            $.ajax({
-
 
352
                'dataType': 'json',
-
 
353
                'accept': 'application/json',
-
 
354
                'method': 'post',
-
 
355
                'url': $('#form').attr('action'),
-
 
356
                'data': $('#form').serialize(),
-
 
357
            }).done(function(response) {
-
 
358
                if (response['success']) {
-
 
359
                    $.fn.showSuccess(response['data']);
-
 
360
                    $('#row-form').hide();
-
 
361
                    $('#row-list').show();
-
 
362
                    $('#row-header').show();
-
 
363
 
-
 
364
                    gridTable.api().ajax.reload(null, false);
-
 
365
                } else {
-
 
366
                    validator.resetForm();
-
 
367
                    if (jQuery.type(response['data']) == 'string') {
-
 
368
                        $.fn.showError(response['data']);
-
 
369
                    } else {
-
 
370
                        $.each(response['data'], function(fieldname, errors) {
-
 
371
                            $.fn.showFormErrorValidator('#form #' + fieldname, errors);
-
 
372
                        });
-
 
373
                    }
-
 
374
                }
-
 
375
            }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
376
                $.fn.showError(textStatus);
-
 
377
            }).always(function() {
-
 
378
                NProgress.done();
-
 
379
            });
-
 
380
            return false;
-
 
381
        },
-
 
382
        invalidHandler: function(form, validator) {}
-
 
383
    });
-
 
384
 
-
 
385
    $('body').on('click', 'button.btn-active', function(e) {
-
 
386
        e.preventDefault();
-
 
387
 
-
 
388
        var action = $(this).data('href');
-
 
389
        $.ajax({
-
 
390
            'dataType': 'json',
-
 
391
            'accept': 'application/json',
-
 
392
            'method': 'post',
-
 
393
            'url': action,
-
 
394
        }).done(function(response) {
-
 
395
            if (response['success']) {
-
 
396
                gridTable.api().ajax.reload(null, false);
-
 
397
            } else {
-
 
398
                $.fn.showError(response['message']);
-
 
399
            }
-
 
400
        }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
401
            $.fn.showError(textStatus);
-
 
402
        });
-
 
403
    });
-
 
404
 
-
 
405
    $('body').on('click', 'button.btn-inactive', function(e) {
-
 
406
        e.preventDefault();
-
 
407
 
-
 
408
        var action = $(this).data('href');
-
 
409
        $.ajax({
-
 
410
            'dataType': 'json',
-
 
411
            'accept': 'application/json',
-
 
412
            'method': 'post',
-
 
413
            'url': action,
-
 
414
        }).done(function(response) {
-
 
415
            if (response['success']) {
-
 
416
                gridTable.api().ajax.reload(null, false);
-
 
417
            } else {
-
 
418
                $.fn.showError(response['message']);
-
 
419
            }
-
 
420
        }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
421
            $.fn.showError(textStatus);
-
 
422
        });
-
 
423
    });
-
 
424
 
-
 
425
 
-
 
426
    $('body').on('click', 'button.btn-edit', function(e) {
-
 
427
        e.preventDefault();
-
 
428
 
-
 
429
        var action = $(this).data('href');
-
 
430
        $.ajax({
-
 
431
            'dataType': 'json',
-
 
432
            'accept': 'application/json',
-
 
433
            'method': 'get',
-
 
434
            'url': action,
-
 
435
        }).done(function(response) {
-
 
436
            if (response['success']) {
-
 
437
                $('#form').attr('action', action);
-
 
438
                $('#form #name').val(response['data']['name']);
-
 
439
                $('#form #description').val(response['data']['description']);
-
 
440
                $('#form #job_description_id').val(response['data']['job_description_id']).trigger('change');
-
 
441
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
-
 
442
               
-
 
443
                $('#row-list').hide();
-
 
444
                $('#row-header').hide();
-
 
445
                $('#row-form').show();
-
 
446
            } else {
-
 
447
                $.fn.showError(response['message']);
-
 
448
            }
-
 
449
        }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
450
            $.fn.showError(textStatus);
-
 
451
        });
-
 
452
    });
-
 
453
    
-
 
454
    $('button.btn-add').click(function(e) {
-
 
455
        e.preventDefault();
-
 
456
 
-
 
457
        $('span[id="form-title"]').html('LABEL_ADD');
-
 
458
        $('#form').attr('action', '$routeAdd');
-
 
459
        $('#form #name').val('');
-
 
460
        $('#form #job_description_id').val('').trigger('change');
-
 
461
        $('#form #job_description_id').prop('disabled', false);
-
 
462
        $('#form #status').bootstrapToggle('on');
-
 
463
        $('#form #description').val('');
-
 
464
       
-
 
465
 
-
 
466
        $.fn.renderCompetencies();
-
 
467
 
-
 
468
 
-
 
469
        $('#row-header').hide();
-
 
470
        $('#row-list').hide();
-
 
471
        $('#row-form').show();
-
 
472
        
-
 
473
    });
-
 
474
 
-
 
475
 
-
 
476
 
-
 
477
    $('button.btn-cancel').click(function(e) {
-
 
478
        e.preventDefault();
-
 
479
 
-
 
480
        $('#row-form').hide();
-
 
481
        $('#row-list').show();
-
 
482
        $('#row-header').show();
-
 
483
    });
-
 
484
 
-
 
485
    $('#form #description').maxlength({
-
 
486
        alwaysShow: true,
-
 
487
        validate: true
-
 
488
    });
-
 
489
 
-
 
490
 
-
 
491
 
-
 
492
 
-
 
493
 
-
 
494
   
-
 
495
    $('#form #status').bootstrapToggle({
-
 
496
        'on': 'LABEL_ACTIVE',
-
 
497
        'off': 'LABEL_INACTIVE',
-
 
498
        'width': '160px',
-
 
499
        'height': '40px'
-
 
500
    });
-
 
501
 
-
 
502
    $('body').on('click', 'button.btn-refresh', function(e) {
-
 
503
        e.preventDefault();
-
 
504
        gridTable.api().ajax.reload(null, false);
-
 
505
    });
-
 
506
        
-
 
507
 
-
 
508
 
-
 
509
    $('#job_description_id').select2({
-
 
510
        theme: 'bootstrap4',
-
 
511
        width: '100%',
-
 
512
    });
-
 
513
 
-
 
514
    $('#job_description_id').on('change', function(e) {
-
 
515
        e.preventDefault();
-
 
516
 
-
 
517
            var uuid = $('#job_description_id').val();
-
 
518
            var job_description = jobs_description.filter((item) => item.uuid == uuid ? item : false)[0];
-
 
519
    
-
 
520
            if (job_description) {
-
 
521
                NProgress.start(); 
-
 
522
                $.getJSON(job_description.link, function(response) {
-
 
523
                    if (response['success']) {
-
 
524
                        behaviors = response['data']['behaviors'];
-
 
525
                        competency_types = response['data']['competency_types'];
-
 
526
                        competencies = response['data']['competencies'];
-
 
527
 
-
 
528
    
-
 
529
                        competencies_selected = response['data']['competencies_selected'];
-
 
530
                        subordinates_selected = response['data']['subordinates_selected'];    
-
 
531
    
-
 
532
                        $.fn.renderCompetencies();
-
 
533
    
-
 
534
                    } else {
-
 
535
    
-
 
536
                        $.fn.showError(response['data'])
-
 
537
                    }
-
 
538
                }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
539
                    $.fn.showError(textStatus);
-
 
540
                }).always(function() {
-
 
541
                    NProgress.done();
-
 
542
                });
-
 
543
            }
-
 
544
        
-
 
545
    });
-
 
546
 
-
 
547
    $('body').on('click', 'button.btn-pdf', function(e) {
-
 
548
        e.preventDefault();
-
 
549
        var action   = $(this).data('href');
-
 
550
 
-
 
551
 
-
 
552
        NProgress.start(); 
-
 
553
        $.ajax({
-
 
554
            'dataType'  : 'json',
-
 
555
            'method'    : 'get',
-
 
556
            'url'       :  action,
-
 
557
        }).done(function(response) {
-
 
558
            if(response['success']) {
-
 
559
                var anchor = window.document.createElement("a");
-
 
560
                anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
-
 
561
                anchor.download = response['data']['basename'];
-
 
562
                document.body.appendChild(anchor);
-
 
563
                anchor.click();  // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
-
 
564
                document.body.removeChild(anchor);
-
 
565
            } else {
-
 
566
                $.fn.showError(response['data']);
-
 
567
            }
-
 
568
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
569
            $.fn.showError(textStatus);
-
 
570
        }).always(function() {
-
 
571
            NProgress.done();
-
 
572
        });
-
 
573
 
-
 
574
 
-
 
575
 
-
 
576
    });
-
 
577
 
-
 
578
 
-
 
579
    $('#form #description').maxlength({
-
 
580
        alwaysShow: true,
30
            allowEdit: $allowEdit,
581
        validate: true
Línea 31... Línea 582...
31
            allowReport: $allowReport
582
    });
32
        }
-
 
33
	}	
-
 
34
JS;
583
 
-
 
584
});
-
 
585
JS;
-
 
586
 
-
 
587
$this->inlineScript()->captureEnd();
-
 
588
?>
-
 
589
<!-- Content Header (Page header) -->
-
 
590
<section class="content-header" id="row-header">
-
 
591
   <div class="container-fluid">
-
 
592
      <div class="row mb-2">
-
 
593
         <div class="col-sm-12">
-
 
594
            <h1>LABEL_PERFORMANCE_EVALUATIONS</h1>
-
 
595
         </div>
-
 
596
      </div>
-
 
597
   </div>
-
 
598
   <!-- /.container-fluid -->
-
 
599
</section>
-
 
600
<section class="content">
-
 
601
    <div class="container-fluid">
-
 
602
       <div class="row">
-
 
603
          <div class="col-12" id="row-list">
-
 
604
             <div class="card">
-
 
605
                <div class="card-body">
-
 
606
                   <table id="gridTable" class="table   table-hover">
-
 
607
                      <thead>
-
 
608
                         <tr>
-
 
609
                            <th style="width:30%">LABEL_NAME</th>
-
 
610
                            <th style="width:15%">LABEL_EVALUATIONS</th>
-
 
611
                            <th style="width:15%">LABEL_DATE</th>
-
 
612
                            <th style="width:10%">LABEL_ACTIVE</th>
-
 
613
                            <th style="width:30%">LABEL_ACTIONS</th>
-
 
614
                         </tr>
-
 
615
                      </thead>
-
 
616
                      <tbody></tbody>
-
 
617
                   </table>
-
 
618
                </div>
-
 
619
                <div class="card-footer clearfix">
-
 
620
                   <div style="float:right;">
-
 
621
                      <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
-
 
622
                      <?php if ($allowAdd) : ?>
-
 
623
                      <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
-
 
624
                      <?php endif; ?>
-
 
625
                   </div>
-
 
626
                </div>
-
 
627
             </div>
-
 
628
          </div>
-
 
629
       </div>
-
 
630
 
-
 
631
       <div class="row" id="row-form" style="display: none">
-
 
632
          <div class="col-12">
-
 
633
             <div class="card">
-
 
634
              	<?php 
-
 
635
                    $form = $this->form;
-
 
636
            		$form->setAttributes([
-
 
637
                        'method'    => 'post',
-
 
638
                        'name'      => 'form',
-
 
639
                        'id'        => 'form'
-
 
640
                    ]);
-
 
641
    
-
 
642
                    $form->prepare();
-
 
643
                    echo $this->form()->openTag($form);
-
 
644
                ?>		
-
 
645
              	<div class="card-header">
-
 
646
					<h4 class="modal-title">LABEL_PERFORMANCE_EVALUATION - <span id="form-title"></span></h4>
-
 
647
                </div>
-
 
648
                <div class="card-body">
-
 
649
						<div class="form-group">
-
 
650
        					<?php 
-
 
651
                            $element = $form->get('job_description_id');
-
 
652
                            $element->setOptions(['label' => 'LABEL_JOB_DESCRIPTION']);
-
 
653
                            $element->setAttributes(['class' => 'form-control']);
-
 
654
                                            
-
 
655
                            echo $this->formLabel($element);
-
 
656
                            echo $this->formSelect($element);
-
 
657
                            ?>
-
 
658
						</div>					
-
 
659
    					<div class="form-group">
-
 
660
        					<?php 
-
 
661
                            $element = $form->get('name');
-
 
662
                            $element->setOptions(['label' => 'LABEL_NAME']);
-
 
663
                            $element->setAttributes(['class' => 'form-control']);
-
 
664
                                            
-
 
665
                            echo $this->formLabel($element);
-
 
666
                            echo $this->formText($element);
-
 
667
                            ?>
-
 
668
						</div>
-
 
669
						<div class="form-group">
-
 
670
                    	<?php 
-
 
671
                            $element = $form->get('description');
-
 
672
                            $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
-
 
673
                            $element->setAttributes(['class' => 'form-control']);
-
 
674
 
-
 
675
                            echo $this->formLabel($element);
-
 
676
                            echo $this->formTextArea($element);
-
 
677
                        ?>
-
 
678
						</div>
-
 
679
						<div class="form-group">
-
 
680
                      	<?php 
-
 
681
                            $element = $form->get('status');
-
 
682
                            $element->setAttributes(['class' => 'form-control']);
-
 
683
                            echo $this->formCheckbox($element);
-
 
684
                        ?>
-
 
685
						</div>
-
 
686
						
-
 
687
						<div class="form-group" id="competencies-to-job" style="display:none">
-
 
688
                            <div class="row">
-
 
689
                               <div class="col-xs-12 col-md-12">
-
 
690
                                  <hr>
-
 
691
                                  <h4 style="font-size: 18px;font-weight: bold;">LABEL_COMPETENCIES_TO_JOB:</h4>
-
 
692
                                  <br>
-
 
693
                                  <div class="panel-group" id="rows-job-competencies"></div>
-
 
694
                               </div>
-
 
695
                            </div>
-
 
696
                   		</div>
-
 
697
                </div>
-
 
698
                <div class="card-footer clearfix">
-
 
699
                   <div style="float:right;">
-
 
700
                   		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
701
                 		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
-
 
702
                   </div>
-
 
703
                </div>
-
 
704
                <?php echo $this->form()->closeTag($form); ?>
-
 
705
             </div>
-
 
706
          </div>
-
 
707
       </div>
-
 
708
    </div>
-
 
709
 </section>   
-
 
710
 
-
 
711
 
-
 
712
 
-
 
713
<script id="competencyTemplate" type="text/x-jsrender">
-
 
714
 <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
-
 
715
   <div class="panel-heading">
-
 
716
      <h4 class="panel-title" style="    font-size: 18px;">
-
 
717
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
-
 
718
         <span class="section-name{{:uuid}}">
-
 
719
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
-
 
720
         </span>
-
 
721
         </a>
-
 
722
      </h4>
-
 
723
   </div>
-
 
724
   <div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
-
 
725
      <div class="panel-body">
-
 
726
         <div class="table-responsive">
-
 
727
            <table class="table table-bordered">
-
 
728
               <thead>
-
 
729
                  <tr>
-
 
730
                     <th style="width: 30%;">LABEL_ELEMENT</th>
-
 
731
                     <th style="width: 60%;">LABEL_TITLE</th>
-
 
732
                     <th style="width: 10%;">LABEL_LEVEL</th>
-
 
733
 
-
 
734
                  </tr>
-
 
735
               </thead>
-
 
736
               <tbody>
-
 
737
                  <tr>
-
 
738
                     <td class="text-left">LABEL_COMPETENCY</td>
-
 
739
                     <td class="text-left">{{:name}}</td>
-
 
740
                     <td>&nbsp;</td>
-
 
741
 
-
 
742
                  </tr>
-
 
743
                  {{for behaviors}}
-
 
744
                  <tr >
-
 
745
                     <td class="text-left">--LABEL_BEHAVIOR</td>
-
 
746
                     <td class="text-left">
-
 
747
                       {{:~getBehavior(uuid).description}}
-
 
748
                     </td>
-
 
749
                     <td class="text-right">
-
 
750
                        {{:level}}
-
 
751
                     </td>
-
 
752
 
-
 
753
                  </tr>
-
 
754
                  {{/for}}
-
 
755
               </tbody>
-
 
756
            </table>
-
 
757
         </div>
-
 
758
      </div>
-
 
759
   </div>
-
 
760
</div>
-
 
761
</script>
-
 
762
 
-
 
763
 
-
 
764
<script id="competencyTemplateWithNivel" type="text/x-jsrender">
-
 
765
 <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
-
 
766
   <div class="panel-heading">
-
 
767
      <h4 class="panel-title" style="    font-size: 18px;">
-
 
768
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
-
 
769
         <span class="section-name{{:uuid}}">
-
 
770
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
-
 
771
         </span>
-
 
772
         </a>
-
 
773
      </h4>
-
 
774
   </div>
-
 
775
   <div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
-
 
776
      <div class="panel-body">
-
 
777
         <div class="table-responsive">
-
 
778
            <table class="table table-bordered">
-
 
779
               <thead>
-
 
780
                  <tr>
-
 
781
                     <th style="width: 30%;">LABEL_ELEMENT</th>
-
 
782
                     <th style="width: 60%;">LABEL_TITLE</th>
-
 
783
                     <th style="width: 10%;">LABEL_LEVEL</th>
-
 
784
 
-
 
785
                  </tr>
-
 
786
               </thead>
-
 
787
               <tbody>
-
 
788
                  <tr>
-
 
789
                     <td class="text-left">LABEL_COMPETENCY</td>
-
 
790
                     <td class="text-left">{{:name}}</td>
-
 
791
                     <td>&nbsp;</td>
-
 
792
 
-
 
793
                  </tr>
-
 
794
                  {{for behaviors}}
-
 
795
                  <tr >
-
 
796
                     <td class="text-left">--LABEL_BEHAVIOR</td>
-
 
797
                     <td class="text-left">
-
 
798
                       {{:~getBehavior(uuid).description}}
-
 
799
                     </td>
-
 
800
                     <td>
-
 
801
                        {{if level == '0'}} LABEL_NA {{/if}} 
Línea -... Línea 802...
-
 
802
                        {{if level == '1' }} LABEL_LEVEL_ONE {{/if}} 
35
 
803
                        {{if level == '2' }} LABEL_LEVEL_TWO {{/if}} 
-
 
804
                        {{if level == '3' }} LABEL_LEVEL_THREE {{/if}} 
-
 
805
                        {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}} 
-
 
806
                     </td>
-
 
807
 
-
 
808
                  </tr>
36
$this->inlineScript()->appendScript($js);
809
                  {{/for}}
-
 
810
               </tbody>
37
$this->headLink()->appendStylesheet('/react-bundles/performance_evaluations/forms/main.css');
811
            </table>