category, status, and priority are editable on tickets.
This commit is contained in:
@@ -1164,8 +1164,8 @@ input[type="checkbox"]:checked {
|
||||
|
||||
/* ===== COLLAPSIBLE ASCII BANNER ===== */
|
||||
.ascii-banner-wrapper {
|
||||
max-width: 1600px;
|
||||
margin: 0 auto 1rem auto;
|
||||
max-width: 100%;
|
||||
margin: 0 1rem 1rem 1rem;
|
||||
border: 2px solid var(--terminal-green);
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
@@ -1348,7 +1348,7 @@ input[type="checkbox"]:checked {
|
||||
.dashboard-layout {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
max-width: 1600px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
@@ -227,6 +227,60 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Metadata Fields Grid (Priority, Category, Type) */
|
||||
.ticket-metadata-fields {
|
||||
margin-top: 0.75rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.metadata-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.metadata-field label {
|
||||
font-weight: 500;
|
||||
display: block;
|
||||
margin-bottom: 0.25rem;
|
||||
color: var(--terminal-amber);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.85rem;
|
||||
text-shadow: var(--glow-amber);
|
||||
}
|
||||
|
||||
.metadata-select {
|
||||
width: 100%;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 0;
|
||||
border: 2px solid var(--terminal-green);
|
||||
background: var(--bg-primary);
|
||||
color: var(--terminal-green);
|
||||
font-family: var(--font-mono);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.metadata-select:hover {
|
||||
border-color: var(--terminal-amber);
|
||||
box-shadow: var(--glow-amber);
|
||||
}
|
||||
|
||||
.metadata-select:focus {
|
||||
outline: none;
|
||||
border-color: var(--terminal-amber);
|
||||
box-shadow: 0 0 10px var(--terminal-amber);
|
||||
}
|
||||
|
||||
/* Mobile: Stack metadata fields */
|
||||
@media (max-width: 768px) {
|
||||
.ticket-metadata-fields {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.ticket-id {
|
||||
font-family: var(--font-mono);
|
||||
margin-right: 20px;
|
||||
|
||||
@@ -233,6 +233,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// Initialize assignment handling
|
||||
handleAssignmentChange();
|
||||
|
||||
// Initialize metadata field handlers (priority, category, type)
|
||||
handleMetadataChanges();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -267,6 +270,81 @@ function handleAssignmentChange() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle metadata field changes (priority, category, type)
|
||||
*/
|
||||
function handleMetadataChanges() {
|
||||
const prioritySelect = document.getElementById('prioritySelect');
|
||||
const categorySelect = document.getElementById('categorySelect');
|
||||
const typeSelect = document.getElementById('typeSelect');
|
||||
|
||||
// Helper function to update ticket field
|
||||
function updateTicketField(fieldName, newValue) {
|
||||
const ticketId = window.ticketData.id;
|
||||
|
||||
fetch('/api/update_ticket.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
ticket_id: ticketId,
|
||||
[fieldName]: fieldName === 'priority' ? parseInt(newValue) : newValue
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (!data.success) {
|
||||
alert(`Error updating ${fieldName}`);
|
||||
console.error(data.error);
|
||||
} else {
|
||||
console.log(`${fieldName} updated successfully to:`, newValue);
|
||||
|
||||
// Update window.ticketData
|
||||
window.ticketData[fieldName] = fieldName === 'priority' ? parseInt(newValue) : newValue;
|
||||
|
||||
// For priority, also update the priority indicator if it exists
|
||||
if (fieldName === 'priority') {
|
||||
const priorityIndicator = document.querySelector('.priority-indicator');
|
||||
if (priorityIndicator) {
|
||||
priorityIndicator.className = `priority-indicator priority-${newValue}`;
|
||||
priorityIndicator.textContent = 'P' + newValue;
|
||||
}
|
||||
|
||||
// Update ticket container priority attribute
|
||||
const ticketContainer = document.querySelector('.ticket-container');
|
||||
if (ticketContainer) {
|
||||
ticketContainer.setAttribute('data-priority', newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Error updating ${fieldName}:`, error);
|
||||
alert(`Error updating ${fieldName}: ` + error.message);
|
||||
});
|
||||
}
|
||||
|
||||
// Priority change handler
|
||||
if (prioritySelect) {
|
||||
prioritySelect.addEventListener('change', function() {
|
||||
updateTicketField('priority', this.value);
|
||||
});
|
||||
}
|
||||
|
||||
// Category change handler
|
||||
if (categorySelect) {
|
||||
categorySelect.addEventListener('change', function() {
|
||||
updateTicketField('category', this.value);
|
||||
});
|
||||
}
|
||||
|
||||
// Type change handler
|
||||
if (typeSelect) {
|
||||
typeSelect.addEventListener('change', function() {
|
||||
updateTicketField('type', this.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateTicketStatus() {
|
||||
const statusSelect = document.getElementById('statusSelect');
|
||||
const selectedOption = statusSelect.options[statusSelect.selectedIndex];
|
||||
|
||||
Reference in New Issue
Block a user