                </div>                
            </div>
        </div>

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <script src="<?php echo URL; ?>/assets/js/bootstrap.min.js"></script>
        <script>
            $(document).ready(function() {
               
                  
                $("#slug_ce").change(function() {
                  
                   var url = window.location.origin + window.location.pathname+"?slug_ce="+$("#slug_ce option:selected").val()+"&ld=0";
                   location.href=url;
                   
                });
                
                $("#slug_ce2").change(function() {
                  
                   var url = window.location.origin + window.location.pathname+"?slug_ce2="+$("#slug_ce2 option:selected").val()+"&ld=2";
                   location.href=url;
                   
                });
                
                
                // Chamada de Encalhe Abertas
                if(window.location.pathname == "/eed/homologacao/adm/controle-artigo/index") {
                    $.urlParam = function (name) {
                        var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                                          .exec(window.location.href);
                        //print_r(results);
                        //die; 
                        
                        if(!results[1]) {
                         return "0";   
                        } else {
                         return results[1];   
                        }
                        if(!results[3]) {
                         return "2";   
                        } else {
                         return results[3];   
                        } 
                         
                    }

                    if($.urlParam('ld') == "0") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce="+$.urlParam('slug_ce')+"&ld=1";
                        location.href=url;
                    }
                    if($.urlParam('ld') == "2") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce2="+$.urlParam('slug_ce2')+"&ld=3";
                        location.href=url;
                    }
                    
                }
                // Chamada de Encalhe Fechadas
                if(window.location.pathname == "/eed/homologacao/adm/controle-artigo/index2") {
                    $.urlParam = function (name) {
                        var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                                          .exec(window.location.href);
                        //print_r(results);
                        //die; 
                        
                        if(!results[1]) {
                         return "0";   
                        } else {
                         return results[1];   
                        }
                        if(!results[3]) {
                         return "2";   
                        } else {
                         return results[3];   
                        } 
                         
                    }

                    if($.urlParam('ld') == "0") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce="+$.urlParam('slug_ce')+"&ld=1";
                        location.href=url;
                    }
                    if($.urlParam('ld') == "2") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce2="+$.urlParam('slug_ce2')+"&ld=3";
                        location.href=url;
                    }
                    
                }
                
                
                 if(window.location.pathname == "/eed/homologacao/adm/controle-artigo/index3") {
                    $.urlParam = function (name) {
                        var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                                          .exec(window.location.href);
                        //print_r(results);
                        //die; 
                        
                        if(!results[1]) {
                         return "0";   
                        } else {
                         return results[1];   
                        }
                        if(!results[3]) {
                         return "2";   
                        } else {
                         return results[3];   
                        } 
                         
                    }

                    if($.urlParam('ld') == "0") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce="+$.urlParam('slug_ce')+"&ld=1";
                        location.href=url;
                    }
                     if($.urlParam('ld') == "2") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce2="+$.urlParam('slug_ce2')+"&ld=3";
                        location.href=url;
                    }
                    
                }
                // RCE por Distribuidor Agrupado
                if(window.location.pathname == "/eed/homologacao/adm/controle-artigo/index4") {
                    $.urlParam = function (name) {
                        var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                                          .exec(window.location.href);
                        //print_r(results);
                        //die; 
                        
                        if(!results[1]) {
                         return "0";   
                        } else {
                         return results[1];   
                        }
                         if(!results[3]) {
                         return "2";   
                        } else {
                         return results[3];   
                        } 
                    }

                    if($.urlParam('ld') == "0") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce="+$.urlParam('slug_ce')+"&ld=1";
                        location.href=url;
                    }
                     if($.urlParam('ld') == "2") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce2="+$.urlParam('slug_ce2')+"&ld=3";
                        location.href=url;
                    }
                    
                    
                }
                // RCE por Distribuidor Analítico
                 if(window.location.pathname == "/eed/homologacao/adm/controle-artigo/index5") {
                    $.urlParam = function (name) {
                        var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                                          .exec(window.location.href);
                        //print_r(results);
                        //die; 
                        
                        if(!results[1]) {
                         return "0";   
                        } else {
                         return results[1];   
                        }
                        
                        if(!results[3]) {
                         return "2";   
                        } else {
                         return results[3];   
                        }
                         
                    }

                    if($.urlParam('ld') == "0") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce="+$.urlParam('slug_ce')+"&ld=1";
                        location.href=url;
                        
                    }
                    if($.urlParam('ld') == "2") {
                        var url = window.location.origin + window.location.pathname+"?slug_ce2="+$.urlParam('slug_ce2')+"&ld=3";
                        location.href=url;
                    }
                    
                }
                
            });
        </script>    
    </body>
</html>