vendor/uvdesk/support-center-bundle/Resources/views/Knowledgebase/frequent-topics.html.twig line 1

Open in your IDE?
  1. {% extends "@UVDeskSupportCenter/Templates/layout.html.twig" %}
  2. {% block title %}Base de Conocimientos{% endblock %}
  3. {% block body %}
  4. <div class="frequent-topics-container">
  5.     <div class="frequent-topics-wrapper">
  6.         <!-- Search Bar -->
  7.         <div class="topics-search-container">
  8.             <div class="topics-search-wrapper">
  9.                 <span class="topics-search-icon">🔍</span>
  10.                 <input type="text" 
  11.                        id="topics-search-input" 
  12.                        class="topics-search-input" 
  13.                        placeholder="Quiero saber sobre...."
  14.                        autocomplete="off">
  15.             </div>
  16.         </div>
  17.         <!-- Frequent Topics Title -->
  18.         <h2 class="frequent-topics-title">Temas frecuentes</h2>
  19.         <!-- Topics Cards Grid -->
  20.         <div class="topics-cards-grid">
  21.             {% for topic in frequentTopics %}
  22.             <div class="topic-card" data-topic-id="{{ topic.id }}" data-topic-name="{{ topic.name }}">
  23.                 <div class="topic-card-image">
  24.                     {% if topic.image %}
  25.                         <img src="{{ app.request.scheme ~'://' ~ app.request.httpHost ~ asset('') }}{{ topic.image }}" 
  26.                              alt="{{ topic.name }}">
  27.                     {% else %}
  28.                         <div class="topic-card-placeholder">
  29.                             {{ topic.name|slice(0, 2)|upper }}
  30.                         </div>
  31.                     {% endif %}
  32.                 </div>
  33.                 <div class="topic-card-label">{{ topic.name }}</div>
  34.             </div>
  35.             {% endfor %}
  36.         </div>
  37.     </div>
  38. </div>
  39. <style>
  40. .frequent-topics-container {
  41.     width: 100%;
  42.     min-height: calc(100vh - 200px);
  43.     background: #f5f5f5;
  44.     padding: 40px 20px;
  45.     display: flex;
  46.     justify-content: center;
  47.     align-items: flex-start;
  48. }
  49. .frequent-topics-wrapper {
  50.     max-width: 1200px;
  51.     width: 100%;
  52.     display: flex;
  53.     flex-direction: column;
  54.     align-items: center;
  55. }
  56. /* Search Bar Styles */
  57. .topics-search-container {
  58.     width: 100%;
  59.     max-width: 900px;
  60.     margin-bottom: 40px;
  61. }
  62. .topics-search-wrapper {
  63.     position: relative;
  64.     width: 100%;
  65. }
  66. .topics-search-icon {
  67.     position: absolute;
  68.     left: 16px;
  69.     top: 50%;
  70.     transform: translateY(-50%);
  71.     color: #7f8c8d;
  72.     font-size: 18px;
  73.     pointer-events: none;
  74.     z-index: 1;
  75. }
  76. .topics-search-input {
  77.     width: 100%;
  78.     padding: 14px 20px 14px 50px;
  79.     background: #ffffff;
  80.     border: 2px solid #e0e0e0;
  81.     border-radius: 8px;
  82.     font-size: 16px;
  83.     color: #2c3e50;
  84.     box-sizing: border-box;
  85.     transition: border-color 0.2s, box-shadow 0.2s;
  86. }
  87. .topics-search-input:focus {
  88.     outline: none;
  89.     border-color: #3498db;
  90.     box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
  91. }
  92. .topics-search-input::placeholder {
  93.     color: #95a5a6;
  94. }
  95. /* Frequent Topics Title */
  96. .frequent-topics-title {
  97.     font-size: 28px;
  98.     font-weight: 700;
  99.     color: #2c3e50;
  100.     margin: 0 0 30px 0;
  101.     text-align: center;
  102. }
  103. /* Topics Cards Grid */
  104. .topics-cards-grid {
  105.     display: grid;
  106.     grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  107.     gap: 24px;
  108.     width: 100%;
  109.     max-width: 1200px;
  110. }
  111. .topic-card {
  112.     background: #ffffff;
  113.     border-radius: 12px;
  114.     padding: 20px;
  115.     text-align: center;
  116.     cursor: pointer;
  117.     transition: transform 0.2s, box-shadow 0.2s;
  118.     box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  119.     display: flex;
  120.     flex-direction: column;
  121.     align-items: center;
  122.     gap: 12px;
  123. }
  124. .topic-card:hover {
  125.     transform: translateY(-4px);
  126.     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  127. }
  128. .topic-card-image {
  129.     width: 100%;
  130.     height: 140px;
  131.     display: flex;
  132.     align-items: center;
  133.     justify-content: center;
  134.     border-radius: 8px;
  135.     overflow: hidden;
  136.     background: #f8f9fa;
  137. }
  138. .topic-card-image img {
  139.     width: 100%;
  140.     height: 100%;
  141.     object-fit: cover;
  142. }
  143. .topic-card-placeholder {
  144.     width: 100%;
  145.     height: 100%;
  146.     background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  147.     display: flex;
  148.     align-items: center;
  149.     justify-content: center;
  150.     font-size: 32px;
  151.     font-weight: bold;
  152.     color: #ffffff;
  153. }
  154. .topic-card-label {
  155.     font-size: 16px;
  156.     font-weight: 600;
  157.     color: #2c3e50;
  158.     margin-top: 8px;
  159. }
  160. /* Responsive */
  161. @media (max-width: 768px) {
  162.     .topics-cards-grid {
  163.         grid-template-columns: repeat(2, 1fr);
  164.         gap: 16px;
  165.     }
  166.     
  167.     .topic-card-image {
  168.         height: 120px;
  169.     }
  170.     
  171.     .frequent-topics-title {
  172.         font-size: 24px;
  173.     }
  174. }
  175. @media (max-width: 480px) {
  176.     .topics-cards-grid {
  177.         grid-template-columns: 1fr;
  178.     }
  179.     
  180.     .frequent-topics-container {
  181.         padding: 20px 15px;
  182.     }
  183. }
  184. </style>
  185. <script>
  186. (function() {
  187.     'use strict';
  188.     
  189.     // Initialize when DOM is ready
  190.     function initializeTopics() {
  191.         // Handle topic card clicks
  192.         const topicCards = document.querySelectorAll('.topic-card');
  193.         
  194.         topicCards.forEach(function(card) {
  195.             card.addEventListener('click', function(e) {
  196.                 e.preventDefault();
  197.                 
  198.                 const topicId = this.dataset.topicId;
  199.                 const topicName = this.dataset.topicName;
  200.                 
  201.                 // Navigate to knowledgebase view with topic filter
  202.                 const baseUrl = window.location.origin + window.location.pathname;
  203.                 const url = new URL(baseUrl);
  204.                 url.searchParams.set('view', 'categories');
  205.                 if (topicId && topicId !== 'undefined') {
  206.                     url.searchParams.set('topic', topicId);
  207.                 }
  208.                 
  209.                 window.location.href = url.toString();
  210.             });
  211.         });
  212.         
  213.         // Handle search functionality
  214.         const searchInput = document.getElementById('topics-search-input');
  215.         
  216.         if (searchInput) {
  217.             searchInput.addEventListener('keydown', function(e) {
  218.                 if (e.key === 'Enter') {
  219.                     e.preventDefault();
  220.                     const searchTerm = this.value.trim();
  221.                     
  222.                     if (searchTerm) {
  223.                         // Navigate to knowledgebase with search
  224.                         const baseUrl = window.location.origin + window.location.pathname;
  225.                         const url = new URL(baseUrl);
  226.                         url.searchParams.set('view', 'categories');
  227.                         url.searchParams.set('search', searchTerm);
  228.                         window.location.href = url.toString();
  229.                     } else {
  230.                         // If no search term, just go to categories view
  231.                         const baseUrl = window.location.origin + window.location.pathname;
  232.                         const url = new URL(baseUrl);
  233.                         url.searchParams.set('view', 'categories');
  234.                         window.location.href = url.toString();
  235.                     }
  236.                 }
  237.             });
  238.         }
  239.     }
  240.     
  241.     if (document.readyState === 'loading') {
  242.         document.addEventListener('DOMContentLoaded', initializeTopics);
  243.     } else {
  244.         initializeTopics();
  245.     }
  246. })();
  247. </script>
  248. {% endblock %}