Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15443 | Rev 16822 | 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
 
15443 efrain 19
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-maxlenght/bootstrap-maxlength.min.js'));
12137 stevensc 20
 
15443 efrain 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
 
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();
223
            $('button.btn-delete').confirmation({
224
                rootSelector: 'button.btn-delete',
225
                title: 'LABEL_ARE_YOU_SURE',
226
                singleton: true,
227
                btnOkLabel: 'LABEL_YES',
228
                btnCancelLabel: 'LABEL_NO',
229
                onConfirm: function(value) {
230
                    action = $(this).data('href');
231
                    NProgress.start();
232
                    $.ajax({
233
                        'dataType': 'json',
234
                        'accept': 'application/json',
235
                        'method': 'post',
236
                        'url': action,
237
                    }).done(function(response) {
238
                        if (response['success']) {
239
                            $.fn.showSuccess(response['data']);
240
                             gridTable.api().ajax.reload(null, false);
241
                        } else {
242
                            $.fn.showError(response['data']);
243
                        }
244
                    }).fail(function(jqXHR, textStatus, errorThrown) {
245
                        $.fn.showError(textStatus);
246
                    }).always(function() {
247
                        NProgress.done();
248
                    });
249
                },
250
            });
251
        },
252
        'aoColumns': [{
253
                'mDataProp': 'name'
254
            },
255
            {
256
                'mDataProp': 'tests'
257
            },
258
            {
259
                'mDataProp': 'date'
260
            },
261
            {
262
                'mDataProp': 'status'
263
            },
264
            {
265
                'mDataProp': 'actions'
266
            },
267
        ],
268
        'columnDefs': [
269
            {
270
                'targets': 0,
271
                'orderable': false,
272
                'render': function(data, type, row) {
273
                    return row['name'] + '<br>' + row['job_description'];
274
                }
275
            },
276
            {
277
                'targets': 1,
278
                'orderable': false,
279
                'className': 'text-right',
280
            },
281
            {
282
                'targets': 2,
283
                'orderable': false,
284
 
285
            },
286
            {
287
                'targets': -2,
288
                'orderable': false,
289
                'className': 'text-center',
290
                'render': function(data, type, row) {
291
                    checked = data == 'a' ? ' checked="checked" ' : '';
292
                    return '<div class="checkbox checkbox-success">' +
293
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
294
                        '<label ></label></div>';
295
                }
296
            },
297
            {
298
                'targets': -1,
299
                'orderable': false,
300
                'render': function(data, type, row) {
301
                    s = '';
302
                    if (allowEdit && data['link_edit']) {
303
                        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;';
304
                    }
305
                    if (allowDelete && data['link_delete']) {
306
                        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;';
307
                    }
308
                    if (allowActive && data['link_active']) {
309
                        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;';
310
                    }
311
                    if (allowInactive && data['link_inactive']) {
312
                        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;';
313
                    }
314
                    if (allowReport && data['link_report'] ) {
315
                        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;';
316
                    }
317
                    return s;
318
                }
319
            }
320
        ],
321
    });
322
 
323
 
324
    var validator = $('#form').validate({
325
        debug: true,
326
        onclick: false,
327
        onkeyup: false,
328
        ignore: [],
329
        rules: {
330
            'name': {
331
                required: true,
332
                maxlength: 128,
333
            },
334
            'description': {
335
                required: true,
336
                maxlength: 1024,
337
            },
338
 
339
            'job_description_id' : {
340
                 required: true,
341
            },
342
            'status': {
343
                required: false,
344
            },
345
         },
346
        submitHandler: function(form) {
347
 
348
 
349
            NProgress.start();
350
            $.ajax({
351
                'dataType': 'json',
352
                'accept': 'application/json',
353
                'method': 'post',
354
                'url': $('#form').attr('action'),
355
                'data': $('#form').serialize(),
356
            }).done(function(response) {
357
                if (response['success']) {
358
                    $.fn.showSuccess(response['data']);
359
                    $('#row-form').hide();
360
                    $('#row-list').show();
361
                    $('#row-header').show();
362
 
363
                    gridTable.api().ajax.reload(null, false);
364
                } else {
365
                    validator.resetForm();
366
                    if (jQuery.type(response['data']) == 'string') {
367
                        $.fn.showError(response['data']);
368
                    } else {
369
                        $.each(response['data'], function(fieldname, errors) {
370
                            $.fn.showFormErrorValidator('#form #' + fieldname, errors);
371
                        });
372
                    }
373
                }
374
            }).fail(function(jqXHR, textStatus, errorThrown) {
375
                $.fn.showError(textStatus);
376
            }).always(function() {
377
                NProgress.done();
378
            });
379
            return false;
380
        },
381
        invalidHandler: function(form, validator) {}
382
    });
