Proyectos de Subversion LeadersLinked - Backend

Rev

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

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