Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15436 Rev 15443
Línea 6... Línea 6...
6
$currentUser    = $this->currentUserHelper();
6
$currentUser    = $this->currentUserHelper();
Línea 7... Línea 7...
7
 
7
 
Línea 8... Línea 8...
8
$roleName = $currentUser->getUserTypeId();
8
$roleName = $currentUser->getUserTypeId();
9
 
9
 
10
 
10
 
11
$routeAdd       = $this->url('settings/jobs-description/add');
11
$routeAdd       = $this->url('jobs-description/add');
Línea 12... Línea 12...
12
$routeDatatable = $this->url('settings/jobs-description');
12
$routeDatatable = $this->url('jobs-description');
13
$routeImport    = $this->url('settings/jobs-description/import');
13
$routeImport    = $this->url('jobs-description/import');
14
$routeDashboard = $this->url('dashboard');
14
$routeDashboard = $this->url('dashboard');
15
 
15
 
16
$allowAdd               = $acl->isAllowed($roleName, 'settings/jobs-description/add') ? 1 : 0;
16
$allowAdd               = $acl->isAllowed($roleName, 'jobs-description/add') ? 1 : 0;
Línea 17... Línea 17...
17
$allowEdit              = $acl->isAllowed($roleName, 'settings/jobs-description/edit') ? 1 : 0;
17
$allowEdit              = $acl->isAllowed($roleName, 'jobs-description/edit') ? 1 : 0;
18
$allowDelete            = $acl->isAllowed($roleName, 'settings/jobs-description/delete') ? 1 : 0;
18
$allowDelete            = $acl->isAllowed($roleName, 'jobs-description/delete') ? 1 : 0;
Línea 19... Línea 19...
19
$allowReport            = $acl->isAllowed($roleName, 'settings/jobs-description/report') ? 1 : 0;
19
$allowReport            = $acl->isAllowed($roleName, 'jobs-description/report') ? 1 : 0;
Línea 20... Línea 20...
20
$allowImport            = $acl->isAllowed($roleName, 'settings/jobs-description/import') ? 1 : 0;
20
$allowImport            = $acl->isAllowed($roleName, 'jobs-description/import') ? 1 : 0;
21
 
21
 
22
 
22
 
Línea 60... Línea 60...
60
 
60
 
61
 
61
 
Línea 62... Línea -...
62
// Page Styles
-
 
63
//$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
-
 
64
 
-
 
65
$vars  = " var competencies_selected = new Array(); \r\n";
-
 
66
$vars .= " var subordinates_selected = new Array(); \r\n";
-
 
67
$vars .= " var behaviors = new Array(); \r\n";
-
 
68
$vars .= " var subordinates = new Array(); \r\n";
-
 
69
$i = 0;
-
 
70
 
-
 
71
foreach ($behaviors as $record) {
-
 
72
    $vars .= "  behaviors[$i] =  { uuid : '{$record['uuid']}', description :'{$record['description']}' }; \r\n ";
-
 
73
    $i++;
-
 
74
}
-
 
75
 
-
 
76
$vars .= " var competency_types = new Array(); \r\n";
-
 
77
$i = 0;
-
 
78
 
-
 
79
foreach ($competency_types as $record) {
-
 
80
    $vars .= "  competency_types[$i] = { uuid : '{$record['uuid']}' , name : '{$record['name']}' } ; \r\n ";
-
 
81
    $i++;
-
 
82
}
-
 
83
 
-
 
84
 
-
 
85
$vars .= " var competencies = new Array(); \r\n";
-
 
86
$i = 0;
-
 
87
 
-
 