383
 
384
    $('body').on('click', 'button.btn-active', function(e) {
385
        e.preventDefault();
386
 
387
        var action = $(this).data('href');
388
        $.ajax({
389
            'dataType': 'json',
390
            'accept': 'application/json',
391
            'method': 'post',
392
            'url': action,
393
        }).done(function(response) {
394
            if (response['success']) {
395
                gridTable.api().ajax.reload(null, false);
396
            } else {
397
                $.fn.showError(response['message']);
398
            }
399
        }).fail(function(jqXHR, textStatus, errorThrown) {
400
            $.fn.showError(textStatus);
401
        });
402
    });
403
 
404
    $('body').on('click', 'button.btn-inactive', function(e) {
405
        e.preventDefault();
406
 
407
        var action = $(this).data('href');
408
        $.ajax({
409
            'dataType': 'json',
410
            'accept': 'application/json',
411
            'method': 'post',
412
            'url': action,
413
        }).done(function(response) {
414
            if (response['success']) {
415
                gridTable.api().ajax.reload(null, false);
416
            } else {
417
                $.fn.showError(response['message']);
418
            }
419
        }).fail(function(jqXHR, textStatus, errorThrown) {
420
            $.fn.showError(textStatus);
421
        });
422
    });
423
 
424
 
425
    $('body').on('click', 'button.btn-edit', function(e) {
426
        e.preventDefault();
427
 
428
        var action = $(this).data('href');
429
        $.ajax({
430
            'dataType': 'json',
431
            'accept': 'application/json',
432
            'method': 'get',
433
            'url': action,
434
        }).done(function(response) {
435
            if (response['success']) {
436
                $('#form').attr('action', action);
437
                $('#form #name').val(response['data']['name']);
438
                $('#form #description').val(response['data']['description']);
439
                $('#form #job_description_id').val(response['data']['job_description_id']).trigger('change');
440
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
441
 
442
                $('#row-list').hide();
443
                $('#row-header').hide();
444
                $('#row-form').show();
445
            } else {
446
                $.fn.showError(response['message']);
447
            }
448
        }).fail(function(jqXHR, textStatus, errorThrown) {
449
            $.fn.showError(textStatus);
450
        });
451
    });
452
 
453
    $('button.btn-add').click(function(e) {
454
        e.preventDefault();
455
 
456
        $('span[id="form-title"]').html('LABEL_ADD');
457
        $('#form').attr('action', '$routeAdd');
458
        $('#form #name').val('');
459
        $('#form #job_description_id').val('').trigger('change');
460
        $('#form #job_description_id').prop('disabled', false);
461
        $('#form #status').bootstrapToggle('on');
462
        $('#form #description').val('');
463
 
464
 
465
        $.fn.renderCompetencies();
466
 
467
 
468
        $('#row-header').hide();
469
        $('#row-list').hide();
470
        $('#row-form').show();
471
 
472
    });
473
 
474
 
475
 
476
    $('button.btn-cancel').click(function(e) {
477
        e.preventDefault();
478
 
479
        $('#row-form').hide();
480
        $('#row-list').show();
481
        $('#row-header').show();
482
    });
483
 
484
    $('#form #description').maxlength({
485
        alwaysShow: true,
486
        validate: true
487
    });
488
 
489
 
490
 
491
 
492
 
493
 
494
    $('#form #status').bootstrapToggle({
495
        'on': 'LABEL_ACTIVE',
496
        'off': 'LABEL_INACTIVE',
497
        'width': '160px',
498
        'height': '40px'
499
    });
500
 
501
    $('body').on('click', 'button.btn-refresh', function(e) {
502
        e.preventDefault();
503
        gridTable.api().ajax.reload(null, false);
504
    });
505
 
506
 
507
 
508
    $('#job_description_id').select2({
509
        theme: 'bootstrap4',
510
        width: '100%',
511
    });
512
 
513
    $('#job_description_id').on('change', function(e) {
514
        e.preventDefault();
515
 
516
            var uuid = $('#job_description_id').val();
517
            var job_description = jobs_description.filter((item) => item.uuid == uuid ? item : false)[0];
518
 
519
            if (job_description) {
520
                NProgress.start();
521
                $.getJSON(job_description.link, function(response) {
522
                    if (response['success']) {
523
                        behaviors = response['data']['behaviors'];
524
                        competency_types = response['data']['competency_types'];
525
                        competencies = response['data']['competencies'];
526
 
527
 
528
                        competencies_selected = response['data']['competencies_selected'];
529
                        subordinates_selected = response['data']['subordinates_selected'];
530
 
531
                        $.fn.renderCompetencies();
532
 
533
                    } else {
534
 
535
                        $.fn.showError(response['data'])
536
                    }
537
                }).fail(function( jqXHR, textStatus, errorThrown) {
538
                    $.fn.showError(textStatus);
539
                }).always(function() {
540
                    NProgress.done();
541
                });
542
            }
543
 
544
    });
