category, status, and priority are editable on tickets.
This commit is contained in:
@@ -1164,8 +1164,8 @@ input[type="checkbox"]:checked {
|
|||||||
|
|
||||||
/* ===== COLLAPSIBLE ASCII BANNER ===== */
|
/* ===== COLLAPSIBLE ASCII BANNER ===== */
|
||||||
.ascii-banner-wrapper {
|
.ascii-banner-wrapper {
|
||||||
max-width: 1600px;
|
max-width: 100%;
|
||||||
margin: 0 auto 1rem auto;
|
margin: 0 1rem 1rem 1rem;
|
||||||
border: 2px solid var(--terminal-green);
|
border: 2px solid var(--terminal-green);
|
||||||
background: var(--bg-secondary);
|
background: var(--bg-secondary);
|
||||||
}
|
}
|
||||||
@@ -1348,7 +1348,7 @@ input[type="checkbox"]:checked {
|
|||||||
.dashboard-layout {
|
.dashboard-layout {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
max-width: 1600px;
|
max-width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,60 @@
|
|||||||
align-items: center;
|
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 {
|
.ticket-id {
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
|||||||
@@ -233,6 +233,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
// Initialize assignment handling
|
// Initialize assignment handling
|
||||||
handleAssignmentChange();
|
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() {
|
function updateTicketStatus() {
|
||||||
const statusSelect = document.getElementById('statusSelect');
|
const statusSelect = document.getElementById('statusSelect');
|
||||||
const selectedOption = statusSelect.options[statusSelect.selectedIndex];
|
const selectedOption = statusSelect.options[statusSelect.selectedIndex];
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ function formatDetails($details, $actionType) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="ticket-assignment" style="margin-top: 0.5rem;">
|
<div class="ticket-assignment" style="margin-top: 0.5rem;">
|
||||||
<label style="font-weight: 500; margin-right: 0.5rem;">Assigned to:</label>
|
<label style="font-weight: 500; margin-right: 0.5rem;">Assigned to:</label>
|
||||||
<select id="assignedToSelect" class="assignment-select" style="padding: 0.25rem 0.5rem; border-radius: 4px; border: 1px solid var(--border-color, #ddd);">
|
<select id="assignedToSelect" class="assignment-select" style="padding: 0.25rem 0.5rem; border-radius: 0; border: 2px solid var(--terminal-green);">
|
||||||
<option value="">Unassigned</option>
|
<option value="">Unassigned</option>
|
||||||
<?php foreach ($allUsers as $user): ?>
|
<?php foreach ($allUsers as $user): ?>
|
||||||
<option value="<?php echo $user['user_id']; ?>"
|
<option value="<?php echo $user['user_id']; ?>"
|
||||||
@@ -118,6 +118,42 @@ function formatDetails($details, $actionType) {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Metadata Fields: Priority, Category, Type -->
|
||||||
|
<div class="ticket-metadata-fields" style="margin-top: 0.75rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem;">
|
||||||
|
<div class="metadata-field">
|
||||||
|
<label style="font-weight: 500; display: block; margin-bottom: 0.25rem; color: var(--terminal-amber); font-family: var(--font-mono); font-size: 0.85rem;">Priority:</label>
|
||||||
|
<select id="prioritySelect" class="metadata-select" style="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);">
|
||||||
|
<option value="1" <?php echo $ticket['priority'] == 1 ? 'selected' : ''; ?>>P1 - Critical</option>
|
||||||
|
<option value="2" <?php echo $ticket['priority'] == 2 ? 'selected' : ''; ?>>P2 - High</option>
|
||||||
|
<option value="3" <?php echo $ticket['priority'] == 3 ? 'selected' : ''; ?>>P3 - Medium</option>
|
||||||
|
<option value="4" <?php echo $ticket['priority'] == 4 ? 'selected' : ''; ?>>P4 - Low</option>
|
||||||
|
<option value="5" <?php echo $ticket['priority'] == 5 ? 'selected' : ''; ?>>P5 - Lowest</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="metadata-field">
|
||||||
|
<label style="font-weight: 500; display: block; margin-bottom: 0.25rem; color: var(--terminal-amber); font-family: var(--font-mono); font-size: 0.85rem;">Category:</label>
|
||||||
|
<select id="categorySelect" class="metadata-select" style="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);">
|
||||||
|
<option value="Hardware" <?php echo $ticket['category'] == 'Hardware' ? 'selected' : ''; ?>>Hardware</option>
|
||||||
|
<option value="Software" <?php echo $ticket['category'] == 'Software' ? 'selected' : ''; ?>>Software</option>
|
||||||
|
<option value="Network" <?php echo $ticket['category'] == 'Network' ? 'selected' : ''; ?>>Network</option>
|
||||||
|
<option value="Security" <?php echo $ticket['category'] == 'Security' ? 'selected' : ''; ?>>Security</option>
|
||||||
|
<option value="General" <?php echo $ticket['category'] == 'General' ? 'selected' : ''; ?>>General</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="metadata-field">
|
||||||
|
<label style="font-weight: 500; display: block; margin-bottom: 0.25rem; color: var(--terminal-amber); font-family: var(--font-mono); font-size: 0.85rem;">Type:</label>
|
||||||
|
<select id="typeSelect" class="metadata-select" style="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);">
|
||||||
|
<option value="Maintenance" <?php echo $ticket['type'] == 'Maintenance' ? 'selected' : ''; ?>>Maintenance</option>
|
||||||
|
<option value="Install" <?php echo $ticket['type'] == 'Install' ? 'selected' : ''; ?>>Install</option>
|
||||||
|
<option value="Task" <?php echo $ticket['type'] == 'Task' ? 'selected' : ''; ?>>Task</option>
|
||||||
|
<option value="Upgrade" <?php echo $ticket['type'] == 'Upgrade' ? 'selected' : ''; ?>>Upgrade</option>
|
||||||
|
<option value="Issue" <?php echo $ticket['type'] == 'Issue' ? 'selected' : ''; ?>>Issue</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-controls">
|
<div class="header-controls">
|
||||||
<div class="status-priority-group">
|
<div class="status-priority-group">
|
||||||
@@ -135,7 +171,6 @@ function formatDetails($details, $actionType) {
|
|||||||
</option>
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<span class="priority-indicator priority-<?php echo $ticket["priority"]; ?>">P<?php echo $ticket["priority"]; ?></span>
|
|
||||||
</div>
|
</div>
|
||||||
<button id="editButton" class="btn" onclick="toggleEditMode()">Edit Ticket</button>
|
<button id="editButton" class="btn" onclick="toggleEditMode()">Edit Ticket</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user