Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 5194 Rev 5206
Línea 301... Línea 301...
301
            invalidHandler: function(form, validator) {
301
            invalidHandler: function(form, validator) {
Línea 302... Línea 302...
302
            
302
            
303
            }
303
            }
Línea 304... Línea -...
304
        });
-
 
305
        
-
 
306
        $('body').on('click', 'button.btn-add', function(e) {
-
 
307
            e.preventDefault();
-
 
308
 
-
 
309
            $('span[id="form-title"]').html('LABEL_ADD');
-
 
310
            $('#form').attr('action', '$routeAdd');
-
 
311
            $('#form #name').val('');
-
 
312
            $('#form #minimum_no_of_employee').val('');
-
 
313
            $('#form #maximum_no_of_employee').val('');
-
 
314
            $('#form #status').bootstrapToggle('on');
-
 
315
 
-
 
316
 
-
 
317
            validator.resetForm();
-
 
318
            $('#modal').modal('show');
-
 
319
        });
-
 
320
        
-
 
321
        $('body').on('click', 'button.btn-edit', function(e) {
-
 
322
            e.preventDefault();
-
 
323
            NProgress.start();
-
 
324
            var action = $(this).data('href');
-
 
325
 
-
 
326
            $.ajax({
-
 
327
                'dataType'  : 'json',
-
 
328
                'accept'    : 'application/json',
-
 
329
                'method'    : 'get',
-
 
330
                'url'       :  action,
-
 
331
            }).done(function(response) {
-
 
332
                if(response['success']) {
-
 
333
 
-
 
334
                    $('span[id="form-title"]').html('LABEL_EDIT');
-
 
335
                    $('#form').attr('action', action);
-
 
336
                    $('#form #name').val(response['data']['name']);
-
 
337
                    $('#form #minimum_no_of_employee').val(response['data']['minimum_no_of_employee']);
-
 
338
                    $('#form #maximum_no_of_employee').val(response['data']['maximum_no_of_employee']);
-
 
339
                    $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
-
 
340
                    validator.resetForm();
-
 
341
                    
-
 
342
                    $('#modal').modal('show');
-
 
343
                } else {
-
 
344
                    $.fn.showError(response['data']);
-
 
345
                }
-
 
346
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
347
                $.fn.showError(textStatus);
-
 
348
            }).always(function() {
-
 
349
                NProgress.done();
-
 
350
            });
-
 
351
        });
304
        });
352
 
305
        
353
        $('body').on('click', 'button.btn-refresh', function(e) {
306
        $('body').on('click', 'button.btn-refresh', function(e) {
354
            e.preventDefault();
307
            e.preventDefault();
Línea 355... Línea -...
355
            gridTable.api().ajax.reload(null, false);
-
 
356
        });
-
 
357
        
-
 
358
 
-
 
359
        $('body').on('click', 'button.btn-cancel', function(e) {
-
 
360
            e.preventDefault();
-
 
361
            $('#modal').modal('hide');
308
            gridTable.api().ajax.reload(null, false);
Línea 362... Línea 309...
362
        });
309
        });
363
        
310
        
364
        $('#form #status').bootstrapToggle({'on' : 'LABEL_ACTIVE',  'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});
311
        $('#form #status').bootstrapToggle({'on' : 'LABEL_ACTIVE',  'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});