Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions resources/js/tasks/components/TasksPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@
<b-button
v-if="allowReassignment"
v-b-tooltip.hover
class="btn text-secondary icon-button"
class="btn text-secondary icon-button preview-reassign-btn"
variant="light"
:aria-label="$t('Reassign')"
:title="$t('Reassign')"
:disabled="isTaskCompleted"
@click="openReassignment()"
>
<i class="fas fa-user-friends" />
<i class="fas fa-user-friends preview-reassign-btn__icon" />
</b-button>
<b-button
v-b-tooltip.hover
Expand Down Expand Up @@ -284,6 +285,26 @@ export default {
},
mixins: [PreviewMixin, autosaveMixins, reassignMixin],
props: ["tooltipButton", "propPreview"],
computed: {
/**
* TasksList replaces status with HTML; API uses CLOSED for completed.
*/
isTaskCompleted() {
const status = this.task?.status;
if (status === undefined || status === null) {
return false;
}
if (typeof status === "string") {
if (status === "CLOSED" || status === "Completed") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Improvements
resources/js/tasks/components/TasksPreview.vue:292
isTaskCompleted() mixes canonical API/DB state with UI display values: CLOSED, Completed, and rendered badge HTML/CSS classes.

Reasoning: CLOSED is the real task status. Completed is a UI label/alias and can be translated or absent depending on where the task object comes from. Parsing badge classes is also fragile.

Suggestion: if the frontend needs a visual disabled state, use a canonical field only, such as task.status === "CLOSED" or task.advanceStatus === "completed". Do not rely on translated labels or rendered HTML.

return true;
}
if (status.includes("badge-primary") && status.includes("status-primary")) {
return true;
}
}
return false;
},
},
data() {
return {
};
Expand Down Expand Up @@ -414,6 +435,9 @@ export default {
});
},
openReassignment() {
if (this.isTaskCompleted) {
return;
}
this.showReassignment = !this.showReassignment;
},
getTaskDefinitionForReassignmentPermission() {
Expand Down Expand Up @@ -493,6 +517,25 @@ export default {
height: 16px;
}

/* Reassign disabled: keep same border as other icon-buttons; mute only the icon */
.tasks-preview .preview-group-button .preview-reassign-btn.btn-light:disabled,
.tasks-preview .preview-group-button .preview-reassign-btn.btn-light.disabled {
opacity: 1;
background-color: #fff;
border: 1px solid #ccc !important;
border-top-color: #ccc !important;
border-bottom-color: #ccc !important;
border-left-color: #ccc !important;
border-right-color: #ccc !important;
color: inherit;
}

.tasks-preview .preview-group-button .preview-reassign-btn.btn-light:disabled .preview-reassign-btn__icon,
.tasks-preview .preview-group-button .preview-reassign-btn.btn-light.disabled .preview-reassign-btn__icon {
color: #adb5bd;
opacity: 0.55;
}

.arrow-button {
width: 46px;
height: 36px;
Expand Down
Loading