Fixed user not clickable after creation, fixed missing data attributes for created user

This commit is contained in:
2025-10-26 21:42:51 +01:00
parent b9b3c91f3f
commit ab28e4b494

View File

@@ -586,6 +586,10 @@
data-user-title="${data.Title || ''}"
data-user-name="${data.Cn || ''}"
data-user-surname="${data.Sn || ''}"
data-user-birthdate="${data.BirthDate}"
data-user-address-city="${data.Description.Address.City}"
data-user-address-street="${data.Description.Address.Street}"
data-user-address-streetnr="${data.Description.Address.StreetNr}"
data-user-workplace="${data.Description?.Workplace || ''}"
data-user-groups='${JSON.stringify(data.Description?.Groups || [])}'
data-bs-toggle="modal"
@@ -602,6 +606,9 @@
</div>
</td>
`;
newRow.setAttribute("data-asset-id", result.Uid);
newRow.classList.toggle("user-row");
registerRowDetailviewClick(newRow);
tbody.appendChild(newRow);
} else {
showToast(`${result.Exception || '@T["Create failed"]'}`, 'danger');
@@ -699,10 +706,12 @@
<script>
document.addEventListener('DOMContentLoaded', () => {
const rows = document.querySelectorAll('table tbody tr');
rows.forEach(row => registerRowDetailviewClick(row));
});
function registerRowDetailviewClick(row) {
const detailModalEl = document.getElementById('detailModal');
const detailModal = new bootstrap.Modal(detailModalEl);
rows.forEach(row => {
row.addEventListener('click', (e) => {
// Dont trigger when clicking inside the action buttons
if (e.target.closest('button')) return;
@@ -743,8 +752,7 @@
detailPhoto.src = `/Home/UserPhoto?uid=${data.uid}&size=256`;
detailModal.show();
});
});
});
}
</script>
<style>