88
foreach ($competencies as $record) {
-
 
89
 
-
 
90
 
-
 
91
 
-
 
92
    $vars .= "  competencies[$i] = new Object(); \r\n ";
-
 
93
    $vars .= "  competencies[$i].competency_type_uuid = '{$record['competency_type_uuid']}' \r\n ";
-
 
94
    $vars .= "  competencies[$i].uuid = '{$record['uuid']}' \r\n ";
-
 
95
    $vars .= "  competencies[$i].name = '{$record['name']}' \r\n ";
-
 
96
    $vars .= "  competencies[$i].behaviors = new Array(); \r\n";
-
 
97
 
-
 
98
    $j = 0;
-
 
99
    foreach ($record['behaviors_by_competency'] as $behavior_uuid) {
-
 
100
        $vars .= "  competencies[$i].behaviors[$j] = '$behavior_uuid'; \r\n";
-
 
101
        $j++;
-
 
102
    }
-
 
103
 
-
 
104
 
-
 
105
    $i++;
-
 
106
}
-
 
Línea 107... Línea 62...
107
 
62
// Page Styles
Línea 116... Línea 71...
116
echo <<<JS
71
echo <<<JS
Línea 117... Línea 72...
117
 
72
 
Línea -... Línea 73...
-
 
73
 
-
 
