PageSourceSearch

https://www.ielrs.org.br/sites/all/themes/fiergs3/js/custom/senai-solutions/solutions-select-senai.js?tkslu7

js ielrs.org.br collected 2026-09-26 13:48:09 UTC 4,395 bytes, 113 lines download raw bytes

1(function ($, Drupal, window, document, undefined) {
2  Drupal.behaviors.solutionsSenaiSelect = {
3    attach: function(context, settings) {
4      
5      // $(function() {
6
7      	if($(".view-display-id-institutes__services__filter").length ){
8      		view = $(".view-display-id-institutes__services__filter");
9      		form = view.find("#views-exposed-form-institutes-institutes--services--filter");
10				$area 			= form.find("#edit-area");
11				$calibration 	= form.find("#edit-calibration");
12				$service 		= form.find("#edit-servico");
13				$cidade 		= form.find("#edit-cidade");
14
15      		form.once('form-processed', function() {
16			      form.find(".views-submit-button").prepend('<button class="btn btn-sm btn-expanded btn-outline-black-primary btn-block" id="edit-submit-institutes-custom" name="" value="Aplicar">Aplicar</button>');
17			      form.find("#edit-submit-institutes").hide();
18
19
20		      	if($service.val() == "2270"){
21		      		$calibration.closest(".views-exposed-widget").show();
22		      		$area.closest(".views-exposed-widget").hide();
23		      		$cidade.closest(".views-exposed-widget").hide();
24		      	}else if ($service.val() == "33"){
25		      		$calibration.closest(".views-exposed-widget").hide();
26		      		$area.closest(".views-exposed-widget").hide();
27		      		$cidade.closest(".views-exposed-widget").show();
28		      	}else{
29		      		$calibration.closest(".views-exposed-widget").hide();
30		      		$cidade.closest(".views-exposed-widget").hide();
31		      		$area.closest(".views-exposed-widget").show();
32		      	}		      	
33			        $service.on("change", function (event){
34			      	selected = $(this).val();
35			      	if(selected == "2270"){
36			      		$calibration.closest(".views-exposed-widget").show();
37			      		$area.closest(".views-exposed-widget").hide();
38			      		$cidade.closest(".views-exposed-widget").hide();
39			      	}else if (selected == "33"){
40		      			$calibration.closest(".views-exposed-widget").hide();
41		      			$area.closest(".views-exposed-widget").hide();
42		      			$cidade.closest(".views-exposed-widget").show();
43		      		}else{
44			      		$calibration.closest(".views-exposed-widget").hide();
45			      		$area.closest(".views-exposed-widget").show();
46			      		$cidade.closest(".views-exposed-widget").hide();
47			      	}
48			      });
49
50			      form.find("#edit-submit-institutes-custom").on("click",function( event ) {
51						  event.preventDefault();
52						  service 		= $service.val();
53						  area 			= $area.val();
54						  calibration 	= $calibration.val();
55						  cidade 		= $cidade.val();
56
57						  // console.log(service);
58						  // console.log(area);
59						  // console.log(calibration);
60
61						  // if both fields are selected
62						  if(service != "All" && area != "All" || service == "2270" && calibration != "All" || service == "33" && cidade != ""){
63						  	//remove alert
64						  	$("#solutions-select-alert").remove();
65							  
66							  node = $.trim(view.find(".views-row-1 .solutions-select-nid").text());
67							  node_path = $.trim(view.find(".views-row-1 .solutions-select-node-url").text());
68							  service_name = $.trim(view.find(".views-row-1 .solutions-select-term-name").text());
69
70						  	// treat each service differently
71							  switch(service){
72							  	case "2270":
73							  		// console.log(node);
74							  		destination = node_path+"/calibracao";
75							  		break;
76							  	case "2269":
77							  		// console.log(node);
78							  		destination = node_path+"/ensaios";
79							  		break;
80							  	case "31":
81							  		destination = "taxonomy/term/"+service;
82							  		break;
83							  	case "33":
84							  		destination = "institutos/servico/"+service_name+"?city="+cidade;
85							  		break;
86							  	default:
87							  		// destination = "taxonomy/term/"+service+"?servico="+service+"&area="+area;
88							  		destination = node_path+"/servico/"+service_name;
89							  		break;
90							  }
91
92							  window.location.href = destination;
93
94							  // console.log("service "+service);
95							  // console.log("area "+area);
96							  // console.log(destination);
97						  }else{
98						  	if(!$("#solutions-select-alert").length){
99						  		form.prepend('<div id="solutions-select-alert" class="alert alert-warning">Selecione um Serviço e uma Área de Atuação.</div>');
100						  	}
101						  }
102						});
103					});
104
105      	};
106
107      // });
108	    
109    }
110  };
111
112
113})(jQuery, Drupal, this, this.document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.