545
 
546
    $('body').on('click', 'button.btn-pdf', function(e) {
547
        e.preventDefault();
548
        var action   = $(this).data('href');
549
 
550
 
551
        NProgress.start();
552
        $.ajax({
553
            'dataType'  : 'json',
554
            'method'    : 'get',
555
            'url'       :  action,
556
        }).done(function(response) {
557
            if(response['success']) {
558
                var anchor = window.document.createElement("a");
559
                anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
560
                anchor.download = response['data']['basename'];
561
                document.body.appendChild(anchor);
562
                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
563
                document.body.removeChild(anchor);
564
            } else {
565
                $.fn.showError(response['data']);
566
            }
567
        }).fail(function( jqXHR, textStatus, errorThrown) {
568
            $.fn.showError(textStatus);
569
        }).always(function() {
570
            NProgress.done();
571
        });
572
 
573
 
574
 
575
    });
576
 
577
 
578
    $('#form #description').maxlength({
579
        alwaysShow: true,
580
        validate: true
581
    });
582
 
583
});
11960 stevensc 584
JS;
585
 
15443 efrain 586
$this->inlineScript()->captureEnd();
977 geraldo 587
?>
15443 efrain 588
<!-- Content Header (Page header) -->
589
<section class="content-header" id="row-header">
16320 stevensc 590
    <div class="container-fluid">
591
        <div class="row mb-2">
592
            <div class="col-sm-12">
593
                <h1>LABEL_FORMS</h1>
594
            </div>
595
        </div>
596
    </div>
597
    <!-- /.container-fluid -->
15443 efrain 598
</section>
599
<section class="content">
600
    <div class="container-fluid">
16320 stevensc 601
        <div class="row">
602
            <div class="col-12" id="row-list">
603
                <div class="card">
604
                    <div class="card-body">
605
                        <table id="gridTable" class="table   table-hover">
606
                            <thead>
607
                                <tr>
608
                                    <th style="width:30%">LABEL_NAME</th>
609
                                    <th style="width:15%">LABEL_EVALUATIONS</th>
610
                                    <th style="width:15%">LABEL_DATE</th>
611
                                    <th style="width:10%">LABEL_ACTIVE</th>
612
                                    <th style="width:30%">LABEL_ACTIONS</th>
613
                                </tr>
614
                            </thead>
615
                            <tbody></tbody>
616
                        </table>
617
                    </div>
618
                    <div class="card-footer clearfix">
619
                        <div style="float:right;">
620
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
621
                            <?php if ($allowAdd) : ?>
622
                                <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
623
                            <?php endif; ?>
624
                        </div>
625
                    </div>
15443 efrain 626
                </div>
16320 stevensc 627
            </div>
628
        </div>
11960 stevensc 629
 
16320 stevensc 630
        <div class="row" id="row-form" style="display: none">
631
            <div class="col-12">
632
                <div class="card">
633
                    <?php
15443 efrain 634
                    $form = $this->form;
16320 stevensc 635
                    $form->setAttributes([
15443 efrain 636
                        'method'    => 'post',
637
                        'name'      => 'form',
638
                        'id'        => 'form'
639
                    ]);
16320 stevensc 640
 
15443 efrain 641
                    $form->prepare();
642
                    echo $this->form()->openTag($form);
16320 stevensc 643
                    ?>
644
                    <div class="card-header">
645
                        <h4 class="modal-title">LABEL_PERFORMANCE_EVALUATION - <span id="form-title"></span></h4>
646
                    </div>
647
                    <div class="card-body">
648
                        <div class="form-group">
649
                            <?php
15443 efrain 650
                            $element = $form->get('job_description_id');
651
                            $element->setOptions(['label' => 'LABEL_JOB_DESCRIPTION']);
652
                            $element->setAttributes(['class' => 'form-control']);
16320 stevensc 653
 
15443 efrain 654
                            echo $this->formLabel($element);
655
                            echo $this->formSelect($element);
656
                            ?>
16320 stevensc 657
                        </div>
658
                        <div class="form-group">
659
                            <?php
15443 efrain 660
                            $element = $form->get('name');
661
                            $element->setOptions(['label' => 'LABEL_NAME']);
662
                            $element->setAttributes(['class' => 'form-control']);
16320 stevensc 663
 
15443 efrain 664
                            echo $this->formLabel($element);
665
                            echo $this->formText($element);
666
                            ?>
16320 stevensc 667
                        </div>
668
                        <div class="form-group">
669
                            <?php
15443 efrain 670
                            $element = $form->get('description');
671
                            $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
672
                            $element->setAttributes(['class' => 'form-control']);
