Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1116 Rev 1117
Línea 312... Línea 312...
312
        },
312
        },
313
        invalidHandler: function(form, validator) {}
313
        invalidHandler: function(form, validator) {}
314
    });
314
    });
315
    $('body').on('click', 'button.btn-add', function(e) {
315
    $('body').on('click', 'button.btn-add', function(e) {
316
        e.preventDefault();
316
        e.preventDefault();
-
 
317
        getAllBehavios();
317
        $('span[id="form-title"]').html('LABEL_ADD');
318
        $('span[id="form-title"]').html('LABEL_ADD');
318
        $('#form').attr('action', '$routeAdd');
319
        $('#form').attr('action', '$routeAdd');
319
        $('#form #name').val('');
320
        $('#form #name').val('');
320
        $('#form #competency_type_id').val('').trigger('change');
321
        $('#form #competency_type_id').val('').trigger('change');
321
        $('#form #status').bootstrapToggle('on');
322
        $('#form #status').bootstrapToggle('on');
Línea 328... Línea 329...
328
        return false;
329
        return false;
329
    });
330
    });
330
    $('body').on('click', 'button.btn-edit', function(e) {
331
    $('body').on('click', 'button.btn-edit', function(e) {
331
        e.preventDefault();
332
        e.preventDefault();
332
        NProgress.start();
333
        NProgress.start();
-
 
334
        getAllBehavios();
333
        var action = $(this).data('href');
335
        var action = $(this).data('href');
334
        $("#rows").html('');
336
        $("#rows").html('');
335
        $.ajax({
337
        $.ajax({
336
            'dataType': 'json',
338
            'dataType': 'json',
337
            'method': 'get',
339
            'method': 'get',
Línea 490... Línea 492...
490
                behaviors.push({
492
                behaviors.push({
491
                    'id': new Date().getTime(),
493
                    'id': new Date().getTime(),
492
                    'description': description
494
                    'description': description
493
                });
495
                });
494
                renderData(behaviors);
496
                renderData(behaviors);
-
 
497
                getAllBehavios();
495
            } else {
498
            } else {
496
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
499
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
497
            }
500
            }
498
        });
501
        });
499
    }
502
    }
Línea 515... Línea 518...
515
                    if (item.id == id) {
518
                    if (item.id == id) {
516
                        item.description = description;
519
                        item.description = description;
517
                    }
520
                    }
518
                });
521
                });
519
                renderData(behaviors);
522
                renderData(behaviors);
-
 
523
                getAllBehavios();
520
            } else {
524
            } else {
521
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
525
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
522
            }
526
            }
523
        });
527
        });
524
    }
528
    }
Línea 531... Línea 535...
531
    }
535
    }
532
    /**
536
    /**
533
     * Render Sections data
537
     * Render Sections data
534
     */
538
     */
535
    const renderData = (data) => $("#rows").html($("#behaviorTemplate").render(data));
539
    const renderData = (data) => $("#rows").html($("#behaviorTemplate").render(data));
-
 
540
    
536
    const getAllBehavios = () => {
541
    const getAllBehavios = () => {
537
        $.get("/settings/behaviors", function(data) {
542
        $.get("/settings/behaviors",headers: {          
-
 
543
            'accept': 'application/json',   
-
 
544
  }, function(data) {
538
            console.log(data);
545
            console.log(data);
-
 
546
 
-
 
547
            $.each(data.data, function (i, item) {
-
 
548
    $('#mySelect').append($('<option>', { 
-
 
549
        value: item.uuid,
-
 
550
        text : item.name 
-
 
551
    }));
-
 
552
});
539
        });
553
        });
540
    }
554
    }
541
    getAllBehavios();
-
 
542
});
555
});