Buscador
An error occurred while processing the template.
Java method "com.sun.proxy.$Proxy229.getLayout(long, boolean, long)" threw an exception when invoked on com.sun.proxy.$Proxy229 object "com.liferay.portal.service.impl.LayoutLocalServiceImpl@38f147b"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign layout = layoutService.getLay... [in template "116627#116666#6166248" at line 23, column 13] ----
1<#assign layoutService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") />
2<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() />
3<#assign themeDisplay = serviceContext.getThemeDisplay()/>
4
5<div class="container mg-t-50 ">
6 <div class="row">
7 <div class="col-12 form-row text-center buscador-fidu">
8 <input class="form-global form-control form-control-lg input-search" id="num" type="text" placeholder="Que deseas buscar">
9 </div>
10 </div>
11 <div class="row mg-t-50 mg-b-50" id="resultado-titulo"></div>
12 <div class="row" id="resultado-fidu">
13
14 </div>
15
16</div>
17
18<#if PaginaInterna.getSiblings()?has_content>
19 <script>
20 var datos = [];
21 </script>
22 <#list PaginaInterna.getSiblings() as cur_PaginaInterna>
23 <#assign layout = layoutService.getLayout(themeDisplay.getScopeGroupId(),false,cur_PaginaInterna.getData()?number) />
24 <#assign pageTitle = layout.getName(locale) />
25
26 <script>
27 datos.push({
28 url_page : "${cur_PaginaInterna.getFriendlyUrl()}",
29 name_page : "${pageTitle}",
30 word_key : "${cur_PaginaInterna.PalabrasClave.getData()}"
31 });
32 </script>
33 </#list>
34
35</#if>
36
37<style>
38 .mg-t-50 {
39 margin-top: 50px;
40 }
41
42 .mg-b-50 {
43 margin-bottom: 50px;
44 }
45
46 .buscador-fidu .form-control {
47 width:50%;
48 margin-right: 20px;
49 }
50
51 .buscador-fidu {
52 position: relative;
53 }
54
55 .input-search {
56 position: absolute;
57 top: 50%;
58 left: 50%;
59 transform: translate(-50%, -50%);
60 }
61
62 .title-content {
63 font-size: 1rem !important;
64 }
65</style>
66
67<script>
68$('#num').on("keyup", function(){
69
70 var words = '';
71 var letter;
72
73 var regex = /^[a-zA-Z0-9\u00C0-\u00FC, \-]+$/;
74
75 for (var i = 0; i < this.value.length; i++) {
76 letter = this.value.charAt(i);
77
78 var valid = regex.test(letter);
79
80 if (valid) {
81 words += letter;
82 }
83 }
84
85 $('#num').val(words);
86
87 if(this.value.length > 2){
88 searchFidu(this.value);
89 } else if (this.value.length == 0){
90 searchEmpty();
91 }
92});
93
94
95function searchFidu(wordSearch){
96 var templateFind = "";
97 var cont = 0;
98 for(var i = 0; i < datos.length; i++){
99 var tempTemp = "";
100 if(datos[i].word_key.toLowerCase().includes(wordSearch.toLowerCase())){
101 cont = cont + 1;
102 tempTemp ="<div class='col-12'><i class='fas fa-circle'></i> <a href='" +datos[i].url_page + "' target='blank_'>" + datos[i].name_page + "</a></div>";
103 }
104 templateFind = templateFind + tempTemp;
105 }
106
107 var tituloResul = "<div class='col-12 text-center'><h3 class='title-content'>"+ cont + " resultados encontrados para " + wordSearch + "</h3></div>";
108
109 $("#resultado-titulo").html(tituloResul);
110 $("#resultado-fidu").html(templateFind);
111
112}
113
114function searchEmpty(){
115 $("#resultado-titulo").html("");
116 $("#resultado-fidu").html("");
117}
118
119</script>