templates/home/courses/detail.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% trans_default_domain 'courses' %}
  3. {% if tipo == 'solicitud' %}
  4. {% set nombre = actividad.curso.nombre %}
  5. {% set descripcion = actividad.curso.descripcion %}
  6. {% set modalidad = actividad.modalidad.nombre %}
  7. {% set horas = actividad.horasAulaVirtual|number_format + actividad.horasPresenciales|number_format + actividad.horasTeleformacion|number_format %}
  8. {% set entidad = actividad.expediente.expedientePerteneAEntidad ? actividad.expediente.expedientePerteneAEntidad.entidadColaboradora : null %}
  9. {% set municipios = '' %}
  10. {% set centros = '' %}
  11. {% set web = '' %}
  12. {% set email = '' %}
  13. {% set telefono = '' %}
  14. {% set primerCentro = null %}
  15. {% set fechaInicio = null %}
  16. {% set fechaFinal = null %}
  17. {% set primeraGrupoDeSolicitud = null %}
  18. {% set sesiones = [] %}
  19. {% else %}
  20. {# Es un grupo #}
  21. {% set nombre = actividad.solicitudAccionFormativa.curso.nombre %}
  22. {% set descripcion = actividad.solicitudAccionFormativa.curso.descripcion %}
  23. {% set modalidad = actividad.solicitudAccionFormativa.modalidad.nombre %}
  24. {% set horas = actividad.horasAulaVirtual|number_format + actividad.horasPresenciales|number_format + actividad.horasTeleformacion|number_format %}
  25. {% set entidad = actividad.solicitudAccionFormativa.expediente.expedientePerteneAEntidad.entidadColaboradora %}
  26. {% set municipios = actividad.centroFormacionAcogeGrupos|map(cfag => cfag.centroFormacion.municipio)|join(', ') %}
  27. {% set centros = actividad.centroFormacionAcogeGrupos|map(cfag => cfag.centroFormacion.getNombre)|join(', ') %}
  28. {% set web = actividad.centroFormacionAcogeGrupos|map(cfag => cfag.centroFormacion.getWeb)|join(', ') %}
  29. {% set email = actividad.centroFormacionAcogeGrupos|map(cfag => cfag.centroFormacion.getEmail)|join(', ') %}
  30. {% set telefono = actividad.centroFormacionAcogeGrupos|map(cfag => cfag.centroFormacion.getTelefono1)|join(', ') %}
  31. {% set primerCentro = actividad.centroFormacionAcogeGrupos|first %}
  32. {% set fechaInicio = actividad.fechaInicio %}
  33. {% set fechaFinal = actividad.fechaFinal %}
  34. {% set primeraGrupoDeSolicitud = actividad %}
  35. {% set sesiones = actividad.grupoSesiones %}
  36. {% endif %}
  37. {% set latitud = primerCentro is not empty ? primerCentro.centroFormacion.getLatitud : null %}
  38. {% set longitud = primerCentro is not empty ? primerCentro.centroFormacion.getLongitud : null %}
  39. {% block stylesheets %}
  40. {{ parent() }}
  41. <!-- FullCalendar CSS -->
  42. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.css">
  43. <link rel="stylesheet" href="{{ asset('css/funcional/fullcalendar.css') }}">
  44. {% endblock %}
  45. {% block javascripts %}
  46. {{ parent() }}
  47. <!-- FullCalendar JS -->
  48. <script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.js"></script>
  49. <script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/locales/es.min.js"></script>
  50. <!-- Font Awesome para iconos -->
  51. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
  52. <script>
  53. // Añadir clase logged-in al body si el usuario está logueado
  54. document.addEventListener('DOMContentLoaded', function () {
  55. {% if app.user %}
  56. document.body.classList.add('logged-in');
  57. {% endif %}
  58. });
  59. </script>
  60. {% endblock %}
  61. {% block title %}
  62. {{ nombre[app.request.locale] | default(nombre | first) }}
  63. {% endblock %}
  64. {% block header_title %}
  65. {{ parent() }} {{ 'header.title.course'|trans({}, 'courses') }}
  66. {% endblock %}
  67. {% block header_miga_pan %}
  68. {% set referer = app.request.headers.get('referer') %}
  69. {{ parent() }} /
  70. {% if app.request.headers.get('referer') ends with '/favoritos' %}
  71. <a href="{{ app.request.headers.get('referer') }}">{{ 'breadcrumbs.favorites'|trans }}</a>
  72. {% elseif app.request.headers.get('referer') ends with '/courses/my' %}
  73. <a href="{{ app.request.headers.get('referer') }}">{{ 'breadcrumbs.my_courses'|trans }}</a>
  74. {% elseif app.request.headers.get('referer') matches '#/participante/centers/#' %}
  75. <a href="{{ app.request.headers.get('referer') }}">{{ 'breadcrumbs.centers'|trans }}</a>
  76. {% else %}
  77. <a href="{{ path('course_list') }}">{{ 'breadcrumbs.courses'|trans }}</a>
  78. {% endif %}
  79. / {{ nombre[app.request.locale] | default(nombre | first) }}
  80. {% endblock %}
  81. {% block content %}
  82. <section id="sidebar">
  83. <div id="calendar-wrapper">
  84. {% set eventosCalendario = [] %}
  85. {% if sesiones is not empty %}
  86. {% set eventosCalendario = sesiones
  87. |map(gs => {
  88. 'title': '',
  89. 'start': gs.dataHoraInici ? gs.dataHoraInici|date('Y-m-d') : null,
  90. 'end': gs.dataHoraFinal ? gs.dataHoraFinal|date('Y-m-d') : null
  91. })
  92. |filter(e => e.start is not null) %}
  93. {% endif %}
  94. {% include 'funcionality/fullcalendar.html.twig' with { positionOnFirstEvent: true, events: eventosCalendario|json_encode , name: 'full_calendar' } %}
  95. </div>
  96. <div class="resume">
  97. <table>
  98. <tr class="estat">
  99. <td>CI</td>
  100. <td>{{ 'label.course_status'|trans({}, 'courses') }}
  101. <br><strong>
  102. {% if actividad.estado is defined %}
  103. {% if actividad.estado == 'interes' %}
  104. {{ actividad.estadoLabel }}
  105. {% elseif actividad.estado == 'en_curso' %}
  106. {{ actividad.estadoLabel }}
  107. {% elseif actividad.estado == 'finalizado' %}
  108. {{ actividad.estadoLabel }}
  109. {% else %}
  110. {{ actividad.estadoLabel }}
  111. {% endif %}
  112. {% else %}
  113. {{ '' }}
  114. {% endif %}
  115. </strong></td>
  116. </tr>
  117. <tr class="modalitat">
  118. <td>M</td>
  119. <td>{{ 'label.modality'|trans({}, 'courses') }}
  120. <br><strong> {{ modalidad[app.request.locale] | default(modalidad | first) }}</strong></td>
  121. </tr>
  122. <tr class="horas">
  123. <td>H</td>
  124. <td>{{ 'label.training_hours'|trans({}, 'courses') }}<br><strong> {{ horas }}</strong></td>
  125. </tr>
  126. <tr class="data">
  127. <td>D</td>
  128. <td>{{ 'label.start_end_date'|trans({}, 'courses') }}<br>
  129. {% if tipo == 'grupo' %}
  130. <strong> {{ fechaInicio is not empty ? fechaInicio|date('d/m/Y') : '--' }}
  131. - {{ fechaFinal is not empty ? fechaFinal|date('d/m/Y') : '--' }}
  132. </strong>
  133. {% else %}
  134. <strong>{{ 'course.fecha_pendiente'|trans({}, 'courses')|default('Fecha pendiente de asignación') }}</strong>
  135. {% endif %}
  136. </td>
  137. </tr>
  138. {% set esFavorito = app.user and app.user.entidadColaboradorasFavorito.contains(entidad) %}
  139. <tr class="entitat{% if esFavorito %} favorite{% endif %}">
  140. <td class="favorite-toggle" data-type="entidad" data-id="{{ entidad.id }}" title="{{ esFavorito ? 'Quitar de favoritos' : 'Añadir a favoritos' }}">{{ esFavorito ? '*' : '' }}</td>
  141. <td {% if app.user %}class="app-user"{% endif %}>
  142. <div>
  143. <span class="titulo-entidad">{{ 'label.training_entity'|trans({}, 'courses') }}</span><br>
  144. <span class="texto-entidad"> {{ entidad|capitalize }}</span>
  145. </div>
  146. {% if app.user %}
  147. <div class="app-user-icon">
  148. <a href="{{ path('course_chat_entidad', {'id': entidad.id}) }}" title="Chatear con {{ entidad }}">
  149. <i class="fas fa-comments"></i>
  150. </a>
  151. </div>
  152. {% endif %}
  153. </td>
  154. </tr>
  155. {% set esFavorito = app.user and actividad.formador and app.user.formadoresFavorito.contains(actividad.formador) %}
  156. <tr class="professional{% if esFavorito %} favorite{% endif %}">
  157. <td class="favorite-toggle" data-type="formador" data-id="{{ actividad.formador ? actividad.formador.id : 0 }}" title="{{ esFavorito ? 'Quitar de favoritos' : 'Añadir a favoritos' }}">{{ esFavorito ? '*' : ''}}</td>
  158. <td>
  159. {% set formadorNombre = actividad.formador.nombre ?? actividad.formador %}
  160. {% set formadorId = actividad.formador.id ?? null %}
  161. <div{% if app.user and actividad.formador %} class="app-user"{% endif %}>
  162. <span class="titulo-professional">{{ 'label.training_professional'|trans({}, 'courses') }}</span><br>
  163. <span class="texto-professional">{{ formadorNombre ?? '--Pendiente--' }}</span>
  164. </div>
  165. {% if app.user and formadorId %}
  166. <div class="app-user-icon">
  167. <a href="{{ path('course_chat_formador', {'id': formadorId}) }}" title="Chatear con {{ formadorNombre }}">
  168. <i class="fas fa-comments"></i>
  169. </a>
  170. </div>
  171. {% endif %}
  172. </td>
  173. </tr>
  174. {% if tipo == 'grupo' %}
  175. <tr class="poblacio">
  176. <td>P</td>
  177. <td>{{ 'label.location'|trans({}, 'courses') }}<br><strong> {{ municipios }}</strong></td>
  178. </tr>
  179. <tr class="centro">
  180. <td>C</td>
  181. <td>{{ 'label.training_center'|trans({}, 'courses') }}<br><strong> {{ centros }}</strong></td>
  182. </tr>
  183. <tr class="web">
  184. <td>W</td>
  185. <td>{{ web }}</td>
  186. </tr>
  187. <tr class="email">
  188. <td>E</td>
  189. <td>{{ email }}</td>
  190. </tr>
  191. <tr class="telefono">
  192. <td>T</td>
  193. <td>{{ telefono }}</td>
  194. </tr>
  195. {% endif %}
  196. </table>
  197. </div>
  198. {% if tipo == 'grupo' and latitud and longitud %}
  199. <div id="mapa">
  200. {% set formattedMarkers = [] %}
  201. {% set formattedMarker = {
  202. 'title': '--no api attrib--',
  203. 'lon': longitud,
  204. 'lat': latitud,
  205. 'content': ''
  206. } %}
  207. {% set formattedMarkers = formattedMarkers|merge([formattedMarker]) %}
  208. {% include 'funcionality/google-maps.html.twig' with { markers: formattedMarkers, name: 'Map', readonly: true} %}
  209. </div>
  210. {% endif %}
  211. </section>
  212. {% include '_partials/courses/_detail.html.twig' with {
  213. nombre: nombre,
  214. descripcion: descripcion,
  215. primeraGrupoDeSolicitud: primeraGrupoDeSolicitud
  216. } %}
  217. {# Modal para solicitudes de usuarios no registrados #}
  218. {% include '_partials/courses/_modal_solicitud.html.twig' %}
  219. {# Js gestion favoritos entidad y formador #}
  220. {% include '_partials/courses/favorites.js.twig' %}
  221. {% include '_partials/courses/_js_modal_actions_empresa.html.twig' %}
  222. {% endblock %}