From dd9a46658f9ebbeb84072ee508cb34b837337cc7 Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Thu, 23 Jul 2026 15:17:42 -0400 Subject: [PATCH] Applying changes to hide Preview Icon on Completed Tasks --- .../js/tasks/components/TaskListRowButtons.vue | 11 +++++++++-- resources/js/tasks/components/TasksList.vue | 13 ++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/resources/js/tasks/components/TaskListRowButtons.vue b/resources/js/tasks/components/TaskListRowButtons.vue index 41e2b3560f..70793d5d84 100644 --- a/resources/js/tasks/components/TaskListRowButtons.vue +++ b/resources/js/tasks/components/TaskListRowButtons.vue @@ -5,7 +5,7 @@ -
@@ -51,6 +52,12 @@ showButtons: null }, methods: { + shouldShow(button) { + if (typeof button.show === "function") { + return button.show(this.row); + } + return button.show; + }, show() { this.triggerFloatingButtons(() => { if (!this.showButtons) { diff --git a/resources/js/tasks/components/TasksList.vue b/resources/js/tasks/components/TasksList.vue index aae5f56de2..f15f9063e4 100644 --- a/resources/js/tasks/components/TasksList.vue +++ b/resources/js/tasks/components/TasksList.vue @@ -348,7 +348,7 @@ export default { click: this.previewTasks, icon: "fas fa-eye", title: this.$t("Preview"), - show: !this.verifyURL("saved-searches") || false, + show: (row) => this.shouldShowPreviewButton(row), }, { id: "openCaseButton", @@ -444,6 +444,7 @@ export default { record.process_request, record, ); + record.task_status = record.status; record.status = this.formatStatus(record); record.assignee = this.formatAvatar(record.user); record.request = this.formatRequest(record); @@ -759,6 +760,16 @@ export default { } return isInUrl; }, + /** + * Hide Preview for completed tasks (API status CLOSED) and on normal saved searches. + * Use task_status because status is replaced with badge HTML in the data watcher. + */ + shouldShowPreviewButton(row) { + if (this.verifyURL("saved-searches") && !this.processesIManage) { + return false; + } + return row?.task_status !== "CLOSED"; + }, /** * This method is used in PMColumnFilterPopoverCommonMixin.js */