| 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;
 | 
        
           | 977 | geraldo | 15 |   | 
        
           | 15073 | stevensc | 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 |   | 
        
           | 1088 | geraldo | 61 | // Page Styles
 | 
        
           |  |  | 62 | $this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
 | 
        
           |  |  | 63 |   | 
        
           | 12137 | stevensc | 64 |   | 
        
           | 15073 | stevensc | 65 | $status_active = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_ACTIVE;
 | 
        
           |  |  | 66 | $status_inactive = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::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> ';
 | 
        
           |  |  | 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> ';
 | 
        
           |  |  | 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> ';
 | 
        
           |  |  | 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 |     /**
 | 
        
           |  |  | 256 |      * Clicked new Form
 | 
        
           |  |  | 257 |      */
 | 
        
           |  |  | 258 |     $('button.btn-add-form').click(function(e) {
 | 
        
           |  |  | 259 |         $("#rows").html('');
 | 
        
           |  |  | 260 |         sections = [];
 | 
        
           |  |  | 261 |         $('#form-main').attr('action', '$routeAdd');
 | 
        
           |  |  | 262 |         $('#form-main #form-name').val('');
 | 
        
           |  |  | 263 |         $('#form-main #job_description_id').val('').trigger('change');
 | 
        
           |  |  | 264 |         $('#form-main #form-status').val('$status_active');
 | 
        
           |  |  | 265 |         CKEDITOR.instances['form-description'].setData('');
 | 
        
           |  |  | 266 |         renderCompetenciesData([]);
 | 
        
           |  |  | 267 |         $('#row-lists').hide();
 | 
        
           |  |  | 268 |         $('#row-form').show();
 | 
        
           |  |  | 269 |         $('#form-main #form-name').focus();
 | 
        
           |  |  | 270 |         return;
 | 
        
           |  |  | 271 |     });
 | 
        
           |  |  | 272 |     /**
 | 
        
           |  |  | 273 |      * Clicked cancel new/edit Form
 | 
        
           |  |  | 274 |      */
 | 
        
           |  |  | 275 |     $('button.btn-edit-cancel').click(function(e) {
 | 
        
           |  |  | 276 |         $('#row-form').hide();
 | 
        
           |  |  | 277 |         $('#row-lists').show();
 | 
        
           |  |  | 278 |         return;
 | 
        
           |  |  | 279 |     });
 | 
        
           |  |  | 280 |     /**
 | 
        
           |  |  | 281 |      * Clicked save and continue new Form
 | 
        
           |  |  | 282 |      */
 | 
        
           |  |  | 283 |     $('button.btn-form-save-continue').click(function(e) {
 | 
        
           |  |  | 284 |         for (var instanceName in CKEDITOR.instances) {
 | 
        
           |  |  | 285 |             CKEDITOR.instances[instanceName].updateElement();
 | 
        
           | 11960 | stevensc | 286 |         }
 | 
        
           | 15073 | stevensc | 287 |         saveData(1);
 | 
        
           |  |  | 288 |     });
 | 
        
           |  |  | 289 |     /**
 | 
        
           |  |  | 290 |      * Clicked save and close new/edit Form
 | 
        
           |  |  | 291 |      */
 | 
        
           |  |  | 292 |     $('button.btn-form-save-close').click(function(e) {
 | 
        
           |  |  | 293 |         for (var instanceName in CKEDITOR.instances) {
 | 
        
           |  |  | 294 |             CKEDITOR.instances[instanceName].updateElement();
 | 
        
           |  |  | 295 |         }
 | 
        
           |  |  | 296 |         saveData(0);
 | 
        
           |  |  | 297 |     });
 | 
        
           |  |  | 298 |     /**
 | 
        
           |  |  | 299 |      * Save Form Data
 | 
        
           |  |  | 300 |      */
 | 
        
           |  |  | 301 |     const saveData = (action) => {
 | 
        
           |  |  | 302 |         if ($('#form-name').val() == '') {
 | 
        
           |  |  | 303 |             $.fn.showError('ERROR_ENTER_NAME');
 | 
        
           |  |  | 304 |         } else if ($('#form-description').val() == '') {
 | 
        
           |  |  | 305 |             $.fn.showError('ERROR_ENTER_DESCRIPTION');
 | 
        
           |  |  | 306 |         } else if ($('#form-text').val() == '') {
 | 
        
           |  |  | 307 |             $.fn.showError('ERROR_ENTER_TEXT');
 | 
        
           |  |  | 308 |         } else if ($('#form-status').val() == '') {
 | 
        
           |  |  | 309 |             $.fn.showError('ERROR_SELECT_STATUS');
 | 
        
           |  |  | 310 |         } else if ($('#job_description_id').val() == '') {
 | 
        
           |  |  | 311 |             $.fn.showError('ERROR_SELECT_JOB_DESCRIPTION');
 | 
        
           |  |  | 312 |         } else {
 | 
        
           |  |  | 313 |             $.ajax({
 | 
        
           |  |  | 314 |                 'dataType': 'json',
 | 
        
           |  |  | 315 |                 'method': 'post',
 | 
        
           |  |  | 316 |                 'url': $('#form-main').attr('action'),
 | 
        
           |  |  | 317 |                 'data': {
 | 
        
           |  |  | 318 |                     'name': $('#form-main #form-name').val(),
 | 
        
           |  |  | 319 |                     'job_description_id': $('#form-main #job_description_id').val(),
 | 
        
           |  |  | 320 |                     'status': $('#form-main #form-status').val(),
 | 
        
           |  |  | 321 |                     'description': $('#form-main #form-description').val(),
 | 
        
           |  |  | 322 |                     'content': JSON.stringify(sections)
 | 
        
           |  |  | 323 |                 },
 | 
        
           |  |  | 324 |             }).done(function(response) {
 | 
        
           |  |  | 325 |                 if (response['success']) {
 | 
        
           |  |  | 326 |                     $.fn.showSuccess(response['data']);
 | 
        
           |  |  | 327 |                     if (action == 1) {
 | 
        
           |  |  | 328 |                         $('#form-main').attr('action', response['action_edit']);
 | 
        
           |  |  | 329 |                     } else {
 | 
        
           |  |  | 330 |                         $('#row-form').hide();
 | 
        
           |  |  | 331 |                         $('#row-lists').show();
 | 
        
           |  |  | 332 |                         /*---------- Reset Form -------- */
 | 
        
           |  |  | 333 |                         $('#form-main')[0].reset();
 | 
        
           |  |  | 334 |                         /*--------Reset Sections ----------*/
 | 
        
           |  |  | 335 |                         sections = [];
 | 
        
           |  |  | 336 |                         tableForm.fnDraw();
 | 
        
           |  |  | 337 |                     }
 | 
        
           |  |  | 338 |                     return;
 | 
        
           |  |  | 339 |                 } else {
 | 
        
           |  |  | 340 |                     $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
 | 
        
           |  |  | 341 |                     return;
 | 
        
           |  |  | 342 |                 }
 | 
        
           |  |  | 343 |             });
 | 
        
           |  |  | 344 |         }
 | 
        
           |  |  | 345 |     }
 | 
        
           |  |  | 346 |     /**
 | 
        
           |  |  | 347 |      * Remove Html Tags
 | 
        
           |  |  | 348 |      */
 | 
        
           |  |  | 349 |     const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
 | 
        
           |  |  | 350 |     /**
 | 
        
           |  |  | 351 |   | 
        
           |  |  | 352 |     /**
 | 
        
           |  |  | 353 |      * Clicked refresh button
 | 
        
           |  |  | 354 |      */
 | 
        
           |  |  | 355 |     $('button.btn-refresh').click(function(e) {
 | 
        
           |  |  | 356 |         tableForm.fnDraw();
 | 
        
           |  |  | 357 |         return;
 | 
        
           |  |  | 358 |     });
 | 
        
           |  |  | 359 |     /**
 | 
        
           |  |  | 360 |      * Initialize select Jobdescription
 | 
        
           |  |  | 361 |      */
 | 
        
           |  |  | 362 |     $('#job_description_id').select2({
 | 
        
           |  |  | 363 |         theme: 'bootstrap4',
 | 
        
           |  |  | 364 |         width: '100%',
 | 
        
           |  |  | 365 |     });
 | 
        
           |  |  | 366 |     /**
 | 
        
           |  |  | 367 |      * On change selecte JobDescription
 | 
        
           |  |  | 368 |      */
 | 
        
           |  |  | 369 |     $('#job_description_id').on('change', function() {
 | 
        
           |  |  | 370 |         if ($("#job_description_id").val() != '') {
 | 
        
           |  |  | 371 |             $.getJSON("/settings/jobs-description/edit/" + $("#job_description_id").val(), function(response) {
 | 
        
           |  |  | 372 |                 if (response['success']) {
 | 
        
           |  |  | 373 |                     competencies_type = response['data']['competency_types'];
 | 
        
           |  |  | 374 |                     renderCompetenciesData(response['data']['competencies_selected']);
 | 
        
           |  |  | 375 |                 }
 | 
        
           |  |  | 376 |             });
 | 
        
           |  |  | 377 |         }
 | 
        
           |  |  | 378 |     });
 | 
        
           |  |  | 379 |     /**
 | 
        
           |  |  | 380 |      * Filter competencie type
 | 
        
           |  |  | 381 |      */
 | 
        
           |  |  | 382 |     const filterTypeById = (id) => competencies_type.filter((item) => item.competency_type_id == id ? item : false)[0];
 | 
        
           |  |  | 383 |     /**
 | 
        
           |  |  | 384 |      * Render Competencies data
 | 
        
           |  |  | 385 |      */
 | 
        
           |  |  | 386 |     const renderCompetenciesData = (data) => {
 | 
        
           |  |  | 387 |         if (data.length > 0) {
 | 
        
           |  |  | 388 |             $("#competencies-to-job").show();
 | 
        
           |  |  | 389 |             $("#rows-job-competencies").html($("#sectionCompetencies").render(data, {
 | 
        
           |  |  | 390 |                 getType: filterTypeById
 | 
        
           |  |  | 391 |             }));
 | 
        
           |  |  | 392 |         } else {
 | 
        
           |  |  | 393 |             $("#competencies-to-job").hide();
 | 
        
           |  |  | 394 |             $("#rows-job-competencies").html('');
 | 
        
           |  |  | 395 |         }
 | 
        
           |  |  | 396 |     }
 | 
        
           |  |  | 397 | });
 | 
        
           | 11960 | stevensc | 398 | JS;
 | 
        
           |  |  | 399 |   | 
        
           | 15073 | stevensc | 400 | $this->inlineScript()->captureEnd();
 | 
        
           | 977 | geraldo | 401 | ?>
 | 
        
           | 15073 | stevensc | 402 | <!-- Content Header (Page header) -->
 | 
        
           |  |  | 403 | <section class="content-header">
 | 
        
           |  |  | 404 |    <div class="container-fluid">
 | 
        
           |  |  | 405 |       <div class="row mb-2">
 | 
        
           |  |  | 406 |          <div class="col-sm-12">
 | 
        
           |  |  | 407 |             <h1>LABEL_PERFORMANCE_EVALUATION</h1>
 | 
        
           |  |  | 408 |          </div>
 | 
        
           |  |  | 409 |       </div>
 | 
        
           |  |  | 410 |    </div>
 | 
        
           |  |  | 411 |    <!-- /.container-fluid -->
 | 
        
           |  |  | 412 | </section>
 | 
        
           |  |  | 413 | <section class="content">
 | 
        
           |  |  | 414 | <div class="container-fluid" id="row-lists">
 | 
        
           |  |  | 415 |    <div class="row">
 | 
        
           |  |  | 416 |       <div class="col-12">
 | 
        
           |  |  | 417 |          <div class="card">
 | 
        
           |  |  | 418 |             <div class="card-body">
 | 
        
           |  |  | 419 |                <table id="gridTable" class="table   table-hover">
 | 
        
           |  |  | 420 |                   <thead>
 | 
        
           |  |  | 421 |                      <tr>
 | 
        
           |  |  | 422 |                         <th style="width:25%">LABEL_NAME</th>
 | 
        
           |  |  | 423 |                         <th style="width:20%">LABEL_JOB_DESCRIPTION</th>
 | 
        
           |  |  | 424 |                         <th style="width:10%">LABEL_ACTIVE</th>
 | 
        
           |  |  | 425 |                         <th style="width:25%">LABEL_ACTIONS</th>
 | 
        
           |  |  | 426 |                      </tr>
 | 
        
           |  |  | 427 |                   </thead>
 | 
        
           |  |  | 428 |                   <tbody></tbody>
 | 
        
           |  |  | 429 |                </table>
 | 
        
           |  |  | 430 |             </div>
 | 
        
           |  |  | 431 |             <div class="card-footer clearfix">
 | 
        
           |  |  | 432 |                <div style="float:right;">
 | 
        
           |  |  | 433 |                   <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
 | 
        
           |  |  | 434 |                   <?php if ($allowAdd) : ?>
 | 
        
           |  |  | 435 |                   <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
 | 
        
           |  |  | 436 |                   <?php endif; ?>
 | 
        
           |  |  | 437 |                </div>
 | 
        
           |  |  | 438 |             </div>
 | 
        
           |  |  | 439 |          </div>
 | 
        
           |  |  | 440 |       </div>
 | 
        
           |  |  | 441 |    </div>
 | 
        
           |  |  | 442 | </div>
 | 
        
           |  |  | 443 | <!-- Create/Edit Form -->
 | 
        
           |  |  | 444 | <div class="row" id="row-form" style="display: none; padding: 16px;">
 | 
        
           |  |  | 445 |    <div class="col-xs-12 col-md-12">
 | 
        
           |  |  | 446 |       <form action="#" name="form-main" id="form-main">
 | 
        
           |  |  | 447 |          <div class="form-group">
 | 
        
           |  |  | 448 |             <label for="form-name">LABEL_FIRST_NAME</label>
 | 
        
           |  |  | 449 |             <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
 | 
        
           |  |  | 450 |          </div>
 | 
        
           |  |  | 451 |          <div class="form-group">
 | 
        
           |  |  | 452 |             <label for="job_description_id">LABEL_POSITION_EVALUATED</label>
 | 
        
           |  |  | 453 |             <select name="job_description_id" id="job_description_id" class="form-control">
 | 
        
           |  |  | 454 |                <option value="">LABEL_SELECT</option>
 | 
        
           |  |  | 455 |                <?php foreach ($jobsDescription as $rs): ?>
 | 
        
           |  |  | 456 |                <option value="<?php echo $rs->uuid;?>"><?php echo $rs->name;?></option>
 | 
        
           |  |  | 457 |                <?php endforeach; ?>
 | 
        
           |  |  | 458 |             </select>
 | 
        
           |  |  | 459 |          </div>
 | 
        
           |  |  | 460 |          <div class="form-group">
 | 
        
           |  |  | 461 |             <label for="form-description">LABEL_DESCRIPTION</label>
 | 
        
           |  |  | 462 |             <!--  ckeditor -->
 | 
        
           |  |  | 463 |             <textarea  name="form-description" id="form-description" rows="5" class="ckeditor form-control"></textarea>
 | 
        
           |  |  | 464 |          </div>
 | 
        
           |  |  | 465 |          <div class="form-group">
 | 
        
           |  |  | 466 |             <label for="form-status">LABEL_STATUS</label>
 | 
        
           |  |  | 467 |             <select name="form-status" id="form-status" class="form-control">
 | 
        
           |  |  | 468 |                <option value="<?php echo $status_inactive; ?>">LABEL_INACTIVE</option>
 | 
        
           |  |  | 469 |                <option value="<?php echo $status_active; ?>">LABEL_ACTIVE</option>
 | 
        
           |  |  | 470 |             </select>
 | 
        
           |  |  | 471 |          </div>
 | 
        
           |  |  | 472 |   | 
        
           |  |  | 473 |          <br />
 | 
        
           |  |  | 474 |          <div class="row">
 | 
        
           |  |  | 475 |             <div class="col-xs-12 col-md-12">
 | 
        
           |  |  | 476 |                <div class="panel-group" id="rows"></div>
 | 
        
           |  |  | 477 |             </div>
 | 
        
           |  |  | 478 |          </div>
 | 
        
           |  |  | 479 |          <div class="form-group" id="competencies-to-job" style="display:none">
 | 
        
           |  |  | 480 |             <div class="row">
 | 
        
           |  |  | 481 |                <div class="col-xs-12 col-md-12">
 | 
        
           |  |  | 482 |                   <hr>
 | 
        
           |  |  | 483 |                   <h4 style="font-size: 18px;font-weight: bold;">LABEL_COMPETENCIES_TO_JOB:</h4>
 | 
        
           |  |  | 484 |                   <br>
 | 
        
           |  |  | 485 |                   <div class="panel-group" id="rows-job-competencies"></div>
 | 
        
           |  |  | 486 |                </div>
 | 
        
           |  |  | 487 |             </div>
 | 
        
           |  |  | 488 |          </div>
 | 
        
           |  |  | 489 |          <div class="form-group">
 | 
        
           |  |  | 490 |             <button type="button" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
 | 
        
           |  |  | 491 |             <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
 | 
        
           |  |  | 492 |             <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
 | 
        
           |  |  | 493 |          </div>
 | 
        
           |  |  | 494 |       </form>
 | 
        
           |  |  | 495 |    </div>
 | 
        
           |  |  | 496 | </div>
 | 
        
           |  |  | 497 | <!-- Create/Edit Form-->
 | 
        
           | 11960 | stevensc | 498 |   | 
        
           | 15073 | stevensc | 499 |   | 
        
           |  |  | 500 |   <!---Template Competencies --->
 | 
        
           |  |  | 501 |    <script id="sectionCompetencies" type="text/x-jsrender">
 | 
        
           |  |  | 502 |    <div class="panel panel-default" id="panel-{{:competency_id}}">
 | 
        
           |  |  | 503 |    <div class="panel-heading">
 | 
        
           |  |  | 504 |       <h4 class="panel-title" style="font-size: 18px;">
 | 
        
           |  |  | 505 |          <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:competency_id}}" href="#collapse-{{:competency_id}}">
 | 
        
           |  |  | 506 |          <span class="competency-name{{:competency_id}}">
 | 
        
           |  |  | 507 |          {{:~getType(competency_type_id).name}} - {{:name}}
 | 
        
           |  |  | 508 |          </span>
 | 
        
           |  |  | 509 |          </a>
 | 
        
           |  |  | 510 |       </h4>
 | 
        
           |  |  | 511 |    </div>
 | 
        
           |  |  | 512 |    <div id="collapse-{{:competency_id}}" class="panel-collapse in collapse show">
 | 
        
           |  |  | 513 |       <div class="panel-body">
 | 
        
           |  |  | 514 |          <div class="table-responsive">
 | 
        
           |  |  | 515 |             <table class="table table-bordered">
 | 
        
           |  |  | 516 |                <thead>
 | 
        
           |  |  | 517 |                   <tr>
 | 
        
           |  |  | 518 |                      <th style="width: 80%;">LABEL_CONDUCT</th>
 | 
        
           |  |  | 519 |                      <th style="width: 20%;">LABEL_LEVEL</th>
 | 
        
           |  |  | 520 |                   </tr>
 | 
        
           |  |  | 521 |                </thead>
 | 
        
           |  |  | 522 |                <tbody>
 | 
        
           |  |  | 523 |                   {{for behaviors}}
 | 
        
           |  |  | 524 |                   <tr >
 | 
        
           |  |  | 525 |                      <td class="text-left">
 | 
        
           |  |  | 526 |                         {{:description}}
 | 
        
           |  |  | 527 |                      </td>
 | 
        
           |  |  | 528 |                      <td>
 | 
        
           |  |  | 529 |                         {{if level == '0'}} LABEL_NA {{/if}}
 | 
        
           |  |  | 530 |                         {{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
 | 
        
           |  |  | 531 |                         {{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
 | 
        
           |  |  | 532 |                         {{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
 | 
        
           |  |  | 533 |                         {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
 | 
        
           |  |  | 534 |                      </td>
 | 
        
           |  |  | 535 |   | 
        
           |  |  | 536 |   | 
        
           |  |  | 537 |                   </tr>
 | 
        
           |  |  | 538 |                   {{/for}}
 | 
        
           |  |  | 539 |                </tbody>
 | 
        
           |  |  | 540 |             </table>
 | 
        
           |  |  | 541 |          </div>
 | 
        
           |  |  | 542 |       </div>
 | 
        
           |  |  | 543 |    </div>
 | 
        
           | 12154 | stevensc | 544 | </div>
 | 
        
           | 15073 | stevensc | 545 |    </script>
 | 
        
           |  |  | 546 |     <!-- End Template Competencies-->
 | 
        
           |  |  | 547 |   | 
        
           |  |  | 548 | </section>
 |