Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 186 Rev 187
Línea 520... Línea 520...
520
                    return s;
520
                    return s;
521
                }
521
                }
522
            }
522
            }
523
        ],
523
        ],
524
    });
524
    });
525
    $('body').on('click', 'a.btn-delete-form', function(e) {
-
 
526
        e.preventDefault();
-
 
527
        form_id = $(this).data('id')
-
 
528
        bootbox.confirm({
-
 
529
            title: "LABEL_DELETE LABEL_FORM",
-
 
530
            message: "LABEL_QUESTION_DELETE",
-
 
531
            buttons: {
-
 
532
                cancel: {
-
 
533
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
-
 
534
                },
-
 
535
                confirm: {
-
 
536
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
-
 
537
                }
-
 
538
            },
-
 
539
            callback: function(result) {
-
 
540
                if (result) {
-
 
541
                    $.ajax({
-
 
542
                        'dataType': 'json',
-
 
543
                        'method': 'post',
-
 
544
                        'url': 'ajax.<?php echo $this->module; ?>.php?action=delete',
-
 
545
                        'data': {
-
 
546
                            'form-id': form_id
-
 
547
                        },
-
 
548
                    }).done(function(response) {
-
 
549
                        if (response['success']) {
-
 
550
                            $.fn.showSuccess(response['message']);
-
 
551
                            tableForm.fnDraw();
-
 
552
                        } else {
-
 
553
                            $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
-
 
554
                        }
-
 
555
                    }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
556
                        $.fn.showError(textStatus);
-
 
557
                    });
-
 
558
                }
-
 
559
            }
-
 
560
        });
-
 
561
    });
-
 
562
    $(document).on('click', '[data-action="delete"]', function() {
-
 
563
        bootbox.confirm({
-
 
564
            title: "LABEL_DELETE LABEL_FORMS_2",
-
 
565
            message: "LABEL_QUESTION_DELETE",
-
 
566
            buttons: {
-
 
567
                cancel: {
-
 
568
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
-
 
569
                },
-
 
570
                confirm: {
-
 
571
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
-
 
572
                }
-
 
573
            },
-
 
574
            callback: function(result) {
-
 
575
                if (result) {
-
 
576
                    var d = currentSelected();
-
 
577
                    $.ajax({
-
 
578
                        'dataType': 'json',
-
 
579
                        'method': 'post',
-
 
580
                        'url': 'ajax.<?php echo $this->module; ?>.php?action=delete-selected',
-
 
581
                        'data': {
-
 
582
                            selected: d
-
 
583
                        },
-
 
584
                    }).done(function(response) {
-
 
585
                        if (response['success']) {
-
 
586
                            $.fn.showSuccess(response['message']);
-
 
587
                            tableForm.fnDraw();
-
 
588
                        } else {
-
 
589
                            $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
-
 
590
                        }
-
 
591
                    }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
592
                        $.fn.showError(textStatus);
-
 
593
                    });
-
 
594
                }
-
 
595
            }
-
 
596
        });
-
 
597
    });
-
 
598
    $('body').on('switch-change', 'input[type="checkbox"].make-switch-form', function(e) {
-
 
599
        e.preventDefault();
-
 
600
        e.stopPropagation();
-
 
601
        form_id = $(this).data('id')
-
 
602
        form_status = $(this).prop('checked') ? 'A' : 'D';
-
 
603
        $.ajax({
-
 
604
            'dataType': 'json',
-
 
605
            'method': 'post',
-
 
606
            'url': 'ajax.<?php echo $this->module; ?>.php?action=status',
-
 
607
            'data': {
-
 
608
                'form-id': form_id,
-
 
609
                'form-status': form_status
-
 
610
            },
-
 
611
        }).done(function(response) {
-
 
612
            if (response['success']) {
-
 
613
                $.fn.showSuccess(response['message']);
-
 
614
            } else {
-
 
615
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
-
 
616
            }
-
 
617
        }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
618
            $.fn.showError(textStatus);
-
 
619
        })
-
 
620
    });
525
    
621
    $('body').on('click', 'button.btn-edit-form', function(e) {
526
    $('body').on('click', 'button.btn-edit-form', function(e) {
622
        e.preventDefault();
527
        e.preventDefault();
623
        form_id = $(this).data('id')
528
        form_id = $(this).data('id')
624
        var action = $(this).data('href');
529
        var action = $(this).data('href');
625
        $.ajax({
530
        $.ajax({
Línea 844... Línea 749...
844
                        'name': $('#form-main #form-name').val(),
749
                        'name': $('#form-main #form-name').val(),
845
                        'description': $('#form-main #form-description').val(),
750
                        'description': $('#form-main #form-description').val(),
846
                        'text': $('#form-main #form-text').val(),
751
                        'text': $('#form-main #form-text').val(),
847
                        'language': $('#form-main #form-language').val(),
752
                        'language': $('#form-main #form-language').val(),
848
                        'status': $('#form-main #form-status').val(),
753
                        'status': $('#form-main #form-status').val(),
849
                        'sections': objFormGenerator.sections
754
                        'content': JSON.stringify(objFormGenerator.sections)
850
                    }
755
                    }
851
                    $.ajax({
756
                    $.ajax({
852
                        'dataType': 'json',
757
                        'dataType': 'json',
853
                        'method': 'post',
758
                        'method': 'post',
854
                        'url': '$routeAdd',
759
                        'url': '$routeAdd',