WorkListCommentsFormTrait
"Work item comments" modal of a job.
The work grid fires the DOM event work-grid:comment-open with itemId; the JS glue
(work-list-sheets.js) turns it into an AJAX GET of this signal.
Does not use the shared Base CommentThread component: work item comments have their own flat
table, so the modal is a plain list plus a simple form (no nesting, approval, reports or
per-language variants).
After submit it redirects back to the itemComments! signal, not to edit, so the modal
reopens with the fresh comment and the admin can keep writing.
Terminology: WorkList is a job, WorkSheet is a work sheet inside a job.
Table of Contents
Properties
- $commentedItem : WorkItem|null
- Work item whose comments are shown; kept for the modal form.
Methods
- handleItemComments() : void
- Opens the modal with comments of one work item (AJAX).
- createComponentCommentForm() : Form
- buildCommentsModalContent() : string
- findCommentedItem() : WorkItem|null
- Returns the work item by id, or `null` when it does not exist or is outside the edited job.
- isItemInWorkList() : bool
- Tells whether the work item belongs, via its work sheet, to the given job.
- processComment() : void
- Saves a comment. The server sets author and time; only the text comes from the form.
- resolveAdminAuthorName() : string
- Returns the logged-in admin's display name; the fallback keeps `author_name` non-empty.
Properties
$commentedItem
Work item whose comments are shown; kept for the modal form.
private
WorkItem|null
$commentedItem
= null
Methods
handleItemComments()
Opens the modal with comments of one work item (AJAX).
public
handleItemComments(int $itemId) : void
Parameters
- $itemId : int
createComponentCommentForm()
protected
createComponentCommentForm() : Form
Return values
FormbuildCommentsModalContent()
private
buildCommentsModalContent(WorkItem|null $item) : string
Parameters
- $item : WorkItem|null
Return values
stringfindCommentedItem()
Returns the work item by id, or `null` when it does not exist or is outside the edited job.
private
findCommentedItem(int $itemId) : WorkItem|null
Parameters
- $itemId : int
Return values
WorkItem|nullisItemInWorkList()
Tells whether the work item belongs, via its work sheet, to the given job.
private
isItemInWorkList(WorkItem $item, int $workListId) : bool
Parameters
- $item : WorkItem
- $workListId : int
Return values
boolprocessComment()
Saves a comment. The server sets author and time; only the text comes from the form.
private
processComment(ArrayHash<string|int, mixed> $values) : void
Parameters
- $values : ArrayHash<string|int, mixed>
resolveAdminAuthorName()
Returns the logged-in admin's display name; the fallback keeps `author_name` non-empty.
private
resolveAdminAuthorName() : string