First works on adding select to joblist

This commit is contained in:
Patrick Jentsch 2023-06-05 13:44:07 +02:00
parent 86318b9a7d
commit 526fd1769e

View File

@ -9,6 +9,7 @@ class JobList extends ResourceList {
super(listContainerElement, options);
this.listjs.list.addEventListener('click', (event) => {this.onClick(event)});
this.isInitialized = false;
this.selectedItemIds = new Set();
this.userId = listContainerElement.dataset.userId;
if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
@ -25,6 +26,12 @@ class JobList extends ResourceList {
get item() {
return `
<tr class="list-item clickable hoverable service-scheme">
<td>
<label class="list-action-trigger" data-list-action="select">
<input class="select-checkbox" type="checkbox">
<span class="disable-on-click"></span>
</label>
</td>
<td><a class="btn-floating"><i class="nopaque-icons service-icons" data-service="inherit"></i></a></td>
<td><b class="title"></b><br><i class="description"></i></td>
<td><span class="badge new job-status-color job-status-text status" data-badge-caption=""></span></td>
@ -61,6 +68,12 @@ class JobList extends ResourceList {
<table>
<thead>
<tr>
<th>
<label class="selection-action-trigger" data-selection-action="select-all">
<input class="select-all-checkbox" type="checkbox">
<span></span>
</label>
</th>
<th>Service</th>
<th>Title and Description</th>
<th>Status</th>
@ -133,6 +146,15 @@ class JobList extends ResourceList {
window.location.href = `/jobs/${itemId}`;
break;
}
case 'select': {
if (event.target.checked) {
this.selectedItemIds.add(itemId);
} else {
this.selectedItemIds.delete(itemId);
}
this.renderingItemSelection();
break;
}
default: {
break;
}