fix: Cache busting and visibility group editing UI
- Add cache busting query params to JS/CSS files (v=20260123) - Add visibility group selection UI for editing existing tickets - Add toggleVisibilityGroupsEdit() and getSelectedVisibilityGroups() functions - Fix visibility data being saved when editing tickets - Pass $conn to views for UserModel access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,25 @@ function escapeHtml(text) {
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle visibility groups field based on visibility selection
|
||||
*/
|
||||
function toggleVisibilityGroupsEdit() {
|
||||
const visibility = document.getElementById('visibilitySelect')?.value;
|
||||
const groupsField = document.getElementById('visibilityGroupsField');
|
||||
if (groupsField) {
|
||||
groupsField.style.display = visibility === 'internal' ? 'block' : 'none';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get selected visibility groups
|
||||
*/
|
||||
function getSelectedVisibilityGroups() {
|
||||
const checkboxes = document.querySelectorAll('.visibility-group-checkbox:checked');
|
||||
return Array.from(checkboxes).map(cb => cb.value);
|
||||
}
|
||||
|
||||
function saveTicket() {
|
||||
const editables = document.querySelectorAll('.editable');
|
||||
const data = {};
|
||||
@@ -34,9 +53,18 @@ function saveTicket() {
|
||||
}
|
||||
});
|
||||
|
||||
// Get visibility settings
|
||||
const visibilitySelect = document.getElementById('visibilitySelect');
|
||||
if (visibilitySelect) {
|
||||
data.visibility = visibilitySelect.value;
|
||||
if (data.visibility === 'internal') {
|
||||
data.visibility_groups = getSelectedVisibilityGroups();
|
||||
}
|
||||
}
|
||||
|
||||
// Use the correct API path
|
||||
const apiUrl = '/api/update_ticket.php';
|
||||
|
||||
|
||||
fetch(apiUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user