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

Open in your IDE?
  1. {% extends "@UVDeskSupportCenter/Templates/layout.html.twig" %}
  2. {# WebkulUVDeskSupportCenterBundle/Resources/views/Front/ticketList.html.twig #}
  3. {% block title %}{% trans %}Tickets{% endtrans %}{% endblock %}
  4. {% block ogtitle %}{% trans %}Tickets{% endtrans %}{% endblock %}
  5. {% block twtitle %}{% trans %}Tickets{% endtrans %}{% endblock %}
  6. {% block metaDescription %}{% trans %}ticketlist.metaDescription{% endtrans %}{% endblock %}
  7. {% block metaKeywords %}{% trans %}ticketlist.metaKeywords{% endtrans %}{% endblock %}
  8. {% block tabHeader %}
  9.     <div class="uv-nav-bar uv-nav-tab">
  10.         <div class="uv-container">
  11.             <div class="uv-nav-bar-lt">
  12.                 <ul class="uv-nav-tab-label">
  13.                     <li><a class="uv-nav-tab-active" href="{{ path('helpdesk_customer_ticket_collection') }}">{{ 'Ticket Requests'|trans }}</a></li>
  14.                     {% if websiteConfiguration.ticketCreateOption is defined and websiteConfiguration.ticketCreateOption %}
  15.                         <li><a href="{{ path('helpdesk_customer_create_ticket') }}">{{ 'New Ticket Request'|trans }}</a></li>
  16.                         <li>  <a href="{{path('helpdesk_knowledgebase_folder')}}">{{"Home"|trans}}</a></li>
  17.                     {% endif %}
  18.                 </ul>
  19.             </div>
  20.             <div class="uv-nav-bar-rt">
  21.                 <form method="get" action="{{path('helpdesk_customer_front_article_search')}}">
  22.                     <input name="s" class="uv-nav-search" type="text" placeholder="{{ 'Search'|trans }}">
  23.                 </form>
  24.             </div>
  25.         </div>
  26.     </div>
  27. {% endblock %}
  28. {% block body %}
  29.     <style>
  30.         .uv-container{
  31.             width: 1500px !important
  32.         } 
  33.          /* Estilo para opciones desactivadas */
  34.         .uv-report-brick.disabled {
  35.             opacity: 0.2; /* Reduce la opacidad para mostrar que está desactivado */
  36.             pointer-events: none; /* Desactiva los clics en las opciones */
  37.         }
  38.         #comment {
  39.         width: 100%; /* Establece el ancho del textarea al 100% del contenedor padre */
  40.         height: 100px; /* Establece la altura del textarea en píxeles o cualquier otra unidad deseada */
  41.         padding: 10px; /* Agrega relleno (padding) para espacio adicional dentro del textarea */
  42.         border: 1px solid #ccc; /* Agrega un borde alrededor del textarea */
  43.         border-radius: 5px; /* Agrega bordes redondeados al textarea */
  44.         resize: none; /* Evita que el usuario pueda cambiar el tamaño del textarea */
  45.         font-size: 16px; /* Establece el tamaño de fuente del texto en el textarea */
  46.         line-height: 1.5; /* Establece la altura de línea del texto para mejorar la legibilidad */
  47.         /* Puedes agregar más estilos aquí, como colores de fondo, colores de texto, etc. */
  48.         }
  49.         .uv-icon-kudos {
  50.             background-image: url("{{ asset('bundles/uvdeskcoreframework/images/uvdesk-kudo-sprite.svg') }}");
  51.             display: inline-block;
  52.             width: 40px;
  53.             height: 40px;
  54.         }
  55.         .uv-icon-kudos.kudos-1 {
  56.             background-position: 0px 40px;
  57.         }
  58.         .uv-icon-kudos.kudos-2 {
  59.             background-position: -40px 40px;
  60.         }
  61.         .uv-icon-kudos.kudos-3 {
  62.             background-position: -80px 40px;
  63.         }
  64.         .uv-icon-kudos.kudos-4 {
  65.             background-position: -120px 40px;
  66.         }
  67.         .uv-icon-kudos.kudos-5 {
  68.             background-position: -160px 40px;
  69.         }
  70.         .kudos-text-1 {
  71.             color: #FC6E46;
  72.         }
  73.         .kudos-text-2 {
  74.             color: #FC6E46;
  75.         }
  76.         .kudos-text-3 {
  77.             color: #FCDA32;
  78.         }
  79.         .kudos-text-4 {
  80.             color: #01D101;
  81.         }
  82.         .kudos-text-5 {
  83.             color: #01D101;
  84.         }
  85.         .uv-table td a {
  86.             color: #333;
  87.         }
  88.         .tooltip {
  89.             position: relative;
  90.         }
  91.         .tooltip .tooltip-text {
  92.             visibility: hidden;
  93.             background-color: #fff;
  94.             color: #000;
  95.             text-align: center;
  96.             border: 1px solid #000;
  97.             border-radius: 4px;
  98.             padding: 5px;
  99.             position: absolute;
  100.             z-index: 1;
  101.             bottom: 100%;
  102.             left: 50%;
  103.             transform: translateX(-50%);
  104.             opacity: 0;
  105.             transition: opacity 0.3s;
  106.             font-size: 14px;
  107.             max-width: 100%; /* Limita el ancho máximo del tooltip al 100% */
  108.             box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  109.             white-space: nowrap;
  110.             overflow: hidden;
  111.             text-overflow: ellipsis; /* Agrega puntos suspensivos si el contenido desborda */
  112.         }
  113.         .tooltip:before {
  114.             content: "";
  115.             top: 100%;
  116.             left: 50%;
  117.             transform: translateX(-50%);
  118.             border-width: 6px;
  119.             border-color: transparent transparent #fff transparent;
  120.         }
  121.         .tooltip:hover .tooltip-text {
  122.             visibility: visible;
  123.             opacity: 1;
  124.         }
  125.     </style>
  126.     
  127.     <div class="uv-nav-tab-view">
  128.         <h1>{{ 'Ticket Requests'|trans }}</h1>
  129.         <div class="uv-action-view">
  130.             <div class="uv-action-view-lt">
  131.                 <!--Sort by-->
  132.                 <div class="uv-dropdown sort">
  133.                     <div class="uv-dropdown-btn uv-vertical-align uv-margin-right-5">
  134.                         {{ 'Sort By:'|trans }} {{ 'Ticket Id'|trans }}
  135.                     </div>
  136.                     <div class="uv-dropdown-list uv-bottom-left">
  137.                         <div class="uv-dropdown-container">
  138.                             <label>{{ 'Sort By'|trans }}</label>
  139.                             <ul>
  140.                             </ul>
  141.                         </div>
  142.                     </div>
  143.                 </div>
  144.                 <!--Sort by-->
  145.                 <!--Filter By Status-->
  146.                 <div class="uv-dropdown filter-by-status">
  147.                     <div class="uv-dropdown-btn">
  148.                         {{ 'Status:'|trans }} {{ 'All'|trans }}
  149.                     </div>
  150.                     <div class="uv-dropdown-list uv-bottom-left">
  151.                         <div class="uv-dropdown-container">
  152.                             <label>{{ 'Status'|trans }}</label>
  153.                             <ul>
  154.                                 <li class="uv-drop-list-active"><a href="#" data-id="">{{ 'All'|trans }}</a></li>
  155.                                 {% for status in ticket_service.getStatus() %}
  156.                                     
  157.                                         <li><a href="#" data-id="{{status.id}}">{{ status.description|trans }}</a></li>
  158.                                     
  159.                                 {% endfor %}
  160.                             </ul>
  161.                         </div>
  162.                     </div>
  163.                 </div>
  164.                 <!--//Filter By Status-->
  165.             </div>
  166.             <div class="uv-action-view-rt">
  167.                 <input type="text" class="uv-search-inline uv-search-inline-full" placeholder="{{ 'Search Tickets'|trans }}">
  168.             </div>
  169.         </div>
  170.     </div>
  171.     <!--//Action Bar-->
  172.     <div class="uv-table uv-list-view">
  173.         <table>
  174.             <thead>
  175.                 <tr>
  176.                     <th>{{ "Ticket Id"|trans }}</th>
  177.                     <th>{{ "Priority"|trans }}</th>
  178.                     <th>{{ "Reference"|trans }}</th>
  179.                     <th>{{ "Subject"|trans }}</th>
  180.                     <th>{{ "Status"|trans }}</th>
  181.                     <th>{{ "Timestamp"|trans }}</th>
  182.                     <th>{{ "Agent"|trans }}</th>
  183.                     <th class="uv-last">{{ "Kudos"|trans }} </th>
  184.                 </tr>
  185.             </thead>
  186.             <tbody>
  187.             </tbody>
  188.         </table>
  189.         <div class="navigation"></div>
  190.     </div>
  191.     
  192. {% endblock %}
  193. {% block footer %}
  194.     {{ parent() }}
  195.     <!-- Sorting Template -->
  196.     <script id="ticket_list_sorting_tmp" type="text/template">
  197.         <li class="<% if(sort == 't.id') { %>uv-drop-list-active<% } %>">
  198.             <a href="#<% if(queryString != '') { %><%- queryString %>/<% } %><% if(page) { %>page/<%- page %><% } else { %>page/1<% } %>/sort/t.id/<% if(sort == 't.id') { %><% if(direction) { %>direction/<%- direction %><% } else { %>direction/desc<% } %><% } else { %>direction/asc<% } %>" data-field="t.id">
  199.                 {{ 'Ticket Id'|trans }}
  200.             </a>
  201.             <% if(sort == 't.id') { %>
  202.                 <span class="uv-sorting <% if(direction == 'asc') { %> descend <% } else { %> ascend <% } %>"></span>
  203.             <% } %>
  204.         </li>
  205.         <li class="<% if(sort == 'name') { %>uv-drop-list-active<% } %>">
  206.             <a href="#<% if(queryString != '') { %><%- queryString %>/<% } %><% if(page) { %>page/<%- page %><% } else { %>page/1<% } %>/sort/name/<% if(sort == 'name') { %><% if(direction) { %>direction/<%- direction %><% } else { %>direction/desc<% } %><% } else { %>direction/asc<% } %>" data-field="name">
  207.                 {{ 'Agent Name'|trans }}
  208.             </a>
  209.             <% if(sort == 'name') { %>
  210.                 <span class="uv-sorting <% if(direction == 'asc') { %> descend <% } else { %> ascend <% } %>"></span>
  211.             <% } %>
  212.         </li>
  213.     </script>
  214.     <!-- //Sorting Template -->
  215.     <script id="ticket_list_item_tmp" type="text/template">
  216.         <td data-value="{{ 'Ticket Id'|trans }}">
  217.            <a class="not-shiny" href="<%- path %>">
  218.                 #<%- id %>
  219.             </a>
  220.         </td>
  221.         <td style="<% if(priority.colorCode) { %>background-color:<%= priority.colorCode %><% } %>"  data-value="{{ 'Priority'|trans }}">
  222.                <a class="not-shiny" href="<%- path %>">
  223.                    <%- priority.description %>
  224.             </a>
  225.         </td>
  226.         <td data-value="{{ 'Reference'|trans }}" class="tooltip">
  227.             <a class="not-shiny" href="<%- path %>">
  228.                 <%- reference %>
  229.             </a>
  230.             <span class="tooltip-text">
  231.                 <%- lastThread.threadMessage && lastThread.threadMessage.length <= 100 ? lastThread.threadMessage : lastThread.threadMessage.substr(0, 100) + '...' %>
  232.             </span>
  233.         </td>
  234.         <td data-value="{{ 'Subject'|trans }}" class="tooltip">
  235.             <a class="not-shiny" href="<%- path %>">
  236.                 <%- subject %>
  237.             </a>
  238.             <span class="tooltip-text">
  239.                 <%- lastThread.threadMessage && lastThread.threadMessage.length <= 100 ? lastThread.threadMessage : lastThread.threadMessage.substr(0, 100) + '...' %>
  240.             </span>
  241.         </td>
  242.         <td style="<% if(status.colorCode) { %>background-color:<%= status.colorCode %><% } %>" data-value="{{ 'Status'|trans }}">
  243.                <a class="not-shiny" href="<%- path %>">
  244.                    <%- status.code %>
  245.             </a>
  246.         </td>
  247.         <td data-value="{{ 'Timestamp'|trans }}">
  248.                <a class="not-shiny" href="<%- path %>">
  249.                    <%= formatedCreatedAt %>
  250.             </a>
  251.         </td>
  252.         <td data-value="{{ 'Agent'|trans }}">
  253.             <a class="not-shiny" href="<%- path %>">
  254.                 <%  if(agent) { %>
  255.                     <% if(agent.smallThumbnail != null) { %>
  256.                         <img class="uv-table-agent" src="{{ app.request.scheme ~'://' ~ app.request.httpHost ~ asset('') }}<%- agent.smallThumbnail %>" alt=""/>
  257.                     <% } else { %>
  258.                         <img class="uv-table-agent" src="{{ asset(default_agent_image_path) }}" alt=""/>
  259.                     <% } %>
  260.                     <%- agent.firstName + ' ' + (agent.lastName == null ? '' : agent.lastName) %>
  261.                 <% } else { %>
  262.                     {{ 'Unassigned'|trans }}
  263.                 <% } %>
  264.             </a>
  265.         </td>
  266.         <td>
  267.             <div class="uv-report-brick-wrapper" <% if (status.id === 5 || status.id === 9) { %>style="display: block;"<% } else { %>style="visibility: hidden;"<% } %>>
  268.                 <!-- Primer elemento -->
  269.                 <span class="uv-report-brick <% if (vote !== null) { %>selected<% } %> <% if (vote !== null && vote !== 2) { %>disabled<% } %>" data-ticket-id="<%- id %>" data-vote="2" data-voted="<%- vote === 2 %>" title="{{ 'Sad'|trans }}" onclick="mostrarValor(this)">
  270.                     <span class="uv-icon-kudos kudos-2"></span>
  271.                 </span>
  272.                 <!-- Segundo elemento -->
  273.                 <span class="uv-report-brick <% if (vote !== null) { %>selected<% } %> <% if (vote !== null && vote !== 3) { %>disabled<% } %>" data-ticket-id="<%- id %>" data-vote="3" data-voted="<%- vote === 3 %>" title="{{ 'Neutral'|trans }}" onclick="mostrarValor(this)">
  274.                     <span class="uv-icon-kudos kudos-3"></span>
  275.                 </span>
  276.                 <!-- Tercer elemento -->
  277.                 <span class="uv-report-brick <% if (vote !== null) { %>selected<% } %> <% if (vote !== null && vote !== 4) { %>disabled<% } %>" data-ticket-id="<%- id %>" data-vote="4" data-voted="<%- vote === 4 %>" title="{{ 'Happy'|trans }}" onclick="mostrarValor(this)">
  278.                     <span class="uv-icon-kudos kudos-4"></span>
  279.                 </span>
  280.             </div>
  281.         </td>
  282.     </script>
  283.     <div class="uv-pop-up-overlay" id="confirm-modal" style="display: none;">
  284.         <div class="uv-pop-up-box uv-pop-up-slim">
  285.             <span class="uv-pop-up-close"></span>
  286.             <h2>{{ 'Confirm Action'|trans }}</h2>
  287.             <p>{{ 'Are you sure? You want to perform this action.'|trans }}</p>
  288.             
  289.             <!-- Agrega el campo de comentario -->
  290.             <textarea id="comment" placeholder="Add a comment"></textarea>
  291.             
  292.             <div class="uv-pop-up-actions">
  293.                 <a href="#" class="uv-btn uv-btn-error confirm">{{ 'Confirm'|trans }}</a>
  294.                 <a href="#" class="uv-btn cancel">{{ 'Cancel'|trans }}</a>
  295.             </div>
  296.         </div>
  297.     </div>
  298.     
  299.     <script type="text/javascript">
  300.         
  301.         function mostrarValor(element) {
  302.             // Obtener el valor del voto desde el atributo "data-vote"
  303.             var voteValue = element.getAttribute("data-vote");
  304.             
  305.             // Obtener el ID del ticket desde el atributo "data-ticket-id"
  306.             var ticketId = element.getAttribute("data-ticket-id");
  307.             // Obtener el primer número antes del guión "-"
  308.             var ticketIdParts = ticketId.split("-");
  309.             var firstNumber = ticketIdParts[0];
  310.             // Verificar si la carita ya tiene un valor asignado (clase "selected")
  311.             if (!element.classList.contains("selected")) {
  312.                 // Mostrar el mensaje de confirmación
  313.                 var confirmModal = document.getElementById("confirm-modal");
  314.                 confirmModal.style.display = "block";
  315.                 // Asignar acciones a los botones del mensaje de confirmación
  316.                 var confirmButton = confirmModal.querySelector(".confirm");
  317.                 var cancelButton = confirmModal.querySelector(".cancel");
  318.                 // Construir la URL utilizando plantillas literales
  319.                 var url = "{{ path('helpdesk_customer_create_vote', {'id': 'ReplaceMeWithFirstNumber', 'vote': 'ReplaceMeWithVote', 'comment': 'ReplaceMeWithComment'}) }}";
  320.                 url = url.replace("ReplaceMeWithFirstNumber", firstNumber);
  321.                 url = url.replace("ReplaceMeWithVote", voteValue);
  322.     
  323.                  confirmButton.onclick = function () {
  324.                            let comment = document.getElementById("comment").value;
  325.                         console.log('comment', comment);
  326.                         if (comment === '') {
  327.                             comment = 'NoCommentProvided'; // O proporciona un valor predeterminado adecuado
  328.                         }
  329.                         url = url.replace("ReplaceMeWithComment", comment);
  330.                             console.log('url',url);
  331.                         // Realizar la solicitud AJAX
  332.                         $.ajax({
  333.                             url: url,
  334.                             type: 'POST',
  335.                             dataType: 'json',
  336.                             success: function (response) {
  337.                                     // Desactivar todas las caritas en el mismo ticket
  338.                                     var caritasEnMismoTicket = document.querySelectorAll(`.uv-report-brick[data-ticket-id="${ticketId}"]`);
  339.                                     caritasEnMismoTicket.forEach(function(carita) {
  340.                                         carita.classList.remove("selected");
  341.                                         carita.classList.add("disabled");
  342.                                     });
  343.                                     // Activar la carita clickeada
  344.                                     element.classList.remove("disabled");
  345.                                     element.classList.add("selected");
  346.                                     
  347.                                     // Ocultar el mensaje de confirmación
  348.                                     confirmModal.style.display = "none";
  349.                                     app.appView.renderResponseAlert(response)
  350.                                     
  351.                             },
  352.                             error: function (xhr) {
  353.                                 // Manejar errores si es necesario
  354.                                 console.error("Error en la solicitud AJAX: " + xhr.statusText);
  355.                                 // Ocultar el mensaje de confirmación
  356.                                 confirmModal.style.display = "none";
  357.                                 app.appView.renderResponseAlert(response)
  358.                             }
  359.                         });
  360.                 }
  361.                 // Acción al hacer clic en "Cancelar"
  362.                 cancelButton.onclick = function () {
  363.                     // Ocultar el mensaje de confirmación
  364.                     confirmModal.style.display = "none";
  365.                 };
  366.             }
  367.         }
  368.         $(function() {
  369.     
  370.             var ticketPath = "{{ path('helpdesk_customer_ticket', {'id': 'replaceId' }) }}";
  371.             var TicketModel = Backbone.Model.extend({
  372.                 idAttribute : "id",
  373.                 defaults : {
  374.                     path : "",
  375.                 }
  376.             });
  377.             var TicketCollection = AppCollection.extend({
  378.                 model : TicketModel,
  379.                 url : "{{ path('helpdesk_customer_ticket_collection_xhr') }}",
  380.                 filterParameters : {
  381.                     "status" : "",
  382.                     "search" : "",
  383.                 },
  384.                 parseRecords: function (resp, options) {
  385.                     return resp.tickets;
  386.                 },
  387.                 syncData : function() {
  388.                     app.appView.showLoader();
  389.                     this.fetch({
  390.                         data : this.getValidParameters(),
  391.                         reset: true,
  392.                         success: function(model, response) {
  393.                             app.appView.hideLoader();
  394.                             var ticketListView = new TicketList();
  395.                             app.pager.paginationData = response.pagination;
  396.                             app.pager.url = response.pagination.url;
  397.                             if(ticketCollection.length == 0 && app.pager.paginationData.current != "0")
  398.                                 router.navigate(url.replace('replacePage', app.pager.paginationData.last),{trigger: true});
  399.                             else {
  400.                                 app.pager.render();
  401.                                 $(".uv-pagination a").on("mouseover", function() {
  402.                                     $(this).attr('style', 'color: white !important')
  403.                                 }).on("mouseout", function() {
  404.                                     $(this).removeAttr("style");
  405.                                 });
  406.                             }
  407.                         },
  408.                         error: function (model, xhr, options) {
  409.                             if(url = xhr.getResponseHeader('Location'))
  410.                                 window.location = url;
  411.                         }
  412.                     });
  413.                 }
  414.             });
  415.             var TicketItem = Backbone.View.extend({
  416.                 tagName : "tr",
  417.                 template : _.template($("#ticket_list_item_tmp").html()),
  418.                 render : function () {
  419.                         this.model.set({path:ticketPath.replace('replaceId', this.model.attributes.id + '-' + this.model.attributes.numeracion)})
  420.                                         if(this.model.attributes.numeracion){
  421.                                          this.model.set('id', this.model.attributes.id + '-' + this.model.attributes.numeracion)
  422.                                         }
  423.                     this.$el.html(this.template(this.model.toJSON()));
  424.                     var text= this.$el.html()
  425.                     if(this.model.attributes.isCustomerView != true){
  426.                         this.$el.html(text);
  427.                         this.$el.addClass('unread')
  428.                     }
  429.                     
  430.                     if(this.model.attributes.status.id==8 || this.model.attributes.status.id==7){
  431.                         var result4= text.split('class="not-shiny"').join('class="not-shiny" style="color: aliceblue;"')
  432.                         this.$el.html(result4);
  433.                         this.el.bgColor="#a70000"
  434.                     }
  435.                     //console.log(this)    
  436.                     return this;
  437.                 }
  438.             });
  439.             var TicketList = Backbone.View.extend({
  440.                 el : $(".uv-list-view table tbody"),
  441.                 initialize : function() {
  442.                     this.render();
  443.                 },
  444.                 render : function () {
  445.                     this.$el.html('');
  446.                     if(ticketCollection.length) {
  447.                         _.each(ticketCollection.models, function (item) {
  448.                             
  449.                             this.renderTicket(item);
  450.                         }, this);
  451.                     } else {
  452.                         this.$el.append("<tr style='text-align: center;float: none;'><td colspan='5'>{% trans %}No Record Found{% endtrans %}</td></tr>")
  453.                     }
  454.                 },
  455.                 renderTicket : function (item) {
  456.                     var ticketItem = new TicketItem({
  457.                         model: item
  458.                     });
  459.                     this.$el.append(ticketItem.render().el);
  460.                         
  461.                 }
  462.             });
  463.             var Filter = app.Filter.extend({
  464.                 defaultSortIndex: 't.id',
  465.                 sortText: "{% trans %}Sort By:{% endtrans %} ",
  466.                 defaultSortText: "{% trans %}Sort By:{% endtrans %} {% trans %}Ticket Id{% endtrans %}",
  467.                 template : _.template($("#ticket_list_sorting_tmp").html()),
  468.                 filterByStatus : function(e) {
  469.                     e.preventDefault()
  470.                     this.collection.reset();
  471.                     this.collection.state.currentPage = null;
  472.                     this.collection.setSorting(null, null, {full: false});
  473.                     this.collection.filterParameters.status = Backbone.$(e.currentTarget).find('a').attr('data-id');
  474.                     var queryString = app.appView.buildQuery($.param(this.collection.getValidParameters()));
  475.                     router.navigate(queryString, {trigger: true});
  476.                 },
  477.             })
  478.             var ticketCollection = new TicketCollection();
  479.             var filter = new Filter({
  480.                 el: $('.uv-action-view'),
  481.                 collection : ticketCollection
  482.             });
  483.             Router = Backbone.Router.extend({
  484.                 routes: {
  485.                     'page/:number(/sort/:sortField)(/direction/:order)' : 'paginate',
  486.                     'search/:query(/page/:number)(/sort/:sortField)(/direction/:order)' : 'filterByQuery',
  487.                     'status/:status(/search/:query)(/page/:number)(/sort/:sortField)(/direction/:order)' : 'filterByStatus',
  488.                     '' : 'initializeList',
  489.                     '_=_' : 'initializeList',
  490.                 },
  491.                 initializeList : function() {
  492.                     this.resetParams('','');
  493.                     this.fetch(null, null, null);
  494.                 },
  495.                 paginate : function(number, sortField, order) {
  496.                     this.resetParams('', '');
  497.                     this.fetch(number, sortField, order);
  498.                 },
  499.                 filterByQuery : function(query, number, sortField, order) {
  500.                     if(query != null)
  501.                         query = query.replace(/\+/g,' ');
  502.                     this.resetParams(query, '');
  503.                     this.fetch(number, sortField, order);
  504.                 },
  505.                 filterByStatus : function(status, query, number, sortField, order) {
  506.                     if(query != null)
  507.                         query = query.replace(/\+/g,' ');
  508.                     this.resetParams(query, status);
  509.                     this.fetch(number, sortField, order);
  510.                 },
  511.                 fetch : function(number, sortField, order) {
  512.                     ticketCollection.state.currentPage = number;
  513.                     filter.sortCollection(sortField, order);
  514.                     ticketCollection.syncData();
  515.                 },
  516.                 resetParams : function(query, status) {
  517.                     ticketCollection.filterParameters.search = query;
  518.                     $(".uv-search-inline ").val(query);
  519.                     ticketCollection.filterParameters.status = status;
  520.                     var statusText = status ? $(".filter-by-status a[data-id='" + status + "']").text() : "{% trans %}All{% endtrans %}";
  521.                     $(".filter-by-status .uv-dropdown-btn").text("{% trans %}Status:{% endtrans %} " + statusText);
  522.                 }
  523.             });
  524.             router = new Router();
  525.             Backbone.history.start({push_state:true});
  526.         });
  527.     </script>
  528. {% endblock %}