Publicador de Conteúdos e Mídias

Um erro ocorreu enquanto processava o modelo.
The following has evaluated to null or missing:
==> themeDisplay.getURLCurrent()?split("/")[2]  [in template "20102#20129#34563606" at line 343, column 41]

----
Tip: It's the final [] step that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign friendlyURLTipoCurso = themeD...  [in template "20102#20129#34563606" in function "getTipoCursoFirendlyUrl" at line 343, column 9]
----
1<#-- 
2Name: Unidade Página Modalidades 
3Type: Asset Publisher Widget Template 
4Path: ROOT/assets/unidades-tipos-de-curso/widget-templates/unidades_pagina_modalidades.html 
5--> 
6<#assign prefix = "ssp" /> 
7<#assign companyId = themeDisplay.getCompanyId() /> 
8<#assign siteGroupId = themeDisplay.getSiteGroupId() /> 
9<#assign friendlyUrlTipoCurso = getTipoCursoFirendlyUrl() /> 
10<#assign friendlyUrlUnidade = getUnidadeFirendlyUrl() /> 
11 
12<#assign categoryId = 0 /> 
13 
14<#if friendlyUrlTipoCurso?contains("livre")> 
15   	<#assign tipoCurso = "Livre" /> 
16	<#assign friendlyUrlTemaFirst = getTemaFirstLevelFriendly() /> 
17	<#assign friendlyUrlTemaSecond = getTemaSecondLevelFriendly() /> 
18	<#assign friendlyUrlTemaThird = getTemaThirdLevelFriendly() /> 
19 
20<#-- cursos tecnicos nao tem 2o e 3o nivel de temas conforme prototipo GCR --> 
21<#else> 
22    <#assign tipoCurso = "Técnico" /> 
23    <#assign friendlyUrlTemaFirst = getTemaFirstLevelFriendly() /> 
24	<#assign friendlyUrlTemaSecond = "#erro#" /> 
25	<#assign friendlyUrlTemaThird = "#erro#" /> 
26</#if> 
27 
28<#assign groupService = serviceLocator.findService("com.liferay.portal.kernel.service.GroupLocalService") /> 
29<#assign groupObj = groupService.fetchFriendlyURLGroup(companyId, "/"+friendlyUrlUnidade) /> 
30<#assign groupIdUnidade = groupObj.getGroupId() /> 
31 
32		<#assign journal = getJournalArticle(groupIdUnidade) > 
33		<#if !journal?contains("#erro#")> 
34			 <#assign groupIdUnidade = groupId /> 
35			 <#assign journalArticleUnidade = journal> 
36			<#assign document = saxReaderUtil.read(journalArticleUnidade.getContent()) /> 
37			<#assign rootElement = document.getRootElement() /> 
38			 
39			    <#-- Get fields --> 
40 
41					 <#--  Nome da unidade  --> 
42                    <#assign xPathSelector_nomeUnidadeParaBreadCrumb = saxReaderUtil.createXPath("dynamic-element[@name='nomeUnidade']")> 
43                    <#assign nomeUnidadeParaBreadCrumb = xPathSelector_nomeUnidadeParaBreadCrumb.selectSingleNode(rootElement).getStringValue()> 
44 
45                    <#--  Nome da unidade  --> 
46                    <#assign xPathSelector_nome = saxReaderUtil.createXPath("dynamic-element[@name='nomeUsualUnidade']")> 
47                    <#assign nomeUnidade = xPathSelector_nome.selectSingleNode(rootElement).getStringValue()> 
48 
49                    <#assign xPathSelector_codigoUnidade = saxReaderUtil.createXPath("dynamic-element[@name='codigoUnidade']")> 
50                    <#assign codigoUnidade = xPathSelector_codigoUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
51                     
52                        <#if nomeUnidade?? > 
53                            <#assign nome = nomeUnidade > 
54                            <#else> 
55                            <#assign nome = "" > 
56                        </#if> 
57 
58                <#--  Endereço 1  --> 
59 
60                        <#--  Rua  --> 
61                        <#assign xPathSelector_enderecoUnidade = saxReaderUtil.createXPath("dynamic-element[@name='enderecoUnidade']")> 
62                        <#assign enderecoUnidade = xPathSelector_enderecoUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
63 
64                            <#if enderecoUnidade?? > 
65                                <#assign endereco = enderecoUnidade > 
66                                <#else> 
67                                <#assign endereco = "" > 
68                            </#if> 
69 
70                        <#--  número  --> 
71                        <#assign xPathSelector_numEnderecoUnidade = saxReaderUtil.createXPath("dynamic-element[@name='numEnderecoUnidade']")> 
72                        <#assign numeroUnidade = xPathSelector_numEnderecoUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
73 
74                            <#if numeroUnidade?? > 
75                                <#assign numero = numeroUnidade > 
76                                <#else> 
77                                <#assign numero = "" > 
78                            </#if> 
79 
80                        <#--  Bairro  --> 
81                        <#assign xPathSelector_bairroUnidade = saxReaderUtil.createXPath("dynamic-element[@name='bairroUnidade']")> 
82                        <#assign bairroUnidade = xPathSelector_bairroUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
83 
84                            <#if bairroUnidade?? > 
85                                <#assign bairro = bairroUnidade > 
86                                <#else> 
87                                <#assign bairro = "" > 
88                            </#if> 
89                         
90                        <#--  Cidade  --> 
91                        <#assign xPathSelector_cidadeUnidade = saxReaderUtil.createXPath("dynamic-element[@name='cidadeUnidade']")> 
92                        <#assign cidadeUnidade = xPathSelector_cidadeUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
93 
94                            <#if cidadeUnidade?? > 
95                                <#assign cidade = cidadeUnidade > 
96                                <#else> 
97                                <#assign cidade = "" > 
98                            </#if> 
99 
100                        <#--  Cep  --> 
101                        <#assign xPathSelector_cepUnidade = saxReaderUtil.createXPath("dynamic-element[@name='cepUnidade']")> 
102                        <#assign cepUnidade = xPathSelector_cepUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
103 
104                            <#if cepUnidade?? > 
105                                <#assign cep = cepUnidade > 
106                                <#else> 
107                                <#assign cep = "" > 
108                            </#if>  
109 
110            <#-- Fim endereço 1 -->   
111 
112            <#--  Endereço 2  --> 
113 
114                        <#--  Rua  --> 
115                        <#assign xPathSelector_enderecoUnidade2 = saxReaderUtil.createXPath("dynamic-element[@name='enderecoUnidade2']")> 
116                        <#assign enderecoUnidade2 = xPathSelector_enderecoUnidade2.selectSingleNode(rootElement).getStringValue()?trim> 
117 
118                            <#if enderecoUnidade2?? > 
119                                <#assign endereco2 = enderecoUnidade2 > 
120                                <#else> 
121                                <#assign endereco2 = "" > 
122                            </#if> 
123 
124                        <#--  número  --> 
125                        <#assign xPathSelector_numeroUnidade2 = saxReaderUtil.createXPath("dynamic-element[@name='numeroUnidade2']")> 
126                        <#assign numeroUnidade2 = xPathSelector_numeroUnidade2.selectSingleNode(rootElement).getStringValue()?trim> 
127 
128                            <#if numeroUnidade2?? > 
129                                <#assign numero2 = numeroUnidade2 > 
130                                <#else> 
131                                <#assign numero2 = "" > 
132                            </#if> 
133 
134                        <#--  Bairro  --> 
135                        <#assign xPathSelector_bairroUnidade2 = saxReaderUtil.createXPath("dynamic-element[@name='bairroUnidade2']")> 
136                        <#assign bairroUnidade2 = xPathSelector_bairroUnidade2.selectSingleNode(rootElement).getStringValue()?trim> 
137 
138                            <#if bairroUnidade2?? > 
139                                <#assign bairro2 = bairroUnidade2 > 
140                                <#else> 
141                                <#assign bairro2 = "" > 
142                            </#if> 
143                         
144                        <#--  Cidade  --> 
145                        <#assign xPathSelector_cidadeUnidade2 = saxReaderUtil.createXPath("dynamic-element[@name='cidadeUnidade2']")> 
146                        <#assign cidadeUnidade2 = xPathSelector_cidadeUnidade2.selectSingleNode(rootElement).getStringValue()?trim> 
147 
148                            <#if cidadeUnidade2?? > 
149                                <#assign cidade2 = cidadeUnidade2 > 
150                                <#else> 
151                                <#assign cidade2 = "" > 
152                            </#if> 
153 
154                        <#--  Cep  --> 
155                        <#assign xPathSelector_cepUnidade2 = saxReaderUtil.createXPath("dynamic-element[@name='cepUnidade2']")> 
156                        <#assign cepUnidade2 = xPathSelector_cepUnidade2.selectSingleNode(rootElement).getStringValue()?trim> 
157 
158                            <#if cepUnidade2?? > 
159                                <#assign cep2 = cepUnidade2 > 
160                                <#else> 
161                                <#assign cep2 = "" > 
162                            </#if>  
163 
164            <#-- Fim endereço 2 --> 
165 
166 
167 
168                        <#--  Horário  --> 
169                        <#assign xPathSelector_horarioUnidade = saxReaderUtil.createXPath("dynamic-element[@name='horarioUnidade']")> 
170                        <#assign horarioUnidade = xPathSelector_horarioUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
171 
172                            <#if horarioUnidade?? > 
173                                <#assign horario = horarioUnidade > 
174                                <#else> 
175                                <#assign horario = "" > 
176                            </#if> 
177 
178                        <#--  DDD  --> 
179                        <#assign xPathSelector_dddUnidade = saxReaderUtil.createXPath("dynamic-element[@name='dddTelefoneUnidade']")> 
180                        <#assign dddUnidade = xPathSelector_dddUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
181 
182                            <#if dddUnidade?? > 
183                                <#assign ddd = dddUnidade > 
184                                <#else> 
185                                <#assign ddd = "" > 
186                            </#if> 
187 
188                        <#--  telefone  --> 
189                        <#assign xPathSelector_telefoneUnidade = saxReaderUtil.createXPath("dynamic-element[@name='telefoneUnidade']")> 
190                        <#assign telefoneUnidade = xPathSelector_telefoneUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
191 
192                            <#if telefoneUnidade?? > 
193                                <#assign telefone = telefoneUnidade > 
194                                <#else> 
195                                <#assign telefone = "" > 
196                            </#if>                         
197 
198                        <#--  UF  --> 
199                        <#assign xPathSelector_ufUnidade = saxReaderUtil.createXPath("dynamic-element[@name='ufUnidade']")> 
200                        <#assign ufUnidade = xPathSelector_ufUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
201 
202                            <#if ufUnidade?? > 
203                                <#assign UF = ufUnidade > 
204                                <#else> 
205                                <#assign UF = "" > 
206                            </#if> 
207 
208                        <#-- Estacionamento --> 
209                        <#assign xPathSelector_estacionamento = saxReaderUtil.createXPath("dynamic-element[@name='estacionamentoUnidade']")> 
210                        <#assign estacionamentoUnidade = xPathSelector_estacionamento.selectSingleNode(rootElement).getStringValue()>  
211 
212                            <#if estacionamentoUnidade?? > 
213                                <#assign estacionamento = estacionamentoUnidade > 
214                                <#else> 
215                                <#assign estacionamento = "" > 
216                            </#if> 
217 
218                         <#-- Estacionamento Unidade 2 --> 
219                        <#assign xPathSelector_estacionamento2 = saxReaderUtil.createXPath("dynamic-element[@name='estacionamentoUnidade2']")> 
220                        <#assign estacionamentoUnidade2 = xPathSelector_estacionamento2.selectSingleNode(rootElement).getStringValue()>  
221 
222                            <#if estacionamentoUnidade2?? > 
223                                <#assign estacionamento2 = estacionamentoUnidade2 > 
224                                <#else> 
225                                <#assign estacionamento2 = "" > 
226                            </#if>          
227 
228                        <#--  Facebook  --> 
229                        <#assign xPathSelector_facebookUnidade = saxReaderUtil.createXPath("dynamic-element[@name='facebookUnidade']")> 
230                        <#assign facebookUnidade = xPathSelector_facebookUnidade.selectSingleNode(rootElement).getStringValue()> 
231 
232                            <#if facebookUnidade?? > 
233                                <#assign facebook = facebookUnidade > 
234                                <#else> 
235                                <#assign facebook = "" > 
236                            </#if> 
237 
238                        <#--  Instagram  --> 
239                        <#assign xPathSelector_instagramUnidade = saxReaderUtil.createXPath("dynamic-element[@name='instagramUnidade']")> 
240                        <#assign instagramUnidade = xPathSelector_instagramUnidade.selectSingleNode(rootElement).getStringValue()> 
241 
242                            <#if instagramUnidade?? > 
243                                <#assign instagram = instagramUnidade > 
244                                <#else> 
245                                <#assign instagram = "" > 
246                            </#if> 
247 
248                        <#--  Maps  --> 
249                        <#assign xPathSelector_googlemapsUnidade = saxReaderUtil.createXPath("dynamic-element[@name='googlemapsUnidade']")> 
250                        <#assign googlemapsUnidade = xPathSelector_googlemapsUnidade.selectSingleNode(rootElement).getStringValue()?trim> 
251 
252                            <#if googlemapsUnidade?? > 
253                                <#assign googlemaps = googlemapsUnidade > 
254                                <#else> 
255                                <#assign googlemaps = "" > 
256                            </#if> 
257 
258                        <#assign  hasMaps = (googlemaps?trim?length > 0) > 
259 
260                         
261 
262                        <#--  Waze  --> 
263                        <#assign xPathSelector_wazeUnidade = saxReaderUtil.createXPath("dynamic-element[@name='wazeUnidade']")> 
264                        <#assign wazeUnidade = xPathSelector_wazeUnidade.selectSingleNode(rootElement).getStringValue()> 
265 
266                            <#if wazeUnidade?? > 
267                                <#assign waze = wazeUnidade > 
268                                <#else> 
269                                <#assign waze = "" > 
270                            </#if>    
271 
272                                       
273 
274                                 
275                    <#--  Imagem  --> 
276 
277                    <#assign xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='imagemUnidade']")> 
278 
279                        <#assign imagemStr = xPathSelector.selectSingleNode(rootElement).getStringValue()> 
280                         
281                        <#if imagemStr?contains("{") > 
282                            <#assign 
283                                imagemJson = jsonFactoryUtil.createJSONObject(imagemStr) 
284                                imagemId = getterUtil.getInteger(imagemJson.get('fileEntryId')) 
285                                dl = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppService") 
286                                dlUtil = staticUtil["com.liferay.document.library.kernel.util.DLUtil"] 
287                                fileEntry = dl.getFileEntry(imagemId) 
288                                imagemUrl = dlUtil.getImagePreviewURL(fileEntry, themeDisplay)  
289                            /> 
290                            <#else> 
291                                <#assign imagemUrl = ""> 
292                        </#if> 
293 
294                    <#--  Imagem 2  -->     
295                    <#assign xPathSelector2 = saxReaderUtil.createXPath("dynamic-element[@name='imagemUnidade2']")> 
296 
297                        <#assign imagemStr2 = xPathSelector2.selectSingleNode(rootElement).getStringValue()> 
298                         
299                        <#if imagemStr2?contains("{") > 
300                            <#assign 
301                                imagemJson2 = jsonFactoryUtil.createJSONObject(imagemStr2) 
302                                imagemId2 = getterUtil.getInteger(imagemJson2.get('fileEntryId')) 
303                                dl = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppService") 
304                                dlUtil = staticUtil["com.liferay.document.library.kernel.util.DLUtil"] 
305                                fileEntry = dl.getFileEntry(imagemId2) 
306                                imagemUrl2 = dlUtil.getImagePreviewURL(fileEntry, themeDisplay)  
307                            /> 
308                            <#else> 
309                                <#assign imagemUrl2 = ""> 
310                        </#if>     
311		 	</#if> 
312 
313 <#function getJournalArticle groupId> 
314    <#assign journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") /> 
315    <#assign friendlyURL = getUnidadeFirendlyUrl()> 
316    
317    <#attempt> 
318   
319      <#if !friendlyURL?contains("fragment_collections") > 
320         
321        <#return journalArticleService.getArticleByUrlTitle(groupId,friendlyURL)> 
322         
323      </#if> 
324       
325    <#recover> 
326         
327      <#return '#erro#'> 
328    </#attempt> 
329 </#function> 
330 
331 <#function getUnidadeFirendlyUrl > 
332 	 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first /> 
333 	 <#if friendly?contains("web") > 
334    	 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[3]?split("?")?first> 
335    </#if> 
336     
337    <#return friendly /> 
338     
339 </#function> 
340   
341 <#function getTipoCursoFirendlyUrl > 
342 	 
343 	<#assign friendlyURLTipoCurso = themeDisplay.getURLCurrent()?split("/")[2]?split("?")?first /> 
344 	<#if friendlyURLTipoCurso?contains("guest") > 
345   	 	<#assign friendlyURLTipoCurso = themeDisplay.getURLCurrent()?split("/")[4]?split("?")?first> 
346   	</#if> 
347     	 
348    <#return friendlyURLTipoCurso /> 
349     
350 </#function> 
351 
352 <#function getTemaFirstLevelFriendly > 
353 	 <#attempt> 
354	 	<#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first /> 
355	 	 <#if !friendly?contains("web") > 
356	 	 	 <#if themeDisplay.getURLCurrent()?split("/")?size gt 3 > 
357	 	 		<#assign friendly = themeDisplay.getURLCurrent()?split("/")[3]?split("?")?first /> 
358	 	 	<#else> 
359	 	 		<#assign friendly = "" /> 
360	 	 	</#if>	 
361	 	 		 
362		<#else> 
363			<#if themeDisplay.getURLCurrent()?split("/")?size gt 5 > 
364	    	 	<#assign friendly = themeDisplay.getURLCurrent()?split("/")[5]?split("?")?first> 
365	    	 <#else> 
366	 	 		<#assign friendly = "" /> 
367	 	 	</#if> 
368	     </#if> 
369	      	  
370	    <#return friendly /> 
371    <#recover> 
372     	<#return '#erro#'> 
373    </#attempt> 
374     
375</#function>  
376 
377 <#function getTemaSecondLevelFriendly > 
378 	 <#attempt> 
379	 	 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first /> 
380	 	 
381	 	 <#if !friendly?contains("web") > 
382	 		 <#if themeDisplay.getURLCurrent()?split("/")?size gt 4 > 
383	 		 	<#assign friendly = themeDisplay.getURLCurrent()?split("/")[4]?split("?")?first /> 
384	 		 <#else> 
385	 	 		<#assign friendly = "" /> 
386	 	 	</#if>		 
387		<#else> 
388			 <#if themeDisplay.getURLCurrent()?split("/")?size gt 6 > 
389	    		 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[6]?split("?")?first> 
390    		<#else> 
391	 	 		<#assign friendly = "" /> 
392	 	 	</#if>	  
393	    </#if> 
394	 
395	    <#return friendly /> 
396    <#recover> 
397     	<#return '#erro#'> 
398    </#attempt> 
399     
400</#function>  
401  
402 <#function getTemaThirdLevelFriendly > 
403 	 <#attempt> 
404	 	 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first /> 
405	 	  
406	 	 <#if !friendly?contains("web") > 
407	 	 	<#if themeDisplay.getURLCurrent()?split("/")?size gt 5 > 
408	 	 		<#assign friendly = themeDisplay.getURLCurrent()?split("/")[5]?split("?")?first /> 
409	 	 	<#else> 
410	 	 		<#assign friendly = "" /> 
411	 	 	</#if>	 
412		<#else> 
413			<#if themeDisplay.getURLCurrent()?split("/")?size gt 7 > 
414	    	 	<#assign friendly = themeDisplay.getURLCurrent()?split("/")[7]?split("?")?first> 
415	    	<#else> 
416	 	 		<#assign friendly = "" /> 
417	 	 	</#if> 	 
418	    </#if> 
419		    <#return friendly /> 
420    <#recover> 
421     	<#return '#erro#'> 
422    </#attempt> 
423     
424</#function>  
425 
426<style> 
427 
428/*Header Unidade*/ 
429 
430.ssp-header-unidade__content-info-body{ 
431	padding-top:30px; 
432
433 
434.ssp-header-unidade__atendimento-container > p > a { 
435    color:white!important; 
436
437 
438.ssp-header-unidade__atendimento-container > p > a:hover { 
439    color:white!important; 
440    font-weight: normal!important; 
441
442 
443.creditoFotoMob{ 
444 
445    margin: 0 auto; 
446    background: #FFF7D6; 
447    font-family: 'Montserrat'; 
448    font-size: 14px; 
449    line-height: 1.6em; 
450    border-radius: 3px; 
451    max-width: 240px; 
452    height: auto; 
453    color: #4F596F; 
454    padding: 5px; 
455    position: relative;     
456    float: right;     
457    top: 70%; 
458    max-height: 40px; 
459    font-weight: 500; 
460    right: 15%; 
461    flex-wrap: unset; 
462
463 
464.creditoFotoMob:after{ /*Triangulo*/ 
465    content: ""; 
466    width: 0; 
467    height: 0; 
468    position: absolute; 
469    border-left: 10px solid transparent; 
470    border-right: 10px solid transparent; 
471    /*Faz seta "apontar para baixo. Definir o valor como 'top' fará ela "apontar para cima" */ 
472    /*Aqui entra a cor da "aba" do balão */ 
473    border-bottom: 10px solid #FFF7D6; 
474    top: -9px; /*localização. Experimente alterar para 'bottom'*/ 
475    left: 20%; 
476
477.tooltip-inner { 
478    max-width: 230px; 
479    padding: 0.75rem 0.75rem; 
480    color: #4F596F; 
481    text-align: center; 
482    background-color: #FFF7D6; 
483    border-radius: 0.3125rem; 
484
485.bs-tooltip-top .arrow::before, .bs-tooltip-auto[x-placement^="top"] .arrow::before { 
486    top: 0; 
487    border-width: 0.4rem 0.4rem 0; 
488    border-top-color: #FFF7D6; 
489
490.ssp-header-title-bloco { 
491    font-size: 20px; 
492    font-weight: 600; 
493
494 
495.ssp:not(.liferay-instance) .ssp-header-unidade__imagem-box-imagem{ 
496    height:100%; 
497
498/*#slider { 
499    width: 80%; 
500    max-width: 500px; 
501    height: 25vw; 
502    max-height: 150px; 
503 
504    position: relative; 
505}*/ 
506 
507#slider .ssp-header-unidade__imagem-box-imagem{ 
508    opacity: 0; 
509    position: absolute; 
510    /*width: 100%; 
511    height: 100%;*/ 
512    object-fit: cover; 
513    transition: opacity 2000ms; 
514
515 
516#slider .ssp-header-unidade__imagem-box-imagem.selected {  
517    opacity: 1; 
518
519 
520@media only screen and (max-width: 1024px) { 
521     
522#slider .ssp-header-unidade__imagem-box-imagem{  
523    margin-top: -240px; 
524    height: 248px; 
525 
526
527 .ssp-header-unidade__container-info { 
528    margin-top: 240px!important; 
529
530 
531
532 
533 @media only screen and (max-width: 768px){ 
534 
535  .ssp:not(.liferay-instance) .ssp-header-unidade__imagem-box-imagem{ 
536    height:228px; 
537
538  .ssp-header-title-bloco { 
539    font-size: 14px;     
540}    
541 
542  .creditoFotoMob{ 
543    font-size: 9px!important; 
544    max-width: 161px!important; 
545    max-height: 30px!important; 
546    padding: 8.5px 9.5px!important; 
547    line-height: 0.6em!important; 
548     
549
550}  
551 
552/* Final Header Unidade*/ 
553 
554.btn-nivel-livre-ead{ 
555        background-color: #ff9057; 
556        border-color: #ff9057; 
557        box-shadow: none; 
558
559 
560    .icon-ao-vivo{ 
561    font-size:12px; 
562    margin:0 3px; 
563
564 
565 
566.subtema-ativo{ 
567 
568    color:#fcc080!important; 
569
570 
571.separador-subtemas{ 
572	width:100% !important; 
573	margin-top: -1em !important; 
574    margin-bottom: 2.25rem!important; 
575
576 
577</style> 
578 
579<#if tipoCurso == "Livre"> 
580 
581	<style> 
582	.ssp:not(.liferay-instance) .ativo{ 
583	  background-color: #FF9057!important; 
584	  color:white!important; 
585	  font-weight: 600!important; 
586
587	 
588	.tema-ativo{ 
589	  background-color: #FF9057!important; 
590	  color:white!important; 
591	  font-weight: 600!important; 
592
593	</style> 
594 
595<#else> 
596 
597	<style> 
598	   
599		.ssp:not(.liferay-instance) .ativo{ 
600			background-color: #F7BD23!important; 
601			color: #454F63!important; 
602			font-weight: 600!important; 
603
604		 
605		.tema-ativo{ 
606			background-color: #F7BD23!important; 
607			color: #454F63!important; 
608			font-weight: 600!important; 
609
610 
611		.ssp:not(.liferay-instance) .ssp-section-tema__container-menu-item .tema:hover { 
612			background-color: #F7BD23; 
613			color: white; 
614			font-weight: 600 !important; 
615
616		 
617		.subtema.btn-nivel-3.subtema-ativo { 
618			background: #F7BD23!important; 
619			color: white!important; 
620			border-color: #F7BD23!important; 
621
622 
623	</style> 
624 
625</#if> 
626 
627<style> 
628 
629/* css para link no nome da unidade */ 
630 
631.ssp-header-unidade__title a{ 
632     
633    text-decoration: none!important; 
634    font-family: Montserrat; 
635    font-size: 44px; 
636    max-width: 440px; 
637    font-weight: 600!important; 
638    line-height: 1.23; 
639    text-align: left; 
640    color: white; 
641
642 
643.ssp-section-tema__subtitle-curso-section { 
644 
645	margin-left: 40px!important; 
646 
647
648 
649.ssp-page-busca__section-resultado__ver-todos{ 
650	margin-right: 40px!important; 
651
652 
653.submenu-tema-ativo{ 
654  background-color: #34495e!important; 
655  color:white!important; 
656  font-weight: 600!important; 
657
658 
659.submenu-tema-ativo-hover{ 
660  background-color: #34495e!important; 
661  color:white!important; 
662  font-size:50px; 
663  font-weight: 600!important; 
664
665 
666.subtema.btn-nivel-3.subtema-ativo{ 
667	background:#a2acc3!important; 
668	color:white!important; 
669
670 
671.slider-curso>.slick-area__item{ 
672 
673width:100%; 
674	 
675
676 
677.custom-card-curso-tema{ 
678  
679 height:288px!important;  
680   
681
682 
683@media only screen and (max-width: 768px){ 
684	 
685  .ssp:not(.liferay-instance) .custom-card-curso-tema { 
686      width: 100% !important; 
687      height:auto!important; 
688
689   
690   
691  .ssp-page-busca__section-resultado__ver-todos { 
692    display:none; 
693
694   
695  .filtroInscBolsa{ 
696  	display:none!important; 
697
698   
699
700   
701.ssp:not(.liferay-instance) .ssp-container__cursos-sem-slick { 
702    display: flex; 
703    justify-content: center; 
704    flex-wrap: wrap; 
705
706 
707/*Novas funcionalidades*/ 
708	#filtro-temas-nivel-3{ 
709		padding-bottom: 2em; 
710
711	 
712 .switch { 
713          position: relative; 
714          display: inline-block; 
715          width: 63px; 
716          height: 31.5px; 
717          margin: 0; 
718
719         
720        .switch input {  
721          opacity: 0; 
722          width: 0; 
723          height: 0; 
724
725         
726        .slider { 
727          position: absolute; 
728          cursor: pointer; 
729          top: 0; 
730          left: 0; 
731          right: 0; 
732          bottom: 0; 
733          background-color: #ccc; 
734          -webkit-transition: .4s; 
735          transition: .4s; 
736
737         
738        .slider:before { 
739          position: absolute; 
740          content: ""; 
741          height: 21px; 
742          width: 21px; 
743          left: 7px; 
744          bottom: 5.5px; 
745          background-color: white; 
746          -webkit-transition: .4s; 
747          transition: .4s; 
748
749         
750        input:checked + .slider { 
751          background-color: #5ACC75; 
752
753         
754        input:focus + .slider { 
755          box-shadow: 0 0 1px #5ACC75; 
756
757         
758        input:checked + .slider:before { 
759          -webkit-transform: translateX(26px); 
760          -ms-transform: translateX(26px); 
761          transform: translateX(26px); 
762
763         
764        /* Rounded sliders */ 
765        .slider.round { 
766          border-radius: 35px; 
767
768         
769        .slider.round:before { 
770          border-radius: 50%; 
771
772 
773        /* content filter */ 
774 
775        .ssp-slider-check__container{ 
776 
777            display: flex; 
778            justify-content: flex-end; 
779 
780
781 
782        .ssp-slider-check__content-itens{ 
783 
784            display: flex; 
785            width: 640px!important; 
786            justify-content: space-between; 
787             
788
789 
790        .ssp-slider-check__content-item{ 
791 
792            display: flex; 
793            align-items: center; 
794 
795
796 
797        .ssp-slider-check__label{ 
798 
799            font-family: Montserrat; 
800            color: #78849E; 
801            font-size: 16px; 
802            padding-left: 10px; 
803            font-weight: 600; 
804 
805
806		 
807        .ssp-section-tema__container-menu { 
808            padding-bottom: 15px; 
809
810 
811		.ssp-section-tema__subtitle-desconto{ 
812			display: block; 
813			font-size: 30px; 
814
815 
816        @media only screen and (max-width: 1024px) { 
817 
818			.ssp-section-tema__subtitle-desconto{ 
819				font-size: 19px; 
820
821 
822			.ssp-header-unidade__title a{ 
823				 
824				font-size: 24px; 
825
826 
827			.ssp-section-tema__subtitle-curso-section { 
828 
829				margin-left: 0px!important; 
830 
831
832 
833            #filtro-ativo-nivel-2{ 
834                justify-content: center; 
835
836 
837            .ssp-slider-check__label{ 
838 
839                font-size: 11px; 
840 
841
842 
843            .tema-slick-area { 
844     
845                display: flex; 
846                align-items: center; 
847                justify-content: flex-start; 
848                font-size: 0; 
849                flex-wrap: wrap; 
850
851 
852            /* custom  itens */ 
853			 
854			 
855            .ssp-unidade-temas__label-filtre-por{ 
856                font-size: 15px!important; 
857    			padding-left: 5px!important; 
858
859            
860 
861            .ssp-section-tema__container-menu { 
862                height: auto!important; 
863
864 
865            .tema-slick-area-mobile { 
866                display: flex; 
867                align-items: center; 
868                justify-content: center; 
869                font-size: 0; 
870                flex-wrap: wrap; 
871
872 
873            .ssp-section-tema__container-submenu-nivel3 { 
874 
875                justify-content: center; 
876
877             
878             .ssp-slider-check__container{ 
879            	padding-top:10px!important; 
880
881      }      
882</style> 
883 
884<#if tipoCurso == "Livre"> 
885 
886	<style>     
887		@media only screen and (max-width: 768px){      
888			.tema-ativo::after{ 
889				font-family: "Font Awesome 5 Free";  
890				font-weight: 900;  
891				content: "\f00d"; 
892				font-size: 12px; 
893				margin: 0 5px; 
894
895
896	</style>             
897</#if> 
898<style> 
899		@media only screen and (max-width: 768px){      
900			.subtema-ativo::after{ 
901				font-family: "Font Awesome 5 Free";  
902				font-weight: 900;  
903				content: "\f00d"; 
904				font-size: 12px; 
905				margin: 0 5px; 
906
907             
908            .ssp:not(.liferay-instance) .ssp-page-busca__section-resultado__ver-todos-mobile { 
909			    font-family: Montserrat; 
910			    font-size: 16px; 
911			    font-weight: 600; 
912			    line-height: 1.21; 
913			    color: #78849e; 
914			    text-decoration: none !important; 
915			    transition: 0.3s; 
916			    text-align: center !important; 
917   				 padding-left: 7em; 
918
919			 
920			.ssp:not(.liferay-instance) .ssp-page-busca__section-resultado__ver-todos-mobile::after { 
921			    font-family: FontAwesome; 
922			    font-weight: 900; 
923			    content: '\f054'; 
924			    font-size: 12px; 
925			    margin-left: 5px; 
926
927 
928
929 
930        /* Custom css para unidades */ 
931 
932        .ssp-unidade-temas__label-filtre-por{ 
933 
934            font-family: Montserrat; 
935            font-size: 20px; 
936            font-weight: 600; 
937            padding: 15px; 
938            padding-left: 30px; 
939            color: #78849E; 
940 
941
942 
943        .ssp-section-tema__container-submenu-nivel3 .btn-nivel-3 { 
944            margin: 15px 10px; 
945           
946
947 
948 
949        .ssp-line-nivel-divisor { 
950            width: 100%; 
951            height: 1px; 
952            background: #78849E; 
953            margin: 15px 0; 
954
955 
956     .ssp-header-unidade__content-info{ 
957            z-index: 0!important; 
958
959 
960        .ssp-btn-tema-mobile--active{ 
961            background-color: #FE9057!important; 
962            color: white!important; 
963
964 
965        .ssp-btn-tema-mobile--active::after{ 
966            font-family: "Font Awesome 5 Free";  
967            font-weight: 900;  
968            content: "\f00d"; 
969            font-size: 12px; 
970            margin: 0 5px; 
971
972 
973        .ssp-btn-subtema-mobile--active{ 
974            background-color: #78849E!important; 
975            color: white!important; 
976
977         
978        
979 
980        /* Botão Visualizar mais */ 
981 
982        .ssp-btn__visualizar-mais-content{ 
983            display: flex; 
984            flex-wrap: nowrap; 
985            align-items: center; 
986            justify-content: center; 
987
988 
989        .ssp-btn__visualizar-mais{ 
990            cursor: pointer; 
991            font-size: 14px; 
992
993         
994        #visualizar-mais{ 
995        	font-family:montserrat; 
996
997		 
998		.tema{ 
999			box-shadow: none !important; 
1000
1001		.separador-subtemas{ 
1002			margin:10px 0px 30px 0px!important; 
1003
1004		 
1005		.py-5{ 
1006			padding-bottom: 0px!important; 
1007			padding-top: 5px!important; 
1008
1009		 
1010		.ssp-section-tema__title{ 
1011			margin: 40px 0px 25px 0px!important; 
1012
1013@media only screen and (min-width: 1025px){ 
1014	.ssp-section-tema__container-submenu-nivel3 .btn-nivel-3 { 
1015		margin-bottom: 20px!important; 
1016
1017	 
1018	.filtroTextoMobile{ 
1019		display: none; 
1020
1021}  
1022 
1023.ssp-section-tema__title{ 
1024	margin: 40px 0px 25px 0px!important; 
1025
1026 
1027.py-5{ 
1028	padding-bottom: 0px!important; 
1029	padding-top: 5px!important; 
1030
1031 
1032.ssp-slider-check__content-itens{ 
1033	display: flex; 
1034	width: 800px!important; 
1035	justify-content: flex-end!important; 
1036
1037 
1038.ssp-slider-check__content-item{ 
1039	display: flex; 
1040	align-items: center; 
1041	padding: 0 20px; 
1042
1043 
1044/* novo botao ver todos os cursos */ 
1045 
1046.ver-todos-cursos-link{ 
1047	color: #78849E!important; 
1048
1049 
1050.ver-todos-cursos-link:hover{ 
1051	color: #515A6B!important; 
1052
1053 
1054.ver-todos-cursos-link:hover p{ 
1055	color: #515A6B!important; 
1056
1057 
1058.custom-card-curso-tema{ 
1059  
1060 height:282px!important;  
1061   
1062
1063 
1064.container-fluid .row{ 
1065	margin: 0 !important; 
1066
1067 
1068 
1069.container-fluid .col-md-12{ 
1070	padding: 0 !important; 
1071
1072 
1073.ver-todos-no-click{ 
1074	text-decoration: none !important; 
1075	pointer-events: none !important; 
1076
1077 
1078.slick-area__item.card-curso-nivel-2 .custom-card-curso-tema__title{ 
1079	height: 70px; 
1080
1081 
1082/*novo forma de exibir o menu de areas*/ 
1083 
1084.ssp:not(.liferay-instance) .ativo { 
1085    background-color: #F7BD23!important; 
1086    color: #454F63!important; 
1087    font-weight: 600 !important; 
1088
1089 
1090.ssp:not(.liferay-instance) .ssp-section-tema__container-menu-item .tema { 
1091	font-size: 15px; 
1092	color: #454F63; 
1093
1094 
1095.ssp:not(.liferay-instance) .ssp-section-tema__container-menu-item .tema:hover { 
1096    background-color: #F7BD23; 
1097	color: #454F63!important; 
1098    font-weight: 600 !important; 
1099
1100 
1101.ssp:not(.liferay-instance) .ssp-section-tema__container-menu { 
1102    flex-wrap: wrap; 
1103
1104 
1105.tema i{ 
1106	margin-right: 8px; 
1107
1108 
1109.subtema.btn-nivel-3.subtema-ativo { 
1110    background: #F7BD23!important; 
1111	color: #454F63!important; 
1112	border-color: #F7BD23!important; 
1113
1114 
1115.ssp:not(.liferay-instance) .ssp-section-tema__container-submenu-nivel3 .btn-nivel-3 { 
1116font-weight: 600; 
1117color: #454F63; 
1118
1119 
1120 
1121 
1122</style>      
1123 
1124<#assign assetVocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService")> 
1125<#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")> 
1126<#assign groupId = themeDisplay.getSiteGroupId()> 
1127 
1128<#assign vocabularyTemaMercadologico = assetVocabularyLocalService.getGroupVocabulary(groupId, "Tema(Mercadológico)")> 
1129 
1130<input type="hidden" id="ssp-vocabulary-id-tema-mercadologico" value="${vocabularyTemaMercadologico.getVocabularyId()}"> 
1131      
1132      
1133<#--  Header da Unidade  --> 
1134 
1135 
1136<section style="position:relative;"> 
1137    <div class="ssp-header-unidade__imagem-box">     
1138        <div class="ssp-header-unidade__imagem-box-box-linha"></div> 
1139 
1140        <div class="ssp-header-unidade__imagem-box-box-linha2"></div> 
1141 
1142		<div id="slider">      
1143 
1144            <div class="ssp-header-unidade__imagem-box-imagem selected" style="background-image: url(${imagemUrl})">                 
1145 
1146            </div> 
1147        
1148            <#if endereco2?length != 0> 
1149 
1150                <div class="ssp-header-unidade__imagem-box-imagem" style="background-image: url(${imagemUrl2})"></div>     
1151 
1152            </#if>     
1153                 
1154             
1155                 
1156        </div> 
1157        <!--div class="ssp-header-unidade__imagem-box-imagem" style="background-image: url(img/bg-fale-com-gente.jpg)"></div--> 
1158 
1159		<#--  dados de compartilhamento  --> 
1160		<@liferay_util["html-top"]> 
1161			<meta name="image" property="og:image" content="${imagemUrl}"> 
1162			<meta property="og:image:width" content="1024"> 
1163		</@> 
1164		<#--  dados de compartilhamento  --> 
1165	 
1166		<#if tipoCurso == "Livre" > 
1167			<div class="ssp-header-tema__tag-tipo-curso"></div> 
1168		<#else> 
1169        	<!-- Tag de Tipo de Curso --> 
1170        	<div class="ssp-header-tema__tag-tipo-curso bg-nivel-tecnico"></div> 
1171			 
1172		</#if> 
1173        <div class="ssp-header-unidade__container-info"> 
1174 
1175            <div class="container"> 
1176 
1177                <div class="ssp-header-unidade__content-info" style="height: auto;"> 
1178 
1179                    <div class="ssp-header-unidade__content-info-container"> 
1180 
1181                        <div> 
1182 
1183                            <div> 
1184                                <small class="ssp-header-unidade__subtitle">Senac</small> 
1185                            </div> 
1186 
1187                            <div class="ssp-header-unidade__title-container"> 
1188 
1189                                <div> 
1190 
1191                                    <h1 class="ssp-header-unidade__title"> 
1192										<a href="https://www.sp.senac.br/${friendlyUrlUnidade}"> 
1193											${nome} 
1194										</a>	 
1195									</h1> 
1196									 
1197 
1198								</div> 
1199								 
1200                                <#-- o código da unidade é usado para referência de unidade no --> 
1201                                <span id="codUnidadeReferencia" class="d-none">${codigoUnidade}</span> 
1202                                <span id="friendlyUnidade" class="d-none">${friendlyUrlUnidade}</span> 
1203                                <span id="friendlyTipoCurso" class="d-none">${friendlyUrlTipoCurso}</span> 
1204                                <span id="nomeUnidadeParaBreadCrumb" class="d-none">${nomeUnidadeParaBreadCrumb}</span> 
1205								 
1206								<#if friendlyUrlTipoCurso?contains("livre")> 
1207                                 	<span id="tipoCursoText" class="d-none">Livre</span> 
1208                                <#else> 
1209                                  	<span id="tipoCursoText" class="d-none">Técnico</span> 
1210                               </#if> 
1211                            	<#if friendlyUrlTemaFirst?contains("#erro#")> 
1212                                 	<span id="friendlyTemaNv1" class="d-none"></span> 
1213                                 <#else> 
1214                                  	<span id="friendlyTemaNv1" class="d-none">${friendlyUrlTemaFirst}</span> 
1215                               </#if> 
1216                                <#if friendlyUrlTemaSecond?contains("#erro#")> 
1217                                 	<span id="friendlyTemaNv2" class="d-none"></span> 
1218                                <#else> 
1219                                  <span id="friendlyTemaNv2" class="d-none">${friendlyUrlTemaSecond}</span> 
1220                               </#if> 
1221                               <#if friendlyUrlTemaThird?contains("#erro#")> 
1222                                 	<span id="friendlyTemaNv3" class="d-none"></span> 
1223                                 <#else> 
1224                                 	 <span id="friendlyTemaNv3" class="d-none">${friendlyUrlTemaThird}</span> 
1225                               </#if> 
1226                                
1227                            </div> 
1228 
1229                        </div> 
1230 
1231                        <div class="ssp-header-unidade__endereco-container"> 
1232 
1233                            <div class="d-flex flex-wrap"> 
1234                                 
1235								<div> 
1236								 
1237									<#if endereco2?length != 0> 
1238										<span class="ssp-header-title-bloco">Bloco I</span><br> 
1239									</#if> 
1240 
1241									<address class="ssp-header-unidade__endereco"> 
1242										${endereco}, ${numero}<br>  
1243										${bairro}, ${cidade} - ${UF}, ${cep} 
1244									</address> 
1245 
1246									<span class="ssp-header-unidade__estacionamento"> 
1247 
1248									<i class="fas fa-car"></i> 
1249 
1250										<#if estacionamento?contains("true")> 
1251											<strong>Possui estacionamento?</strong> Sim 
1252											<#else> 
1253											<strong>Possui estacionamento?</strong> Não 
1254										</#if> 
1255 
1256									</span> 
1257								</div> 
1258 
1259								<#if endereco2?length != 0> 
1260 
1261									<div class="pt-5"> 
1262										<span class="ssp-header-title-bloco">Bloco II</span><br> 
1263										<address class="ssp-header-unidade__endereco"> 
1264											${endereco2}, ${numero2}<br>  
1265											${bairro2}, ${cidade2}, ${cep2} 
1266										</address> 
1267										<span class="ssp-header-unidade__estacionamento"> 
1268											<i class="fas fa-car"></i> 
1269 
1270												<#if estacionamento2?contains("true")> 
1271													<strong>Possui estacionamento?</strong> Sim 
1272													<#else> 
1273													<strong>Possui estacionamento?</strong> Não 
1274												</#if> 
1275 
1276										</span> 
1277									</div> 
1278 
1279								</#if> 
1280 
1281							</div>   
1282 
1283                            <div class="ssp-header-unidade__content-info-maps"> 
1284 
1285 
1286                                <a class="btn btn-nivel border-white ssp-header-unidade__btn" href="${googlemaps}" target="_blank"> 
1287                                    <i class="fas fa-map-marker-alt mr-2 ssp-header-unidade__btn-icon"></i>Google Maps 
1288                                </a> 
1289 
1290	                            <a class="btn btn-nivel border-white ml-2  d-sm-inline-block d-md-none d-lg-none d-xl-none ssp-header-unidade__btn" href="${waze}" target="_blank"> 
1291                                    <i class="fab fa-waze mr-2 ssp-header-unidade__btn-icon"></i>Waze 
1292                                </a> 
1293 
1294                            </div>                         
1295                             
1296                        </div> 
1297 
1298                    </div> 
1299 
1300                    <div class="ssp-header-unidade__content-info-body"> 
1301 
1302                        <div class="ssp-header-unidade__atendimento-container"> 
1303                            <p><strong>Atendimento:</strong></p> 
1304	                        <p>${horario}</p> 
1305                        </div> 
1306                         
1307                    </div> 
1308 
1309                     
1310            </div> 
1311             
1312        </div> 
1313 
1314        </div>  
1315                     
1316    </div> 
1317         
1318 
1319<script> 
1320     
1321    if ( $.trim($('.ssp-header-unidade__title').html()) === 'Santo Amaro'){ 
1322 
1323    $('.ssp-header-unidade__subtitle').html('Centro Universitário Senac') 
1324 
1325    } else if ( $.trim($('.ssp-header-unidade__title').html()) === 'Campos do Jordão'){ 
1326 
1327        $('.ssp-header-unidade__subtitle').html('Centro Universitário Senac') 
1328 
1329    } else if ( $.trim($('.ssp-header-unidade__title').html()) === 'Águas de São Pedro'){ 
1330 
1331        $('.ssp-header-unidade__subtitle').html('Centro Universitário Senac') 
1332 
1333
1334 
1335//Animação de Crédito da imagem 
1336 
1337$(document).ready(function(){   
1338 
1339    let larguraTela = $(window).width(); 
1340 
1341    if(larguraTela < 1024){ 
1342 
1343        animateCreditImage() 
1344 
1345        $(window).scroll(function() { 
1346            ScrollPagina() 
1347        }); 
1348 
1349    }else{ 
1350 
1351        $(".ssp-header-unidade__imagem-box-imagem" ).mouseover(function() { 
1352            $(".creditoFotoMob").removeClass('d-none') 
1353         
1354        });   
1355 
1356        $(".ssp-header-unidade__imagem-box-imagem" ).mouseout(function() { 
1357                $(".creditoFotoMob").addClass('d-none') 
1358                 
1359        });  
1360 
1361
1362 
1363    //verifica posição do Top 
1364 
1365    function ScrollPagina(){ 
1366 
1367        let scrollPage = $(window).scrollTop(); 
1368 
1369        if(scrollPage == 0){ 
1370 
1371            animateCreditImage() 
1372 
1373
1374
1375 
1376    function animateCreditImage(){ 
1377 
1378        $( ".creditoFotoMob" ).removeClass('d-none').fadeIn( 200 ).delay( 2500 ).fadeOut( 5000 ); 
1379 
1380
1381 
1382    //anima Slider fotos unidades de 
1383 
1384    let time = 5000, 
1385        currentImageIndex = 0, 
1386        images = document 
1387                    .querySelectorAll("#slider .ssp-header-unidade__imagem-box-imagem") 
1388        max = images.length; 
1389 
1390    function nextImage() { 
1391 
1392        images[currentImageIndex] 
1393            .classList.remove("selected") 
1394 
1395        currentImageIndex++ 
1396 
1397        if(currentImageIndex >= max) 
1398            currentImageIndex = 0 
1399 
1400        images[currentImageIndex] 
1401            .classList.add("selected") 
1402
1403 
1404    function start() { 
1405 
1406        let enderecos = document.querySelectorAll('address'); 
1407 
1408        if(enderecos.length >= 2){     
1409 
1410            setInterval(() => { 
1411                // troca de image 
1412                nextImage() 
1413            }, time) 
1414
1415        
1416
1417 
1418    window.addEventListener("load", start) 
1419 
1420});  
1421     
1422</script> 
1423	 
1424 
1425     
1426</section> 
1427 
1428<!--  Fim Header Unidade --> 
1429 
1430 
1431      
1432<#--  Conteúdo dinâmico que carrega os temas, subtemas e cursos  --> 
1433 
1434<section> 
1435 
1436	<div> 
1437 
1438		<h2 class="ssp-section-tema__title"> 
1439		 
1440			Especialização Técnica 
1441 
1442		</h2> 
1443 
1444		<div class="container"> 
1445 
1446			<div> 
1447				<span class="ssp-unidade-temas__label-filtre-por">Selecione uma área:</span> 
1448			</div> 
1449 
1450			<div id="temas" class="ssp-section-tema__container-menu"> 
1451 
1452				<div class="ssp-section-tema__container-menu-item"> 
1453					<a href="#a" class="tema todos" data-nvl="0"> 
1454						<i class="fa-solid fa-dice-d6"></i> 
1455						Todos 
1456					</a> 
1457				</div> 
1458 
1459			</div> 
1460 
1461			<!-- Botão Visualizar Mais --> 
1462 
1463			<div class="ssp-btn__visualizar-mais-content d-md-none d-lg-none d-xl-none"> 
1464 
1465				<p id="visualizar-mais" class="ssp-btn__visualizar-mais">Visualizar mais</p> 
1466 
1467				<i class="fas fa-chevron-down mx-2 visualizar-mais-seta" style="font-size: 14px;"></i> 
1468				 
1469			</div> 
1470 
1471			<!-- filtros ativos para Mobile --> 
1472 
1473			<div id="filtro-ativo" class="tema-slick-area-mobile py-2"> 
1474 
1475				<!-- filtro nivel 1 --> 
1476				<div id="filtro-ativo-nivel-1" class="ssp-section-tema__container-menu-item mega-menu"> 
1477					 
1478				</div> 
1479 
1480				<div id="filtro-ativo-nivel-2" class="container ssp-section-tema__container-submenu-nivel3"> 
1481							 
1482				</div> 
1483 
1484			</div> 
1485 
1486		</div> 
1487 
1488	</div> 
1489 
1490</section> 
1491 
1492<section  id="tema-nivel2-container" 
1493	style="background-color: #e4e8f0;"> 
1494	 
1495	<h2 id="tema-atual" class="ssp-section-tema__title"></h2> 
1496		 
1497	<#--   
1498	<div id="subtemas-lista-mobile" 
1499		class="container d-none ssp-section-tema__container-submenu-nivel3"></div>  --> 
1500 
1501	<div id="filtro-temas-nivel-2" class="container ssp-section-tema__container-submenu-nivel3 d-none"></div> 
1502	 
1503	<div id="filtro-temas-nivel-3" class="container ssp-section-tema__container-submenu-nivel3 d-none"></div> 
1504 
1505</section> 
1506 
1507<section id="cursos-por-categoria-container" 
1508	style="background-color: #e4e8f0;padding-bottom:30px"> 
1509 
1510	<section class="py-5" style="background-color: #e4e8f0;"> 
1511 
1512		<div class="container"> 
1513			<!-- <hr class="filtroInscBolsa"> --> 
1514			<div class="filtroTextoMobile">  
1515				<span style="font-family: 'Montserrat';font-size: 15px;font-weight: 600;color: #454F63;" > Filtrar por:</span>  
1516			</div> 
1517			<div class="ssp-slider-check__container" style="padding: 20px 0px;" id="container-filtros"> 
1518				<div class="ssp-slider-check__content-itens"> 
1519					<div class="ssp-slider-check__content-item filtroInscBolsa"> 
1520                   		 <span style="font-family: 'Montserrat';font-size: 18px;font-weight: 600;color: #454F63;" >Filtrar por: </span> 
1521                    </div> 
1522					 
1523	 
1524					<div class="ssp-slider-check__content-item"> 
1525	 
1526						<label id="bolsas-estudo" class="switch"> 
1527							<input id="chkBolsa" type="checkbox"> 
1528							<span class="slider azul round"></span> 
1529						</label> 
1530			 
1531						<span class="ssp-slider-check__label">Bolsas de estudo</span> 
1532	 
1533					</div> 
1534	 
1535				</div>     
1536 
1537			</div> 
1538 
1539			<!-- <hr class="filtroInscBolsa"> --> 
1540		</div> 
1541		 
1542		<div id="curso-sem-slick" class="ssp-container__cursos-sem-slick container" style="margin-top:15px;"></div> 
1543 
1544 
1545	</section> 
1546	<div id="filtroSemCurso" class="ssp-bolsa-formulario__card-aviso-atencao d-none container text-left" style="width: 100%;"> 
1547                     
1548        <i class="fas fa-exclamation-circle ssp-bolsa-formulario__card-aviso-atencao-icon" aria-hidden="true"></i> 
1549     
1550        <div class="ssp-bolsa-formulario__card-aviso-texto""><p>Sem cursos para o filtro selecionado</p> 
1551        </div> 
1552     
1553     </div> 
1554	 
1555	 
1556</section> 
1557 
1558 
1559<#-- Template para card de cursos por categoria --> 
1560<section id="cursos-por-categoria-template" 
1561	class="cursos-por-categoria ssp-section container d-none"> 
1562 
1563 
1564	<div class="ssp-page-busca__section-resultado-container" 
1565		id="container-slider-cursos-livres"> 
1566 
1567		<a href="#a" data-nvl="" data-tema="" 
1568			class="ver-todos-cursos-link d-none-mobile"> 
1569		<p 
1570			class="ssp-page-busca__section-resultado__title-outros tema-nome ssp-section-tema__subtitle-curso-section"></p></a> 
1571			 
1572	</div> 
1573 
1574	<div class="slider-curso" style="display: flex;"></div> 
1575 
1576</section> 
1577 
1578<#-- Section para o item de curso--> 
1579<div id="curso-item-template" class="d-none slick-area__item"> 
1580 
1581	<div class="ssp-card-curso custom-card-curso-tema"> 
1582 
1583		<a class="ssp-absolute-link ck-curso" href="#a"></a> 
1584 
1585		<div class="ssp-card-curso__image custom-card-curso-tema__image"> 
1586 
1587			<div class="ssp-image-container"> 
1588				<img src="" /> 
1589 
1590			</div> 
1591 
1592		</div> 
1593 
1594		<div class="ssp-card-curso__body custom-card-curso-tema__body"> 
1595        	<!-- Tag de Tipo de Curso --> 
1596			<#if tipoCurso == "Livre" > 
1597				<div class="ssp-card-curso__color-tag-modalidade bg-nivel-livre custom-card-curso-tema__color-tag-modalidade"></div> 
1598			<#else> 
1599     			<div class="ssp-card-curso__color-tag-modalidade bg-nivel-tecnico custom-card-curso-tema__color-tag-modalidade"></div> 
1600			 
1601			</#if> 
1602			 
1603 
1604			<div class="ssp-card-curso__tags custom-card-curso-tema__tags"> 
1605 
1606				<span class="ssp-card-curso__tag-formato-title">${tipoCurso}</span> 
1607				 
1608				<span class="tag-modalidade-title__senac-online d-none">Senac Online - ao vivo</span> 
1609 
1610			</div> 
1611 
1612			<h6 class="ssp-card-curso__title custom-card-curso-tema__title"> 
1613 
1614			</h6> 
1615 
1616			<div class="ssp-card-curso__info custom-card-curso-tema__info"> 
1617 
1618				<span 
1619					class="ssp-tag bg-white border-nivel-extensao text-nivel-extensao mr-1 btn-inscricoes-abertas">Inscrições 
1620					abertas</span> <span 
1621					class="ssp-tag bg-white border-primary text-primary btn-bolsas">Bolsas</span> 
1622 
1623			</div> 
1624						 
1625		</div> 
1626 
1627	</div> 
1628 
1629</div> 
1630 
1631<#--  Estrutura com botões de tipos de curso -  os únicos que precisam ser dinâmicos são Livre e Técnico  --> 
1632 
1633<section class="ssp-section ssp-section-lg-top"> 
1634 
1635 
1636    <div class="container text-left"> 
1637 
1638        <h2 class="ssp-section-title"> 
1639            <lfr-editable id="title" type="rich-text"> 
1640                Cursos oferecidos 
1641            </lfr-editable> 
1642        </h2> 
1643     
1644        <div class="ssp-btns-horizontal-area"> 
1645 
1646			<#function getCategorias primaryKey> 
1647   
1648			<#assign categoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") /> 
1649			<#attempt> 
1650		   
1651				<#return categoryService.getCategories("com.liferay.journal.model.JournalArticle", primaryKey)> 
1652		   
1653			<#recover> 
1654			   
1655			  <#return '#erro#'> 
1656			</#attempt> 
1657		  </#function> 
1658 
1659			<#assign  
1660			 
1661 
1662				categoriesList = getCategorias(journal.getResourcePrimKey())  
1663				normalizer = serviceLocator.findService("com.liferay.portal.kernel.util.FriendlyURLNormalizerUtil")  
1664				vocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService") 
1665				vocabularies = vocabularyLocalService.getAssetVocabularies(-1,-1) 
1666				 
1667			/> 
1668 
1669 
1670			<#list vocabularies as vocabulary > 
1671			<#if vocabulary.getName() == 'Unidades'> 
1672				 
1673				<#assign  
1674					xPathSelector_nomeUsualUnidade = saxReaderUtil.createXPath("dynamic-element[@name='nomeUsualUnidade']") 
1675					  nomeUsual = xPathSelector_nomeUsualUnidade.selectSingleNode(rootElement).getStringValue() 
1676					  categories = vocabulary.getCategories() 
1677
1678				<#list categories as category> 
1679					<#if  category.getName()?trim == nomeUsual?trim> 
1680						 
1681						<#assign categoryId = category.getCategoryId() > 
1682					</#if> 
1683				</#list> 
1684			</#if> 
1685		</#list> 
1686 
1687 
1688 
1689		<#-- Prefixo EAD--> 
1690        <#assign xPathSelector_urlEAD = saxReaderUtil.createXPath("dynamic-element[@name='prefixourlead']")> 
1691        <#assign prefixoURLEAD = xPathSelector_urlEAD.selectSingleNode(rootElement).getStringValue()> 
1692 
1693        <#assign  hasPrefixoUrlEad = (prefixoURLEAD?trim?length > 0) > 
1694 
1695 
1696			<#list categoriesList![] as category> 
1697  
1698                <#assign vocabularyName = vocabularyLocalService.getVocabulary(category.getVocabularyId()).getTitle("pt-br")?trim /> 
1699  
1700                <#if normalizer.normalize(vocabularyName) == "tipo-de-curso"> 
1701					<#assign normalizedCategoryName = normalizer.normalize(category.getName()) /> 
1702					 
1703					<#if category.getName() == "Livre EAD"> 
1704                    <a href="#" data-categoryId="${category.getCategoryId()}" class="btn btn-nivel btn-nivel-${normalizedCategoryName}">Senac Online<i class="fas fa-signal-stream icon-ao-vivo" aria-hidden="true"></i>ao vivo</a> 
1705                    <#else> 
1706                        <a href="#" data-categoryId="${category.getCategoryId()}" class="btn btn-nivel btn-nivel-${normalizedCategoryName}">${category.getName()}</a> 
1707                    </#if> 
1708					 
1709 
1710                </#if> 
1711  
1712			</#list> 
1713 
1714			<#-- Verifica se a unidade oferta curso de Idiomas--> 
1715 
1716                <<#list categoriesList![] as category> 
1717 
1718                    <#assign vocabularyName = vocabularyLocalService.getVocabulary(category.getVocabularyId()).getTitle("pt-br")?trim /> 
1719 
1720                    <#if normalizer.normalize(vocabularyName) == "tema-mercadologico-">  
1721 
1722						<#assign normalizedCategoryName = normalizer.normalize(category.getName()) /> 
1723 
1724						<#if category.getName() == "Idiomas"> 
1725								<a href="#" data-categoryId="${category.getCategoryId()}" class="btn btn-nivel btn-nivel-${normalizedCategoryName}">${category.getName()}</a> 
1726							<#else> 
1727						</#if> 
1728 
1729                    </#if> 
1730 
1731                </#list>  
1732 
1733            <#-- Verifica se a unidade oferta curso livre--> 
1734 
1735			 
1736			<#if hasPrefixoUrlEad > 
1737 
1738                <a href="${prefixoURLEAD}" target="_blank" class="btn btn-nivel btn-nivel-ead">EAD</a> 
1739 
1740            </#if> 
1741     
1742 
1743	</div> 
1744 
1745    </div> 
1746 
1747 
1748</section> 
1749  
1750 <script> 
1751  
1752var temas = []; 
1753var subtemasStorage = new Map(); 
1754var activeCategory = 'all'; 
1755var activeCategoryLevel = 0; 
1756var limit = 2; 
1757var offset = 0; 
1758var todosText = ''; 
1759var limitTodosCursos = 16; 
1760var offsetTodosCursos = 0; 
1761var groupId = 0; 
1762var tipoCursoNome = ""; 
1763var tipoCursoNomeBreadCrumb = ""; 
1764var cookieName = ""; 
1765var tam = $(window).width(); 
1766var urlUnidade = ""; 
1767var urlTipoCurso = "";  
1768var categoryIdUnidade = ""; 
1769var urlTemasStorage = new Map(); 
1770var urlTemaNv1 = ""; 
1771var urlTemaNv2 = ""; 
1772var urlTemaNv3 = ""; 
1773var acessoDireto = 0; 
1774var categoryIdTemaNv1 = ""; 
1775var categoryIdTemaNv2 = ""; 
1776var categoryIdTemaNv3 = ""; 
1777const HOST = window.location.origin; 
1778var filtrarInscricoesAbertas = 0; 
1779var filtrarBolsaEstudo = 0; 
1780var activeModeloExibicao = 1; 
1781var limitCursos = tam <= 1024 ? 4 : 11; 
1782var cliqueFiltroMobile = 0; 
1783var idModalidadeEspecTecnica = 0; 
1784 
1785const codModalidadeEspecTecnica = 10; 
1786var urlSearchModalidadeEspecTecnica = '/o/senac-category-services/categoryByVocabularyNameAndProperty/{groupId}/Modalidade/codModalidade/' + codModalidadeEspecTecnica; 
1787var urlSearchCursos = '/o/senac-unidade-services/cursosPorCategoriaETemaEUnidade/{groupId}/{categoryTemaId}/{categoriaId}/{unidadeCategoryId}/{filtrarInscricoesAbertas}/{filtrarBolsaEstudo}/{start}/{end}'; 
1788var urlCursosPorTipoCursoETemaComFiltrosBolsaECompra = "/o/senac-content-services/cursosPorCategoriasComFiltrosBolsaECompra/{groupId}/{filtrarInscricoesAbertas}/{filtrarBolsaEstudo}/{considerarUnidade}/{start}/{end}?categoryIds={categoryTemaId}&categoryIds={categoriaId}&categoryIds={unidadeCategoryId}" 
1789var urlSearchTemas = '/o/senac-unidade-services/temasPorCategoriaEUnidade/{groupId}/{unidadeCategoryId}/{categoriaId}/{nivelTema}/{categoriaParentId}'; 
1790 
1791let categorias = [] 
1792 
1793function montaBreadCrumb(){ 
1794	var breadCrumb = $(".breadcrumb"); 
1795	var nomeUnidade = $("#nomeUnidadeParaBreadCrumb").text().trim(); 
1796	 
1797	breadCrumb.empty(); 
1798	 
1799	//Home 
1800	breadCrumb.append('<li class="breadcrumb-item"><a class="breadcrumb-link" href="/" title="Home"><span class="breadcrumb-text-truncate">Home</span></a></li>'); 
1801	 
1802	//Unidades 
1803	breadCrumb.append('<li class="breadcrumb-item"><a class="breadcrumb-link" href="/unidades" title="Unidades"><span class="breadcrumb-text-truncate">Unidades</span></a></li>'); 
1804	 
1805	//Unidade 
1806	breadCrumb.append('<li class="breadcrumb-item"><a class="breadcrumb-link" href="/'+urlUnidade+'" title="'+nomeUnidade+'"><span class="breadcrumb-text-truncate">'+nomeUnidade+'</span></a></li>'); 
1807	 
1808	//Tipo de Curso 
1809	breadCrumb.append('<li class="breadcrumb-item"><a class="breadcrumb-link" href="/'+urlUnidade+'/'+urlTipoCurso+'" title="'+tipoCursoNomeBreadCrumb+'"><span class="breadcrumb-text-truncate">'+tipoCursoNomeBreadCrumb+'</span></a></li>'); 
1810	 
1811
1812 
1813function carregaLinkTodosBotoesModalidades(){ 
1814 
1815	$( document ).ready(function() { 
1816		 
1817        var friendlyUrlUnidade = $("#friendlyUnidade").text().trim(); 
1818 
1819        // extensão 
1820        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-extensao'))){ 
1821 
1822            $('.ssp-btns-horizontal-area').find('.btn-nivel-extensao').attr("href", "https://www.sp.senac.br/jsp/default.jsp?template=1588.dwt&testeira=725&type=X&unit=NONE&sub=") 
1823 
1824
1825 
1826        // Ensino Médio 
1827        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-ensino-medio-tecnico'))){ 
1828 
1829            $('.ssp-btns-horizontal-area').find('.btn-nivel-ensino-medio-tecnico').attr({ 
1830                href : "http://www1.sp.senac.br/hotsites/sites/ensinomedio/", 
1831                target: "_blank" 
1832            }) 
1833 
1834
1835 
1836 
1837        // Graduação 
1838        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-graduacao'))){ 
1839        	 
1840        	var urlGraduacao = "/"+friendlyUrlUnidade+ "/graduacao"; 
1841 
1842            $('.ssp-btns-horizontal-area').find('.btn-nivel-graduacao').attr("href", urlGraduacao); 
1843             
1844
1845 
1846        // Pos-Graduação 
1847        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-pos-graduacao'))){ 
1848 
1849            $('.ssp-btns-horizontal-area').find('.btn-nivel-pos-graduacao').attr({ 
1850                href: "/"+friendlyUrlUnidade+ "/pos-graduacao", 
1851                target: "_blank" 
1852            }) 
1853 
1854
1855 
1856        // livre 
1857        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-livre'))){ 
1858                 
1859            var urlLiv = "/"+friendlyUrlUnidade+ "/cursos-livres"; 
1860             
1861            //Solucao temporaria, ate o proxy estiver correto 
1862            if(friendlyUrlUnidade == "senac-tatuape-luis-americano" || friendlyUrlUnidade == "centro-universitario-senac-campos-do-jordao")  
1863                urlLiv = "/busca?q=*&tipo-curso="+$('.ssp-btns-horizontal-area').find('.btn-nivel-livre').data('categoryid')+"&unidade="+${categoryId}+'#c'; 
1864             
1865				$('.ssp-btns-horizontal-area').find('.btn-nivel-livre').attr("href", urlLiv); 
1866 
1867
1868		 
1869		 // livre Ao vivo 
1870		 if (($('.ssp-btns-horizontal-area').find('.btn-nivel-livre-ead'))){ 
1871 
1872			$('.ssp-btns-horizontal-area').find('.btn-nivel-livre-ead').attr({ 
1873 
1874				href : "https://www.sp.senac.br/cursos-livres-senac-online-ao-vivo" 
1875			}) 
1876 
1877
1878 
1879		// Regra para Botão de Idiomas 
1880 
1881        if( 
1882 
1883            $('#codUnidadeReferencia').text() === "123" ||  
1884            $('#codUnidadeReferencia').text() === "23" ||  
1885            $('#codUnidadeReferencia').text() === "58" ||  
1886            $('#codUnidadeReferencia').text() === "32" ||  
1887            $('#codUnidadeReferencia').text() === "62" && $('.ssp-btns-horizontal-area').find('.btn-nivel-idiomas') 
1888             
1889        ) { 
1890 
1891            var urlIdi = "/"+friendlyUrlUnidade+ "/cursos-livres/idiomas"; 
1892 
1893            $('.ssp-btns-horizontal-area').find('.btn-nivel-idiomas').attr("href", urlIdi); 
1894 
1895        }else{ 
1896            $('.ssp-btns-horizontal-area').find('.btn-nivel-idiomas').addClass("d-none") 
1897
1898 
1899        // Técnicos 
1900        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-tecnico'))){ 
1901 
1902            var urlTec = "/"+friendlyUrlUnidade+ "/cursos-tecnicos"; 
1903             
1904        //Solucao temporaria, ate o proxy estiver correto 
1905        if(friendlyUrlUnidade == "senac-tatuape-luis-americano" || friendlyUrlUnidade == "centro-universitario-senac-campos-do-jordao")  
1906            urlTec = "/busca?q=*&tipo-curso="+$('.ssp-btns-horizontal-area').find('.btn-nivel-tecnico').data('categoryid')+"&unidade="+${categoryId}+'#c'; 
1907         
1908            $(this).find('.btn-nivel-tecnico').attr("href", urlTec); 
1909 
1910
1911 
1912        // Jovem Aprendiz 
1913        if (($('.ssp-btns-horizontal-area').find('.btn-nivel-jovem-aprendiz'))){ 
1914 
1915            $(this).find('.btn-nivel-jovem-aprendiz').attr({ 
1916                href: "/jovem-aprendiz", 
1917            }) 
1918 
1919
1920 
1921 
1922    }); 
1923 
1924 
1925
1926 
1927function carregaLinkBotoesLivreETecnico(){ 
1928	 
1929	urlUnidade = $("#friendlyUnidade").text().trim(); 
1930	urlTipoCurso = $("#friendlyTipoCurso").text().trim();  
1931		 
1932	$.ajax({ 
1933	 
1934		url : '/o/senac-content-services/url-tipos-de-curso/'+groupId, 
1935		type : 'get', 
1936		dataType: 'json', 
1937	 
1938	}).done(function(res) { 
1939		$(res).each(function(key , value){ 
1940			 
1941			if(value.name == 'tecnico'){ 
1942				//botao livre 
1943				$("#linkTecnico").attr('href', "/"+urlUnidade+"/"+value.friendlyURL); 
1944				 
1945			}else 
1946				 if(value.name == 'livre'){ 
1947			 
1948					 $("#linkLivre").attr('href', "/"+urlUnidade+"/"+ value.friendlyURL); 
1949					  
1950
1951			 
1952		 
1953		}); 
1954		 
1955	}); 
1956 
1957	 
1958 
1959
1960 
1961//verifica se usuario acessou direto pelas urls dos temas e carrega os temas para dar sequencia 
1962function verificaAcessoDiretoELoadTema(){ 
1963	 
1964	urlTemaNv1 = $("#friendlyTemaNv1").text().trim(); 
1965	urlTemaNv2 = $("#friendlyTemaNv2").text().trim(); 
1966	urlTemaNv3 = $("#friendlyTemaNv3").text().trim(); 
1967	 
1968	//tem tema de nivel 1 na url 
1969	if(urlTemaNv1 != ''){ 
1970		 
1971		//seta variavel global para checar de outras partes se necessario 
1972		acessoDireto = 1; 
1973		 
1974		$.ajax({ 
1975			url : '/o/senac-unidade-services/categoriaPorFriendlyURL/'+urlTemaNv1+"/"+0, 
1976			type : 'get', 
1977			dataType: 'json' 
1978		}) 
1979		.done(function(temaCategories) { 
1980			 
1981			categoryIdTemaNv1 = temaCategories[0].categoryId; 
1982			 
1983			//armazenando no map para nao precisar ficar buscando a url quando clicar nos temas  
1984			urlTemasStorage.set(categoryIdTemaNv1,urlTemaNv1); 
1985			 
1986			if(urlTemaNv2 == ""){ 
1987				carregaTemasNivelDireto(1); 
1988			}else{ 
1989				//buscando categoria do tema nivel 2 
1990				$.ajax({ 
1991					url : '/o/senac-unidade-services/categoriaPorFriendlyURL/'+urlTemaNv2+"/"+categoryIdTemaNv1, 
1992					type : 'get', 
1993					dataType: 'json' 
1994				}) 
1995				.done(function(temaCategories2) { 
1996					 
1997						 
1998					categoryIdTemaNv2 = temaCategories2[0].categoryId; 
1999					urlTemasStorage.set(categoryIdTemaNv2,urlTemaNv2); 
2000					 
2001					if(urlTemaNv3 == ""){ 
2002						carregaTemasNivelDireto(2); 
2003					}else{ 
2004						 
2005						//buscando categoria do tema nivel 3 
2006						$.ajax({ 
2007							url : '/o/senac-unidade-services/categoriaPorFriendlyURL/'+urlTemaNv3+"/"+categoryIdTemaNv2, 
2008							type : 'get', 
2009							dataType: 'json' 
2010						}) 
2011						.done(function(temaCategories3) { 
2012							categoryIdTemaNv3 = temaCategories3[0].categoryId; 
2013							urlTemasStorage.set(categoryIdTemaNv3,urlTemaNv3); 
2014							carregaTemasNivelDireto(3); 
2015							 
2016						}); 
2017						 
2018
2019				}); 
2020
2021			 
2022		}); 
2023		 
2024	//nao tem tema na url entao carrega tudo normal 
2025	}else{ 
2026		carregaTemas(); 
2027		$('#tema-atual').text("Todos os cursos"); 
2028		todosText = $('#tema-atual').text(); 
2029
2030 
2031 
2032
2033 
2034// Verificar se a url em parametro de bolsas 
2035 
2036function verificaUrlBolsa(){ 
2037 
2038	let urlPage = window.location.href; 
2039	let parametroBolsa = "?bolsa:true" 
2040	let verificaURL = urlPage.includes(parametroBolsa) 
2041 
2042	if(verificaURL == true){ 
2043 
2044		$('#bolsas-estudo input').trigger( "click" ); 
2045 
2046
2047 
2048
2049 
2050/* Prepara a montagem inicial da página */ 
2051function init() { 
2052	 
2053 
2054	tipoCursoNomeBreadCrumb = "Cursos Técnicos"; 
2055	tipoCursoNome = "Técnico"; 
2056	cookieName = "ck-cursos-tecnico";	 
2057 
2058	const urlParams = new URLSearchParams(window.location.search) 
2059	  $('#chkInscricao').prop("checked", urlParams.get('inscricao') == 'true') 
2060	  $('#chkInscricao').prop("checked") ? filtrarInscricoesAbertas = 1 : filtrarInscricoesAbertas = 0 
2061	  $('#chkInscricao').change(ev => selectFilter('inscricao', $('#chkInscricao')) ) 
2062	   
2063	  if($('#chkBolsa').length) { 
2064	   $('#chkBolsa').prop("checked", urlParams.get('bolsa') == 'true') 
2065	   $('#chkBolsa').prop("checked") ? filtrarBolsaEstudo = 1 : filtrarBolsaEstudo = 0 
2066	   $('#chkBolsa').change(ev => selectFilter('bolsa', $('#chkBolsa')) ) 
2067	     
2068	  }  
2069 
2070	 
2071	groupId = Liferay.ThemeDisplay.getScopeGroupId(); 
2072	 
2073	 
2074	carregarCategorias(); 
2075	setCategoryIds(); 
2076
2077 
2078function carregarCategorias() { 
2079	if(!categorias.length) { 
2080		const searchParams = new URLSearchParams({ 
2081			companyId: themeDisplay.getCompanyId(), 
2082			groupIds: themeDisplay.getScopeGroupId(), 
2083			parentCategoryIds: 0, 
2084			vocabularyIds: document.querySelector('#ssp-vocabulary-id-tema-mercadologico').value 
2085		}) 
2086 
2087		$.ajax({ 
2088			url : '/o/senac-category-services/categories?' + searchParams.toString(), 
2089			method : 'get', 
2090			async: false 
2091		}) 
2092		.done(data => categorias = data) 
2093		.fail(err => console.error(err)) 
2094
2095
2096 
2097function selectFilter(paramkey, el) { 
2098	 setUrlParam(paramkey, el.prop("checked"))   
2099
2100 
2101function setUrlParam(key, value) { 
2102	 const url = new URL(window.location.href) 
2103	 if(value) 
2104	 	url.searchParams.set(key, value); 
2105	 else 
2106	 	url.searchParams.set(key, false); 
2107	 window.history.pushState({}, '', url.toString()) 
2108
2109 
2110 
2111 
2112 
2113$(document).ready(function() { 
2114	 
2115	init(); 
2116	 
2117	//Associa eventos 
2118	$(document).on("click", ".ver-todos-cursos-link", verTodosCursos); 
2119	$(document).on("click", ".card-ver-todos-cursos-link", verTodosCursos); 
2120 
2121 
2122}); 
2123 
2124 
2125//Função que carrega os 5 primeiros Temas e utiliza o botão Visualizar mais e menos na versão Mobile 
2126 
2127function exibeTemasMobile(){ 
2128 
2129   //seleciona todos os temas 
2130	var itensTema = $('#temas').children() 
2131	var itensExibidos = 6 
2132 
2133	//mostra apenas os 5 primeiros 
2134	itensTema.slice(itensExibidos).hide() 
2135 
2136	//Verifica a quantidade de temas e se exibe ou nao o botao ver mais  
2137	if( itensTema.length < itensExibidos){ 
2138 
2139		$('.ssp-btn__visualizar-mais-content').addClass('d-none') 
2140 
2141	}else{ 
2142		$('.ssp-btn__visualizar-mais-content').removeClass('d-none') 
2143
2144 
2145	//Mostra apenas os 5 primeiros temas 
2146	//$('#temas').children().slice(3).hide() 
2147 
2148 
2149 
2150
2151 
2152// mobile - botao visualiza mais/menos 
2153if(tam <= 1024){ 
2154	// Botao ver mais e menos Temas 
2155	$(document).on("click", '#visualizar-mais',function(){ 
2156			var itensTema = $('#temas').children() 
2157			var itensExibidos = 6; 
2158			 
2159			if( $(this).text() === "Visualizar mais" ){ 
2160	 
2161				itensTema.slice(itensExibidos).show(); 
2162	 
2163				$(this).text('Visualizar menos'); 
2164				 
2165				$(this).parent().find('i').removeClass('fa-chevron-down'); 
2166				 
2167				$(this).parent().find('i').addClass('fa-chevron-up'); 
2168				 
2169	 
2170			}else{ 
2171	 
2172				itensTema.slice(itensExibidos).hide(); 
2173	 
2174				$(this).text('Visualizar mais'); 
2175	 
2176				$(this).parent().find('i').removeClass('fa-chevron-up'); 
2177				 
2178				$(this).parent().find('i').addClass('fa-chevron-down'); 
2179				 
2180			}      
2181	}) 
2182 
2183
2184function resetTemasMobile(){ 
2185    $('.todos').trigger('click'); 
2186     
2187    if($('#visualizar-mais').text() === "Visualizar menos"){ 
2188    	$('#visualizar-mais').text("Visualizar mais"); 
2189    	$('#visualizar-mais').parent().find('i').removeClass('fa-chevron-up'); 
2190    	$('#visualizar-mais').parent().find('i').addClass('fa-chevron-down'); 
2191
2192     
2193    $('#visualizar-mais').removeClass('d-none'); 
2194
2195 
2196// Botao para filtro de cursos com inscricoes abertas e bolsas 
2197$('#inscricao-aberta input, #bolsas-estudo input').click(function(){ 
2198	 
2199	if(tam <= 1024){ 
2200		//mobile quando clica no tema/subtema volta ao nivel anterior, esta flag serve para nos eventos de click nao fazer isso 
2201		cliqueFiltroMobile = 1; 
2202
2203	 
2204   
2205  //Atualiza as variaveis globais dos dois filtros 
2206  $("#inscricao-aberta input").is(":checked") == true ? filtrarInscricoesAbertas = 1 : filtrarInscricoesAbertas = 0; 
2207  $("#bolsas-estudo input").is(":checked") == true ? filtrarBolsaEstudo = 1 : filtrarBolsaEstudo = 0; 
2208   
2209  //Refaz a busca com os filtros atualizados 
2210  switch(activeModeloExibicao){ 
2211    case 1: 
2212    	  
2213    case 2: 
2214       
2215      //Verifica se esta exibindo todos ou algum tema 
2216      var botaoTodos = $('.todos'); 
2217       
2218      if(botaoTodos.hasClass('ativo') || botaoTodos.hasClass('tema-ativo'))  
2219          $('.todos:first').trigger('click'); 
2220       
2221      //Se estiver ativo um tema, verifica se possui ativo um subtema 
2222      else 
2223        //Verifica o nivel do tema clicado 
2224        $('.subtema-ativo').length == 0 ? $('.tema-ativo:first').trigger('click') : $('.subtema-ativo:first').trigger('click'); 
2225        break; 
2226 
2227      case 3: 
2228    	  $('.subtema-ativo').length == 0 ? $('.tema-ativo:first').trigger('click') : $('.subtema-ativo:last').trigger('click'); 
2229      break; 
2230
2231}) 
2232 
2233//nivel 0 -> botao todos 
2234function atualizaUrlBrowser(urlTema,nivel){ 
2235	var path = window.location.pathname; 
2236	var urlFinal = ""; 
2237	 
2238	if(path.indexOf('staging') > 1){ 
2239		urlFinal = "/web/guest-staging"; 
2240	}else 
2241		if(path.indexOf('guest') > 1){ 
2242			urlFinal = "/web/guest"; 
2243
2244		 
2245	urlFinal += "/"+urlUnidade+"/"+urlTipoCurso;	 
2246	 
2247	//se for todos os cursos a url fica so /unidade/tipo-curso 
2248	if(nivel > 0){ 
2249 
2250		switch(nivel){ 
2251		 
2252			case 1: 
2253				urlTemaNv1 = urlTema; 
2254				urlFinal += "/"+urlTemaNv1; 
2255			break; 
2256			 
2257			case 2: 
2258				urlTemaNv2 = urlTema; 
2259				if(tipoCursoNome == "Livre"){ 
2260					urlFinal += "/"+urlTemaNv1+"/"+urlTemaNv2; 
2261				}else{ 
2262					urlFinal += "/"+urlTemaNv1; 
2263
2264			break; 
2265			 
2266			case 3: 
2267				if(tipoCursoNome == "Livre"){ 
2268					urlTemaNv3 = urlTema; 
2269					urlFinal += "/"+urlTemaNv1+"/"+urlTemaNv2+"/"+urlTemaNv3; 
2270
2271			break; 
2272		 
2273
2274		 
2275
2276 
2277	urlFinal = new URL(window.location.origin + urlFinal); 
2278	  if($("#inscricao-aberta input").is(":checked")){ 
2279	    urlFinal.searchParams.set("inscricao", true); 
2280	  }  
2281	  if($("#bolsas-estudo input").is(":checked")){ 
2282	    urlFinal.searchParams.set("bolsa", true); 
2283	  }  
2284	  window.history.pushState('', 'Categoria JavaScript', urlFinal.toString()); 
2285
2286 
2287function buscaFriendlyUrlTemaEAtualizaBrowser(temaId,nivelClicado){ 
2288	 
2289	var friendlyUrlTema = urlTemasStorage.get(temaId); 
2290	 
2291	 
2292	//se ainda nao tem no map, busco via ajax e armazeno no map a url do tema clicado para nao precisar buscar novamente 
2293	if(typeof  friendlyUrlTema === "undefined"){ 
2294		$.ajax({ 
2295			url : '/o/senac-content-services/friendlyUrlPorCategoria/'+temaId, 
2296			type : 'get', 
2297			dataType: 'json', 
2298		}).done(function(res) { 
2299			 
2300			urlTemasStorage.set(temaId,res.url); 
2301			 
2302			atualizaUrlBrowser(res.url,nivelClicado); 
2303			 
2304		}) 
2305	}else{ 
2306		atualizaUrlBrowser(friendlyUrlTema,nivelClicado); 
2307
2308
2309 
2310/* Carrega os subtemas ou cursos ao clicar no tema */ 
2311$(".container").on( 
2312		"click", 
2313		".tema", 
2314		function() { 
2315			 
2316			//No mobile, se ja tiver o tema ativo, fecha esse tema e volta ao nivel 0 
2317			if(tam <= 1024){ 
2318				 
2319				if(!cliqueFiltroMobile){ 
2320					 
2321					$('#visualizar-mais').addClass('d-none'); 
2322					 
2323					if($(this).hasClass('tema-ativo')){ 
2324						 
2325						carregaTemas(); 
2326					    $('#filtro-ativo-nivel-1').empty() 
2327					    $('#temas').empty() 
2328					    $('#temas').removeClass('d-none') 
2329					    //Recria o botao Todos os cursos e recarrega os temas 
2330					    $('#temas').append('<div class="ssp-section-tema__container-menu-item"><a href="#a" class="tema todos" data-nvl="0"><i class="fa-solid fa-dice-d6"></i>Todos</a></div>') 
2331					    resetTemasMobile(); 
2332					   
2333					    //Limpa os filtros de nivel 2 ativos 
2334					    $("#filtro-ativo-nivel-2").empty(); 
2335					     
2336						return; 
2337
2338				}else{ 
2339					//reinicializo clique no filtro quando é mobile e continuo com comportamento normal do clique 
2340					cliqueFiltroMobile = 0; 
2341
2342
2343			 
2344			 
2345			var categoriaId = $(this).data('tema'); 
2346			 
2347			if($(this).hasClass('todos')){ 
2348			 
2349				//se clicou em todos nao preciso buscar o id da categoria do tema, so atualizo a url 
2350				//nivel 0 = botao todos os cursos 
2351				atualizaUrlBrowser(0,0);		 
2352				 
2353				$('.todos').addClass('ativo'); 
2354			}else{ 
2355				 
2356				if(!acessoDireto)				 
2357					buscaFriendlyUrlTemaEAtualizaBrowser(categoriaId,1); 
2358				 
2359				// Verifica o elemento, adiciona a classe ativo e remove dos seus primos 
2360				$('.todos').removeClass('ativo'); 
2361
2362			 
2363			var primos = $(this).parent().siblings().children(); 
2364			$('.tema[data-tema="'+categoriaId+'"]').addClass('tema-ativo'); 
2365			$(primos).not('.tema[data-tema="'+categoriaId+'"]').removeClass('tema-ativo'); 
2366			 
2367			 
2368			// limpa a lista de subtemas 
2369			$('#filtro-temas-nivel-2').empty(); 
2370			$('#filtro-temas-nivel-3').empty() 
2371			 
2372			limit = 2; 
2373			offset = 0; 
2374			 
2375			limitTodosCursos = 16; 
2376			offsetTodosCursos = 0; 
2377			 
2378			activeCategoryLevel = $(this).data('nvl'); 
2379 
2380      		//Evita de chamar o servico de categoria quando clicar em 'todos' 
2381	      if(!$(this).hasClass('todos')){ 
2382	  			$.ajax( 
2383
2384	  						url : '/o/senac-content-services/category/' 
2385	  								+ $(this).data('tema'), 
2386	  						type : 'get' 
2387	  					}).done(function(category) { 
2388	 
2389	  				activeCategory = JSON.parse(category); 
2390	  				 
2391	  				cleanElements();		 
2392	  				 
2393	  				displayCursosPorTema(); 
2394	  				 
2395	  				//if(tipoCursoNome == "Livre") 
2396	  					displaySubTemasLista(); 
2397	  			}); 
2398	  			 
2399	  			if(tipoCursoNome == "Livre"){ 
2400	  				if (tam <=1024){ 
2401	 
2402	  					$('#temas').addClass('d-none') 
2403	  					// adiciona o item selecionado nos filtros 
2404	  					$("#filtro-ativo-nivel-1").prepend(this); 
2405
2406
2407
2408		 
2409}); 
2410		 
2411 
2412/* Quando clica em Ver Todos cursos de um tema */ 
2413function verTodosCursos(){ 
2414	 
2415	 
2416	//Scrool top 
2417	$('html, body').animate({ 
2418        scrollTop: $("#temas").offset().top 
2419    }, -1000); 
2420	 
2421	 
2422	var tema = $(this).data('tema'); 
2423	activeCategoryLevel = $(this).data('nvl'); 
2424	 
2425	//buscaFriendlyUrlTemaEAtualizaBrowser(tema,activeCategoryLevel); 
2426 
2427	// Verifica o elemento, adiciona a classe ativo e remove dos seus primos 
2428	$('.todos').removeClass('ativo'); 
2429	 
2430 
2431	// Esconde os subtemas 
2432	//$('#filtro-temas-nivel-2').empty(); 
2433	//$('#filtro-temas-nivel-2').addClass('d-none'); 
2434	 
2435	 
2436	limit = 2; 
2437	offset = 0; 
2438 
2439	$.ajax({ 
2440		url : '/o/senac-content-services/category/'+ tema, 
2441		type : 'get' 
2442	}).done(function(category) { 
2443 
2444		activeCategory = JSON.parse(category); 
2445		 
2446		switch(activeCategoryLevel){ 
2447			case 1: 
2448				$('.tema').removeClass('tema-ativo'); 
2449				$('.tema[data-tema="'+activeCategory.categoryId+'"]').not('.slick-cloned').each(function(){ 
2450					if(!$(this).parent().hasClass('slick-cloned')){	 
2451						var botaoTemaVerTodos = $(this); 
2452						botaoTemaVerTodos.trigger('click'); 
2453
2454				}); 
2455				 
2456				break; 
2457			case 2: 
2458					 
2459				var botaoTemaVerTodosNv2 = $('.subtema[data-tema="'+activeCategory.categoryId+'"]'); 
2460				botaoTemaVerTodosNv2.trigger('click'); 
2461				 
2462				break; 
2463			case 3: 
2464				var botaoTemaVerTodosNv3 = $('.subtema[data-tema="'+activeCategory.categoryId+'"]'); 
2465				botaoTemaVerTodosNv3.trigger('click'); 
2466				 
2467				break; 
2468
2469			 
2470		 
2471	}); 
2472
2473 
2474// evento de click nos subtemas 
2475 
2476$("#filtro-temas-nivel-2, #filtro-temas-nivel-3").on( 
2477		"click", 
2478		".subtema", 
2479		function() { 
2480			$(this).addClass("subtema-ativo"); 
2481			$(this).siblings().removeClass("subtema-ativo"); 
2482			$(this).siblings().removeClass("ativo"); 
2483			 
2484			limitTodosCursos = 16; 
2485			offsetTodosCursos = 0; 
2486			offset = 0; 
2487			 
2488			$('#cursos-por-subtema-container').find('#curso-sem-slick').empty(); 
2489 
2490			activeCategoryLevel = $(this).data('nvl'); 
2491			 
2492			if(!acessoDireto) 
2493				buscaFriendlyUrlTemaEAtualizaBrowser($(this).data('tema'),activeCategoryLevel); 
2494			 
2495			$.ajax( 
2496
2497						url : '/o/senac-content-services/category/' 
2498								+ $(this).data('tema'), 
2499						type : 'get' 
2500					}) 
2501 
2502			.done(function(category) { 
2503 
2504				activeCategory = JSON.parse(category); 
2505				 
2506				cleanElements();				 
2507				displayCursosPorTema(); 
2508 
2509			}); 
2510			 
2511            if (tam <=1024){ 
2512 
2513				//$('#temas').addClass('d-none') 
2514				// adiciona o item selecionado nos filtros 
2515            	$("#filtro-ativo-nivel-2").append(this); 
2516                $("#filtro-temas-nivel-2, #filtro-temas-nivel-3").empty(); 
2517                 
2518
2519 
2520}); 
2521 
2522//Mobile, quando clica em um subtema ativo 
2523$("#filtro-ativo-nivel-2").on( 
2524		"click", 
2525		".subtema-ativo", 
2526		function() { 
2527		 
2528		//o filtro ativa esta trigger, entao preciso saber se clique veio do filtro ou do botao mesmo	 
2529		//se botao, removo ele e volto pro tema pai 
2530		if(!cliqueFiltroMobile){ 
2531				 
2532				$(this).remove(); 
2533				 
2534				if($(this).attr('data-nvl') == '2'){ 
2535			    	 
2536					var temaAtivo = $('.tema-ativo'); 
2537					 
2538					temaAtivo.removeClass('tema-ativo'); 
2539					 
2540					temaAtivo.trigger('click'); 
2541			       
2542			    }else { 
2543			    	 
2544					var subtemaAtivo = $('.subtema-ativo'); 
2545					 
2546					subtemaAtivo.removeClass('subtema-ativo'); 
2547					 
2548					subtemaAtivo.trigger('click'); 
2549			       
2550
2551				 
2552		//se filtro carrego os cursos com o filtro, igual comportamento desktop 		 
2553		}else{ 
2554			 
2555			//reinicializo a flag 
2556			cliqueFiltroMobile = 0 ; 
2557			 
2558			$(this).addClass("subtema-ativo"); 
2559			 
2560			limitTodosCursos = 16; 
2561			offsetTodosCursos = 0; 
2562			offset = 0; 
2563			 
2564			$('#cursos-por-subtema-container').find('#curso-sem-slick').empty(); 
2565		 
2566			activeCategoryLevel = $(this).data('nvl'); 
2567			 
2568			if(!acessoDireto) 
2569				buscaFriendlyUrlTemaEAtualizaBrowser($(this).data('tema'),activeCategoryLevel); 
2570		 
2571			$.ajax( 
2572
2573						url : '/o/senac-content-services/category/' 
2574								+ $(this).data('tema'), 
2575						type : 'get' 
2576					}) 
2577		 
2578			.done(function(category) { 
2579		 
2580				activeCategory = JSON.parse(category); 
2581				 
2582				cleanElements();				 
2583				displayCursosPorTema(); 
2584		 
2585			}); 
2586		 
2587			if($(this).attr('data-nvl') == '2'){		 
2588				// adiciona o item selecionado nos filtros 
2589		    	$("#filtro-ativo-nivel-2").prepend(this); 
2590		        $("#filtro-temas-nivel-2, #filtro-temas-nivel-3").empty(); 
2591
2592		 
2593
2594}); 
2595 
2596/*Mobile, quando clica em um subtema via trigger*/ 
2597 if (tam <=1024){ 
2598	$("#filtro-ativo-nivel-2").on( 
2599			"click", 
2600			".subtema", 
2601			function() { 
2602				 
2603				if($(this).attr('data-nvl') == '2' && !$(this).hasClass('subtema-ativo')){ 
2604					 
2605					$(this).addClass("subtema-ativo"); 
2606					$(this).siblings().removeClass("subtema-ativo"); 
2607					$(this).siblings().removeClass("ativo"); 
2608					 
2609					limitTodosCursos = 16; 
2610					offsetTodosCursos = 0; 
2611					offset = 0; 
2612					 
2613					$('#cursos-por-subtema-container').find('#curso-sem-slick').empty(); 
2614				 
2615					activeCategoryLevel = $(this).data('nvl'); 
2616					 
2617					if(!acessoDireto) 
2618						buscaFriendlyUrlTemaEAtualizaBrowser($(this).data('tema'),activeCategoryLevel); 
2619				 
2620					$.ajax( 
2621
2622								url : '/o/senac-content-services/category/' 
2623										+ $(this).data('tema'), 
2624								type : 'get' 
2625							}) 
2626				 
2627					.done(function(category) { 
2628				 
2629						activeCategory = JSON.parse(category); 
2630						 
2631						cleanElements();				 
2632						displayCursosPorTema(); 
2633				 
2634					}); 
2635					 
2636					// adiciona o item selecionado nos filtros 
2637			    	$("#filtro-ativo-nivel-2").prepend(this); 
2638			        $("#filtro-temas-nivel-2, #filtro-temas-nivel-3").empty(); 
2639
2640
2641	); 
2642 }		 
2643		 
2644/* Click no botao todos */ 
2645$(".container").on("click", ".todos", function() { 
2646	 
2647	activeCategory = 'all'; 
2648	activeCategoryLevel = $(this).data('nvl'); 
2649	offset = 0; 
2650 
2651	/* Limpa dados de subtemas que possam ter sido criados na navegacao */ 
2652	cleanElements(); 
2653 
2654	$('#tema-atual').text("Todos os cursos"); 
2655 
2656	// Esconde a div com subtemas 
2657	$('#filtro-temas-nivel-2').empty(); 
2658	$('#filtro-temas-nivel-2').addClass('d-none'); 
2659 
2660 
2661	displayCursosPorTema(); 
2662 
2663}); 
2664 
2665function getTextoSemCurso(filtroBolsa,filtroInsc,temaNome){ 
2666	 
2667	temaNome = typeof temaNome === "undefined" ? '' : 'de '+temaNome; 
2668	 
2669	if(filtroBolsa && filtroInsc) 
2670		return "<p>No momento, estamos sem cursos <strong><span id='nomeTemaSemCurso'>"+temaNome+"</span></strong> disponíveis para compra e com bolsas de estudo nesta unidade.<br>Selecione outras áreas para consultar bolsas nesta unidade ou <a href='https://www.sp.senac.br/bolsas-de-estudo'>confira bolsas disponíveis em diferentes cursos de outras unidades.</a></p>"; 
2671	else if(filtroBolsa) 
2672		return "<p>No momento, estamos sem cursos <strong><span id='nomeTemaSemCurso'>"+temaNome+"</span></strong> com bolsas de estudo nesta unidade.<br>Selecione outras áreas para consultar bolsas nesta unidade ou <a href='https://www.sp.senac.br/bolsas-de-estudo'>confira bolsas disponíveis em diferentes cursos de outras unidades.</a></p>";	 
2673	else if(filtroInsc) 
2674		return "<p>No momento, estamos sem cursos <strong><span id='nomeTemaSemCurso'>"+temaNome+"</span></strong> disponíveis para compra nesta unidade."; 
2675
2676 
2677/* Limpa a tela para exibicao de novos cursos */ 
2678function cleanElements() { 
2679 
2680	$('#cursos-por-categoria-container .cursos-por-categoria').remove(); 
2681	$('#curso-sem-slick').empty(); 
2682	$('#cursos-por-categoria-container').removeClass('d-none'); 
2683
2684 
2685function cleanCursosCategoria(){ 
2686	$('#cursos-por-categoria-container .cursos-por-categoria').remove(); 
2687
2688 
2689function cleanTemasNivel2(){ 
2690	$('#subsubtemas-lista').remove(); 
2691
2692 
2693/* 
2694 * Armazena a navegacao em cookies, se habilitado 
2695 */ 
2696$(document).on("click", ".ck-curso", function() { 
2697	 
2698	//Verifica se o cookie esta habilitado 
2699    if(getCookie('portalSenacCookie') != null){ 
2700    	 
2701		var articleId = $(this).data('ck'); 
2702		manageCookieArray(cookieName, articleId); 
2703		manageCookieArray('ck-cursos', articleId); 
2704
2705 
2706}); 
2707 
2708/* 
2709 * Exibe os cursos por tema, dependendo do nivel 
2710 */ 
2711function displayCursosPorTema() { 
2712	 
2713	$("#filtroSemCurso").addClass("d-none"); 
2714	 
2715	// Verifica o nivel 
2716	switch (activeCategoryLevel) { 
2717 
2718	case 0: // exibe todos 
2719		 
2720		limit = 2; 
2721 
2722		$.each(temas.slice(offset, limit + offset), function(k, t) { 
2723			 
2724			if($('#cursos-por-categoria-'+t.categoryId).length == 0){ 
2725				 
2726				var template = $('#cursos-por-categoria-template').clone(); 
2727				template.prop('id', 'cursos-por-categoria-'+t.categoryId); 
2728				template.removeClass('d-none'); 
2729				$('#cursos-por-categoria-container').append(template); 
2730
2731			 
2732			$.ajax( 
2733
2734						url : '/o/senac-content-services/category/' 
2735								+ t.categoryId, 
2736						type : 'get' 
2737					}).done(function(category) { 
2738						 
2739						var dadosCategoria = JSON.parse(category); 
2740						 
2741						//monta as divs para cada tcategoria 
2742						var templatePorCategoria = $('#cursos-por-categoria-'+dadosCategoria.categoryId); 
2743						templatePorCategoria.find('.tema-nome').text(dadosCategoria.name); 
2744						templatePorCategoria.find('.ver-todos-cursos-link').attr('data-nvl', 1); 
2745						templatePorCategoria.find('.ver-todos-cursos-link').attr('data-tema', dadosCategoria.categoryId); 
2746						templatePorCategoria.removeClass('d-none'); 
2747 
2748						cursosPorCategoriaModelo1(dadosCategoria); 
2749 
2750			}); 
2751		}); 
2752		 
2753		// Esconde botao carregar mais, se  necessario 
2754		 
2755		$('.section-carregar-mais').remove(); 
2756		 
2757		if (temas.length > limit + offset){ 
2758			$('#cursos-por-categoria-container').append('<section style="padding: 30px 0; width:100%" class="section-carregar-mais"><div class="container"><a href="#a" class="ssp-section-tema__btn-ver-mais" id="carregar-mais" style="visibility:hidden"> Carregar mais unidades </a></div></section>'); 
2759
2760		 
2761		 
2762		break; 
2763 
2764	case 1: 
2765		limit = 2; 
2766 
2767		$('#tema-atual').text("Cursos de "+activeCategory.name); 
2768			 
2769		//Exibe a lista de subtemas, quando mobile 
2770		var tam = $(window).width(); 
2771		  
2772		if (tam < 1024){ 
2773			 
2774			$('#subtemas-lista-mobile').empty(); 
2775			$('#subtemas-lista-mobile').removeClass('d-none'); 
2776			 
2777			$.each(subtemasStorage.get(activeCategory.categoryId), function(k, t) { 
2778				 
2779				$('#subtemas-lista-mobile').append('<a href="#a" class="subtema btn-nivel-3" data-tema="' 
2780						+ t.categoryId 
2781						+ '" data-nvl="2" style="font-size: 14px;">' 
2782						+ t.name 
2783						+ '</a>'); 
2784			}); 
2785			 
2786
2787		 
2788		// Exibe os cursos dos subtemas do tema clicado percorrendo a lista de 
2789		// subtemas do tema clicado 
2790		if(subtemasStorage.get(activeCategory.categoryId).length > 0){ 
2791						 
2792			$.each(subtemasStorage.get(activeCategory.categoryId).slice(offset, 
2793					limit + offset), function(k, t) { 
2794				 
2795				 
2796				if($('#cursos-por-categoria-'+t.categoryId).length == 0){ 
2797					 
2798					var template = $('#cursos-por-categoria-template').clone(); 
2799					template.prop('id', 'cursos-por-categoria-'+t.categoryId); 
2800	 
2801					template.removeClass('d-none'); 
2802					 
2803					$('#cursos-por-categoria-container').append(template); 
2804
2805	 
2806				$.ajax( 
2807
2808							url : '/o/senac-content-services/category/' 
2809									+ t.categoryId, 
2810							type : 'get' 
2811						}).done(function(category) { 
2812							 
2813							var dadosCategoria = JSON.parse(category); 
2814							 
2815							//monta as divs para cada tcategoria 
2816							var templatePorCategoria = $('#cursos-por-categoria-'+dadosCategoria.categoryId); 
2817							templatePorCategoria.find('.tema-nome').text(dadosCategoria.name); 
2818							templatePorCategoria.find('.ver-todos-cursos-link').attr('data-nvl', 2); 
2819							templatePorCategoria.find('.ver-todos-cursos-link').attr('data-tema', dadosCategoria.categoryId); 
2820							templatePorCategoria.removeClass('d-none'); 
2821 
2822							cursosPorCategoriaModelo1(dadosCategoria); 
2823	 
2824				}); 
2825				 
2826			}); 
2827			 
2828			 
2829			// Esconde botao carregar mais, se  necessario 
2830			$('.section-carregar-mais').remove(); 
2831			 
2832			if (subtemasStorage.get(activeCategory.categoryId).length > limit + offset) 
2833				$('#cursos-por-categoria-container').append('<section style="padding: 30px 0; width:100%" class="section-carregar-mais"><div class="container"><a href="#a" class="ssp-section-tema__btn-ver-mais" id="carregar-mais" style="visibility:hidden"> Carregar mais unidades </a></div></section>'); 
2834			 
2835			 
2836			 
2837		}else{ 
2838			//Se nao tiver subtema, exibe o modelo 3 
2839			cursosPorCategoriaModelo3(); 
2840
2841 
2842		break; 
2843 
2844	case 2: // exibe cursos do nivel 2 
2845		limit = 2; 
2846		cursosPorCategoriaModelo2(); 
2847		break; 
2848		 
2849	case 3: 
2850		cursosPorCategoriaModelo3(); 
2851		break; 
2852
2853
2854 
2855/* 
2856 * Faz a exibicao dos cursos quando se carrega a tela ou clica em 'Todos' 
2857 */ 
2858 function cursosPorCategoriaModelo1(category) { 
2859		 
2860	 	activeModeloExibicao = 1; 
2861	 	 	 
2862		var url = urlCursosPorTipoCursoETemaComFiltrosBolsaECompra 
2863		.replace('{groupId}', groupId) 
2864		.replace('{unidadeCategoryId}', categoryIdUnidade) 
2865		.replace('{categoryTemaId}', category.categoryId) 
2866		.replace('{categoriaId}', idModalidadeEspecTecnica) 
2867		.replace('{filtrarInscricoesAbertas}', filtrarInscricoesAbertas) 
2868		.replace('{filtrarBolsaEstudo}', filtrarBolsaEstudo) 
2869		.replace('{considerarUnidade}', 1) 
2870		.replace('{start}', 0) 
2871		.replace('{end}', limitCursos); 
2872		 
2873		$.ajax({ 
2874			url : url, 
2875			type : 'get', 
2876			beforeSend: function () { 
2877				loading('#cursos-por-categoria-'+category.categoryId+' .slider-curso'); 
2878
2879		}).done(function(cursosPorCategoria) { 
2880 
2881			cursosPorCategoria = JSON.parse(cursosPorCategoria); 
2882							 
2883			var totalCursos = cursosPorCategoria.total; 
2884			 
2885			//Se nao retornou cursos, deve esconder a div da categoria 
2886			if(totalCursos == 0){ 
2887				//$('#cursos-por-categoria-'+category.categoryId).remove(); 
2888				$('#cursos-por-categoria-'+category.categoryId).html(''); 
2889				 
2890				//essa classe tirar todo o padding da div, escondendo ela 
2891				$('#cursos-por-categoria-'+category.categoryId).removeClass('ssp-section'); 
2892				 
2893				if(tam <= 1024){ 
2894					var $element = document.getElementById('cursos-por-categoria-container'); 
2895					var _elementPos = $element.offsetTop + 100; 
2896					var _scrollDown = _elementPos + (filtrarInscricoesAbertas == 1 || filtrarBolsaEstudo == 1 ? 300 : 1); 
2897					window.scrollTo(window.scrollX || window.pageXOffset, _scrollDown);//carrega os cursos 
2898					setTimeout(()=> window.scrollTo(window.scrollX || window.pageXOffset, _elementPos), 500);//mostra o primeiro 
2899					 
2900				}else{ 
2901					var _scrollDown = (window.scrollY || window.pageYOffset) + (filtrarInscricoesAbertas == 1 || filtrarBolsaEstudo == 1 ? 20 : 1); 
2902					window.scrollTo(window.scrollX || window.pageXOffset, _scrollDown); 
2903
2904				return; 
2905			}else{ 
2906			 
2907				if(!$('#cursos-por-categoria-'+category.categoryId).hasClass('ssp-section')) 
2908					$('#cursos-por-categoria-'+category.categoryId).addClass('ssp-section'); 
2909			 
2910
2911		 
2912			var articles = []; 
2913				      		 
2914	   		 $.each(cursosPorCategoria.cursos, function(k, c){ 
2915	   			articles.push(c.articleId); 
2916	   		 }); 
2917				      		  
2918	   		//Verifica a situacao dos botoes de inscricoes e bolsa 
2919			  $.ajax({ 
2920			        url :  '/o/senac-content-services/verificaBotoesInscricaoEBolsaPorUnidade/'+groupId+'/'+articles.join(',')+'/'+categoryIdUnidade, 
2921			        type : 'get' 
2922			    })  
2923			    .done(function(infoBotoes){ 
2924				    	 
2925				    	if(infoBotoes.length > 0) { 
2926				    		 
2927			    		  	infoBotoes = JSON.parse(infoBotoes); 
2928 
2929							var template = $('#cursos-por-categoria-'+category.categoryId); 
2930							 
2931							$('#cursos-por-categoria-'+category.categoryId+' .slider-curso').empty(); 
2932 
2933							$.each(cursosPorCategoria.cursos, function(k, curso) { 
2934		 
2935								var itemCurso = gerarItemCurso(curso); 
2936								 
2937								//checa inscricoes abertas e bolsas 
2938							   if(!infoBotoes[curso.articleId].botaoInscricoesAbertas) 
2939								   itemCurso.find('.btn-inscricoes-abertas').remove(); 
2940								    
2941							   if(!infoBotoes[curso.articleId].botaoBolsas) 
2942								   itemCurso.find('.btn-bolsas').remove(); 
2943 
2944								template.append(itemCurso); 
2945 
2946								template.find('.slider-curso').append(itemCurso); 
2947		 
2948							}); // fim each 
2949		 
2950							// chama o slider por categoria 
2951							if (tam >=1024){ 
2952 
2953								template.find('.slider-curso').addClass( 
2954									'slick-area slick-area--md-bleed slider-container slider-id-' 
2955											+ category.categoryId); 
2956								 
2957								if(totalCursos > 11){ 
2958									template.find('.slider-curso').append('<a data-nvl="'+(activeCategoryLevel+1)+'" data-tema="'+category.categoryId+'" class="ssp-card-todos-cursos especializacao-tecnica card-ver-todos-cursos-link" ><p>Conferir todos <br>os <span>cursos</span></p><i class="far fa-arrow-right"></i></a>')			 
2959								} else { 
2960									$(".ver-todos-cursos-link[data-tema='"+category.categoryId+"']").addClass("ver-todos-no-click"); 
2961
2962 
2963							}else{ 
2964								template.find('.slider-curso').css({"flex-wrap":"wrap"}); 
2965								 
2966								if($('.ssp-page-busca__section-resultado__ver-todos-mobile[data-tema="'+category.categoryId+'"]').length == 0){ 
2967									 
2968									//Adicionava o botão ver todos. Possível adição do código do card novo! 
2969									if(totalCursos > 4){ 
2970										template.find('.slider-curso').append('<a data-nvl="'+(activeCategoryLevel+1)+'" data-tema="'+category.categoryId+'" class="ssp-card-todos-cursos especializacao-tecnica card-ver-todos-cursos-link" ><p>Conferir todos <br>os <span>cursos</span></p><i class="far fa-arrow-right"></i></a>') 
2971									} else { 
2972										$(".ver-todos-cursos-link[data-tema='"+category.categoryId+"']").addClass("ver-todos-no-click"); 
2973
2974									 
2975
2976							}; 
2977 
2978 
2979							// chama o slider por categoria 
2980							if (tam >=1024){ 
2981 
2982								sliderCurso('.slider-id-' + category.categoryId); 
2983 
2984							}; 
2985				    	} //fim if botoes length 
2986				    	 
2987						 
2988			    }); // fim done 
2989			 
2990		}).fail(function(jqXHR, textStatus, msg) { 
2991			// alert(msg); 
2992		}); 
2993	 
2994		 
2995
2996 
2997//ao final de todos os ajax, se não houver curso na pag por causa dos filtros, exibimos mensagem de nenhum curso 
2998$(document).ajaxStop(function () { 
2999	if($(".slick-area__item").not('.d-none').length == 0){ 
3000		var htmlTextoSemCurso = getTextoSemCurso(filtrarBolsaEstudo,filtrarInscricoesAbertas,activeCategory.name);  
3001 
3002		$(".ssp-bolsa-formulario__card-aviso-texto").html(htmlTextoSemCurso);					 
3003		$("#filtroSemCurso").removeClass("d-none"); 
3004
3005});	 
3006 
3007/* 
3008 * Faz a exibicao dos cursos quando se clica em temas nivel 2 
3009 */ 
3010 function cursosPorCategoriaModelo2() { 
3011		activeModeloExibicao = 2; 
3012	 
3013		$("#tema-atual").html("<span>Cursos de </span>"	+ activeCategory.name); 
3014		 
3015		var url = urlSearchTemas 
3016		.replace('{groupId}', groupId) 
3017		.replace('{unidadeCategoryId}', categoryIdUnidade) 
3018		.replace('{categoriaId}', idModalidadeEspecTecnica) 
3019		.replace('{nivelTema}', 2) 
3020		.replace('{categoriaParentId}', activeCategory.categoryId); 
3021		 
3022		// Busca os filhos (3 nivel) 
3023		$.ajax({ 
3024			//url : '/o/senac-unidade-services/subtemasPorTipoCursoETemaEUnidade/'+ groupId+ '/'+ activeCategory.categoryId+ '/'+ tipoCursoNome+'/'+categoryIdUnidade, 
3025			url: url, 
3026			type : 'get', 
3027			data : {} 
3028			}).done(function(subtemas) { 
3029 
3030				subtemas = JSON.parse(subtemas); 
3031				 
3032				if(tam > 1024 && subtemas.length > 0) 
3033					var subsubtemaLista = '<hr class="separador-subtemas"/>'; 
3034				else 
3035					var subsubtemaLista = '' ;  
3036						 
3037				$.each(subtemas, function(k, v) { 
3038					subsubtemaLista += '<a href="#a" class="subtema btn-nivel-3" data-tema="' 
3039							+ v.categoryId 
3040							+ '" data-nvl="3" style="font-size: 14px;">' 
3041							+ v.name 
3042							+ '</a>'; 
3043				}); 
3044	 
3045				$('#filtro-temas-nivel-3').html(subsubtemaLista); 
3046				 
3047				if(subtemas.length > 0 && tipoCursoNome == "Livre"){  
3048					$('#filtro-temas-nivel-3').removeClass('d-none'); 
3049					//Caso nao tenha subtemas, exibe o modelo 3 
3050						 
3051				}else{ 
3052					cursosPorCategoriaModelo3(); 
3053					return; 
3054
3055					 
3056				// Exibe os cursos dos subtemas do tema clicado percorrendo a lista de 
3057				// subtemas do tema clicado 
3058				if(subtemas.length > 0){ 
3059					 
3060					$.each(subtemas.slice(offset, limit + offset), function(k, t) { 
3061						 
3062						if($('#cursos-por-categoria-'+t.categoryId).length == 0){ 
3063							var template = $('#cursos-por-categoria-template').clone(); 
3064							template.prop('id', 'cursos-por-categoria-'+t.categoryId); 
3065	 
3066							template.removeClass('d-none'); 
3067							 
3068							$('#cursos-por-categoria-container').append(template); 
3069
3070			 
3071						$.ajax( 
3072
3073									url : '/o/senac-content-services/category/' 
3074											+ t.categoryId, 
3075									type : 'get' 
3076								}).done(function(category) { 
3077									 
3078									var dadosCategoria = JSON.parse(category); 
3079									 
3080									//monta as divs para cada tcategoria 
3081									var templatePorCategoria = $('#cursos-por-categoria-'+dadosCategoria.categoryId); 
3082									templatePorCategoria.find('.tema-nome').text(dadosCategoria.name); 
3083									templatePorCategoria.find('.ver-todos-cursos-link').attr('data-nvl', 3); 
3084									templatePorCategoria.find('.ver-todos-cursos-link').attr('data-tema', dadosCategoria.categoryId); 
3085									templatePorCategoria.removeClass('d-none'); 
3086 
3087									cursosPorCategoriaModelo1(dadosCategoria); 
3088			 
3089						}); 
3090					}); 
3091					 
3092					// Esconde botao carregar mais, se  necessario 
3093					$('.section-carregar-mais').remove(); 
3094					 
3095					if (subtemas.length > limit + offset) 
3096						$('#cursos-por-categoria-container').append('<section style="padding: 30px 0; width:100%" class="section-carregar-mais"><div class="container"><a href="#a" class="ssp-section-tema__btn-ver-mais" id="carregar-mais" style="visibility:hidden"> Carregar mais unidades </a></div></section>'); 
3097					 
3098				}else{ 
3099					//Se nao tiver subtema, exibe o modelo 3 
3100					cursosPorCategoriaModelo3(); 
3101
3102					 
3103		}); 
3104		 
3105	 
3106		 
3107
3108/* 
3109 * Faz a exibicao dos cursos quando se clica em temas nivel 3 
3110 */ 
3111 function cursosPorCategoriaModelo3() { 
3112		activeModeloExibicao = 3; 
3113	     
3114		//Se já estiver carregando não deixa juntar várias chamadas 
3115		if($('#loading-todos-cursos').length > 0) return; 
3116		 
3117		//Loading 
3118		$('#curso-sem-slick').append('<div id="loading-todos-cursos" style="width:100%; text-align:center">'+ 
3119		'<div class="ssp-loader-content">'+ 
3120		'<div class="ssp-loader"></div>'+ 
3121		'<p class="ssp-loader-text">Carregando...</p>'+ 
3122		'</div>'+ 
3123		'</div>'); 
3124		 
3125		$("#tema-atual").html("<span>Cursos de </span>"	+ activeCategory.name); 
3126		 
3127		//Ativa o botao clicado 
3128		$('.btn-nivel-3').each(function(btn){ 
3129			$(this).removeClass('ativo'); 
3130			 
3131			if($(this).attr('data-tema') == activeCategory.categoryId) $(this).addClass('ativo'); 
3132		}); 
3133		 
3134		var url = urlCursosPorTipoCursoETemaComFiltrosBolsaECompra 
3135		.replace('{groupId}', groupId) 
3136		.replace('{unidadeCategoryId}', categoryIdUnidade) 
3137		.replace('{categoryTemaId}', activeCategory.categoryId) 
3138		.replace('{categoriaId}', idModalidadeEspecTecnica) 
3139		.replace('{filtrarInscricoesAbertas}', filtrarInscricoesAbertas) 
3140		.replace('{filtrarBolsaEstudo}', filtrarBolsaEstudo) 
3141		.replace('{considerarUnidade}', 1) 
3142		.replace('{start}', offsetTodosCursos) 
3143		.replace('{end}', (limitTodosCursos + offsetTodosCursos)); 
3144		 
3145		$.ajax({ 
3146			url : url, 
3147			type : 'get', 
3148			data : {}, 
3149			/*beforeSend: function () { 
3150				 
3151				var totalItens = $('#curso-sem-slick .slick-area__item').length; 
3152				if(totalItens == 0) 
3153					loading('#curso-sem-slick'); 
3154			}*/ 
3155		}).done(function(cursosPorSubtema) { 
3156							 
3157			$('.ssp-loader-content').parent().remove(); 
3158 
3159			cursosPorSubtema = JSON.parse(cursosPorSubtema); 
3160			 
3161			var totalCursos = cursosPorSubtema.total; 
3162			 
3163			var templateContainer = $('#cursos-por-categoria-container'); 
3164 
3165			var articles = []; 
3166	      		 
3167	      	$.each(cursosPorSubtema.cursos, function(k, c){ 
3168	    		articles.push(c.articleId); 
3169	   		 }); 
3170	      		  
3171	      		//Verifica a situacao dos botoes de inscricoes e bolsa 
3172			 $.ajax({ 
3173				        url :  '/o/senac-content-services/verificaBotoesInscricaoEBolsaPorUnidade/'+groupId+'/'+articles.join(',')+'/'+categoryIdUnidade, 
3174				        type : 'get' 
3175		    }).done(function(infoBotoes){ 
3176		    	 
3177		    	templateContainer.find('#curso-sem-slick').empty(); 
3178		    	 
3179		    	if(infoBotoes.length > 0) { 
3180		    		 
3181	    		   infoBotoes = JSON.parse(infoBotoes); 
3182		 
3183 
3184					$.each(cursosPorSubtema.cursos,function(k, curso) { 
3185 
3186							var itemCurso = gerarItemCurso(curso); 
3187							 
3188							//checa inscricoes abertas e bolsas 
3189						   if(!infoBotoes[curso.articleId].botaoInscricoesAbertas) 
3190							   itemCurso.find('.btn-inscricoes-abertas').remove(); 
3191							    
3192						   if(!infoBotoes[curso.articleId].botaoBolsas) 
3193							   itemCurso.find('.btn-bolsas').remove(); 
3194							 
3195							itemCurso.addClass('card-curso-nivel-2'); 
3196 
3197 
3198							// procura a div criada e adiciona os cursos 
3199							templateContainer.find('#curso-sem-slick').append(itemCurso); 
3200					}); // fim each 
3201 
3202					templateContainer.removeClass('d-none'); 
3203 
3204					var totalCursosExibicao = $('#curso-sem-slick .slick-area__item').length; 
3205						 
3206					// Esconde botao carregar mais, se  necessario 
3207					$('.section-carregar-mais').remove(); 
3208						 
3209					if (totalCursosExibicao < totalCursos)  
3210						$('#cursos-por-subtema-container').append('<section style="padding: 30px 0; width:100%" class="section-carregar-mais"><div class="container"><a href="#a" class="ssp-section-tema__btn-ver-mais" id="carregar-mais" style="visibility:hidden"> Carregar mais unidades </a></div></section>'); 
3211
3212 
3213			});  
3214 
3215		}).fail(function(jqXHR, textStatus, msg) { 
3216			// alert(msg); 
3217		}); 
3218	 
3219
3220 
3221/* 
3222 * Faz a exibicao dos cursos quando se carrega a tela ou clica em 'Todos' 
3223 */ 
3224function displayCursosRecentes() { 
3225 
3226	// Verifica se existem cursos no cookie 
3227	if (getCookie(cookieName) == null || getCookie(cookieName) == null) 
3228		return; 
3229	 
3230	var cursosLivresRecentes = JSON.parse(getCookie(cookieName)).join(','); 
3231	 
3232	if(cursosLivresRecentes.length) 
3233		$('#section-buscados-recentes').removeClass('d-none'); 
3234 
3235
3236			.ajax( 
3237
3238						url : '/o/senac-content-services/cursosInfo/' + groupId 
3239								+ '/' + cursosLivresRecentes+'/0/' 
3240								+ limitCursos, 
3241						type : 'get' 
3242					}) 
3243			.done( 
3244					function(cursosRecentes) { 
3245 
3246						cursosRecentes = JSON.parse(cursosRecentes); 
3247 
3248						var template = $('#cursos-recentes-template'); 
3249 
3250						$.each(cursosRecentes, function(k, curso) { 
3251 
3252							var itemCurso = gerarItemCurso(curso); 
3253 
3254							template.find('.slider-curso').append(itemCurso); 
3255						}); 
3256 
3257						template 
3258								.find('.slider-curso') 
3259								.addClass( 
3260										'slick-area slick-area--md-bleed slider-container slider-id-recentes'); 
3261 
3262						 
3263						// section de buscado recentes* 
3264 
3265						$('#template').removeClass('d-none'); 
3266						template.removeClass('d-none'); 
3267						// div de recentes* 
3268 
3269						sliderCurso('.slider-id-recentes'); 
3270 
3271					}).fail(function(jqXHR, textStatus, msg) { 
3272				// alert(msg); 
3273			}); 
3274 
3275
3276 
3277/* 
3278 * Monta a lista de temas de curso livre no header da pagina 
3279 */ 
3280 
3281 function carregaTemasNivelDireto(nivel) { 
3282		//buscando o categoryId da unidade 
3283		$.ajax({ 
3284			url : '/o/senac-unidade-services/categoriaPorFriendlyURL/'+urlUnidade+"/"+0, 
3285			type : 'get', 
3286			dataType: 'json' 
3287		}) 
3288		.done(function(unidadesCategory) { 
3289			 
3290			categoryIdUnidade = unidadesCategory[0].categoryId; 
3291			 
3292			var url = urlSearchTemas 
3293			.replace('{groupId}', groupId) 
3294			.replace('{unidadeCategoryId}', categoryIdUnidade) 
3295			.replace('{categoriaId}', idModalidadeEspecTecnica) 
3296			.replace('{nivelTema}', 0) 
3297			.replace('{categoriaParentId}', 0); 
3298			 
3299			//buscando os temas que os cursos da unidade tem com este tipo de curso 
3300			$.ajax({ 
3301				url : url, 
3302				type : 'get', 
3303				dataType: 'json' 
3304			}) 
3305			.done(function(temasLista) { 
3306					var temasObj = $('#temas'); 
3307									 
3308					$.each(temasLista,function(k, tema) { 
3309						const icon = (categorias.filter(cat => cat.categoryId == tema.categoryId)[0] || {properties: {}}).properties.icon 
3310						temasObj.append('<div class="ssp-section-tema__container-menu-item mega-menu"><a href="#a" class="tema" data-nvl="1" data-tema="'+ tema.categoryId+ '">'+ '<i class="' + icon + '"></i>'+ tema.name+ '</a></div>'); 
3311		 
3312						var url = urlSearchTemas 
3313						.replace('{groupId}', groupId) 
3314						.replace('{unidadeCategoryId}', categoryIdUnidade) 
3315						.replace('{categoriaId}', idModalidadeEspecTecnica) 
3316						.replace('{nivelTema}', 2) 
3317						.replace('{categoriaParentId}', tema.categoryId); 
3318						 
3319						// Armazena os subtemas deste tema 
3320						$.ajax({ 
3321							//url : '/o/senac-unidade-services/subtemasPorTipoCursoETemaEUnidade/'+ groupId+ '/'+ tema.categoryId+ '/'+ tipoCursoNome+'/'+categoryIdUnidade, 
3322							url: url, 
3323							type : 'get', 
3324						}) 
3325						.done(function(subtemas) { 
3326							 
3327							 
3328							subtemasStorage.set(tema.categoryId,JSON.parse(subtemas)); 
3329							 
3330							if(nivel == 1 && tema.categoryId == categoryIdTemaNv1){ 
3331								var clicou = 0; 
3332								$('.tema[data-tema="'+categoryIdTemaNv1+'"]').not('.slick-cloned').each(function(){ 
3333									 
3334									if(!clicou){ 
3335										var botaoTemaTargetNv1 = $(this); 
3336										botaoTemaTargetNv1.trigger('click'); 
3337										 
3338										clicou = 1; 
3339										acessoDireto = 0; 
3340
3341										 
3342								}); 
3343
3344							 
3345							if(nivel == 2){ 
3346								 
3347								if(tipoCursoNome == "Livre"){ 
3348									subTemasJson = JSON.parse(subtemas); 
3349									if(subTemasJson.length > 0){ 
3350									 
3351										$.each(subTemasJson, function(i, each){ 
3352											if(each.categoryId == categoryIdTemaNv2){ 
3353													 
3354													var botaoTema = $('.tema[data-tema="'+categoryIdTemaNv1+'"]'); 
3355													botaoTema.addClass('tema-ativo'); 
3356													 
3357													tam = $(window).width(); 
3358													 
3359													if (tam <=1024){ 
3360														$("#visualizar-mais, .visualizar-mais-seta").addClass('d-none'); 
3361														$('#temas').addClass('d-none'); 
3362														// adiciona o item selecionado nos filtros 
3363														$("#filtro-ativo-nivel-1").prepend(botaoTema); 
3364
3365													 
3366													$.ajax({ 
3367														url : '/o/senac-content-services/category/' 
3368																+ categoryIdTemaNv1, 
3369														type : 'get' 
3370													}).done(function(category) { 
3371														 
3372														activeCategory = JSON.parse(category); 
3373														displaySubTemasLista(); 
3374														 
3375														$.ajax({ 
3376															url : '/o/senac-content-services/category/' 
3377																	+ categoryIdTemaNv2, 
3378															type : 'get' 
3379														}).done(function(category2) { 
3380															 
3381															activeCategory = JSON.parse(category2); 
3382															var botaoTemaTargetNv2 = $('.subtema[data-tema="'+categoryIdTemaNv2+'"]'); 
3383															botaoTemaTargetNv2.trigger('click'); 
3384															acessoDireto = 0; 
3385														}); 
3386														 
3387													}); 
3388													 
3389
3390													 
3391											}); 
3392
3393
3394
3395							 
3396							 
3397							 
3398						}); 
3399						 
3400					}); // fim each 
3401												 
3402					 
3403					if(nivel == 3){ 
3404						if(tipoCursoNome == "Livre"){ 
3405							 
3406							var botaoTema = $('.tema[data-tema="'+categoryIdTemaNv1+'"]'); 
3407							botaoTema.addClass('tema-ativo'); 
3408							 
3409							tam = $(window).width(); 
3410							 
3411							if (tam <=1024){ 
3412								$("#visualizar-mais, .visualizar-mais-seta").addClass('d-none'); 
3413								$('#temas').addClass('d-none'); 
3414								// adiciona o item selecionado nos filtros 
3415								$("#filtro-ativo-nivel-1").prepend(botaoTema); 
3416
3417							 
3418							$.ajax({ 
3419								url : '/o/senac-content-services/category/' 
3420										+ categoryIdTemaNv1, 
3421								type : 'get' 
3422							}).done(function(category) { 
3423 
3424								 
3425								activeCategory = JSON.parse(category); 
3426								displaySubTemasLista(); 
3427								var botaoSubtema = $('.subtema[data-tema="'+categoryIdTemaNv2+'"]'); 
3428								botaoSubtema.addClass('subtema-ativo'); 
3429								 
3430								if (tam <=1024){ 
3431									// adiciona o item selecionado nos filtros 
3432									$("#filtro-ativo-nivel-2").prepend(botaoSubtema); 
3433
3434 
3435								$.ajax({ 
3436									url : '/o/senac-content-services/category/' 
3437											+ categoryIdTemaNv2, 
3438									type : 'get' 
3439								}).done(function(category2) { 
3440									 
3441									activeCategory = JSON.parse(category2); 
3442 
3443									var url = urlSearchTemas 
3444									.replace('{groupId}', groupId) 
3445									.replace('{unidadeCategoryId}', categoryIdUnidade) 
3446									.replace('{categoriaId}', idModalidadeEspecTecnica) 
3447									.replace('{nivelTema}', 2) 
3448									.replace('{categoriaParentId}', activeCategory.categoryId); 
3449									 
3450									// Busca os filhos (3 nivel) 
3451									$.ajax({ 
3452										//url : '/o/senac-unidade-services/subtemasPorTipoCursoETemaEUnidade/'+ groupId+ '/'+ activeCategory.categoryId+ '/'+ tipoCursoNome+'/'+categoryIdUnidade, 
3453										url: url, 
3454										type : 'get', 
3455										data : {} 
3456										}).done(function(subtemas) { 
3457											subtemas = JSON.parse(subtemas); 
3458											 
3459											if(tam > 1024 && subtemas.length > 0) 
3460												var subsubtemaLista = '<hr class="separador-subtemas"/>'; 
3461											else 
3462												var subsubtemaLista = ''; 
3463											 
3464											$.each(subtemas, function(k, v) { 
3465												subsubtemaLista += '<a href="#a" class="subtema btn-nivel-3" data-tema="' 
3466														+ v.categoryId 
3467														+ '" data-nvl="3" style="font-size: 14px;">' 
3468														+ v.name 
3469														+ '</a>'; 
3470														 
3471												if(v.categoryId == categoryIdTemaNv3) 
3472													activeCategory = v; 
3473													 
3474											}); 
3475 
3476											$('#filtro-temas-nivel-3').html(subsubtemaLista); 
3477											$('#filtro-temas-nivel-3').removeClass('d-none'); 
3478											 
3479											var botaoTemaTargetNv3 = $('.subtema[data-tema="'+categoryIdTemaNv3+'"]'); 
3480											botaoTemaTargetNv3.trigger('click'); 
3481											acessoDireto = 0; 
3482										});	 
3483									 
3484								}); 
3485								 
3486							}); 
3487
3488
3489					 
3490					temas = temasLista; 
3491			 
3492					 
3493					//displayCursosPorTema(); 
3494 
3495					// Verificar o tamanho da tela e chama da função para desktop e mobile 
3496					var tam = $(window).width(); 
3497					 
3498					//$('.todos').addClass('ativo'); 
3499 
3500					if (tam <=1024){ 
3501 
3502						exibeTemasMobile() 
3503						 
3504
3505 
3506					// // Adiciona a classe do slider no elemento 
3507					// $('#temas').addClass("tema-slick-area tema-slick-area--md-bleed slider-container"); 
3508					// // e faz a chamada da função 
3509					// sliderTemaBtn(); 
3510 
3511					// verifica Device e tira o slider 
3512					 
3513					 
3514 
3515				}).fail(function(jqXHR, textStatus, msg) { 
3516					// alert(msg); 
3517				}); 
3518		 
3519					 
3520		 
3521		}); // fim done 1o ajax 
3522		 
3523		 
3524
3525 
3526function carregaTemas() {	 
3527	//buscando o categoryId da unidade 
3528	$.ajax({ 
3529		url : '/o/senac-unidade-services/categoriaPorFriendlyURL/'+urlUnidade+"/"+0, 
3530		type : 'get', 
3531		dataType: 'json' 
3532	}) 
3533	.done(function(unidadesCategory) { 
3534		 
3535		categoryIdUnidade = unidadesCategory[0].categoryId; 
3536 
3537		var url = urlSearchTemas 
3538		.replace('{groupId}', groupId) 
3539		.replace('{unidadeCategoryId}', categoryIdUnidade) 
3540		.replace('{categoriaId}', idModalidadeEspecTecnica) 
3541		.replace('{nivelTema}', 0) 
3542		.replace('{categoriaParentId}', 0); 
3543		 
3544		//buscando os temas que os cursos da unidade tem com este tipo de curso 
3545		$.ajax({ 
3546			url : url, 
3547			type : 'get', 
3548			dataType: 'json' 
3549		}) 
3550		.done(function(temasLista) { 
3551				var temasObj = $('#temas'); 
3552								 
3553				$.each(temasLista,function(k, tema) { 
3554					const icon = (categorias.filter(cat => cat.categoryId == tema.categoryId)[0] || {properties: {}}).properties.icon 
3555					temasObj.append('<div class="ssp-section-tema__container-menu-item mega-menu"><a href="#a" class="tema" data-nvl="1" data-tema="'+ tema.categoryId+ '">'+ '<i class="' + icon + '"></i>'+ tema.name+ '</a></div>'); 
3556	 
3557 
3558					var url = urlSearchTemas 
3559					.replace('{groupId}', groupId) 
3560					.replace('{unidadeCategoryId}', categoryIdUnidade) 
3561					.replace('{categoriaId}', idModalidadeEspecTecnica) 
3562					.replace('{nivelTema}', 2) 
3563					.replace('{categoriaParentId}', tema.categoryId); 
3564					 
3565					// Armazena os subtemas deste tema 
3566					$.ajax({ 
3567						//url : '/o/senac-unidade-services/subtemasPorTipoCursoETemaEUnidade/'+ groupId+ '/'+ tema.categoryId+ '/'+ tipoCursoNome+'/'+categoryIdUnidade, 
3568						url: url, 
3569						type : 'get', 
3570					}) 
3571					.done(function(subtemas) { 
3572						subtemasStorage.set(tema.categoryId,JSON.parse(subtemas)); 
3573 
3574					}); 
3575					 
3576				}); // fim each 
3577 
3578				temas = temasLista; 
3579		 
3580				displayCursosPorTema(); 
3581 
3582				// Verificar o tamanho da tela e chama da função para desktop e mobile 
3583				var tam = $(window).width(); 
3584				 
3585				$('.todos').addClass('ativo'); 
3586 
3587				if (tam <=1024){ 
3588 
3589					exibeTemasMobile() 
3590 
3591
3592 
3593				// // Adiciona a classe do slider no elemento 
3594				// $('#temas').addClass("tema-slick-area tema-slick-area--md-bleed slider-container"); 
3595				// // e faz a chamada da função 
3596				// sliderTemaBtn(); 
3597 
3598				// verifica Device e tira o slider 
3599				 
3600				 
3601 
3602			}).fail(function(jqXHR, textStatus, msg) { 
3603				// alert(msg); 
3604			}); 
3605	 
3606	 
3607	 
3608	}); // fim done 1o ajax 
3609	 
3610	 
3611
3612 
3613/* 
3614 * Exibe a lista de subtemas no click do tema 
3615 */ 
3616function displaySubTemasLista(categoryId) { 
3617	 
3618	$('#filtro-temas-nivel-2').empty(); 
3619	$('#filtro-temas-nivel-2').removeClass('d-none'); 
3620	 
3621	$.each(subtemasStorage.get(activeCategory.categoryId), function(k, t) { 
3622		$('#filtro-temas-nivel-2').append('<a href="#a" class="subtema btn-nivel-3" data-tema="' 
3623				+ t.categoryId 
3624				+ '" data-nvl="2" style="font-size: 14px;">' 
3625				+ t.name 
3626				+ '</a>'); 
3627	}); 
3628	 
3629	 
3630	// $('#subtemas-lista').empty(); 
3631 
3632	// var subtemaLista = '<div class="subtema-content">'; 
3633 
3634	// $.each(subtemasStorage.get(categoryId), function(k, s) { 
3635 
3636	// 	// controle feito pela classe tema 
3637	// 	subtemaLista += '<a href="#a" class="subtema"  data-tema="' 
3638	// 			+ s.categoryId + '" data-nvl="2">' + s.name + '</a>'; 
3639 
3640	// }); 
3641 
3642	// subtemaLista += '</div>'; 
3643 
3644	// $('#subtemas-lista').append(subtemaLista); 
3645
3646  
3647function gerarItemCurso(curso){ 
3648	 
3649	var friendlyUrlUnidadeCurso = $("#friendlyUnidade").text().trim(); 
3650	 
3651	var item = $('#curso-item-template').clone(); 
3652	 
3653	if(verificaFormatoAovivo(curso)){ 
3654		item.find('.tag-modalidade-title__senac-online').removeClass('d-none'); 
3655		item.find('.ssp-card-curso__tag-formato-title').remove(); 
3656	}else{ 
3657		var tipoCursoNomeFinal = "";	                 			  
3658 
3659		if(curso.tipoCursoNome == "Livre") 
3660			tipoCursoNomeFinal = "Livre"; 
3661			//tipoCursoNomeFinal = "Curso Livre" + " - " + curso.formatos[0].name; 
3662		 
3663		else if(curso.tipoCursoNome == "Técnico") 
3664			tipoCursoNomeFinal = "Técnico"; 
3665			//tipoCursoNomeFinal = "Técnico " + " - " + curso.formatos[0].name; 
3666		 
3667		item.find('.ssp-card-curso__tag-formato-title').text(tipoCursoNomeFinal); 
3668		 
3669
3670	 
3671	item.prop('id', ''); 
3672	 
3673	item.find('.ssp-card-curso__title').text(limitaTitleCurso(curso.title)); 
3674	item.find('.ssp-image-container img').attr("src", HOST + curso.imagemURL); 
3675	 
3676	item.find('.ck-curso').attr('data-ck', curso.articleId); 
3677	item.find('.ck-curso').attr('href',"/"+friendlyUrlUnidadeCurso+curso.url); 
3678	 
3679	item.find('.ssp-image-container').css("background-image", "url(" + HOST + curso.imagemURL + ")"); 
3680	 
3681	item.removeClass('d-none'); 
3682	 
3683	return item; 
3684
3685 
3686 function setCategoryIds(){ 
3687		 
3688		//Obter o id da modalidade espec tecnica 
3689		var url = urlSearchModalidadeEspecTecnica 
3690			.replace('{groupId}', groupId); 
3691		 
3692		$.ajax({ 
3693			url : url, 
3694			type : 'get' 
3695		}).done(function(categoryIdModalidade) { 
3696			try{ 
3697				idModalidadeEspecTecnica = JSON.parse(categoryIdModalidade).categoryId; 
3698				 
3699				carregaLinkTodosBotoesModalidades(); 
3700				 
3701				carregaLinkBotoesLivreETecnico(); 
3702				 
3703				montaBreadCrumb(); 
3704 
3705				verificaAcessoDiretoELoadTema(); 
3706 
3707				//verificaUrlBolsa(); 
3708			}catch(err){ 
3709				console.error('idModalidadeEspecTecnica nao obtido ' + err.message); 
3710
3711			 
3712		}); 
3713		 
3714
3715 
3716//Carregar mais 
3717$(window).scroll(function() { 
3718	 
3719	var element = document.querySelector('#carregar-mais'); 
3720	 
3721	if(element != null){ 
3722		$("#filtroSemCurso").addClass("d-none"); 
3723		var position = element.getBoundingClientRect(); 
3724		 
3725		// carregar maios 
3726		if(position.top >= 0 && position.bottom <= window.innerHeight) { 
3727			 
3728			if (activeCategoryLevel == 0 || activeCategoryLevel == 1 || activeCategoryLevel == 2){ 
3729				offset = $('.cursos-por-categoria').not('.d-none').length; 
3730				 
3731				displayCursosPorTema(); 
3732				 
3733			}else{ 
3734				offsetTodosCursos = $('#cursos-por-subtema-container .ssp-card-curso') 
3735						.not('.d-none').length; 
3736				 
3737				displayCursosPorTema(); 
3738
3739
3740
3741	 
3742}); 
3743 
3744</script>