Um erro ocorreu enquanto processava o modelo.
The following has evaluated to null or missing:
==> tipoCursoObj.hexColor [in template "20102#20129#82610143" at line 210, column 29]
----
Tip: It's the step after the last dot 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: ${tipoCursoObj.hexColor.main} [in template "20102#20129#82610143" at line 210, column 27]
----
1<#function getTipoCurso url>
2 <#-- Para facilitar o uso desse widget consideram-se aqui os tipos e ainda as modalidades de curso -->
3 <#assign tipos = [
4 {
5 "url" : "cursos-livres",
6 "name" : "Livre",
7 "title" : "Cursos Livres",
8 "displayTitle" : "<span>Cursos</span> Livres",
9 "imgPath" : "/documents/20125/41488/AdobeStock_182045199.jpeg",
10 "imgFileEntryId" : "41513",
11 "hexColor" : {
12 "main" : "#FF9057",
13 "sub" : "#FCC080"
14 },
15 "styleClass" : "livre",
16 "allTemas" : true,
17 "cookieName" : "ck-cursos-livre",
18 "description" : "Aprenda em cursos rápidos, práticos e conectados com as inovações do mercado.",
19 "codModalidade" : "0"
20 },
21 {
22 "url" : "cursos-tecnicos",
23 "name" : "Técnico",
24 "title" : "Cursos Técnicos",
25 "displayTitle" : "<span>Cursos</span> Técnicos",
26 "imgPath" : "/documents/20125/44871585/pg-cursos_tecnicos.jpeg",
27 "imgFileEntryId" : "44871588",
28 "hexColor" : {
29 "main" : "#F7BD23",
30 "sub" : "#FCC080"
31 },
32 "styleClass" : "tecnico",
33 "allTemas" : false,
34 "cookieName" : "ck-cursos-tecnico",
35 "description" : "Aprenda uma profissão com cursos que preparam você para os desafios do mercado.",
36 "codModalidade" : "0"
37 },
38 {
39 "url" : "extensao-universitaria",
40 "name" : "Extensão",
41 "title" : "Extensão Universitária",
42 "displayTitle" : "<span>Extensão</span> Universitária",
43 "imgPath" : "/documents/20125/41488/AdobeStock_182045199.jpeg",
44 "imgFileEntryId" : "44871588",
45 "hexColor" : {
46 "main" : "#3ECCA6",
47 "sub" : "#5ACC75"
48 },
49 "styleClass" : "extensao",
50 "allTemas" : true,
51 "cookieName" : "ck-cursos-extensao",
52 "description" : "Cursos práticos e de média duração para começar uma profissão ou evoluir na carreira",
53 "codModalidade" : "0"
54 },
55 <#-- Especializacao tecnica: trata-se de uma modalidade de curso e nao um tipo -->
56 {
57 "url" : "especializacao-tecnica",
58 "name" : "Técnico",
59 "title" : "Cursos de especialização técnica",
60 "displayTitle" : "<span>Especialização</span> Técnica",
61 "imgPath" : "/documents/20125/34562659/bg-esp-tecnica.png",
62 "imgFileEntryId" : "34562684",
63 "hexColor" : {
64 "main" : "#F7BD23",
65 "sub" : "#FCC080"
66 },
67 "styleClass" : "tecnico",
68 "allTemas" : false,
69 "cookieName" : "ck-cursos-tecnico",
70 "description" : "Terminou o curso técnico? Faça uma especialização e se destaque ainda mais na profissão.",
71 "codModalidade" : "10"
72 }
73 ]>
74
75 <#list tipos?filter(t -> t.url == url) as t>
76 <#return t />
77 </#list>
78
79 <#return {}>
80
81</#function>
82
83 <#function getTemaFirstLevelFriendly>
84 <#attempt>
85 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first />
86 <#if !friendly?contains("web") >
87 <#if themeDisplay.getURLCurrent()?split("/")?size gt 2 >
88 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[2]?split("?")?first />
89 <#else>
90 <#assign friendly = "" />
91 </#if>
92
93 <#else>
94 <#if themeDisplay.getURLCurrent()?split("/")?size gt 4 >
95 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[4]?split("?")?first>
96 <#else>
97 <#assign friendly = "" />
98 </#if>
99 </#if>
100
101 <#return friendly />
102 <#recover>
103 <#return ''>
104 </#attempt>
105
106</#function>
107
108 <#function getTemaSecondLevelFriendly >
109 <#attempt>
110 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first />
111
112 <#if !friendly?contains("web") >
113 <#if themeDisplay.getURLCurrent()?split("/")?size gt 3 >
114 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[3]?split("?")?first />
115 <#else>
116 <#assign friendly = "" />
117 </#if>
118 <#else>
119 <#if themeDisplay.getURLCurrent()?split("/")?size gt 5 >
120 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[5]?split("?")?first>
121 <#else>
122 <#assign friendly = "" />
123 </#if>
124 </#if>
125
126 <#return friendly />
127 <#recover>
128 <#return ''>
129 </#attempt>
130
131</#function>
132
133 <#function getTemaThirdLevelFriendly >
134 <#attempt>
135 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first />
136
137 <#if !friendly?contains("web") >
138 <#if themeDisplay.getURLCurrent()?split("/")?size gt 4 >
139 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[4]?split("?")?first />
140 <#else>
141 <#assign friendly = "" />
142 </#if>
143 <#else>
144 <#if themeDisplay.getURLCurrent()?split("/")?size gt 6 >
145 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[6]?split("?")?first>
146 <#else>
147 <#assign friendly = "" />
148 </#if>
149 </#if>
150 <#return friendly />
151 <#recover>
152 <#return ''>
153 </#attempt>
154
155</#function>
156 <#function getTipoCursoFriendly >
157 <#attempt>
158 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first />
159 <#if !friendly?contains("web") >
160 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[1]?split("?")?first />
161 <#else>
162 <#assign friendly = themeDisplay.getURLCurrent()?split("/")[3]?split("?")?first>
163 </#if>
164
165 <#return friendly />
166 <#recover>
167 <#return '#erro#'>
168 </#attempt>
169
170</#function>
171
172 <#-- Buscando url do tema se existir para carregamento direto do tema -->
173 <#assign friendlyUrlTipoCurso = getTipoCursoFriendly() />
174 <#assign tipoCursoObj = getTipoCurso(friendlyUrlTipoCurso) />
175
176<#assign friendlyUrlTemaFirst = getTemaFirstLevelFriendly() />
177<#assign friendlyUrlTemaSecond = getTemaSecondLevelFriendly() />
178<#assign friendlyUrlTemaThird = getTemaThirdLevelFriendly() />
179
180
181 <#assign assetVocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService")>
182 <#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")>
183 <#assign groupId = themeDisplay.getSiteGroupId()>
184
185 <#assign vocabularyTemaMercadologico = assetVocabularyLocalService.getGroupVocabulary(groupId, "Tema(Mercadológico)")>
186
187
188 <#-- css header -->
189
190 <style type="text/css">
191 .stop-scrolling {
192 height: 100%;
193 overflow: hidden;
194 }
195
196 input[type="search"]::-webkit-search-decoration,
197 input[type="search"]::-webkit-search-cancel-button,
198 input[type="search"]::-webkit-search-results-button,
199 input[type="search"]::-webkit-search-results-decoration {
200 display: none;
201 }
202
203 <#-- css conteudo -->
204
205 .ssp:not(.liferay-instance) .ssp-section-tema__container-submenu {
206 margin-top: -28px;
207 }
208
209.ssp-header-tema__tag-tipo-curso {
210 background-color: ${tipoCursoObj.hexColor.main} !important;
211}
212
213 .ssp-header-tema__title span {
214 color: ${tipoCursoObj.hexColor.main} !important;
215}
216
217 .subtema-ativo{
218 color: ${tipoCursoObj.hexColor.sub} !important;
219 }
220
221 .separador-subtemas{
222 width:100% !important;
223 margin-top: -1em !important;
224 margin-bottom: 2.25rem!important;
225 }
226
227 .ssp:not(.liferay-instance) .ativo{
228 background-color: ${tipoCursoObj.hexColor.main}!important;
229 color:white!important;
230 font-weight: 600!important;
231 }
232
233
234 .tema-ativo{
235 background-color:${tipoCursoObj.hexColor.main}!important;
236 color:white!important;
237 font-weight: 600!important;
238 }
239
240 .submenu-tema-ativo{
241 background-color: #34495e!important;
242 color:white!important;
243 font-weight: 600!important;
244 }
245
246 .submenu-tema-ativo-hover{
247 background-color: #34495e!important;
248 color:white!important;
249 font-size:50px;
250 font-weight: 600!important;
251 }
252
253
254
255 .ssp:not(.liferay-instance) .ssp-section-tema__container-submenu-nivel3 .btn-nivel-3 {
256
257 font-weight: 600;
258 color: #454F63;
259 }
260
261 .subtema.btn-nivel-3.subtema-ativo{
262 background: ${tipoCursoObj.hexColor.main}!important;
263 color:white!important;
264 border-color: ${tipoCursoObj.hexColor.main}!important;
265 }
266
267 .slider-curso>.slick-area__item{
268
269 width:100%;
270
271 }
272
273 .ssp:not(.liferay-instance) .slick-area .slick-track, .ssp:not(.liferay-instance) .slick-area .slick-list {
274 min-width: 100%!important;
275 }
276
277 .custom-card-curso-tema{
278
279 height:288px!important;
280
281 }
282
283 @media only screen and (max-width: 768px){
284
285 .ssp:not(.liferay-instance) .ssp-header-tema {
286 height: 100%;
287 padding-bottom: 60px;
288 }
289
290 .ssp:not(.liferay-instance) .ssp-page-busca__section-resultado__ver-todos-mobile {
291 font-family: Montserrat;
292 font-size: 16px;
293 font-weight: 600;
294 color: #78849e;
295 text-decoration: none !important;
296 transition: 0.3s;
297 text-align: center !important;
298 }
299
300 .ssp:not(.liferay-instance) .ssp-page-busca__section-resultado__ver-todos-mobile::after {
301 font-family: FontAwesome;
302 font-weight: 900;
303 content: '\f054';
304 font-size: 12px;
305 margin-left: 5px;
306 }
307
308 .ssp:not(.liferay-instance) .custom-card-curso-tema {
309 width: 100% !important;
310 height:auto!important;
311 }
312
313 .filtroInscBolsa{
314 display:none!important;
315 }
316
317 .ssp:not(.liferay-instance) .ssp-page-busca__section-resultado__ver-todos-mobile {
318 font-family: Montserrat;
319 font-size: 16px;
320 font-weight: 600;
321 line-height: 1.21;
322 color: #78849e;
323 text-decoration: none !important;
324 transition: 0.3s;
325 text-align: center !important;
326 padding-left: 7em;
327 }
328
329 .ssp:not(.liferay-instance) .ssp-page-busca__section-resultado__ver-todos-mobile::after {
330 font-family: FontAwesome;
331 font-weight: 900;
332 content: '\f054';
333 font-size: 12px;
334 margin-left: 5px;
335 }
336
337 .ssp-page-busca__section-resultado__ver-todos {
338 display:none;
339 }
340
341 .separador-subtemas{
342 margin:10px 0px 30px 0px!important;
343 }
344
345 /* Botão Visualizar mais */
346
347 .ssp-btn__visualizar-mais-content{
348 display: flex;
349 flex-wrap: nowrap;
350 align-items: center;
351 justify-content: center;
352 }
353
354 .ssp-btn__visualizar-mais{
355 cursor: pointer;
356 font-size: 14px;
357 }
358
359 #visualizar-mais{
360 font-family:montserrat;
361 }
362
363
364 }
365
366 .ssp-unidade-temas__label-filtre-por{
367
368 font-family: Montserrat;
369 font-size: 20px;
370 font-weight: 600;
371 padding: 15px;
372 padding-left: 30px;
373 color: #78849E;
374 display: none;
375
376 }
377
378 /*Animação submenu temas*/
379
380 .ssp:not(.liferay-instance) .ssp-section-tema__container-submenu {
381
382 animation-name: animatetopmenu;
383 animation-duration: 0.4s;
384
385 }
386
387
388 @keyframes animatetopmenu {
389 from {top:-20px}
390 to {top:0}
391 }
392
393 .ssp:not(.liferay-instance) .ssp-container__cursos-sem-slick {
394 display: flex;
395 justify-content: center;
396 flex-wrap: wrap;
397 }
398
399 .ssp-section-tema__container-menu {
400 padding-bottom: 15px;
401 }
402
403 @media only screen and (max-width: 1024px) {
404
405 .ssp-section-tema__subtitle-curso-section {
406
407 margin-left: 0px!important;
408
409 }
410
411 .ssp-slider-check__label{
412
413 font-size: 11px;
414
415 }
416
417 .tema-slick-area {
418
419 display: flex;
420 align-items: center;
421 justify-content: flex-start;
422 font-size: 0;
423 flex-wrap: wrap;
424 }
425
426 /* custom itens */
427
428 .ssp-unidade-temas__label-filtre-por{
429 font-size: 15px!important;
430 padding-left: 5px!important;
431 display: block;
432 }
433
434 .ssp-section-tema__container-menu {
435 height: auto!important;
436 }
437
438 .tema-slick-area-mobile {
439 display: flex;
440 align-items: center;
441 justify-content: center;
442 font-size: 0;
443 flex-wrap: wrap;
444 }
445
446 .ssp-section-tema__container-submenu-nivel3 {
447
448 justify-content: center;
449 }
450
451 .ssp-slider-check__container{
452 padding-top:10px!important;
453 }
454
455 }
456
457 @media only screen and (min-width: 1025px){
458 .filtroTextoMobile{
459 display: none;
460 }
461 }
462
463 .py-5{
464 padding-bottom: 0px!important;
465 padding-top: 5px!important;
466 }
467
468 .ssp-slider-check__content-itens{
469 display: flex;
470 width: 800px!important;
471 justify-content: flex-end!important;
472 }
473
474 .ssp-slider-check__content-item{
475 display: flex;
476 align-items: center;
477 padding: 0 20px;
478 }
479
480 /* novo botao ver todos os cursos */
481
482 .ver-todos-cursos-link{
483 color: #78849E!important;
484 }
485
486 .ver-todos-cursos-link:hover{
487 color: #515A6B!important;
488 }
489
490 .ver-todos-cursos-link:hover p{
491 color: #515A6B!important;
492 }
493
494 .custom-card-curso-tema{
495
496 height:282px!important;
497
498 }
499
500 .container-fluid .row{
501 margin: 0 !important;
502 }
503
504
505 .container-fluid .col-md-12{
506 padding: 0 !important;
507 }
508
509 .ver-todos-no-click{
510 text-decoration: none !important;
511 pointer-events: none !important;
512 }
513
514 .slick-area__item.card-curso-nivel-2 .custom-card-curso-tema__title{
515 height: 70px;
516 }
517
518 .ssp:not(.liferay-instance) .ssp-section-tema__container-menu-item .tema {
519 font-size: 15px;
520 color: #454F63;
521 }
522
523 .ssp:not(.liferay-instance) .ssp-section-tema__container-menu-item .tema:hover {
524 background-color: ${tipoCursoObj.hexColor.main};
525 color: white;
526 font-weight: 600 !important;
527 }
528
529 .ssp:not(.liferay-instance) .ssp-section-tema__container-menu {
530 flex-wrap: wrap;
531 }
532
533 .tema i{
534 margin-right: 8px;
535 }
536
537
538 /* Alteracoes para 10019 */
539 #filtro-temas-nivel-2 .subtema.subtema-ativo:not(.todos){
540 margin: 0 auto 30px auto!important;
541 }
542 #filtro-temas-nivel-2 .btn-nivel-3{
543 display: inline-flex;
544 height: 40.061px;
545 padding: 16.868px;
546 justify-content: center;
547 align-items: center;
548 gap: 16.868px;
549 flex-shrink: 0;
550 border-radius: 8px;
551 border: 1.054px solid #C3CAD9;
552 }
553 .tema-ativo::after{
554 font-family: "Font Awesome 5 Free";
555 font-weight: 900;
556 content: "\f00d";
557 font-size: 12px;
558 margin: 0 5px;
559 }
560 .subtema-ativo:not(.subtema-ativo.todos)::after{
561 font-family: "Font Awesome 5 Free";
562 font-weight: 900;
563 content: "\f00d";
564 font-size: 12px;
565 margin: 0 5px;
566 }
567 #filtro-temas-nivel-3{
568 margin-bottom: 20px;
569 }
570 #filtro-temas-nivel-3 a:not(.todos, .subtema-ativo)::after{
571 content: "+";
572 padding-left: 10px;
573 font-size: 16px;
574 }
575 .ssp:not(.liferay-instance) .ssp-section-tema__title{
576 color: #78849E;
577 text-align: center;
578 font-family: Montserrat;
579 font-size: 32px;
580 font-style: normal;
581 font-weight: 600;
582 line-height: normal;
583 }
584 .ssp:not(.liferay-instance) .ssp-section-tema__title.selected {
585 font-size: 24px;
586 font-weight: 400;
587 }
588 .ssp:not(.liferay-instance) .ssp-section-tema__title::after {
589 display: none!important;
590 }
591 .ssp-title-filtrar-mais {
592 color: #454F63;
593 font-family: Montserrat;
594 font-size: 20px;
595 font-style: normal;
596 font-weight: 600;
597 line-height: normal;
598 margin-top: 58px;
599 margin-bottom: 24px;
600 margin-left: 10px;
601 }
602 #filtro-temas-nivel-3 .subtema {
603 border-radius: 32px;
604 border: 1.054px solid #C3CAD9;
605 display: flex;
606 height: 32px;
607 padding: 16.868px 16px;
608 justify-content: center;
609 align-items: center;
610 gap: 12px;
611 color: var(--boto, #636C7E);
612 text-align: center;
613 font-family: Montserrat;
614 font-size: 16px;
615 font-style: normal;
616 font-weight: 600;
617 line-height: normal;
618 }
619 .ssp-divider {
620 content: " ";
621 display: block;
622 background-color: #78849E;
623 width: 127px;
624 height: 3px;
625 margin: -25px auto 50px;
626 }
627 .ssp-section-tema__container-menu-item:has(.tema-ativo) {
628 margin-left: auto;
629 margin-right: auto;
630 }
631
632 @media only screen and (max-width: 1024px) {
633 .ssp-title-filtrar-mais {
634 color: #454F63;
635 font-family: Montserrat;
636 font-size: 18px;
637 font-style: normal;
638 font-weight: 600;
639 line-height: normal;
640 margin-top: 48px;
641 margin-bottom: 40px;
642 margin-left: 0px;
643 }
644 .ssp:not(.liferay-instance) .ssp-section-tema__title {
645 color: #78849E;
646 text-align: center;
647 font-family: Montserrat;
648 font-size: 21px;
649 font-style: normal;
650 font-weight: 700;
651 line-height: normal;
652 }
653
654 .ssp:not(.liferay-instance) .ssp-section-tema__title.selected {
655 font-size: 16px;
656 font-weight: 400;
657 }
658
659 .ssp-divider {
660 margin: 0px auto 30px;
661 }
662 }
663
664
665 .ssp:not(.liferay-instance) .ssp-card-curso, .ssp:not(.liferay-instance) .ssp-card-todos-cursos{
666
667 box-shadow: 0 0 15px rgba(0, 0, 0, 0.20);
668
669 }
670
671 .ssp-header-tema img {
672 width: 100%;
673 height: 100%;
674 position: absolute;
675 top: 0;
676 object-fit: cover;
677 }
678
679 </style>
680
681
682 <input type="hidden" id="ssp-vocabulary-id-tema-mercadologico" value="${vocabularyTemaMercadologico.getVocabularyId()}">
683
684<#-- html header -->
685<section class="ssp-header-tema">
686
687 <#-- dados de compartilhamento -->
688
689 <@liferay_util["html-top"]>
690 <meta name="image" property="og:image" content="${tipoCursoObj.imgPath}">
691 <meta property="og:image:width" content="1024">
692 </@>
693
694 <#-- dados de compartilhamento -->
695
696 <img data-fileentryid="${tipoCursoObj.imgFileEntryId}" src="${tipoCursoObj.imgPath}" alt="${tipoCursoObj.title}">
697
698
699 <div class="ssp-header-tema__overlay"></div>
700 <div class="ssp-header-tema__tag-tipo-curso"></div>
701
702 <div class="container">
703
704
705 <div class="ssp-header-tema__title-content">
706 <h1 class="ssp-header-tema__title">${tipoCursoObj.displayTitle}</h1>
707
708 <p class="ssp-header-tema__description">
709
710 ${tipoCursoObj.description}
711
712 </p>
713
714 </div>
715
716 <div class="ssp-campo-pesquisa__content ssp-header-tema__search-content">
717
718 <div class="ssp-campo-pesquisa__container">
719
720 <input class="ssp-campo-pesquisa__input" maxlength="55" type="search" id="busca" name="q" placeholder="Pesquisar curso de interesse" autocomplete="off">
721
722 <i class="fas fa-times ssp-busca-avancada__input-search-icon d-none" id="limpa-busca" style="left: 20px;top:20px;color: white;"></i>
723
724 <i class="fas fa-search ssp-campo-pesquisa__input-icon ssp-busca-avancada__input-search-icon" id="cursos-lupa-busca" style="right: 20px; top: 20px; font-size: 20px;color: white;"></i>
725
726
727 </div>
728
729 </div>
730
731
732 </div>
733
734
735 </section>
736
737<#-- html conteudo -->
738
739<section>
740
741 <div>
742
743 <h2 class="ssp-section-tema__title" data-section="title">
744 Qual a sua área de interesse?
745 </h2>
746
747 <div class="ssp-divider"></div>
748
749 <div class="container">
750
751 <div id="temas" class="ssp-section-tema__container-menu">
752
753 <div class="ssp-section-tema__container-menu-item">
754 <a href="#a" class="tema todos" data-nvl="0">
755 <i class="fa-solid fa-dice-d6"></i>
756 Todos
757 </a>
758 </div>
759
760 </div>
761
762 <div class="ssp-btn__visualizar-mais-content d-md-none d-lg-none d-xl-none">
763
764 <p id="visualizar-mais" class="ssp-btn__visualizar-mais">Visualizar mais</p>
765
766 <i class="fas fa-chevron-down mx-2 visualizar-mais-seta" style="font-size: 14px;"></i>
767
768 </div>
769
770 </div>
771
772 </div>
773
774</section>
775
776<section id="tema-nivel2-container">
777 <div id="tema-atual">
778 <h2 class="ssp-section-tema__title"></h2>
779 <div class="ssp-divider"></div>
780 </div>
781
782 <#--
783 <div id="subtemas-lista-mobile"
784 class="container d-none ssp-section-tema__container-submenu-nivel3"></div> -->
785
786 <div id="filtro-temas-nivel-2" class="container ssp-section-tema__container-submenu-nivel3 d-none"></div>
787
788 <div id="filtro-temas-nivel-3" class="container ssp-section-tema__container-submenu-nivel3 d-none"></div>
789
790</section>
791
792<section id="cursos-por-categoria-container">
793
794 <section class="py-5">
795
796 <div class="container">
797 <!-- <hr class="filtroInscBolsa"> -->
798 <div class="ssp-slider-check__container" style="padding: 20px 0px;">
799 <div class="ssp-slider-check__content-itens">
800
801 <div class="ssp-slider-check__content-item">
802
803 <label id="inscricao-aberta" class="switch">
804 <input id="chkInscricao" type="checkbox">
805 <span class="slider round"></span>
806 </label>
807
808 <span class="ssp-slider-check__label">Comprar agora</span>
809
810 </div>
811
812
813 <div class="ssp-slider-check__content-item">
814
815 <label id="bolsas-estudo" class="switch">
816 <input id="chkBolsa" type="checkbox">
817 <span class="slider azul round"></span>
818 </label>
819
820 <span class="ssp-slider-check__label">Bolsas de estudo</span>
821
822 </div>
823
824 </div>
825
826 </div>
827
828 <!-- <hr class="filtroInscBolsa"> -->
829 </div>
830
831 <div id="curso-sem-slick" class="ssp-container__cursos-sem-slick container" style="margin-top:15px;"></div>
832
833
834 </section>
835 <div id="filtroSemCurso" class="ssp-bolsa-formulario__card-aviso-atencao d-none container text-left" style="width: 100%;">
836
837 <i class="fas fa-exclamation-circle ssp-bolsa-formulario__card-aviso-atencao-icon" aria-hidden="true"></i>
838
839 <div class="ssp-bolsa-formulario__card-aviso-texto"><p>Sem cursos para o filtro selecionado</p>
840 </div>
841
842 </div>
843</section>
844
845<#-- Template para exibição de cursos por subtema -->
846
847<div style="padding-bottom: 30px;">
848
849 <section id="cursos-por-subtema-container" class="container d-none">
850
851 <!--h2 id="subtema-atual" class="ssp-section-tema__title-subtema"></h2-->
852
853 <div id="subsubtemas-lista" class="ssp-section-tema__container-submenu-nivel3"></div>
854
855 <div id="curso-sem-slick" class="ssp-container__cursos-sem-slick"></div>
856
857
858 </section>
859
860</div>
861
862
863<#-- Template para card de cursos por categoria -->
864<section id="cursos-por-categoria-template"
865 class="cursos-por-categoria ssp-section container d-none">
866
867
868 <div class="ssp-page-busca__section-resultado-container"
869 id="container-slider-cursos-livres">
870
871 <a href="#a" data-nvl="" data-tema=""
872 class="ver-todos-cursos-link d-none-mobile">
873 <p
874 class="ssp-page-busca__section-resultado__title-outros tema-nome ssp-section-tema__subtitle-curso-section"></p></a>
875
876 </div>
877
878 <div class="slider-curso" style="display: flex;"></div>
879
880</section>
881
882
883<#-- Buscados Recente -->
884
885<div id="section-buscados-recentes" class="ssp-section-lg-bottom d-none">
886
887 <section id="cursos-recentes-template"
888 class="cursos-recentes container d-none slider-curso">
889
890 <h3 class="ssp-section-tema__title">
891 Últimos cursos acessados
892 </h3>
893
894 <div class="slider-curso" style="display: flex;"></div>
895
896 </section>
897
898</div>
899
900
901
902<#-- js header -->
903
904<script>
905
906function initHeader() {
907
908 $('#busca').bind("keyup", digitaBuscaLocal);
909 $('#cursos-lupa-busca').click(buscaLocal);
910 $('#limpa-busca').click(limpaBuscaLocal);
911
912}
913
914$(document).ready(function() {
915 initHeader();
916 init();
917
918 //Associa eventos
919 $(document).on("click", ".ver-todos-cursos-link", verTodosCursos);
920 $(document).on("click", ".card-ver-todos-cursos-link", verTodosCursos);
921});
922
923function buscaLocal() {
924
925 var term = $('#busca').val();
926 if(!term.length || term.length < 4) return;
927
928 const urlSearch = urlCategoriaIdTipoCurso.replace('\{groupId\}', groupId)
929 .replace('\{tipoCursoNome\}', tipoCursoNome);
930
931 $.ajax({
932 url : urlSearch,
933 method : 'get',
934 async: false
935 }).done(
936 function(data) {
937
938 if (data.length > 0) {
939
940 var linkBusca = '/busca?q='
941 + encodeURIComponent(term) + '&tipo-curso=' + data
942 + '#c';
943
944 window.location.href = linkBusca;
945 }
946 });
947}
948
949function limpaBuscaLocal(){
950 $('#busca').val('');
951 mostraBtnFechar()
952}
953
954function digitaBuscaLocal() {
955
956 var value = $(this).val();
957
958 mostraBtnFechar()
959
960 // Se apertou Enter, executa a busca
961 if (window.event.keyCode == 13) {
962 buscaLocal();
963 return;
964 }
965}
966
967function mostraBtnFechar(){
968
969 if(!($('#busca').val() == '')){
970 $('#limpa-busca').removeClass('d-none');
971 }else{
972 $('#limpa-busca').addClass('d-none');
973 }
974}
975
976
977
978<#-- js conteudo -->
979
980 const isMobile = $(window).width() <= 1024;
981 const urlCategoriaIdTipoCurso = '/o/senac-content-services/idTipoCursoPorNome/{groupId}/{tipoCursoNome}';
982 const urlCursosPorTipoCursoETemaComFiltrosBolsaECompra = "/o/senac-content-services/cursosPorCategoriasComFiltrosBolsaECompra/{groupId}/{filtrarInscricoesAbertas}/{filtrarBolsaEstudo}/{considerarUnidade}/{start}/{end}?categoryIds={categoriaTemaId}&categoryIds={tipoCurso}"
983 const groupId = themeDisplay.getScopeGroupId();
984 const tipoCursoNome = "${tipoCursoObj.name}";
985 const cookieName = "${tipoCursoObj.cookieName}";
986 const urlTipoCurso = "${friendlyUrlTipoCurso}";
987 var carregandoMais = false;
988 var temas = [];
989 var subtemasStorage = new Map();
990 var activeCategory = 'all';
991 var activeCategoryLevel = 0;
992 var limit = 2;
993 var offset = 0;
994 var todosText = '';
995 var limitTodosCursos = 16;
996 var offsetTodosCursos = 0;
997 var categoryIdTipoCurso = 0;
998 var categoryIdModalidade = 0;
999 var limitCursos = isMobile ? 4 : 11;
1000 var urlTemaNv1 = "";
1001 var urlTemaNv2 = "";
1002 var urlTemaNv3 = "";
1003 let urlParamTemaNv3 = "";
1004 var urlTemasStorage = new Map();
1005 var filtrarInscricoesAbertas = 0;
1006 var filtrarBolsaEstudo = 0;
1007 let categorias = [];
1008 let categoryWithoutCourse = [];
1009 let isAcessoDireto = false;
1010
1011 // Botao para filtro de cursos com inscricoes abertas e bolsas
1012 $('#inscricao-aberta input, #bolsas-estudo input').click(function () {
1013
1014 //Atualiza as variaveis globais dos dois filtros
1015 filtrarInscricoesAbertas = $("#inscricao-aberta input").is(":checked") ? 1 : 0;
1016 filtrarBolsaEstudo = $("#bolsas-estudo input").is(":checked") ? 1 : 0;
1017
1018 //Refaz a busca com os filtros atualizados
1019 switch (getCurrentLevel()) {
1020 case 1:
1021 case 2:
1022 //Verifica se esta exibindo todos ou algum tema
1023 var botaoTodos = $('.todos');
1024
1025 if (botaoTodos.hasClass('ativo') || botaoTodos.hasClass('tema-ativo'))
1026 $('.todos:first').trigger('click');
1027
1028 //Se estiver ativo um tema, verifica se possui ativo um subtema
1029 else
1030 //Verifica o nivel do tema clicado
1031 $('.subtema-ativo:not(.todos)').length == 0 ? $('.subtema-ativo.todos').trigger('click') : $('.subtema-ativo:first').trigger('click', [$(this)]);
1032 break;
1033
1034 case 3:
1035 if ($('#filtro-temas-nivel-3 .subtema-ativo:not(.todos)').length) {
1036 const preSelecteds = []
1037 document.querySelectorAll('#filtro-temas-nivel-3 .subtema-ativo:not(.todos)')
1038 .forEach(el => {
1039 preSelecteds.push(el)
1040 el.classList.remove('subtema-ativo')
1041 })
1042
1043 preSelecteds.forEach(async el => await clickTema(el.getAttribute('data-tema')))
1044 } else {
1045 const el = $('#filtro-temas-nivel-3 .todos')
1046 el.trigger('click')
1047 }
1048 break;
1049 }
1050 })
1051
1052 //carrega url com tema clicado
1053 function atualizaUrlBrowser(urlTema, nivel) {
1054 var path = window.location.pathname;
1055 var urlFinal = "";
1056
1057 if (path.indexOf('staging') > 1) {
1058 urlFinal = "/web/guest-staging";
1059 } else
1060 if (path.indexOf('guest') > 1) {
1061 urlFinal = "/web/guest";
1062 }
1063
1064 urlFinal += "/" + urlTipoCurso;
1065
1066 //se for todos os cursos a url fica so /unidade/tipo-curso
1067 if ("${tipoCursoObj.allTemas?c}" == "true" && nivel && nivel > 0) {
1068 const urlParams = new URLSearchParams(window.location.search);
1069
1070 switch (nivel) {
1071
1072 case 1:
1073 urlTemaNv1 = urlTema;
1074 urlFinal += "/" + urlTemaNv1;
1075 break;
1076
1077 case 2:
1078 urlTemaNv2 = urlTema;
1079 urlFinal += "/" + urlTemaNv1 + "/" + urlTemaNv2;
1080 break;
1081
1082 case 3:
1083 urlTemaNv3 = urlTema;
1084
1085 urlParams.set('q', urlTemaNv3)
1086
1087 urlFinal += "/" + urlTemaNv1 + "/" + urlTemaNv2;
1088 break;
1089
1090 }
1091
1092 urlFinal += (urlParams.toString() ? '?' + urlParams.toString() : '')
1093
1094 } else {
1095
1096 if (urlTema != 0) urlFinal += "/" + urlTema;
1097
1098 }
1099
1100 urlFinal = new URL(window.location.origin + urlFinal);
1101 if ($("#inscricao-aberta input").is(":checked")) {
1102 urlFinal.searchParams.set("inscricao", true);
1103 }
1104 if ($("#bolsas-estudo input").is(":checked")) {
1105 urlFinal.searchParams.set("bolsa", true);
1106 }
1107 window.history.pushState('', 'Categoria JavaScript', decodeURIComponent(urlFinal.toString()))
1108 }
1109
1110 function getUrlTipoCurso() {
1111 return "${friendlyUrlTipoCurso}";
1112 }
1113
1114 function buscaFriendlyUrlTemaEAtualizaBrowser(temaId, nivelClicado) {
1115
1116 var friendlyUrlTema = urlTemasStorage.get(temaId);
1117
1118 if (typeof friendlyUrlTema === "undefined") {
1119 //se ainda nao tem no map, busco via ajax e armazeno no map a url do tema clicado para nao precisar buscar novamente
1120 $.ajax({
1121 url: '/o/senac-content-services/friendlyUrlPorCategoria/' + temaId,
1122 type: 'get',
1123 dataType: 'json',
1124 async: false
1125 }).done(function (res) {
1126
1127 urlTemasStorage.set(temaId, res.url);
1128 friendlyUrlTema = res.url
1129
1130 })
1131 }
1132
1133 if (nivelClicado && nivelClicado == 3 && "${tipoCursoObj.allTemas?c}" == "true") {
1134 let params = '';
1135
1136 document.querySelectorAll("#filtro-temas-nivel-3 a.subtema-ativo")
1137 .forEach(a => {
1138 const friendlyUrl = urlTemasStorage.get(parseInt(a.getAttribute('data-tema')))
1139 params = (params ? params + ',' : '') + friendlyUrl
1140 })
1141
1142 atualizaUrlBrowser(params, nivelClicado);
1143 } else {
1144 atualizaUrlBrowser(friendlyUrlTema, nivelClicado || '');
1145 }
1146
1147 }
1148
1149
1150 //verifica se usuario acessou direto pelas urls dos temas e carrega os temas para dar sequencia
1151 async function verificaAcessoDiretoELoadTema() {
1152 isAcessoDireto = true;
1153 urlTemaNv1 = "${friendlyUrlTemaFirst}";
1154 urlTemaNv2 = "${friendlyUrlTemaSecond}";
1155 urlTemaNv3 = "${friendlyUrlTemaThird}";
1156
1157 const urlParamsTemaNv3 = new URLSearchParams(window.location.search);
1158 urlParamTemaNv3 = urlParamsTemaNv3.get('q');
1159
1160 carregaTemas()
1161
1162 let nivel1CategoryId
1163 let nivel2CategoryId
1164 let nivel3CategoryId
1165
1166 if (urlTemaNv1) {
1167 getSubtemas(urlTemaNv1)
1168 .done(categories => {
1169 nivel1CategoryId = categories[0].categoryId
1170 clickTema(nivel1CategoryId)
1171 })
1172 }
1173
1174 if (urlTemaNv2) {
1175 getSubtemas(urlTemaNv2, nivel1CategoryId)
1176 .done(categories => {
1177 nivel2CategoryId = categories[0].categoryId
1178 clickTema(nivel2CategoryId)
1179 })
1180 }
1181
1182 if (urlParamTemaNv3) {
1183 const params = urlParamTemaNv3.split(',')
1184
1185 for (let index = 0; index < params.length; index++) {
1186 const url = params[index];
1187
1188 const categories = await getSubtemas(url, nivel2CategoryId)
1189
1190 await clickTema(categories[0].categoryId)
1191 }
1192 }
1193
1194 isAcessoDireto = false
1195 }
1196
1197 /* Prepara a montagem inicial da página */
1198 function init() {
1199
1200 $('#tema-atual h2').text("");
1201 $('#tema-atual').hide();
1202
1203 todosText = $('#tema-atual h2').text();
1204
1205 //Preenche o id do tipo de curso e a modalidade
1206 var url = urlCategoriaIdTipoCurso
1207 .replace('{groupId}', groupId)
1208 .replace('{tipoCursoNome}', tipoCursoNome);
1209
1210 $.ajax({
1211 url: url,
1212 type: 'get',
1213 async: false
1214 }).done(function (categoryIdTipoCursoResponse) {
1215
1216 categoryIdTipoCurso = categoryIdTipoCursoResponse;
1217
1218 if ("${tipoCursoObj.codModalidade}" != "0") {
1219 const urlModalidade = "/o/senac-category-services/categoryByVocabularyNameAndProperty/{groupId}/Modalidade/codModalidade/{codModalidade}";
1220 var url = urlModalidade
1221 .replace("{groupId}", groupId)
1222 .replace("{codModalidade}", "${tipoCursoObj.codModalidade}");
1223 $.ajax({
1224 url : url,
1225 type : 'get',
1226 async: false
1227 }).done(function(categoryIdModalidadeResp) {
1228 try{
1229 categoryIdModalidade = JSON.parse(categoryIdModalidadeResp).categoryId;
1230 }catch(err){
1231 console.error('idModalidade nao obtido ' + err.message);
1232 }
1233 });
1234 }
1235
1236 });
1237
1238 carregarCategorias()
1239 verificaFiltroInscricaoBolsaEToggle()
1240 verificaAcessoDiretoELoadTema()
1241 visualizarMais()
1242 hideVisualizarMais()
1243
1244 if (isMobile) {
1245 visualizarMenos()
1246 showVisualizarMais()
1247 }
1248 }
1249
1250 function verificaFiltroInscricaoBolsaEToggle() {
1251 const urlParams = new URLSearchParams(window.location.search);
1252 $('#chkInscricao').prop("checked", urlParams.get('inscricao') == 'true');
1253 filtrarInscricoesAbertas = $('#chkInscricao').prop("checked") ? 1 : 0;
1254 $('#chkInscricao').change(ev => selectFilter('inscricao', $('#chkInscricao')));
1255
1256 if ($('#chkBolsa').length) {
1257 $('#chkBolsa').prop("checked", urlParams.get('bolsa') == 'true');
1258 filtrarBolsaEstudo = $('#chkBolsa').prop("checked") ? 1 : 0;
1259 $('#chkBolsa').change(ev => selectFilter('bolsa', $('#chkBolsa')));
1260 }
1261 }
1262
1263 function carregarCategorias() {
1264 if (!categorias.length) {
1265 const searchParams = new URLSearchParams({
1266 companyId: themeDisplay.getCompanyId(),
1267 groupIds: themeDisplay.getScopeGroupId(),
1268 parentCategoryIds: 0,
1269 vocabularyIds: document.querySelector('#ssp-vocabulary-id-tema-mercadologico').value
1270 })
1271
1272 $.ajax({
1273 url: '/o/senac-category-services/categories?' + searchParams.toString(),
1274 method: 'get',
1275 async: false
1276 })
1277 .done(data => categorias = data)
1278 .fail(err => console.error(err))
1279 }
1280 }
1281
1282 function selectFilter(paramkey, el) {
1283 setUrlParam(paramkey, el.prop("checked"))
1284 }
1285
1286 function setUrlParam(key, value) {
1287 const url = new URL(window.location.href)
1288 url.searchParams.set(key, value || false);
1289
1290 window.history.pushState({}, '', decodeURIComponent(url.toString()))
1291 }
1292
1293 $(document).on("click", '.ssp-btn__visualizar-mais-content', toggleVisualizarMais)
1294
1295 function visualizarMenos() {
1296 const itensTema = $('#temas').children();
1297 const itensExibidos = 6;
1298
1299 if (isMobile)
1300 itensTema.slice(itensExibidos).hide();
1301
1302 $('#visualizar-mais').text('Visualizar mais');
1303 $('#visualizar-mais').parent().find('i').removeClass('fa-chevron-up');
1304 $('#visualizar-mais').parent().find('i').addClass('fa-chevron-down');
1305 }
1306
1307 function visualizarMais() {
1308 const itensTema = $('#temas').children();
1309 const itensExibidos = 6;
1310
1311 if (isMobile)
1312 itensTema.slice(itensExibidos).show();
1313
1314 $('#visualizar-mais').text('Visualizar menos');
1315 $('#visualizar-mais').parent().find('i').removeClass('fa-chevron-down');
1316 $('#visualizar-mais').parent().find('i').addClass('fa-chevron-up');
1317 }
1318
1319 function toggleVisualizarMais() {
1320 if ($('#visualizar-mais').text() === "Visualizar mais")
1321 visualizarMais()
1322 else
1323 visualizarMenos()
1324 }
1325
1326 function showVisualizarMais() {
1327 const itensExibidos = 6;
1328
1329 if ($('#temas').children().length <= itensExibidos)
1330 hideVisualizarMais()
1331 else
1332 $('.ssp-btn__visualizar-mais-content').show()
1333 }
1334
1335 function hideVisualizarMais() {
1336 $('.ssp-btn__visualizar-mais-content').hide()
1337 }
1338
1339 /* Carrega os subtemas ou cursos ao clicar no tema */
1340 let lastClicked
1341 $(".container").on("click", ".tema", function (ev) {
1342 ev.preventDefault();
1343
1344 const categoriaId = $(this).data('tema');
1345 const isEqualTema = lastClicked == categoriaId
1346 lastClicked = categoriaId
1347
1348 const isTodos = this.classList.contains('todos')
1349
1350 activeCategoryLevel = $(this).data('nvl');
1351 limit = 2;
1352 offset = 0;
1353 limitTodosCursos = 16;
1354 offsetTodosCursos = 0;
1355
1356 $('#filtro-temas-nivel-2').empty()
1357 $('#filtro-temas-nivel-3').empty()
1358
1359 hideVisualizarMais()
1360 $('.tema').removeClass('ativo');
1361 $('.tema').removeClass('tema-ativo')
1362 $('.ssp-section-tema__container-menu-item').show()
1363
1364 document.querySelector('.ssp-divider').classList.add('d-none')
1365
1366 document.querySelector('[data-section="title"]').classList.remove('selected')
1367
1368 if (isTodos) {
1369 document.querySelector('[data-section="title"]').innerHTML = 'Qual a sua área de interesse?'
1370 document.querySelector('.ssp-divider').classList.remove('d-none')
1371
1372 showVisualizarMais()
1373 atualizaUrlBrowser(0, 0);
1374 $('.todos').addClass('ativo');
1375
1376 if (isMobile) {
1377 visualizarMenos()
1378 showVisualizarMais()
1379 }
1380 } else {
1381 document.querySelector('[data-section="title"]').innerHTML = 'Você selecionou:'
1382 $('.ssp-section-tema__container-menu-item').hide()
1383 $('.ssp-section-tema__container-menu-item').has(this).show()
1384
1385 if (isEqualTema) {
1386 removeFiltersLevel1()
1387 return
1388 } else
1389 $(this).addClass('tema-ativo')
1390
1391 $.ajax(
1392 {
1393 url: '/o/senac-content-services/category/'
1394 + $(this).data('tema'),
1395 type: 'get'
1396 }).done(function (category) {
1397
1398 activeCategory = JSON.parse(category);
1399
1400 cleanElements();
1401
1402 displayCursosPorTema();
1403
1404 displaySubTemasLista();
1405
1406 buscaFriendlyUrlTemaEAtualizaBrowser(categoriaId, 1);
1407 });
1408
1409 if (!this.classList.contains('todos')) {
1410 hideOthersLevel1(this)
1411 }
1412 }
1413 });
1414
1415 /* Quando clica em Ver Todos cursos de um tema */
1416 function verTodosCursos() {
1417
1418 //Scrool top
1419 $('html, body').animate({
1420 scrollTop: $("#temas").offset().top
1421 }, -1000);
1422
1423
1424 var tema = $(this).data('tema');
1425 activeCategoryLevel = $(this).data('nvl');
1426
1427 if (activeCategoryLevel == 1)
1428 buscaFriendlyUrlTemaEAtualizaBrowser(tema, activeCategoryLevel);
1429
1430 // Verifica o elemento, adiciona a classe ativo e remove dos seus primos
1431 $('.todos').removeClass('ativo');
1432
1433 limit = 2;
1434 offset = 0;
1435
1436 $.ajax({
1437 url: '/o/senac-content-services/category/' + tema,
1438 type: 'get'
1439 }).done(function (category) {
1440
1441 activeCategory = JSON.parse(category);
1442
1443 switch (activeCategoryLevel) {
1444 case 1:
1445 $('.tema').removeClass('tema-ativo');
1446 $('.tema[data-tema="' + activeCategory.categoryId + '"]').not('.slick-cloned').each(function () {
1447 if (!$(this).parent().hasClass('slick-cloned')) {
1448 var botaoTemaVerTodos = $(this);
1449 botaoTemaVerTodos.trigger('click');
1450 }
1451 });
1452
1453 break;
1454 case 2:
1455
1456 var botaoTemaVerTodosNv2 = $('.subtema[data-tema="' + activeCategory.categoryId + '"]');
1457 botaoTemaVerTodosNv2.trigger('click');
1458
1459 break;
1460 case 3:
1461 var botaoTemaVerTodosNv3 = $('.subtema[data-tema="' + activeCategory.categoryId + '"]');
1462 botaoTemaVerTodosNv3.trigger('click');
1463
1464 break;
1465 }
1466
1467
1468 });
1469 }
1470
1471 function defaultSubtema(el, temaIds) {
1472 limit = 2;
1473 offset = 0;
1474 limitTodosCursos = 16;
1475 offsetTodosCursos = 0;
1476
1477 $('#cursos-por-subtema-container').find('#curso-sem-slick').empty();
1478
1479 activeCategoryLevel = $(el).data('nvl');
1480
1481 if ("${tipoCursoObj.allTemas?c}" == "true")
1482 buscaFriendlyUrlTemaEAtualizaBrowser($(el).data('tema'), activeCategoryLevel);
1483
1484 cleanElements();
1485
1486 const categories = []
1487 temaIds.forEach(id => {
1488 $.ajax({
1489 url: '/o/senac-content-services/category/' + id,
1490 type: 'get',
1491 async: false
1492 })
1493 .done((category) => {
1494 activeCategory = JSON.parse(category)
1495 categories.push(activeCategory)
1496 })
1497 });
1498
1499 displayCursosPorTema(categories)
1500 }
1501
1502 // evento de click nos subtemas
1503 $("#filtro-temas-nivel-2")
1504 .on("click", ".subtema", function (ev, trigger) {
1505
1506 ev.preventDefault();
1507
1508 $(this).siblings('.todos').removeClass("subtema-ativo")
1509
1510 if (this.classList.contains('todos') || (this.classList.contains('subtema-ativo') && !trigger)) {
1511 removeFiltersLevel2()
1512 return
1513 } else {
1514 hideOthersLevel2(this)
1515 this.classList.add('subtema-ativo')
1516 }
1517
1518 defaultSubtema(this, [$(this).data('tema')])
1519 })
1520
1521 $("#filtro-temas-nivel-3")
1522 .on("click", ".subtema", function (ev) {
1523
1524 ev.preventDefault();
1525
1526 $(this).siblings('.todos').removeClass("subtema-ativo")
1527
1528 if (this.classList.contains('todos')) {
1529 removeFiltersLevel3()
1530 return
1531 }
1532
1533 const isActived = this.classList.contains('subtema-ativo')
1534 if (isActived)
1535 this.classList.remove('subtema-ativo')
1536 else
1537 this.classList.add('subtema-ativo')
1538
1539
1540 const anyActive = !!document.querySelector("#filtro-temas-nivel-3 a.subtema-ativo")
1541 if (!anyActive)
1542 removeFiltersLevel3()
1543
1544 const temaIds = []
1545 document.querySelectorAll("#filtro-temas-nivel-3 a.subtema-ativo:not(.todos)")
1546 .forEach(a => temaIds.push(a.getAttribute('data-tema')))
1547
1548 defaultSubtema(this, temaIds)
1549 })
1550
1551 /* Click no botao todos */
1552 $(".container").on("click", ".todos:not(.subtema.todos)", function () {
1553
1554 atualizaUrlBrowser(0);
1555
1556 activeCategory = 'all';
1557 activeCategoryLevel = $(this).data('nvl');
1558 offset = 0;
1559
1560 /* Limpa dados de subtemas que possam ter sido criados na navegação */
1561 cleanElements();
1562
1563 $('#tema-atual').show()
1564 $('#tema-atual h2').text(todosText);
1565
1566 // Esconde a div com subtemas
1567 $('#filtro-temas-nivel-2').empty();
1568 $('#filtro-temas-nivel-2').addClass('d-none');
1569
1570 displayCursosPorTema();
1571
1572 });
1573
1574 /* Limpa a tela para exibição de novos cursos */
1575 function cleanElements() {
1576
1577 $('#subtemas-lista').empty();
1578
1579 $('#cursos-por-categoria-container .cursos-por-categoria').remove();
1580 $('#subtema-atual').empty();
1581 $('#cursos-por-subtema-container #subsubtemas-lista').empty();
1582 $('#cursos-por-subtema-container .ssp-card-curso').remove();
1583
1584 $('#cursos-por-categoria-container').removeClass('d-none');
1585 $('#cursos-por-subtema-container').addClass('d-none');
1586 }
1587
1588 /*
1589 * Armazena a navegação em cookies, se habilitado
1590 */
1591 $(document).on("click", ".ck-curso", function () {
1592
1593 //Verifica se os alternadores estao selecionados e manipula o link do curso de acordo a eles.
1594 urlFinal = new URL(window.location.origin + $(this).attr('href'));
1595 let filtroInscricaoBolsa = false;
1596
1597 if ($("#inscricao-aberta input").is(":checked")) {
1598 urlFinal.searchParams.set("inscricao", true);
1599 filtroInscricaoBolsa = true;
1600 }
1601 if ($("#bolsas-estudo input").is(":checked")) {
1602 urlFinal.searchParams.set("bolsa", true);
1603 filtroInscricaoBolsa = true;
1604 }
1605 $(this).attr('href', urlFinal.pathname + (filtroInscricaoBolsa ? "?" + urlFinal.searchParams : ""))
1606
1607
1608 //Verifica se o cookie está habilitado
1609 if (getCookie('portalSenacCookie') != null) {
1610
1611 var articleId = $(this).data('ck');
1612 manageCookieArray(cookieName, articleId);
1613 manageCookieArray('ck-cursos', articleId);
1614 }
1615
1616 });
1617
1618 function exibirSliderCategoria(dadosCategoriaJson, nivel) {
1619
1620 var dadosCategoria = JSON.parse(dadosCategoriaJson);
1621
1622 //monta as divs para cada tcategoria
1623 var templatePorCategoria = $('#cursos-por-categoria-' + dadosCategoria.categoryId);
1624 templatePorCategoria.find('.tema-nome').text(dadosCategoria.name);
1625 templatePorCategoria.find('.ver-todos-cursos-link').attr('data-nvl', nivel);
1626 templatePorCategoria.find('.ver-todos-cursos-link').attr('data-tema', dadosCategoria.categoryId);
1627 templatePorCategoria.removeClass('d-none');
1628
1629 cursosPorCategoriaModelo1(dadosCategoria);
1630
1631 }
1632
1633 /*
1634 * Exibe os cursos por tema, dependendo do nivel
1635 */
1636 function displayCursosPorTema(categories) {
1637 hideMensagemSemCurso();
1638
1639 // Verifica o nivel
1640 switch (activeCategoryLevel) {
1641
1642 case 0: // exibe todos
1643 $('#tema-atual').hide()
1644 limit = 2;
1645
1646 $.each(temas.slice(offset, limit + offset), function (k, t) {
1647
1648 if ($('#cursos-por-categoria-' + t.categoryId).length == 0) {
1649 var template = $('#cursos-por-categoria-template').clone();
1650 template.prop('id', 'cursos-por-categoria-' + t.categoryId);
1651 template.removeClass('d-none');
1652 $('#cursos-por-categoria-container').append(template);
1653 }
1654
1655 $.ajax(
1656 {
1657 url: '/o/senac-content-services/category/'
1658 + t.categoryId,
1659 type: 'get',
1660 async: false
1661 }).done((category) => exibirSliderCategoria(category, 1));
1662 });
1663
1664 // Esconde botao carregar mais, se necessário
1665
1666 $('.section-carregar-mais').remove();
1667
1668 if (temas.length > limit + offset)
1669 $('#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>');
1670
1671 break;
1672
1673 case 1:
1674 limit = 2;
1675
1676 $('#tema-atual h2').text("O que você quer aprender nessa área?");
1677 $('#tema-atual').show();
1678
1679 // Exibe os cursos dos subtemas do tema clicado percorrendo a lista de
1680 // subtemas do tema clicado
1681 if (subtemasStorage.get(activeCategory.categoryId) && subtemasStorage.get(activeCategory.categoryId).length > 0) {
1682
1683 $.each(subtemasStorage.get(activeCategory.categoryId).slice(offset,
1684 limit + offset), function (k, t) {
1685
1686 if ($('#cursos-por-categoria-' + t.categoryId).length == 0) {
1687 var template = $('#cursos-por-categoria-template').clone();
1688 template.prop('id', 'cursos-por-categoria-' + t.categoryId);
1689
1690 template.removeClass('d-none');
1691
1692 $('#cursos-por-categoria-container').append(template);
1693 }
1694
1695 $.ajax(
1696 {
1697 url: '/o/senac-content-services/category/'
1698 + t.categoryId,
1699 type: 'get',
1700 async: false
1701 }).done((category) => exibirSliderCategoria(category, 2));
1702 });
1703
1704 // Esconde botao carregar mais, se necessário
1705 $('.section-carregar-mais').remove();
1706
1707 if (subtemasStorage.get(activeCategory.categoryId).length > limit + offset)
1708 $('#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>');
1709
1710 } else {
1711 //Se nao tiver subtema, exibe o modelo 2
1712 cursosPorCategoriaModelo2();
1713 }
1714
1715 break;
1716
1717 case 2: // exibe cursos do nivel 2
1718 limitTodosCursos = 16;
1719 cursosPorCategoriaModelo2();
1720 break;
1721
1722 case 3:
1723 // subtemas de nivel 3 nao devem ter limite
1724 limitTodosCursos = ($('#filtro-temas-nivel-3 .subtema-ativo:not(.todos)').length) ? -1 : 16;
1725 cursosPorCategoriaModelo3(categories);
1726 break;
1727 }
1728
1729 }
1730
1731 /*
1732 * Faz a exibição dos cursos quando se carrega a tela ou clica em 'Todos'
1733 */
1734 function cursosPorCategoriaModelo1(category) {
1735
1736 categoryWithoutCourse = []
1737 hideMensagemSemCurso()
1738
1739 let urlFinal = urlCursosPorTipoCursoETemaComFiltrosBolsaECompra
1740 .replace('\{groupId\}', groupId)
1741 .replace('\{categoriaTemaId\}', category.categoryId)
1742 .replace('\{tipoCurso\}', categoryIdTipoCurso)
1743 .replace('\{filtrarInscricoesAbertas\}', filtrarInscricoesAbertas)
1744 .replace('\{filtrarBolsaEstudo\}', filtrarBolsaEstudo)
1745 .replace('\{considerarUnidade\}', 0)
1746 .replace('\{start\}', 0)
1747 .replace('\{end\}', limitCursos);
1748 if(categoryIdModalidade != 0){
1749 urlFinal = urlFinal.concat("&categoryIds=", categoryIdModalidade);
1750 }
1751
1752 $.ajax(
1753 {
1754 url: urlFinal,
1755 type: 'get',
1756 beforeSend: function () {
1757 loading('#cursos-por-categoria-' + category.categoryId + ' .slider-curso');
1758 }
1759 })
1760 .done(
1761 function (cursosPorCategoria) {
1762
1763 enableScroll(true);
1764
1765 cursosPorCategoria = JSON.parse(cursosPorCategoria);
1766
1767 var totalCursos = cursosPorCategoria.total;
1768
1769 //Se nao retornou cursos, deve esconder a div da categoria
1770 if (totalCursos == 0) {
1771 $('#cursos-por-categoria-' + category.categoryId).html('');
1772
1773 //essa classe tirar todo o padding da div, escondendo ela
1774 $('#cursos-por-categoria-' + category.categoryId).removeClass('ssp-section');
1775
1776 if (isMobile) {
1777 var $element = document.getElementById('cursos-por-categoria-container');
1778 var _elementPos = $element.offsetTop + 100;
1779 var _scrollDown = _elementPos + (filtrarInscricoesAbertas == 1 || filtrarBolsaEstudo == 1 ? 300 : 1);
1780 window.scrollTo(window.scrollX || window.pageXOffset, _scrollDown);//carrega os cursos
1781 setTimeout(() => window.scrollTo(window.scrollX || window.pageXOffset, _elementPos), 500);//mostra o primeiro
1782
1783 } else {
1784 var _scrollDown = (window.scrollY || window.pageYOffset) + (filtrarInscricoesAbertas == 1 || filtrarBolsaEstudo == 1 ? 20 : 1);
1785 window.scrollTo(window.scrollX || window.pageXOffset, _scrollDown);
1786 }
1787 updateMensagemSemCurso();
1788 return;
1789 } else {
1790
1791 if (!$('#cursos-por-categoria-' + category.categoryId).hasClass('ssp-section'))
1792 $('#cursos-por-categoria-' + category.categoryId).addClass('ssp-section');
1793
1794 }
1795
1796 var articles = [];
1797
1798 $.each(cursosPorCategoria.cursos, function (k, c) {
1799 articles.push(c.articleId);
1800 });
1801
1802
1803 //Verifica a situação dos botoes de inscrições e bolsa
1804 $.ajax({
1805 url: '/o/senac-content-services/verificaBotoesInscricaoEBolsa/' + groupId + '/' + articles.join(','),
1806 type: 'get',
1807 async: false
1808 })
1809 .done(function (infoBotoes) {
1810
1811 enableScroll(true);
1812
1813 if (infoBotoes.length > 0) {
1814
1815 infoBotoes = JSON.parse(infoBotoes);
1816
1817 var template = $('#cursos-por-categoria-' + category.categoryId);
1818
1819 $('#cursos-por-categoria-' + category.categoryId + ' .slider-curso').empty();
1820
1821 $.each(cursosPorCategoria.cursos, async function (k, curso) {
1822
1823 var itemCurso = buildCardCurso(curso, infoBotoes, isMobile)
1824
1825 template.append(itemCurso);
1826
1827 template.find('.slider-curso').append(itemCurso);
1828
1829 });
1830
1831 updateMensagemSemCurso();
1832
1833 // chama o slider por categoria
1834 if (isMobile) {
1835 template.find('.slider-curso').css({ "flex-wrap": "wrap" });
1836
1837 if ($('.ssp-page-busca__section-resultado__ver-todos-mobile[data-tema="' + category.categoryId + '"]').length == 0) {
1838
1839 //Exibe o link ver todos
1840 //Adicionava o botão ver todos. Possível adição do código do card novo!
1841 if (totalCursos > 4) {
1842 template.find('.slider-curso').append('<a data-nvl="' + (activeCategoryLevel + 1) + '" data-tema="' + category.categoryId + '" class="ssp-card-todos-cursos ${tipoCursoObj.styleClass} card-ver-todos-cursos-link" ><p>Conferir todos <br>os <span>cursos</span></p><i class="far fa-arrow-right"></i></a>')
1843 } else {
1844 $(".ver-todos-cursos-link[data-tema='" + category.categoryId + "']").addClass("ver-todos-no-click");
1845 }
1846 }
1847 } else {
1848 template.find('.slider-curso').addClass(
1849 'slick-area slick-area--md-bleed slider-container slider-id-'
1850 + category.categoryId);
1851 if (totalCursos > 11) {
1852 template.find('.slider-curso').append('<a data-nvl="' + (activeCategoryLevel + 1) + '" data-tema="' + category.categoryId + '" class="ssp-card-todos-cursos ${tipoCursoObj.styleClass} card-ver-todos-cursos-link" ><p>Conferir todos <br>os <span>cursos</span></p><i class="far fa-arrow-right"></i></a>')
1853 } else {
1854 $(".ver-todos-cursos-link[data-tema='" + category.categoryId + "']").addClass("ver-todos-no-click");
1855 }
1856
1857 $('.slider-id-' + category.categoryId).removeClass('slick-initialized')
1858 sliderCurso('.slider-id-' + category.categoryId);
1859 }
1860 }
1861 })
1862 })
1863
1864 .fail(function (jqXHR, textStatus, msg) { })
1865 }
1866
1867 /*
1868 * Faz a exibição dos cursos quando se clica em temas nivel 2
1869 */
1870 function cursosPorCategoriaModelo2() {
1871
1872 categoryWithoutCourse = []
1873 hideMensagemSemCurso()
1874
1875 $('#tema-atual').hide()
1876 $("#tema-atual h2").html('');
1877
1878 let url;
1879 if(categoryIdModalidade != 0){
1880 url = '/o/senac-category-services/subtemasPorCategoryIds/'+ groupId+ '/'+ activeCategory.categoryId + '?categoryIds='+ categoryIdTipoCurso+ ','+ categoryIdModalidade;
1881 }else{
1882 url = '/o/senac-content-services/subtemasPorTipoCurso/' + groupId + '/' + activeCategory.categoryId + '/' + tipoCursoNome;
1883 }
1884
1885 // Busca os filhos (3 nivel)
1886 $.ajax({
1887 url: url,
1888 type: 'get',
1889 data: {}
1890 }).done(function (subtemas) {
1891
1892 enableScroll(true);
1893
1894 subtemas = JSON.parse(subtemas);
1895
1896 let subsubtemaLista = '';
1897
1898 if (subtemas.length > 0) {
1899 subsubtemaLista = '<h3 class="ssp-title-filtrar-mais">Filtrar mais:</h3>';
1900 const btnTodos = '<a href="#a" '
1901 + ' class="subtema btn-nivel-3 subtema-ativo todos" '
1902 + '" data-nvl="2" >'
1903 + 'Todos'
1904 + '</a>'
1905
1906 subsubtemaLista += btnTodos
1907 }
1908
1909 $.each(subtemas, function (k, v) {
1910 subsubtemaLista += '<a href="#a" class="subtema btn-nivel-3" data-tema="'
1911 + v.categoryId
1912 + '" data-nvl="3" >'
1913 + v.name
1914 + '</a>';
1915 });
1916
1917 const containerSubTemaLista = document.createElement('div')
1918 containerSubTemaLista.classList.add('row')
1919 containerSubTemaLista.innerHTML = subsubtemaLista
1920 $('#filtro-temas-nivel-3').html(containerSubTemaLista.outerHTML);
1921
1922 if (subtemas.length > 0) $('#filtro-temas-nivel-3').removeClass('d-none');
1923
1924 cursosPorCategoriaModelo3();
1925 })
1926
1927 }
1928
1929 async function getCursosByCategory(category) {
1930 if (activeCategory == 'all')
1931 return []
1932
1933 let urlFinal = urlCursosPorTipoCursoETemaComFiltrosBolsaECompra
1934 .replace('\{groupId\}', groupId)
1935 .replace('\{categoriaTemaId\}', category.categoryId)
1936 .replace('\{tipoCurso\}', categoryIdTipoCurso)
1937 .replace('\{filtrarInscricoesAbertas\}', filtrarInscricoesAbertas)
1938 .replace('\{filtrarBolsaEstudo\}', filtrarBolsaEstudo)
1939 .replace('\{considerarUnidade\}', 0)
1940 .replace('\{start\}', offsetTodosCursos)
1941 .replace('\{end\}', (limitTodosCursos + offsetTodosCursos));
1942 if(categoryIdModalidade != 0){
1943 urlFinal = urlFinal.concat("&categoryIds=", categoryIdModalidade);
1944 }
1945
1946 return new Promise((resolve) => {
1947 $.ajax({
1948 url: urlFinal,
1949 type: 'get',
1950 data: {},
1951 async: false,
1952 beforeSend: function () {
1953 var totalItens = $('#curso-sem-slick .slick-area__item').length;
1954 if (totalItens > 0) {
1955 $('#curso-sem-slick .slick-area__item').each(function () {
1956 if (!$.trim($(this).html()).length)
1957 $(this).remove();
1958 })
1959 }
1960 }
1961 })
1962 .done((data) => resolve(JSON.parse(data)))
1963 })
1964 }
1965 /*
1966 * Faz a exibição dos cursos quando se clica em temas nivel 3
1967 */
1968 async function cursosPorCategoriaModelo3(categories) {
1969
1970 categoryWithoutCourse = []
1971 hideMensagemSemCurso()
1972
1973 //Se já estiver carregando não deixa juntar várias chamadas
1974 if ($('#loading-todos-cursos').length > 0) return;
1975
1976 //Loading
1977 $('#cursos-por-categoria-container').append('<div id="loading-todos-cursos" style="width:100%; text-align:center">' +
1978 '<div class="ssp-loader-content">' +
1979 '<div class="ssp-loader"></div>' +
1980 '<p class="ssp-loader-text">Carregando...</p>' +
1981 '</div>' +
1982 '</div>');
1983 $("#tema-atual").hide()
1984 $("#tema-atual h2").html('');
1985
1986 categories = categories && categories.length ? categories : [activeCategory];
1987
1988 const cursosPorSubtema = [];
1989 var totalCursos = 0;
1990 var templateContainer = $('#cursos-por-subtema-container');
1991 if (offsetTodosCursos == 0) templateContainer.find('#curso-sem-slick').empty();
1992
1993 for (let index = 0; index < categories.length; index++) {
1994 const category = categories[index];
1995
1996 const cursosEncontrados = await getCursosByCategory(category)
1997
1998 if (!cursosEncontrados || !cursosEncontrados.cursos || !cursosEncontrados.cursos.length)
1999 categoryWithoutCourse.push(category)
2000
2001 totalCursos += cursosEncontrados.total;
2002
2003 cursosEncontrados.cursos.forEach(cEncontrado => {
2004 if (!cursosPorSubtema.filter(c => c.articleId == cEncontrado.articleId).length)
2005 cursosPorSubtema.push(cEncontrado)
2006 })
2007 }
2008
2009 $('.ssp-loader-content').parent().remove();
2010
2011 if (!cursosPorSubtema.length) {
2012 updateMensagemSemCurso()
2013 enableScroll(true)
2014 return
2015 }
2016
2017 var articles = [];
2018
2019 $.each(cursosPorSubtema, function (k, c) {
2020 articles.push(c.articleId);
2021 });
2022
2023 //Verifica a situação dos botoes de inscrições e bolsa
2024 $.ajax({
2025 url: '/o/senac-content-services/verificaBotoesInscricaoEBolsa/' + groupId + '/' + articles.join(','),
2026 type: 'get',
2027 async: false
2028 })
2029 .done(async function (infoBotoes) {
2030
2031 if (infoBotoes.length > 0) {
2032
2033 infoBotoes = JSON.parse(infoBotoes);
2034
2035 for (let index = 0; index < cursosPorSubtema.length; index++) {
2036 const curso = cursosPorSubtema[index];
2037
2038 var itemCurso = buildCardCurso(curso, infoBotoes, isMobile)
2039
2040 itemCurso.addClass('card-curso-nivel-2');
2041
2042 // procura a div criada e adiciona os cursos
2043 templateContainer.find('#curso-sem-slick').append(itemCurso);
2044 }
2045
2046 templateContainer.removeClass('d-none');
2047
2048 var totalCursosExibicao = $('#curso-sem-slick .slick-area__item').length;
2049
2050 // Esconde botao carregar mais, se necessário
2051 $('.section-carregar-mais').remove();
2052
2053 if (totalCursosExibicao < totalCursos && $(".subtema-ativo[data-nvl=3]").length <= 1)
2054 $('#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>');
2055 }
2056
2057 updateMensagemSemCurso();
2058
2059 })
2060
2061 enableScroll(true)
2062 }
2063
2064 function montaTextoTipoCursoParaCard(curso) {
2065
2066 var tipoCursoNomeFinal = curso.tipoCursoNome + " ¿ " + curso.formatos[0].name;
2067
2068 if (curso.tipoCursoNome == "${tipoCursoObj.name}")
2069 tipoCursoNomeFinal = "${tipoCursoObj.name}";
2070
2071 return tipoCursoNomeFinal;
2072 }
2073
2074 //ao final de todos os ajax, se não houver curso na pag por causa dos filtros, exibimos mensagem de nenhum curso
2075 $(document).ajaxStop(function () {
2076 $(".card-curso-nivel-2").each(function () {
2077 if ($(this).children().length == 0)
2078 $(this).remove()
2079 });
2080 });
2081
2082 function hideMensagemSemCurso() {
2083 const $msg = $("#filtroSemCurso");
2084 if (!$msg.hasClass('d-none')) $msg.addClass('d-none');
2085 }
2086 function updateMensagemSemCurso() {
2087
2088 if ($(".slick-area__item").not('.cursos-recentes-card').not('.d-none').length > 0 || $('#curso-sem-slick .slick-area__item').length > 0) {
2089 hideMensagemSemCurso();
2090 return;
2091 }
2092
2093 let htmlSemCurso = ''
2094
2095 switch (getCurrentLevel()) {
2096 case 1:
2097 case 2:
2098 htmlSemCurso = getTextoSemCurso(filtrarBolsaEstudo, filtrarInscricoesAbertas, activeCategory.name)
2099 $(".ssp-bolsa-formulario__card-aviso-texto").html(htmlSemCurso);
2100 break;
2101
2102 case 3:
2103 categoryWithoutCourse
2104 .forEach(category => {
2105 const el = document.querySelector('[data-tema="' + category.categoryId + '"]')
2106 if (el) {
2107 const temaName = el.text
2108 htmlSemCurso += getTextoSemCurso(filtrarBolsaEstudo, filtrarInscricoesAbertas, temaName)
2109 }
2110 })
2111 if (!htmlSemCurso)
2112 htmlSemCurso = getTextoSemCurso(filtrarBolsaEstudo, filtrarInscricoesAbertas, activeCategory.name)
2113
2114 $(".ssp-bolsa-formulario__card-aviso-texto").html(htmlSemCurso);
2115 break;
2116
2117 default:
2118 break;
2119 }
2120
2121 if (htmlSemCurso) {
2122 $("#filtroSemCurso").removeClass("d-none");
2123 }
2124 }
2125
2126 function getTextoSemCurso(filtroBolsa, filtroInsc, temaNome) {
2127
2128 temaNome = typeof temaNome === "undefined" ? '' : 'de ' + temaNome;
2129
2130 if (filtroBolsa && filtroInsc)
2131 return "<p>No momento, estamos sem cursos <strong><span id='nomeTemaSemCurso'>" + temaNome + "</span></strong> disponíveis para compra e com bolsas de estudo.<br>Selecione outras áreas para consultar bolsas ou <a href='https://www.sp.senac.br/bolsas-de-estudo'>confira bolsas disponíveis em diferentes cursos.</a></p>";
2132 else if (filtroBolsa)
2133 return "<p>No momento, estamos sem cursos <strong><span id='nomeTemaSemCurso'>" + temaNome + "</span></strong> com bolsas de estudo.<br>Selecione outras áreas para consultar bolsas ou <a href='https://www.sp.senac.br/bolsas-de-estudo'>confira bolsas disponíveis em diferentes cursos.</a></p>";
2134 else if (filtroInsc)
2135 return "<p>No momento, estamos sem cursos <strong><span id='nomeTemaSemCurso'>" + temaNome + "</span></strong> disponíveis para compra.";
2136
2137 return ''
2138 }
2139
2140 /*
2141 * Monta a lista de temas de curso livre no header da página
2142 */
2143
2144 function carregaTemas() {
2145
2146 let urlTema, urlSubtema;
2147 if(categoryIdModalidade != 0){
2148 urlTema = '/o/senac-category-services/temasPorCategoryIds/'+ groupId
2149 + '?categoryIds=' + categoryIdTipoCurso + ',' + categoryIdModalidade;
2150 urlSubtema = '/o/senac-category-services/subtemasPorCategoryIds/'+ groupId+ '/{categoryIdTema}?categoryIds='+ categoryIdTipoCurso + ','+ categoryIdModalidade;
2151 }else{
2152 urlTema = '/o/senac-content-services/temasPorTipoCurso/'+ groupId + '/' + tipoCursoNome;
2153 urlSubtema = '/o/senac-content-services/subtemasPorTipoCurso/'+ groupId+ '/{categoryIdTema}/'+ tipoCursoNome;
2154 }
2155
2156 $.ajax(
2157 {
2158 url: urlTema,
2159 type: 'get',
2160 async: false
2161 })
2162 .done(
2163 function (temasLista) {
2164
2165 temasLista = JSON.parse(temasLista);
2166
2167 var temasObj = $('#temas');
2168
2169 $.each(temasLista,
2170 function (k, tema) {
2171 const icon = (categorias.filter(cat => cat.categoryId == tema.categoryId)[0] || { properties: {} }).properties.icon
2172 temasObj.append('<div class="ssp-section-tema__container-menu-item mega-menu"><a href="#a" class="tema" data-nvl="1" data-tema="'
2173 + tema.categoryId
2174 + '">'
2175 + '<i class="' + icon + '"></i>'
2176 + tema.name
2177 + '</a></div>');
2178
2179 // Armazena os subtemas deste tema
2180 $.ajax(
2181 {
2182 url: urlSubtema.replace("{categoryIdTema}", tema.categoryId || 'ops'),
2183 type: 'get',
2184 data: {},
2185 async: false
2186 })
2187 .done(
2188 function (subtemas) {
2189 subtemasStorage.set(tema.categoryId, JSON.parse(subtemas));
2190 }
2191 );
2192 });
2193
2194 temas = temasLista;
2195
2196 displayCursosPorTema();
2197
2198 $('.todos').addClass('ativo');
2199
2200 }).fail(function (jqXHR, textStatus, msg) { });
2201 }
2202
2203 /*
2204 * Exibe a lista de subtemas no mouse over do tema
2205 */
2206 function displaySubTemasLista(categoryId) {
2207 $('#filtro-temas-nivel-2').empty();
2208 $('#filtro-temas-nivel-2').removeClass('d-none');
2209
2210 const btnTodos = $('<a href="#a" '
2211 + ' class="subtema btn-nivel-3 subtema-ativo todos" '
2212 + '" data-nvl="2" >'
2213 + 'Todos'
2214 + '</a>')
2215
2216 $('#filtro-temas-nivel-2').append(btnTodos);
2217
2218 if (!subtemasStorage.get(activeCategory.categoryId) || !subtemasStorage.get(activeCategory.categoryId).length)
2219 $('#filtro-temas-nivel-2 .subtema-ativo.todos').hide()
2220
2221 $.each(subtemasStorage.get(activeCategory.categoryId), function (k, t) {
2222 $('#filtro-temas-nivel-2').append('<a href="#a" class="subtema btn-nivel-3" data-tema="'
2223 + t.categoryId
2224 + '" data-nvl="2" >'
2225 + t.name
2226 + '</a>');
2227 });
2228 }
2229
2230 //Carregar mais
2231 $(window).scroll(function () {
2232
2233 var element = document.querySelector('#carregar-mais');
2234
2235 if (element != null && !carregandoMais) {
2236 var position = element.getBoundingClientRect();
2237
2238 // carregar maios
2239 if (position.top >= 0 && position.bottom <= window.innerHeight) {
2240 // enableScroll(false);
2241 var qtCardsSubTema = $('#cursos-por-subtema-container .ssp-card-curso').not('.d-none').length;
2242 if (qtCardsSubTema > 0) {
2243 offsetTodosCursos = qtCardsSubTema;
2244 $('.section-carregar-mais').remove();
2245 } else {
2246 offset = $('.cursos-por-categoria').not('.d-none').length;
2247 }
2248
2249 const urlParamsTemaNv3 = new URLSearchParams(window.location.search);
2250 urlParamTemaNv3 = urlParamsTemaNv3.get('q');
2251
2252 if (!urlParamTemaNv3) displayCursosPorTema();
2253 }
2254 }
2255
2256 });
2257
2258 function enableScroll(enable) {
2259 if (enable === false) document.body.classList.add("stop-scrolling")
2260 else document.body.classList.remove("stop-scrolling");
2261 carregandoMais = !enable;
2262 }
2263
2264 function hideOthersLevel1(elementShow) {
2265 document.querySelectorAll('#temas .ssp-section-tema__container-menu-item a')
2266 .forEach(a => a != elementShow ? a.classList.add('d-none') : undefined)
2267 }
2268
2269 function hideOthersLevel2(elementShow) {
2270 document.querySelectorAll('#filtro-temas-nivel-2 a')
2271 .forEach(a => a != elementShow ? a.classList.add('d-none') : undefined)
2272 }
2273
2274 function hideOthersLevel3(elementShow) {
2275 document.querySelectorAll('#filtro-temas-nivel-3 a')
2276 .forEach(a => a != elementShow ? a.classList.add('d-none') : undefined)
2277 }
2278
2279 function showAllLevel1() {
2280 document.querySelectorAll('#temas .ssp-section-tema__container-menu-item a')
2281 .forEach(btn => {
2282 btn.classList.remove('d-none')
2283 btn.classList.remove('ativo')
2284 btn.classList.remove('tema-ativo')
2285 })
2286 }
2287
2288 function showAllLevel2() {
2289 document.querySelectorAll('#filtro-temas-nivel-2 a')
2290 .forEach(btn => {
2291 btn.classList.remove('d-none')
2292 btn.classList.remove('subtema-ativo')
2293 })
2294 }
2295
2296 function showAllLevel3() {
2297 document.querySelectorAll('#filtro-temas-nivel-3 a')
2298 .forEach(btn => {
2299 btn.classList.remove('d-none')
2300 btn.classList.remove('subtema-ativo')
2301 })
2302 }
2303
2304 function removeFiltersLevel1() {
2305 showAllLevel1()
2306
2307 const btnActived = document.querySelector('#temas .ssp-section-tema__container-menu-item .todos')
2308 btnActived.click()
2309 }
2310
2311 function removeFiltersLevel2() {
2312 const btnActived = document.querySelector('#temas .tema-ativo')
2313 btnActived.click()
2314
2315 new Promise(() => btnActived.click())
2316 }
2317
2318 function removeFiltersLevel3() {
2319 const btnActivedNivel2 = document.querySelector('#filtro-temas-nivel-2 .subtema-ativo:not(.todos)')
2320 const temaNivel2 = btnActivedNivel2.getAttribute('data-tema')
2321
2322 removeFiltersLevel2()
2323
2324 const intervalNível2 = setInterval(() => {
2325 const btn = document.querySelector('[data-tema="' + temaNivel2 + '"]')
2326
2327 if (btn) {
2328 btn.click()
2329 $('.ssp-loader-content').parent().remove();
2330 clearInterval(intervalNível2)
2331 }
2332 }, 200);
2333 }
2334
2335 function clickTema(categoryId) {
2336 return new Promise(resolve => {
2337 const interval = setInterval(() => {
2338 const el = document.querySelector('[data-tema="' + categoryId + '"]')
2339
2340 if (el) {
2341 el.click()
2342 clearInterval(interval)
2343 resolve()
2344 }
2345 }, 200);
2346 })
2347 }
2348
2349 function getSubtemas(categoryFriendlyUrl, parentCategoryId) {
2350 return $.ajax({
2351 url: '/o/senac-unidade-services/categoriaPorFriendlyURL/' + categoryFriendlyUrl + "/" + (parentCategoryId || 0),
2352 type: 'get',
2353 dataType: 'json',
2354 async: false
2355 })
2356 }
2357
2358 function getCategoriesIdNivel3Actived() {
2359 const categories = []
2360
2361 document.querySelectorAll("#filtro-temas-nivel-3 a.subtema-ativo")
2362 .forEach(a => categories.push(parseInt(a.getAttribute('data-tema'))))
2363
2364 return categories
2365 }
2366
2367 function getCurrentLevel() {
2368 let level = 1
2369
2370 if (document.querySelector('#temas .tema-ativo'))
2371 level = 1
2372
2373 if (document.querySelector('#filtro-temas-nivel-2 .subtema-ativo'))
2374 level = 2
2375
2376 if (document.querySelector('#filtro-temas-nivel-3 .subtema-ativo'))
2377 level = 3
2378
2379 return level
2380 }
2381
2382</script>