Fixed ticket editing, and ticket overview size.
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
/* Base Layout Components */
|
/* Base Layout Components */
|
||||||
.ticket-container {
|
.ticket-container {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
|
height: auto !important;
|
||||||
|
min-height: 900px !important;
|
||||||
min-width: 800px;
|
min-width: 800px;
|
||||||
max-width: 1800px;
|
max-width: 1800px;
|
||||||
margin: 40px auto;
|
margin: 40px auto;
|
||||||
@ -125,9 +127,18 @@ input.editable {
|
|||||||
|
|
||||||
textarea.editable {
|
textarea.editable {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
min-height: 150px;
|
min-height: 800px !important;
|
||||||
resize: vertical;
|
height: auto !important; /* Allow it to grow with content */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
white-space: pre; /* Preserve formatting */
|
||||||
|
font-family: monospace; /* Better for ASCII art */
|
||||||
|
line-height: 1.2; /* Tighter line spacing for ASCII art */
|
||||||
|
}
|
||||||
|
|
||||||
|
#description-tab {
|
||||||
|
min-height: 850px !important; /* Slightly larger than the textarea */
|
||||||
|
height: auto !important;
|
||||||
|
padding-bottom: 20px; /* Add some padding at the bottom */
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable:disabled {
|
.editable:disabled {
|
||||||
|
|||||||
@ -492,21 +492,15 @@ function resetHamburgerEditMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createHamburgerMenu() {
|
function createHamburgerMenu() {
|
||||||
// Create hamburger menu container
|
|
||||||
const hamburgerMenu = document.createElement('div');
|
const hamburgerMenu = document.createElement('div');
|
||||||
hamburgerMenu.className = 'hamburger-menu';
|
hamburgerMenu.className = 'hamburger-menu';
|
||||||
|
|
||||||
// Check if we're on a ticket page
|
|
||||||
const isTicketPage = window.location.pathname.includes('ticket.php');
|
const isTicketPage = window.location.pathname.includes('ticket.php');
|
||||||
|
|
||||||
if (isTicketPage) {
|
if (isTicketPage && window.ticketData) {
|
||||||
// Get current values from existing select elements
|
// Use the ticket data from the global variable
|
||||||
const selects = document.querySelectorAll('select.editable');
|
const values = window.ticketData;
|
||||||
const values = {};
|
|
||||||
selects.forEach(select => {
|
|
||||||
select.dataset.originalValue = select.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
hamburgerMenu.innerHTML = `
|
hamburgerMenu.innerHTML = `
|
||||||
<div class="hamburger-icon">☰</div>
|
<div class="hamburger-icon">☰</div>
|
||||||
<div class="hamburger-content">
|
<div class="hamburger-content">
|
||||||
@ -552,13 +546,12 @@ function createHamburgerMenu() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const hamburgerEditButton = hamburgerMenu.querySelector('#hamburgerEditButton');
|
const hamburgerEditButton = hamburgerMenu.querySelector('#hamburgerEditButton');
|
||||||
if (hamburgerEditButton) {
|
if (hamburgerEditButton) {
|
||||||
hamburgerEditButton.addEventListener('click', toggleHamburgerEditMode);
|
hamburgerEditButton.addEventListener('click', toggleHamburgerEditMode);
|
||||||
} else {
|
|
||||||
console.error("Error: #hamburgerEditButton not found!");
|
|
||||||
}
|
}
|
||||||
// Add event listener for Escape key press
|
|
||||||
document.addEventListener('keydown', (event) => {
|
document.addEventListener('keydown', (event) => {
|
||||||
if (event.key === 'Escape') {
|
if (event.key === 'Escape') {
|
||||||
cancelHamburgerEdit();
|
cancelHamburgerEdit();
|
||||||
|
|||||||
@ -161,6 +161,32 @@ function addComment() {
|
|||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Show description tab by default
|
// Show description tab by default
|
||||||
showTab('description');
|
showTab('description');
|
||||||
|
|
||||||
|
// Add the auto-resize functionality here
|
||||||
|
// Auto-resize the description textarea to fit content
|
||||||
|
const descriptionTextarea = document.querySelector('textarea[data-field="description"]');
|
||||||
|
|
||||||
|
function autoResizeTextarea() {
|
||||||
|
// Reset height to auto to get the correct scrollHeight
|
||||||
|
descriptionTextarea.style.height = 'auto';
|
||||||
|
// Set the height to match the scrollHeight
|
||||||
|
descriptionTextarea.style.height = descriptionTextarea.scrollHeight + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial resize
|
||||||
|
autoResizeTextarea();
|
||||||
|
|
||||||
|
// Resize on input when in edit mode
|
||||||
|
descriptionTextarea.addEventListener('input', autoResizeTextarea);
|
||||||
|
|
||||||
|
// Also resize when edit mode is toggled
|
||||||
|
const originalToggleEditMode = window.toggleEditMode;
|
||||||
|
if (typeof originalToggleEditMode === 'function') {
|
||||||
|
window.toggleEditMode = function() {
|
||||||
|
originalToggleEditMode.apply(this, arguments);
|
||||||
|
setTimeout(autoResizeTextarea, 0);
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function showTab(tabName) {
|
function showTab(tabName) {
|
||||||
|
|||||||
13
ticket.php
13
ticket.php
@ -30,6 +30,17 @@ $ticket = $result->fetch_assoc();
|
|||||||
<script src="assets/js/dashboard.js"></script>
|
<script src="assets/js/dashboard.js"></script>
|
||||||
<script src="assets/js/ticket.js"></script>
|
<script src="assets/js/ticket.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
|
<script>
|
||||||
|
// Store ticket data in a global variable
|
||||||
|
window.ticketData = {
|
||||||
|
ticket_id: "<?php echo $ticket['ticket_id']; ?>",
|
||||||
|
title: "<?php echo htmlspecialchars($ticket['title']); ?>",
|
||||||
|
status: "<?php echo $ticket['status']; ?>",
|
||||||
|
priority: "<?php echo $ticket['priority']; ?>",
|
||||||
|
category: "<?php echo $ticket['category']; ?>",
|
||||||
|
type: "<?php echo $ticket['type']; ?>"
|
||||||
|
};
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="ticket-container" data-priority="<?php echo $ticket[
|
<div class="ticket-container" data-priority="<?php echo $ticket[
|
||||||
@ -55,6 +66,7 @@ $ticket = $result->fetch_assoc();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ticket-details">
|
<div class="ticket-details">
|
||||||
|
<!--
|
||||||
<div class="detail-group status-priority-row">
|
<div class="detail-group status-priority-row">
|
||||||
<div class="detail-quarter">
|
<div class="detail-quarter">
|
||||||
<label>Status</label>
|
<label>Status</label>
|
||||||
@ -120,6 +132,7 @@ $ticket = $result->fetch_assoc();
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
<div class="ticket-tabs">
|
<div class="ticket-tabs">
|
||||||
<button class="tab-btn active" onclick="showTab('description')">Description</button>
|
<button class="tab-btn active" onclick="showTab('description')">Description</button>
|
||||||
<button class="tab-btn" onclick="showTab('comments')">Comments</button>
|
<button class="tab-btn" onclick="showTab('comments')">Comments</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user