Fragment: Hide system or plugin UI element if Worklog != 0

I managed to hide the “delete” from the More Panel, but I can’t write the Condition correctly, which will hide this element only on tickets that have a booked time. I imagined the script, but I need to get false whenever worklogged or timespent is greater than 0. Is this even possible?

Solution is Fragment: com.atlassian.jira.plugin.system.issueoperations:delete-issue

and Script:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
def workLogManager = ComponentAccessor.getWorklogManager()
def logged = workLogManager.getByIssue(issue)
if (logged != null && logged.size() > 0) { return false }
else return true

Best Regards