Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 3071 Rev 3094
Línea 106... Línea 106...
106
                error.insertAfter(element.parent());
106
                error.insertAfter(element.parent());
107
            }
107
            }
108
        }
108
        }
109
    };
109
    };
Línea -... Línea 110...
-
 
110
 
-
 
111
    var gridTable = $('#gridTable').dataTable({
-
 
112
        'processing': true,
-
 
113
        'serverSide': true,
-
 
114
        'searching': true,
-
 
115
        'order': [
-
 
116
            [0, 'asc']
-
 
117
        ],
-
 
118
        'ordering': true,
-
 
119
        'ordenable': true,
-
 
120
        'responsive': true,
-
 
121
        'select': false,
-
 
122
        'paging': true,
-
 
123
        'pagingType': 'simple_numbers',
-
 
124
        'ajax': {
-
 
125
            'url': '$routeDatatable',
-
 
126
            'type': 'get',
-
 
127
            'beforeSend': function(request) {
-
 
128
                NProgress.start();
-
 
129
            },
-
 
130
            'dataFilter': function(response) {
-
 
131
                var response = jQuery.parseJSON(response);
-
 
132
                var json = {};
-
 
133
                json.recordsTotal = 0;
-
 
134
                json.recordsFiltered = 0;
-
 
135
                json.data = [];
-
 
136
                if (response.success) {
-
 
137
                    json.recordsTotal = response.data.total;
-
 
138
                    json.recordsFiltered = response.data.total;
-
 
139
                    json.data = response.data.items;
-
 
140
                } else {
-
 
141
                    $.fn.showError(response.data)
-
 
142
                }
-
 
143
                return JSON.stringify(json);
-
 
144
            }
-
 
145
        },
-
 
146
        'language': {
-
 
147
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
-
 
148
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
-
 
149
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
-
 
150
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
-
 
151
            'sInfo': 'LABEL_DATATABLE_SINFO',
-
 
152
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
-
 
153
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
-
 
154
            'sInfoPostFix': '',
-
 
155
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
-
 
156
            'sUrl': '',
-
 
157
            'sInfoThousands': ',',
-
 
158
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
-
 
159
            'oPaginate': {
-
 
160
                'sFirst': 'LABEL_DATATABLE_SFIRST',
-
 
161
                'sLast': 'LABEL_DATATABLE_SLAST',
-
 
162
                'sNext': 'LABEL_DATATABLE_SNEXT',
-
 
163
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
-
 
164
            },
-
 
165
            'oAria': {
-
 
166
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
-
 
167
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
-
 
168
            },
-
 
169
        },
-
 
170
        'drawCallback': function(settings) {
-
 
171
            NProgress.done();
-
 
172
            $('button.btn-delete').confirmation({
-
 
173
                rootSelector: 'button.btn-delete',
-
 
174
                title: 'LABEL_ARE_YOU_SURE',
-
 
175
                singleton: true,
-
 
176
                btnOkLabel: 'LABEL_YES',
-
 
177
                btnCancelLabel: 'LABEL_NO',
-
 
178
                onConfirm: function(value) {
-
 
179
                    action = $(this).data('href');
-
 
180
                    NProgress.start();
-
 
181
                    $.ajax({
-
 
182
                        'dataType': 'json',
-
 
183
                        'accept': 'application/json',
-
 
184
                        'method': 'post',
-
 
185
                        'url': action,
-
 
186
                    }).done(function(response) {
-
 
187
                        if (response['success']) {
-
 
188
                            $.fn.showSuccess(response['data']);
-
 
189
                            gridTable.api().ajax.reload(null, false);
-
 
190
                        } else {
-
 
191
                            $.fn.showError(response['data']);
-
 
192
                        }
-
 
193
                    }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
194
                        $.fn.showError(textStatus);
-
 
195
                    }).always(function() {
-
 
196
                        NProgress.done();
-
 
197
                    });
-
 
198
                },
-
 
199
            });
-
 
200
        },
-
 
201
        'aoColumns': [{
-
 
202
                'mDataProp': 'name'
-
 
203
            },
-
 
204
            {
-
 
205
                'mDataProp': 'status'
-
 
206
            },
-
 
207
            {
-
 
208
                'mDataProp': 'actions'
-
 
209
            },
-
 
210
        ],
-
 
211
        'columnDefs': [{
-
 
212
                'targets': 0,
-
 
213
                'className': 'text-vertical-middle',
-
 
214
            },
-
 
215
            {
-
 
216
                'targets': -2,
-
 
217
                'orderable': false,
-
 
218
                'className': 'text-center',
-
 
219
                'render': function(data, type, row) {
-
 
220
                    checked = data == 'a' ? ' checked="checked" ' : '';
-
 
221
                    return '<div class="checkbox checkbox-success">' +
-
 
222
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
-
 
223
                        '<label ></label></div>';
-
 
224
                }
-
 
225
            },
-
 
226
            {
-
 
227
                'targets': -1,
-
 
228
                'orderable': false,
-
 
229
                'render': function(data, type, row) {
-
 
230
                    s = '';
-
 
231
                    if (allowEdit) {
-
 
232
                        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;';
-
 
233
                    }
-
 
234
                    if (allowDelete) {
-
 
235
                        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;';
-
 
236
                    }
-
 
237
                    if (allowReport) {
-
 
238
                        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;';
-
 
239
                    }
-
 
240
                    return s;
-
 
241
                }
-
 
242
            }
-
 
243
        ],
-
 
244
    });
110
 
245
 
111
    function getContent() {
246
    function getContent() {
112
        return $('[data-competency-behavior]').map(
247
        return $('[data-competency-behavior]').map(
113
            function (idx, td) {
248
            function (idx, td) {
114
                const competencyUuid = $(td).data('competency-uuid');
249
                const competencyUuid = $(td).data('competency-uuid');