PageSourceSearch

https://mcs.com.pr/Style%20Library/MCS/js/Home/Proveedores/providerSearch.js?id=1

js mcs.com.pr collected 2026-10-02 04:51:53 UTC 12,992 bytes, 532 lines download raw bytes

1var selectCategoryDesktop;
2var selectSpecialtyDesktop;
3var selectCityDesktop;
4var selectCategoryMobile;
5var selectSpecialtyMobile;
6var selectCityMobile;
7
8var loadFiltersBaseUrl = 'https://webapisharepoint.mcs.com.pr/api/providers/ProviderDirectory/';
9
10var mimcsUrl = "https://mimcs.mcs.com.pr/providers?";
11var mymcsUrl = "https://mymcs.mcs.com.pr/providers?";
12var customHeaders = {"MiMCSShrptReqProv": "7beeb1dfd7911dcf9492cedc7ad70458"};
13var parameter = "";
14
15//var loadFiltersBaseUrl = 'http://uatmosswp01:9082/api/providers/ProviderDirectory/';
16
17
18$(document).ready(function() {
19
20	selectCategoryDesktop = $("#ddlCategory_desktop");
21	selectCategoryMobile = $("#ddlCategory_mobile");
22	selectSpecialtyDesktop = $("#ddlSpecialty_desktop");
23	selectSpecialtyMobile = $("#ddlSpecialty_mobile");
24	selectCityDesktop = $("#ddlCity_desktop");
25	selectCityMobile = $("#ddlCity_mobile");	
26	
27	$('label[for=radio1_desktop]').click()
28	
29	getCategories(null);
30	//getCities(null, null);
31	
32	$('#firstName_Desktop').mouseleave(function()
33	{
34	    if( $(this).val() ) {
35	        $("#sprov-button").removeClass("disabled");
36    		$("#sprov-button").prop('disabled', false);
37	    }
38	    else{
39	    	if(selectCategoryDesktop.val() == 0){
40	    		$("#sprov-button").addClass("disabled");
41    			$("#sprov-button").prop('disabled', true);
42	    	}
43	    }    
44	    
45	});
46	
47	$('#lastName_Mobile').blur(function()
48	{
49	    if( $(this).val() ) {
50	        $("#provSearchMobile").removeClass("disabled");
51    		$("#provSearchMobile").prop('disabled', false);
52
53	    }
54	    else{
55	    	if(selectCategoryMobile .val() == 0){
56	    		$("#provSearchMobile").addClass("disabled");
57    			$("#provSearchMobile").prop('disabled', true);
58	    	}
59	    }    
60	    
61	});
62
63
64	selectSpecialtyDesktop.change(function () {
65		getCities(selectCityDesktop , selectCategoryDesktop.val(), $(this).val());
66	})
67	
68	selectSpecialtyMobile.change(function () {
69		getCities(selectCityDesktop , selectSpecialtyMobile.val(), $(this).val());
70	})
71
72	
73	selectCategoryDesktop.change(function () {
74			getCities(selectCityDesktop , $(this).val(), '');
75			getSpecialties(selectSpecialtyDesktop , $(this).val(), '');
76
77    	if($(this).val() != 0){  		  		
78    		$("#provSearchMobile").removeClass("disabled");
79    		$("#provSearchMobile").prop('disabled', false);
80			
81			
82			 $("#sprov-button").removeClass("disabled");
83    		$("#sprov-button").prop('disabled', false);
84    	}
85    	else{
86    		if(!$('#lastName_Mobile').val()){
87    			$("#provSearchMobile").addClass("disabled");
88    			$("#provSearchMobile").prop('disabled', true);
89				
90    			$("#sprov-button").addClass("disabled");
91    			$("#sprov-button").prop('disabled', true);
92			}    		
93    	}    
94	});
95	
96	selectCategoryMobile.change(function () {
97    	getCities(selectCityMobile , $(this).val());
98    	getSpecialties(selectSpecialtyMobile , $(this).val());
99    
100    	
101    	if($(this).val() != 0){  		  		
102    		$("#provSearchMobile").removeClass("disabled");
103    		$("#provSearchMobile").prop('disabled', false);
104    	}
105    	else{
106    		if(!$('#lastName_Mobile').val()){
107    			$("#provSearchMobile").addClass("disabled");
108    			$("#provSearchMobile").prop('disabled', true);
109			}    		
110    	}    
111	}); 
112	
113	$('input[type=radio][name=radiog_lite_desktop]').change(function() {
114        if (this.value == 'pharm') {
115			
116    		$('input[type=radio][name=radiog_lite_mobile][value=pharm]').prop('checked', true);
117        	selectCategoryDesktop.selectpicker('val', 'CPHA');
118        	selectCategoryDesktop.trigger('change'); 	
119			getCategories('CPHA');
120            
121        }
122        else if (this.value == 'net') {
123			
124    		$('input[type=radio][name=radiog_lite_mobile][value=net]').prop('checked', true);
125            selectCategoryDesktop.selectpicker('val', 'CSN');
126			selectCategoryDesktop.trigger('change');
127			getCategories('CSN');
128            
129        }else{
130			
131    		$('input[type=radio][name=radiog_lite_mobile][value=prov]').prop('checked', true); 
132			selectCategoryDesktop.trigger('change');
133			getCategories(null);
134		}
135        
136    });	
137    
138    $('input[type=radio][name=radiog_lite_mobile]').change(function() {
139         if (this.value == 'pharm') {
140			
141    		$('input[type=radio][name=radiog_lite_mobile][value=pharm]').prop('checked', true);
142        	selectCategoryDesktop.selectpicker('val', 'CPHA');
143        	selectCategoryDesktop.trigger('change'); 	
144			getCategories('CPHA');
145            
146        }
147        else if (this.value == 'net') {
148			
149    		$('input[type=radio][name=radiog_lite_mobile][value=net]').prop('checked', true);
150            selectCategoryDesktop.selectpicker('val', 'CSN');
151			selectCategoryDesktop.trigger('change');
152			getCategories('CSN');
153            
154        }else{
155			
156    		$('input[type=radio][name=radiog_lite_mobile][value=prov]').prop('checked', true); 
157			selectCategoryDesktop.trigger('change');
158			getCategories(null);
159		}
160        
161    });	
162
163	$('#sprov-button').on("click",function(e){
164		e.preventDefault();
165		var searchURL = mimcsUrl;
166		if(currLang == "1033"){
167			searchURL = mymcsUrl; 			
168		}
169
170		var companyNum = "CompanyNumber=79";		
171		
172		var categoryParam = "";
173		if(selectCategoryDesktop.val() != 0){
174			categoryParam = "&Category=" + selectCategoryDesktop.val();
175		}
176
177		
178		//Check if empty before sending adding params
179		var firstName = "";
180		if($('#firstName_Desktop').val()){
181			firstName = "&FirstName=" + $('#firstName_Desktop').val();
182		}
183		/*
184		var lastName = "";
185		if($('#lastName_Desktop').val()){
186			lastName = "&LastName=" + $('#lastName_Desktop').val();
187		}
188		*/
189		
190		var city = "";
191		if(selectCityDesktop.val() != 0){
192			city = "&Municipality=" + selectCityDesktop.val();
193		}
194		
195		var specialty = "";
196		if(selectSpecialtyDesktop.val() != 0){
197			specialty = "&SpecialtyCode=" + selectSpecialtyDesktop.val();
198		}	
199		
200		
201		var Providers = "";
202		if ($("input#radio1_desktop:checked").val() != null)
203		{
204			Providers = "PROV";
205		}
206		if ($("input#radio2_desktop:checked").val() != null)
207		{
208			Providers = "CSN";
209		}
210
211		if ($("input#radio3_desktop:checked").val() != null)
212		{
213			Providers = "CPHA";
214		}
215		Providers = "&Providers=" + Providers;
216		
217		searchURL = searchURL + companyNum + categoryParam + firstName + city + specialty + Providers;
218		
219		window.open(searchURL, '_self');
220    });
221    
222    $('#provSearchMobile').on("click",function(e){
223		e.preventDefault();
224		var searchURL = mimcsUrl;
225		if(currLang == "1033"){
226			searchURL = mymcsUrl; 			
227		}
228
229
230		var companyNum = "CompanyNumber=79";
231				
232		var categoryParam = "";
233		if(selectCategoryMobile.val() != 0){
234			categoryParam = "&Category=" + selectCategoryMobile.val();
235		}
236
237		
238		//Check if empty before sending adding params
239		
240		var firstName = "";
241		if($('#lastName_Mobile').val()){
242			firstName = "&FirstName=" + $('#lastName_Mobile').val();
243		}
244		/*
245		var lastName = "";
246		if($('#lastName_Mobile').val()){
247			lastName = "&LastName=" + $('#lastName_Mobile').val();
248		}
249		*/
250		var city = "";
251		if(selectCityMobile.val() != 0){
252			city = "&Municipality=" + selectCityMobile.val();
253		}
254		
255		var specialty = "";
256		if(selectSpecialtyMobile.val() != 0){
257			specialty = "&SpecialtyCode=" + selectSpecialtyMobile.val();
258		}
259		
260		var Providers = "";
261		if ($("input#radio1_mobile:checked").val() != null)
262		{
263			Providers = "PROV";
264		}
265		if ($("input#radio2_mobile:checked").val() != null)
266		{
267			Providers = "CSN";
268		}
269
270		if ($("input#radio3_mobile:checked").val() != null)
271		{
272			Providers = "CPHA";
273		}
274		Providers = "&Providers=" + Providers;
275
276		
277		searchURL = searchURL + companyNum + categoryParam + firstName + city + specialty + Providers;
278		
279		window.open(searchURL, '_self');
280    });
281
282
283});
284
285function getSpecialties(selectObj, category){
286	var text = "Especialidad";
287	var errorText = "Error cargando especialidades.";
288	var language = "es";
289	
290	if(currLang == "1033"){
291		text = "Specialty";
292		errorText = "Error loading specialties.";
293		language = "en";
294	}
295
296	var apiURL = loadFiltersBaseUrl + 'GetSpecialties/' + language + "/" + category + '/79/' ;
297	
298  
299    	
300	$.ajax({
301	   	url: apiURL,
302	   	type: 'GET',
303	   	
304	   	success: function(data) {
305			selectObj.empty();
306
307			selectObj.append($('<option/>', {
308
309			value: 0,
310
311			text: text
312
313			}));
314
315			selectObj.prop('disabled', false);
316
317		
318			
319			if(data!=null){
320				$.each(data, function(index, itemData) {
321		   		//alert(element.CategoryGroupCode);
322		   		                        
323                selectObj.append($('<option/>', {
324					
325                    value: itemData.SpecialityCode,
326
327                    text: itemData.Speciality
328
329                }));
330
331			  });
332			}
333            
334			selectObj.selectpicker('refresh');		
335
336			 $("#sprov-button").removeClass("disabled");
337    		$("#sprov-button").prop('disabled', false);
338	   	},
339
340	   	error: function() {
341	   	//	alert(errorText);
342	   	}
343	   	
344
345	});
346
347}
348
349
350function getCities(selectObj, category, specialityCode){
351
352
353	if (specialityCode == '0')
354	{specialityCode = ''}
355
356
357
358	if (category == '0')
359	{category = ''}
360	
361	var text = "Ciudad";
362	var errorText = "Error cargando ciudades.";
363	var language = "es";
364	
365	if(currLang == "1033"){
366		text = "Town";
367		errorText = "Error loading towns.";
368		language = "en";
369	}
370
371	
372	var apiURL = loadFiltersBaseUrl + 'GetMunicipalities/' + language + '/79/' + "?categoryGroupCode=" + category +  "&specialityCode=" + specialityCode; 	
373	
374	$.ajax({
375	   	url: apiURL,
376	   	type: 'GET',
377	   	
378	   	success: function(data) {
379			
380			selectObj.empty();
381			
382			selectObj.append($('<option/>', {
383
384				value: 0,
385
386				text: text
387
388			}));
389			
390			
391			selectObj.prop('disabled', false);
392			
393    	
394			if(data!=null){
395				$.each(data, function(index, itemData) {
396					//alert(element.CategoryGroupCode);
397											
398					selectObj.append($('<option/>', {
399						
400						value: itemData.Id,
401
402						text: itemData.Name
403
404					}));
405
406				});
407			}
408            
409			selectObj.selectpicker('refresh');	
410
411
412			 $("#sprov-button").removeClass("disabled");
413    		$("#sprov-button").prop('disabled', false);			
414
415	   	},
416
417	   	error: function() {
418	   		//alert(errorText);
419	   	}
420	   	
421
422	});
423
424}
425
426function getCategories(category){
427
428
429	var text = "Categoría";
430	var errorText = "Error cargando categorías.";
431	var language = "es";
432	
433	if(currLang == "1033"){
434		text = "Category";
435		errorText = "Error loading categories.";
436		language = "en";
437	}
438	
439	if(category==undefined || category==null) category = 'null';
440	
441	var apiURL = loadFiltersBaseUrl + 'GetCategoryGroups/' +  language + "/79/" ;
442	
443	//if(category!=null && category!='null'){
444		apiURL = apiURL	+ category + '/' ;
445	//}
446
447	$.ajax({
448	   	url: apiURL,
449	   	type: 'GET',	   	
450	   	success: function(data) {
451			
452			selectCategoryDesktop.empty();
453			selectCategoryMobile.empty();
454				
455			selectCategoryDesktop.append($('<option/>', {
456
457				value: 0,
458
459				text: text
460
461			}));
462			
463			selectCategoryMobile.append($('<option/>', {
464
465				value: 0,
466
467				text: text
468
469			}));
470			
471			if(data!=null){
472				$.each(data, function(index, itemData) {
473					//alert(element.CategoryGroupCode);
474											
475					selectCategoryDesktop.append($('<option/>', {
476						
477						value: itemData.CategoryGroupCode,
478
479						text: itemData.Category
480
481					}));
482					
483					selectCategoryMobile.append($('<option/>', {
484
485						value: itemData.CategoryGroupCode,
486
487						text: itemData.Category
488
489					}));
490					
491
492				});
493				selectCategoryDesktop.trigger('change'); 	
494			}
495
496            selectCategoryDesktop.selectpicker('refresh');
497            selectCategoryMobile.selectpicker('refresh');
498
499	   	},
500		
501	   	error: function() {
502		   	//	alert(errorText);
503	   	}
504	   	
505	   	/*
506	   	error: function(jqXHR, exception, textStatus, errorThrown) {
507	   		alert("jqHR.status: " + jqXHR.status);
508	   		alert("textStatus: " + textStatus);
509	   		alert("errorThrown: " + errorThrown);
510	   		alert("Response Text: " + jqXHR.responseText);
511            if (jqXHR.status === 0) {
512                alert('Not connect.\n Verify Network.');
513            } else if (jqXHR.status == 404) {
514                alert('Requested page not found. [404]');
515            } else if (jqXHR.status == 500) {
516                alert('Internal Server Error [500].');
517            } else if (exception === 'parsererror') {
518                alert('Requested JSON parse failed.');
519            } else if (exception === 'timeout') {
520                alert('Time out error.');
521            } else if (exception === 'abort') {
522                alert('Ajax request aborted.');
523            } else {
524                alert('Uncaught Error.\n' + jqXHR.responseText);
525            }
526        }
527	   	
528	   	*/
529
530	});
531	
532}

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.