74
jQuery(document).ready(function($) {
118
 
75
 
119
jQuery(document).ready(function($) {
-
 
120
 
-
 
121
    $vars
-
 
-
 
76
    var competencies_selected = new Array(); 
-
 
77
    var subordinates_selected = new Array();
-
 
78
    var behaviors = new Array();
Línea 122... Línea 79...
122
 
79
    var subordinates = new Array(); 
123
 
80
    var competency_types = new Array(); 
124
 
81
    var competencies = new Array(); 
Línea 344... Línea 301...
344
            {
301
            {
345
                'targets': -1,
302
                'targets': -1,
346
                'orderable': false,
303
                'orderable': false,
347
                'render': function(data, type, row) {
304
                'render': function(data, type, row) {
348
                    s = '';
305
                    s = '';
349
                    if (allowEdit) {
306
                    if (allowEdit && data['link_edit']) {
350
                        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;';
307
                        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;';
351
                    }
308
                    }
352
                    if (allowDelete) {
309
                    if (allowDelete && data['link_delete']) {
353
                        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;';
310
                        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;';
354
                    }
311
                    }
355
                    if (allowReport) {
312
                    if (allowReport && data['link_report']) {
356
                        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;';
313
                        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;';
357
                    }
314
                    }
358
                    return s;
315
                    return s;
359
                }
316
                }
360
            }
317
            }
Línea 370... Línea 327...
370
            'name': {
327
            'name': {
371
                required: true,
328
                required: true,
372
                maxlength: 64,
329
                maxlength: 64,
373
            },
330
            },
374
            'functions': {
331
            'functions': {
375
                updateCkeditor: function() {
-
 
376
                    CKEDITOR.instances.functions.updateElement();
-
 
377
                },
-
 
378
                required: true,
332
                required: true,
-
 
333
                maxlength: 1024,
379
            },
334
            },
380
            'objectives': {
335
            'objectives': {
381
                updateCkeditor: function() {
-
 
382
                    CKEDITOR.instances.objectives.updateElement();
-
 
383
                },
336
               required: true,
384
                required: true,
337
                maxlength: 1024,
385
            },
338
            },
386
            'status': {
339
            'status': {
387
                required: false,
340
                required: false,
388
            },
341
            },
389
            'job_description_id_boss': {
342
            'job_description_id_boss': {
Línea 457... Línea 410...
457
            'url': '$routeAdd',
410
            'url': '$routeAdd',
458
        }).done(function(response) {
411
        }).done(function(response) {
Línea 459... Línea 412...
459
 
412
 
Línea -... Línea 413...
-
 
413
            if (response['success']) {
-
 
414
 
-
 
415
 
-
 
416
                behaviors = response['data']['behaviors'];
-
 
417
                competency_types = response['data']['competency_types'];
-
 
418
                competencies = response['data']['competencies'];
460
            if (response['success']) {
419
 
461
 
420
 
Línea 462... Línea 421...
462
                competencies_selected = [];
421
                competencies_selected = [];
463
                subordinates = [];
422
                subordinates = [];
Línea 499... Línea 458...
499
                $('span[id="form-title"]').html('LABEL_ADD');
458
                $('span[id="form-title"]').html('LABEL_ADD');
500
                $('#form').attr('action', '$routeAdd');
459
                $('#form').attr('action', '$routeAdd');
501
                $('#form #name').val('');
460
                $('#form #name').val('');
502
                $('#form #status').bootstrapToggle('on');
461
                $('#form #status').bootstrapToggle('on');
Línea 503... Línea 462...
503
                    
462
                    
504
                CKEDITOR.instances.functions.setData('');
463
                $('#form #functions').val('');
Línea 505... Línea 464...
505
                CKEDITOR.instances.objectives.setData('');
464
                $('#form #objectives').val('');
Línea 506... Línea 465...
506
 
465
 
Línea 536... Línea 495...
536
                $('span[id="form-title"]').html('LABEL_EDIT');
495
                $('span[id="form-title"]').html('LABEL_EDIT');
537
                $('#form').attr('action', action);
496
                $('#form').attr('action', action);
538
                $('#form #name').val(response['data']['name']);
497
                $('#form #name').val(response['data']['name']);
539
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
498
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
Línea 540... Línea 499...
540
               
499
               
541
                CKEDITOR.instances.functions.setData(response['data']['functions']);
500
                $('#form #functions').val(response['data']['functions']);
-
 
501
                $('#form #objectives').val(response['data']['objectives']);
-
 
502
 
-
 
503
                behaviors = response['data']['behaviors'];
-
 
504
                competency_types = response['data']['competency_types'];
Línea 542... Línea 505...
542
                CKEDITOR.instances.objectives.setData(response['data']['objectives']);
505
                competencies = response['data']['competencies'];
543
 
506
 
544
                subordinates = [];
507
                subordinates = [];
Línea 627... Línea 590...
627
 
590
 
628
    $('body').on('click', 'button.btn-pdf', function(e) {
591
    $('body').on('click', 'button.btn-pdf', function(e) {
629
        e.preventDefault();
592
        e.preventDefault();
Línea -... Línea 593...
-
 
593
        var action   = $(this).data('href');
630
        var action   = $(this).data('href');
594
 
631
 
595
 
632
        NProgress.start(); 
596
        NProgress.start(); 
633
        $.ajax({
597
        $.ajax({
634
            'dataType'  : 'json',
598
            'dataType'  : 'json',
Línea 644... Línea 608...
644
                document.body.removeChild(anchor);
608
                document.body.removeChild(anchor);
645
            } else {
609
            } else {
646
                $.fn.showError(response['data']);
610
                $.fn.showError(response['data']);
647
            }
611
            }
648
        }).fail(function( jqXHR, textStatus, errorThrown) {
612
        }).fail(function( jqXHR, textStatus, errorThrown) {
649
            showError(textStatus);
613
            $.fn.showError(textStatus);
650
        }).always(function() {
614
        }).always(function() {
651
            NProgress.done();
615
            NProgress.done();
652
        });
616
        });
Línea -... Línea 617...
-
 
617
 
653
 
618
 
Línea 654... Línea 619...
654
 
619
 
Línea 813... Línea 778...
813
        'off': 'LABEL_INACTIVE',
778
        'off': 'LABEL_INACTIVE',
814
        'width': '160px',
779
        'width': '160px',
815
        'height': '40px'
780
        'height': '40px'
816
    });
781
    });
Línea -... Línea 782...
-
 
782
 
-
 
783
    $('#form #functions').maxlength({
-
 
784
        alwaysShow: true,
-
 
785
         validate: true
-
 
786
    });
-
 
787
 
-
 
788
    $('#form #objectives').maxlength({
-
 
789
        alwaysShow: true,
-
 
790
        validate: true
-
 
791
    });
-
 
792
 
817
 
793
 
818
    $('#form #job_description_id_boss').select2({
794
    $('#form #job_description_id_boss').select2({
819
        theme: 'bootstrap4',
795
        theme: 'bootstrap4',
820
        width: '100%',
796
        width: '100%',
Línea 832... Línea 808...
832
    $('#select-competency').select2({
808
    $('#select-competency').select2({
833
        theme: 'bootstrap4',
809
        theme: 'bootstrap4',
834
        width: '100%',
810
        width: '100%',
835
    });
811
    });
Línea 836... Línea -...
836
    
-
 
837
    CKEDITOR.replace('functions');
-
 
Línea 838... Línea 812...
838
    CKEDITOR.replace('objectives');
812
    
Línea 839... Línea 813...
839
 
813
 
840
});
814
});
Línea 1058... Línea 1032...
1058
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
1032
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
1059
                    <span aria-hidden="true">&times;</span>
1033
                    <span aria-hidden="true">&times;</span>
1060
                </button>
1034
                </button>
1061
            </div>
1035
            </div>
1062
            <div class="modal-body">
1036
            <div class="modal-body">
1063
                <div class="form-group">
1037
               <div class="form-group">
1064
                    <label for="behavior-value">LABEL_LEVEL</label>
1038
                  <label for="behavior-value">LABEL_LEVEL</label>
1065
                    <select class="form-control" id="level" name="level">
1039
                  <input type="number" step="1" min="0" max="100" id="level" name="level">
1066
                        <option value="0">LABEL_NA</option>
-
 
1067
                        <option value="1">LABEL_LEVEL_ONE</option>
-
 
1068
                        <option value="2">LABEL_LEVEL_TWO</option>
-
 
1069
                        <option value="3">LABEL_LEVEL_THREE</option>
-
 
1070
                        <option value="4">LABEL_LEVEL_FOUR</option>
-
 
1071
                    </select>
-
 
1072
                </div>
-
 
1073
            </div>
1040
            </div>
1074
            <div class="modal-footer">
1041
            <div class="modal-footer">
1075
                <button type="button" class="btn btn-primary btn-behavior-submit">LABEL_SAVE</button>
1042
                <button type="button" class="btn btn-primary btn-behavior-submit">LABEL_SAVE</button>
1076
                <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
1043
                <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
1077
            </div>
1044
            </div>
1078
    </div>
1045
    </div>
1079
    </form>
1046
    </form>
1080
</div>
1047
</div>
1081
</div>
1048
</div>
Línea 1082... Línea -...
1082
 
-
 
1083
<script>
-
 
1084
    CKEDITOR.replace('objectives', {
-
 
1085
        toolbar: [{
-
 
1086
                name: 'editing',
-
 
1087
                items: ['Scayt']
-
 
1088
            },
-
 
1089
            {
-
 
1090
                name: 'links',
-
 
1091
                items: ['Link', 'Unlink']
-
 
1092
            },
-
 
1093
            {
-
 
1094
                name: 'paragraph',
-
 
1095
                items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote']
-
 
1096
            },
-
 
1097
            {
-
 
1098
                name: 'basicstyles',
-
 
1099
                items: ['Bold', 'Italic', 'Strike', 'RemoveFormat']
-
 
1100
            },
-
 
1101
            '/',
-
 
1102
            {
-
 
1103
                name: 'insert',
-
 
1104
                items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar']
-
 
1105
            },
-
 
1106
            {
-
 
1107
                name: 'styles',
-
 
1108
                items: ['Styles', 'Format']
-
 
1109
            },
-
 
1110
            {
-
 
1111
                name: 'tools',
-
 
1112
                items: ['Maximize']
-
 
1113
            }
-
 
1114
        ],
-
 
1115
        removePlugins: 'elementspath,Anchor',
-
 
1116
        heigth: 100
-
 
1117
    });
-
 
1118
    CKEDITOR.replace('functions', {
-
 
1119
        toolbar: [{
-
 
1120
                name: 'editing',
-
 
1121
                items: ['Scayt']
-
 
1122
            },
-
 
1123
            {
-
 
1124
                name: 'links',
-
 
1125
                items: ['Link', 'Unlink']
-
 
1126
            },
-
 
1127
            {
-
 
1128
                name: 'paragraph',
-
 
1129
                items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote']
-
 
1130
            },
-
 
1131
            {
-
 
1132
                name: 'basicstyles',
-
 
1133
                items: ['Bold', 'Italic', 'Strike', 'RemoveFormat']
-
 
1134
            },
-
 
1135
            '/',
-
 
1136
            {
-
 
1137
                name: 'insert',
-
 
1138
                items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar']
-
 
1139
            },
-
 
1140
            {
-
 
1141
                name: 'styles',
-
 
1142
                items: ['Styles', 'Format']
-
 
1143
            },
-
 
1144
            {
-
 
1145
                name: 'tools',
-
 
1146
                items: ['Maximize']
-
 
1147
            }
-
 
1148
        ],
-
 
1149
        removePlugins: 'elementspath,Anchor',
-
 
1150
        heigth: 100
1049
 
1151
    });
-
 
1152
</script>
-
 
Línea 1153... Línea 1050...
1153
<!---end modal behavior --->
1050
 
1154
 
1051
 
1155
<!---Template Competencies --->
1052
<!---Template Competencies --->
1156
<script id="competencyTemplate" type="text/x-jsrender">
1053
<script id="competencyTemplate" type="text/x-jsrender">
1157
    <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
1054
    <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
1158
   <div class="panel-heading">
1055
   <div class="panel-heading">
1159
      <h4 class="panel-title" style="    font-size: 18px;">
1056
      <h4 class="panel-title" style="    font-size: 18px;">
1160
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
1057
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
-
 
1058
         <span class="section-name{{:uuid}}">
-
 
1059
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
-
 
1060
         </span>
-
 
1061
         </a>
-
 
1062
      </h4>
-
 
1063
   </div>
-
 
1064
   <div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
-
 
1065
      <div class="panel-body">
-
 
1066
         <div class="table-responsive">
-
 
1067
            <table class="table table-bordered">
-
 
1068
               <thead>
-
 
1069
                  <tr>
-
 
1070
                     <th style="width: 20%;">LABEL_ELEMENT</th>
-
 
1071
                     <th style="width: 50%;">LABEL_TITLE</th>
-
 
1072
                     <th style="width: 10%;">LABEL_LEVEL</th>
-
 
1073
                     <th style="width: 20%;">LABEL_ACTIONS</th>
-
 
1074
                  </tr>
-
 
1075
               </thead>
-
 
1076
               <tbody>
-
 
1077
                  <tr>
-
 
1078
                     <td class="text-left">LABEL_COMPETENCY</td>
-
 
1079
                     <td class="text-left">{{:name}}</td>
-
 
1080
                     <td>
-
 
1081
                     </td>
-
 
1082
                     <td>
-
 
1083
                        <button  type="button" class="btn btn-default btn-delete-competency" data-competency="{{:uuid}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_COMPETENCY"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_COMPETENCY </button> 
-
 
1084
                     </td>
-
 
1085
                  </tr>
-
 
1086
                  {{for behaviors}}
-
 
1087
                  <tr >
-
 
1088
                     <td class="text-left">--LABEL_BEHAVIOR</td>
-
 
1089
                     <td class="text-left">
-
 
1090
                       {{:~getBehavior(uuid).description}}
-
 
1091
                     </td>
-
 
1092
                     <td class="text-right">
-
 
1093
                        {{:level}} 
-
 
1094
                     </td>
-
 
1095
                     <td>
-
 
1096
                        <button type="button"  class="btn btn-default btn-edit-behavior" data-behavior="{{:uuid}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_LEVEL"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_LEVEL</button> 
-
 
1097
                     </td>
-
 
1098
                  </tr>
-
 
1099
                  {{/for}}
-
 
1100
               </tbody>
-
 
1101
            </table>
-
 
1102
         </div>
-
 
1103
      </div>
-
 
1104
   </div>
-
 
1105
</div>
-
 
1106
</script>
-
 
1107
 
-
 
1108
<script id="competencyTemplateWithLevel" type="text/x-jsrender">
-
 
1109
 <div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
-
 
1110
   <div class="panel-heading">
-
 
1111
      <h4 class="panel-title" style="    font-size: 18px;">
-
 
1112
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
1161
         <span class="section-name{{:uuid}}">
1113
         <span class="section-name{{:uuid}}">
1162
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
1114
            {{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
1163
         </span>
1115
         </span>
1164
         </a>
1116
         </a>
1165
      </h4>
1117
      </h4>