Proyectos de Subversion LeadersLinked - Backend

Rev

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