diff --git a/public/js/app.js b/public/js/app.js index bc24de2..7d789e1 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -156,20 +156,8 @@ const App = { } }; - let timeout; searchInput.addEventListener('input', () => { toggleClearBtn(); - clearTimeout(timeout); - timeout = setTimeout(() => { - const hash = window.location.hash; - if (hash.startsWith('#/tickets') && !hash.includes('/new') && !hash.match(/#\/tickets\/\d+/)) { - TicketListView.currentPage = 1; - TicketListView.render(); - } else { - // Navigate to ticket list with search - window.location.hash = '#/tickets'; - } - }, 350); }); searchInput.addEventListener('keydown', (e) => { diff --git a/public/js/views/ticketDetail.js b/public/js/views/ticketDetail.js index 837dbcb..bfd0394 100644 --- a/public/js/views/ticketDetail.js +++ b/public/js/views/ticketDetail.js @@ -263,6 +263,7 @@ const TicketDetailView = {
+
-
- Cliente - - - - -
+ ${(App.lookups.types || []).length > 0 ? ` +
+ Tipo + +
+ ` : ''} @@ -439,6 +441,8 @@ const TicketListView = { if (batchOwner) batchOwner.value = ''; const batchResponsible = document.getElementById('batch-responsible'); if (batchResponsible) batchResponsible.value = ''; + const batchType = document.getElementById('batch-type'); + if (batchType) batchType.value = ''; this.updateBatchBar(); }); @@ -620,6 +624,7 @@ const TicketListView = { const batchQueue = document.getElementById('batch-queue')?.value; const batchOwner = document.getElementById('batch-owner')?.value; const batchResponsible = document.getElementById('batch-responsible')?.value; + const batchType = document.getElementById('batch-type')?.value; const batchCustomerSearch = document.getElementById('batch-customer-search')?.value.trim(); let batchCustomerUserId = document.getElementById('batch-customer-user-id')?.value; let batchCustomerId = document.getElementById('batch-customer-id')?.value; @@ -633,6 +638,7 @@ const TicketListView = { if (batchState) updates.ticket_state_id = parseInt(batchState); if (batchQueue) updates.queue_id = parseInt(batchQueue); + if (batchType) updates.type_id = parseInt(batchType); if (batchOwner) updates.user_id = parseInt(batchOwner); if (batchResponsible) { updates.responsible_user_id = parseInt(batchResponsible); diff --git a/routes/tickets.js b/routes/tickets.js index ec930f7..62d793f 100644 --- a/routes/tickets.js +++ b/routes/tickets.js @@ -1417,6 +1417,7 @@ router.patch('/batch/update', async (req, res) => { if (updates.ticket_state_id !== undefined) ticketFields.StateID = updates.ticket_state_id; if (updates.ticket_priority_id !== undefined) ticketFields.PriorityID = updates.ticket_priority_id; if (updates.queue_id !== undefined) ticketFields.QueueID = updates.queue_id; + if (updates.type_id !== undefined) ticketFields.TypeID = updates.type_id; if (updates.user_id !== undefined) ticketFields.OwnerID = updates.user_id; if (updates.responsible_user_id !== undefined) ticketFields.ResponsibleID = updates.responsible_user_id; if (updates.customer_id !== undefined) ticketFields.CustomerID = updates.customer_id; @@ -1471,7 +1472,7 @@ router.patch('/batch/update', async (req, res) => { try { await client.query('BEGIN'); - const allowedFields = ['ticket_state_id', 'ticket_priority_id', 'queue_id', 'user_id', 'responsible_user_id', 'customer_id', 'customer_user_id']; + const allowedFields = ['ticket_state_id', 'ticket_priority_id', 'queue_id', 'type_id', 'user_id', 'responsible_user_id', 'customer_id', 'customer_user_id']; const setClauses = []; const setParams = []; let pIdx = 1;