Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1132 Rev 1133
Línea 486... Línea 486...
486
                'description': description
486
                'description': description
487
            }
487
            }
488
        }).done(function(response) {
488
        }).done(function(response) {
489
            if (response['success']) {
489
            if (response['success']) {
490
                behaviors.push({
490
                behaviors.push({
491
                    'id': new Date().getTime(),
491
                    'id': response['uuid'],
492
                    'description': description
492
                    'description': description
493
                });
493
                });
494
                renderData(behaviors);
494
                renderData(behaviors);
495
            } else {
495
            } else {
496
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
496
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
Línea 532... Línea 532...
532
    /**
532
    /**
533
     * Render Sections data
533
     * Render Sections data
534
     */
534
     */
535
    const renderData = (data) => {
535
    const renderData = (data) => {
536
        getAllBehaviors();
536
        getAllBehaviors();
537
        if(data.length>0){
537
        data.length > 0 ?
538
            $("#rows").html($("#behaviorTemplate").render(data));
538
            $("#rows").html($("#behaviorTemplate").render(data)) :
539
        }else{
-
 
540
            $("#rows").html('')
539
            $("#rows").html('')
541
        }
-
 
542
    }
540
    }
543
    /**
541
    /**
544
     * get alls Behavios
542
     * get alls Behavios
545
     */
543
     */
546
    const getAllBehaviors = () => {
544
    const getAllBehaviors = () => {
Línea 549... Línea 547...
549
            $('#select-conduct').append($('<option>', {
547
            $('#select-conduct').append($('<option>', {
550
                value: '',
548
                value: '',
551
                text: 'LABEL_SELECT'
549
                text: 'LABEL_SELECT'
552
            }));
550
            }));
553
            $.each(data.data, function(i, item) {
551
            $.each(data.data, function(i, item) {
554
 
-
 
555
                if(!behaviors.filter((i)=>i.id ==item.uiid)){
552
                if (!filterItemById(item.uiid)) {
556
                    $('#select-conduct').append($('<option>', {
553
                    $('#select-conduct').append($('<option>', {
557
                    value: item.uuid,
554
                        value: item.uuid,
558
                    text: item.description
555
                        text: item.description
559
                }));
556
                    }));
560
                }
557
                }
561
 
-
 
562
            });
558
            });
563
        });
559
        });
564
    }
560
    }
565
    /**
561
    /**
566
     * Clicked cancel new/edit Form
562
     * Clicked cancel new/edit Form
Línea 575... Línea 571...
575
                'description': $('select[name="select-conduct"] option:selected').text()
571
                'description': $('select[name="select-conduct"] option:selected').text()
576
            });
572
            });
577
            renderData(behaviors);
573
            renderData(behaviors);
578
        }
574
        }
579
    });
575
    });
-
 
576
    const filterItemById = (id) => behaviors.filter((i) => i.id == item.uiid ? item : false);
580
});
577
});
Línea 581... Línea 578...
581
 
578
 
582
JS;
579
JS;
583
$this->inlineScript()->captureEnd();
580
$this->inlineScript()->captureEnd();