templates/recherche/js.html.twig line 1

Open in your IDE?
  1.   <script type='text/javascript' >
  2.     $( function() {
  3.   
  4.          
  5.         // Multiple select
  6.         $( "#multi_autocomplete" ).autocomplete({
  7.             source: function( request, response ) {
  8.                 
  9.                 var searchText = extractLast(request.term);
  10.                 $.ajax({
  11.                     url: "/fetch/achat",
  12.                     type: 'post',
  13.                     dataType: "json",
  14.                     data: {
  15.                         search: searchText,
  16.                         type: 2,
  17.                          
  18.                     },
  19.                     success: function( data ) {
  20.                         response( data );
  21.                        
  22. $.each(data, function(index, element) {
  23.             $('#ville').html(element.name);  
  24.             $('#nbr').html(element.nbr);  
  25.             $('#moyenne').html(element.moyenne);   
  26.             $('#prixmini').html(element.prixmini); 
  27.             $('#prixmax').html(element.prixmax);  
  28.         });
  29.  
  30.                     }
  31.                 });
  32.             },
  33.             select: function( event, ui ) {
  34.                 var terms = split( $('#multi_autocomplete').val() );
  35.                 
  36.                 terms.pop();
  37.                 
  38.                 terms.push( ui.item.label );
  39.                 
  40.                 terms.push( "" );
  41.                 $('#multi_autocomplete').val(terms.join( " " ));
  42.                 // Id
  43.                 var terms = split( $('#selectuser_ids').val() );
  44.                 
  45.                 terms.pop();
  46.                 
  47.                 terms.push( ui.item.value );
  48.                 
  49.                 terms.push( "" );
  50.                 $('#selectuser_ids').val(terms.join( ", " ));
  51.                 return false;
  52.             }
  53.            
  54.         });
  55.     });
  56.     function split( val ) {
  57.       return val.split( /,\s*/ );
  58.     }
  59.     function extractLast( term ) {
  60.       return split( term ).pop();
  61.     }
  62.     </script>
  63.  
  64.  
  65.     <script type='text/javascript' >
  66.     $( function() {
  67.   
  68.          
  69.         // Multiple select
  70.         $( "#multi_autocomplete-loc" ).autocomplete({
  71.             source: function( request, response ) {
  72.                 
  73.                 var searchText = extractLast(request.term);
  74.                 $.ajax({
  75.                     url: "/fetch/location",
  76.                     type: 'post',
  77.                     dataType: "json",
  78.                     data: {
  79.                         search: searchText,
  80.                         type: 1,
  81.                          
  82.                     },
  83.                     success: function( data ) {
  84.                         response( data );
  85.                        
  86. $.each(data, function(index, element) {
  87.             $('#villeloc').html(element.name);  
  88.             $('#nbrloc').html(element.nbr);  
  89.             $('#moyenneloc').html(element.moyenne);   
  90.             $('#prixminiloc').html(element.prixmini); 
  91.             $('#prixmaxloc').html(element.prixmax);   
  92.         });
  93.  
  94.                     }
  95.                 });
  96.             },
  97.             select: function( event, ui ) {
  98.                 var terms = split( $('#multi_autocomplete-loc').val() );
  99.                 
  100.                 terms.pop();
  101.                 
  102.                 terms.push( ui.item.label );
  103.                 
  104.                 terms.push( "" );
  105.                 $('#multi_autocomplete-loc').val(terms.join( " " ));
  106.                 // Id
  107.                 var terms = split( $('#selectuser_ids-loc').val() );
  108.                 
  109.                 terms.pop();
  110.                 
  111.                 terms.push( ui.item.value );
  112.                 
  113.                 terms.push( "" );
  114.                 $('#selectuser_ids').val(terms.join( ", " ));
  115.                 return false;
  116.             }
  117.            
  118.         });
  119.     });
  120.     function split( val ) {
  121.       return val.split( /,\s*/ );
  122.     }
  123.     function extractLast( term ) {
  124.       return split( term ).pop();
  125.     }
  126.     </script>
  127.     
  128.  
  129.     <script type='text/javascript' >
  130.     $( function() {
  131.   
  132.          
  133.         // Multiple select
  134.         $( "#multi_autocomplete-sejour" ).autocomplete({
  135.             source: function( request, response ) {
  136.                 
  137.                 var searchText = extractLast(request.term);
  138.                 $.ajax({
  139.                     url: "/fetch/sejour",
  140.                     type: 'post',
  141.                     dataType: "json",
  142.                     data: {
  143.                         search: searchText,
  144.                         type: 1,
  145.                          
  146.                     },
  147.                     success: function( data ) {
  148.                         response( data );
  149.                        
  150. $.each(data, function(index, element) {
  151.             $('#villesejour').html(element.name);  
  152.             $('#nbrsejour').html(element.nbr);  
  153.             $('#moyennesejour').html(element.moyenne);   
  154.             $('#prixminisejour').html(element.prixmini); 
  155.             $('#prixmaxsejour').html(element.prixmax);   
  156.         });
  157.  
  158.                     }
  159.                 });
  160.             },
  161.             select: function( event, ui ) {
  162.                 var terms = split( $('#multi_autocomplete-sejour').val() );
  163.                 
  164.                 terms.pop();
  165.                 
  166.                 terms.push( ui.item.label );
  167.                 
  168.                 terms.push( "" );
  169.                 $('#multi_autocomplete-sejour').val(terms.join( " " ));
  170.                 // Id
  171.                 var terms = split( $('#selectuser_ids-sejour').val() );
  172.                 
  173.                 terms.pop();
  174.                 
  175.                 terms.push( ui.item.value );
  176.                 
  177.                 terms.push( "" );
  178.                 $('#selectuser_ids').val(terms.join( ", " ));
  179.                 return false;
  180.             }
  181.            
  182.         });
  183.     });
  184.     function split( val ) {
  185.       return val.split( /,\s*/ );
  186.     }
  187.     function extractLast( term ) {
  188.       return split( term ).pop();
  189.     }
  190.     </script>
  191.