From 7b317f0508a51d39211d97071c25ac6ee0b55fbf Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Wed, 17 Jun 2026 10:20:42 +0100 Subject: [PATCH] workign comments strucuture --- .../views/livewire/ticket-show.blade.php | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php b/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php index 75a5da05..fc7ed905 100644 --- a/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php +++ b/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php @@ -103,7 +103,7 @@ Expand all - @@ -234,9 +234,10 @@ const expandButton = event.target.closest('[data-helpdesk-expand-comments]'); if (expandButton) { - document.querySelectorAll('[data-helpdesk-comments-shell], [data-helpdesk-comment-card]').forEach((card) => { + document.querySelectorAll('[data-helpdesk-comment-card]').forEach((card) => { card.open = true; }); + updateCommentToggleButtons(); return; } @@ -246,6 +247,7 @@ document.querySelectorAll('[data-helpdesk-comment-card]').forEach((card) => { card.open = false; }); + updateCommentToggleButtons(); return; } @@ -293,6 +295,24 @@ } }); + function updateCommentToggleButtons() { + const commentCards = Array.from(document.querySelectorAll('[data-helpdesk-comment-card]')); + const expandButton = document.querySelector('[data-helpdesk-expand-comments]'); + const collapseButton = document.querySelector('[data-helpdesk-collapse-comments]'); + + if (! expandButton || ! collapseButton) { + return; + } + + const hasExpandableComments = commentCards.some((card) => ! card.open); + const hasExpandedComments = commentCards.some((card) => card.open); + + expandButton.classList.toggle('hidden', ! hasExpandableComments); + expandButton.classList.toggle('inline-flex', hasExpandableComments); + collapseButton.classList.toggle('hidden', ! hasExpandedComments || hasExpandableComments); + collapseButton.classList.toggle('inline-flex', hasExpandedComments && ! hasExpandableComments); + } + function decodeHtmlEntities(value) { const textarea = document.createElement('textarea'); textarea.innerHTML = value;