Disable editable fields from start
This commit is contained in:
@ -642,3 +642,15 @@ th.sort-desc::after {
|
|||||||
padding: 12px;
|
padding: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-controls {
|
||||||
|
padding: 15px;
|
||||||
|
text-align: center;
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-controls .btn {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
@ -448,14 +448,14 @@ function createHamburgerMenu() {
|
|||||||
<h3>Ticket Controls</h3>
|
<h3>Ticket Controls</h3>
|
||||||
<div class="menu-group">
|
<div class="menu-group">
|
||||||
<label>Status</label>
|
<label>Status</label>
|
||||||
<select class="editable" data-field="status">
|
<select class="editable" data-field="status" disabled>
|
||||||
<option value="Open" ${values.status === 'Open' ? 'selected' : ''}>Open</option>
|
<option value="Open" ${values.status === 'Open' ? 'selected' : ''}>Open</option>
|
||||||
<option value="Closed" ${values.status === 'Closed' ? 'selected' : ''}>Closed</option>
|
<option value="Closed" ${values.status === 'Closed' ? 'selected' : ''}>Closed</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-group">
|
<div class="menu-group">
|
||||||
<label>Priority</label>
|
<label>Priority</label>
|
||||||
<select class="editable" data-field="priority">
|
<select class="editable" data-field="priority" disabled>
|
||||||
<option value="1" ${values.priority === '1' ? 'selected' : ''}>P1 - Critical Impact</option>
|
<option value="1" ${values.priority === '1' ? 'selected' : ''}>P1 - Critical Impact</option>
|
||||||
<option value="2" ${values.priority === '2' ? 'selected' : ''}>P2 - High Impact</option>
|
<option value="2" ${values.priority === '2' ? 'selected' : ''}>P2 - High Impact</option>
|
||||||
<option value="3" ${values.priority === '3' ? 'selected' : ''}>P3 - Medium Impact</option>
|
<option value="3" ${values.priority === '3' ? 'selected' : ''}>P3 - Medium Impact</option>
|
||||||
@ -464,7 +464,7 @@ function createHamburgerMenu() {
|
|||||||
</div>
|
</div>
|
||||||
<div class="menu-group">
|
<div class="menu-group">
|
||||||
<label>Category</label>
|
<label>Category</label>
|
||||||
<select class="editable" data-field="category">
|
<select class="editable" data-field="category" disabled>
|
||||||
<option value="Hardware" ${values.category === 'Hardware' ? 'selected' : ''}>Hardware</option>
|
<option value="Hardware" ${values.category === 'Hardware' ? 'selected' : ''}>Hardware</option>
|
||||||
<option value="Software" ${values.category === 'Software' ? 'selected' : ''}>Software</option>
|
<option value="Software" ${values.category === 'Software' ? 'selected' : ''}>Software</option>
|
||||||
<option value="Network" ${values.category === 'Network' ? 'selected' : ''}>Network</option>
|
<option value="Network" ${values.category === 'Network' ? 'selected' : ''}>Network</option>
|
||||||
@ -474,7 +474,7 @@ function createHamburgerMenu() {
|
|||||||
</div>
|
</div>
|
||||||
<div class="menu-group">
|
<div class="menu-group">
|
||||||
<label>Type</label>
|
<label>Type</label>
|
||||||
<select class="editable" data-field="type">
|
<select class="editable" data-field="type" disabled>
|
||||||
<option value="Maintenance" ${values.type === 'Maintenance' ? 'selected' : ''}>Maintenance</option>
|
<option value="Maintenance" ${values.type === 'Maintenance' ? 'selected' : ''}>Maintenance</option>
|
||||||
<option value="Install" ${values.type === 'Install' ? 'selected' : ''}>Install</option>
|
<option value="Install" ${values.type === 'Install' ? 'selected' : ''}>Install</option>
|
||||||
<option value="Task" ${values.type === 'Task' ? 'selected' : ''}>Task</option>
|
<option value="Task" ${values.type === 'Task' ? 'selected' : ''}>Task</option>
|
||||||
@ -482,7 +482,7 @@ function createHamburgerMenu() {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-controls">
|
<div class="menu-controls">
|
||||||
<button id="hamburgerEditButton" class="btn" onclick="toggleHamburgerEditMode()">Edit Ticket</button>
|
<button id="hamburgerEditButton" class="btn primary" onclick="toggleHamburgerEditMode()">Edit Ticket</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-actions">
|
<div class="menu-actions">
|
||||||
<button onclick="saveTicket()" class="btn primary">Save Changes</button>
|
<button onclick="saveTicket()" class="btn primary">Save Changes</button>
|
||||||
|
|||||||
@ -31,11 +31,10 @@ function saveTicket() {
|
|||||||
|
|
||||||
function toggleEditMode() {
|
function toggleEditMode() {
|
||||||
const editButton = document.getElementById('editButton');
|
const editButton = document.getElementById('editButton');
|
||||||
const editables = document.querySelectorAll('.editable');
|
const editables = document.querySelectorAll('.title-input, textarea[data-field="description"]');
|
||||||
const isEditing = editButton.classList.contains('active');
|
const isEditing = editButton.classList.contains('active');
|
||||||
|
|
||||||
if (!isEditing) {
|
if (!isEditing) {
|
||||||
// Enable editing
|
|
||||||
editButton.textContent = 'Save Changes';
|
editButton.textContent = 'Save Changes';
|
||||||
editButton.classList.add('active');
|
editButton.classList.add('active');
|
||||||
editables.forEach(field => {
|
editables.forEach(field => {
|
||||||
@ -45,7 +44,6 @@ function toggleEditMode() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Save changes and disable editing
|
|
||||||
saveTicket();
|
saveTicket();
|
||||||
editButton.textContent = 'Edit Ticket';
|
editButton.textContent = 'Edit Ticket';
|
||||||
editButton.classList.remove('active');
|
editButton.classList.remove('active');
|
||||||
@ -54,6 +52,7 @@ function toggleEditMode() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addComment() {
|
function addComment() {
|
||||||
const commentText = document.getElementById('newComment').value;
|
const commentText = document.getElementById('newComment').value;
|
||||||
const ticketId = window.location.href.split('id=')[1];
|
const ticketId = window.location.href.split('id=')[1];
|
||||||
|
|||||||
Reference in New Issue
Block a user