resources/assets/js/report.js
/**
     * @desc  Clones existing DOM element and generates unique id for each child
     */
@desc  Clones existing DOM element and generates unique id for each child
@desc Clones existing DOM element and generates unique id for each child
function duplicateElement(){
        var $uniqueCounterElm,$uniqueCounter,$clonedElement,$parentContainer,$cloneTargetElement,$this;
        $this = $(this);
        $uniqueCounterElm = $('#unique-counter');
        $uniqueCounter = parseInt($uniqueCounterElm.val());
        $uniqueCounterElm.val(++$uniqueCounter);
        $cloneTargetElement = $this.closest($this.data('target'));
        $parentContainer = $cloneTargetElement.parent();
        $clonedElement = $cloneTargetElement.clone();
        clearInputsAndEditors($clonedElement);
        replaceIds($clonedElement,$uniqueCounter);
        replaceLabels($clonedElement,$uniqueCounter);
        replaceNames($clonedElement,$uniqueCounter);
        replaceDataTarget($clonedElement,$uniqueCounter);
        trancuateClonedInputs($clonedElement);
        showRemoveButton($clonedElement);
        $parentContainer.append($clonedElement);
        initEditors($clonedElement);
        if($this.data('scroll')){
            $('body, html').animate({ scrollTop: $($clonedElement).offset().top-100 }, 1000);
        }
    }
function duplicateElement ( ) { var $uniqueCounterElm , $uniqueCounter , $clonedElement , $parentContainer , $cloneTargetElement , $this ; $this = $ ( this ) ; $uniqueCounterElm = $ ( '#unique-counter' ) ; $uniqueCounter = parseInt ( $uniqueCounterElm . val ( ) ) ; $uniqueCounterElm . val ( ++ $uniqueCounter ) ; $cloneTargetElement = $this . closest ( $this . data ( 'target' ) ) ; $parentContainer = $cloneTargetElement . parent ( ) ; $clonedElement = $cloneTargetElement . clone ( ) ; clearInputsAndEditors ( $clonedElement ) ; replaceIds ( $clonedElement , $uniqueCounter ) ; replaceLabels ( $clonedElement , $uniqueCounter ) ; replaceNames ( $clonedElement , $uniqueCounter ) ; replaceDataTarget ( $clonedElement , $uniqueCounter ) ; trancuateClonedInputs ( $clonedElement ) ; showRemoveButton ( $clonedElement ) ; $parentContainer . append ( $clonedElement ) ; initEditors ( $clonedElement ) ; if ( $this . data ( 'scroll' ) ) { $ ( 'body, html' ) . animate ( { scrollTop : $ ( $clonedElement ) . offset ( ) . top - 100 } , 1000 ) ; } }
@desc  Clones existing DOM element and generates unique id for each child
@desc Clones existing DOM element and generates unique id for each child
//Init editors for cloned inputs