673
 
674
                            echo $this->formLabel($element);
675
                            echo $this->formTextArea($element);
16320 stevensc 676
                            ?>
677
                        </div>
678
                        <div class="form-group">
679
                            <?php
15443 efrain 680
                            $element = $form->get('status');
681
                            $element->setAttributes(['class' => 'form-control']);
682
                            echo $this->formCheckbox($element);
16320 stevensc 683
                            ?>
684
                        </div>
685
 
686
                        <div class="form-group" id="competencies-to-job" style="display:none">
15443 efrain 687
                            <div class="row">
16320 stevensc 688
                                <div class="col-xs-12 col-md-12">
689
                                    <hr>
690
                                    <h4 style="font-size: 18px;font-weight: bold;">LABEL_COMPETENCIES_TO_JOB:</h4>
691
                                    <br>
692
                                    <div class="panel-group" id="rows-job-competencies"></div>
693
                                </div>
15443 efrain 694
                            </div>
16320 stevensc 695
                        </div>
696
                    </div>
697
                    <div class="card-footer clearfix">
698
                        <div style="float:right;">
699
                            <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
700
                            <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
701
                        </div>
702
                    </div>
703
                    <?php echo $this->form()->closeTag($form); ?>
15443 efrain 704
                </div>
16320 stevensc 705
            </div>
706
        </div>
15443 efrain 707
    </div>
16320 stevensc 708
</section>
15443 efrain 709
 
710
 
711
 
712
<script id="competencyTemplate" type="text/x-jsrender">
16320 stevensc 713
    <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
15443 efrain 714
   <div class="panel-heading">
715
      <h4 class="panel-title" style="    font-size: 18px;">
716
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
717
         <span class="section-name{{:uuid}}">
718
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
719
         </span>
720
         </a>
721
      </h4>
722
   </div>
723
   <div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
724
      <div class="panel-body">
725
         <div class="table-responsive">
726
            <table class="table table-bordered">
727
               <thead>
728
                  <tr>
729
                     <th style="width: 30%;">LABEL_ELEMENT</th>
730
                     <th style="width: 60%;">LABEL_TITLE</th>
731
                     <th style="width: 10%;">LABEL_LEVEL</th>
732
 
733
                  </tr>
734
               </thead>
735
               <tbody>
736
                  <tr>
737
                     <td class="text-left">LABEL_COMPETENCY</td>
738
                     <td class="text-left">{{:name}}</td>
739
                     <td>&nbsp;</td>
740
 
741
                  </tr>
742
                  {{for behaviors}}
743
                  <tr >
744
                     <td class="text-left">--LABEL_BEHAVIOR</td>
745
                     <td class="text-left">
746
                       {{:~getBehavior(uuid).description}}
747
                     </td>
748
                     <td class="text-right">
749
                        {{:level}}
750
                     </td>
751
 
752
                  </tr>
753
                  {{/for}}
754
               </tbody>
755
            </table>
756
         </div>
757
      </div>
758
   </div>
12154 stevensc 759
</div>
15443 efrain 760
</script>
761
 
762
 
763
<script id="competencyTemplateWithNivel" type="text/x-jsrender">
16320 stevensc 764
    <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
15443 efrain 765
   <div class="panel-heading">
766
      <h4 class="panel-title" style="    font-size: 18px;">
767
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
768
         <span class="section-name{{:uuid}}">
769
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
770
         </span>
771
         </a>
772
      </h4>
773
   </div>
774
   <div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
775
      <div class="panel-body">
776
         <div class="table-responsive">
777
            <table class="table table-bordered">
778
               <thead>
779
                  <tr>
780
                     <th style="width: 30%;">LABEL_ELEMENT</th>
781
                     <th style="width: 60%;">LABEL_TITLE</th>
782
                     <th style="width: 10%;">LABEL_LEVEL</th>
783
 
784
                  </tr>
785
               </thead>
786
               <tbody>
787
                  <tr>
788
                     <td class="text-left">LABEL_COMPETENCY</td>
789
                     <td class="text-left">{{:name}}</td>
790
                     <td>&nbsp;</td>
791
 
792
                  </tr>
793
                  {{for behaviors}}
794
                  <tr >
795
                     <td class="text-left">--LABEL_BEHAVIOR</td>
796
                     <td class="text-left">
797
                       {{:~getBehavior(uuid).description}}
798
                     </td>
799
                     <td>
800
                        {{if level == '0'}} LABEL_NA {{/if}}
801
                        {{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
802
                        {{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
803
                        {{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
804
                        {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
805
                     </td>
806
 
807
                  </tr>
808
                  {{/for}}
809
               </tbody>
810
            </table>
811
         </div>
812
      </div>
813
   </div>
814
</div>
815
</script>