Fix template priority field name and improve admin form styling

Template fixes:
- Fixed column name mismatch: use 'default_priority' instead of 'priority'
- Updated manage_templates.php API INSERT and UPDATE queries
- Updated TemplatesView.php to use correct field name in PHP and JS

CSS improvements for .setting-row:
- Better flexbox layout with flex-wrap for responsiveness
- Proper styling for inputs, selects, and textareas in setting rows
- Labels now align to top (better for textareas)
- Added focus states with amber glow effect
- Improved checkbox styling within setting rows
- Better mobile responsive behavior (stacked layout)
- Updated cache version to 20260126a

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-26 11:21:29 -05:00
parent 8b89114607
commit b1013392e6
6 changed files with 75 additions and 13 deletions

View File

@@ -81,7 +81,7 @@ try {
$data = json_decode(file_get_contents('php://input'), true); $data = json_decode(file_get_contents('php://input'), true);
$stmt = $conn->prepare("INSERT INTO ticket_templates $stmt = $conn->prepare("INSERT INTO ticket_templates
(template_name, title_template, description_template, category, type, priority, is_active) (template_name, title_template, description_template, category, type, default_priority, is_active)
VALUES (?, ?, ?, ?, ?, ?, ?)"); VALUES (?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param('sssssii', $stmt->bind_param('sssssii',
$data['template_name'], $data['template_name'],
@@ -89,7 +89,7 @@ try {
$data['description_template'], $data['description_template'],
$data['category'], $data['category'],
$data['type'], $data['type'],
$data['priority'] ?? 4, $data['default_priority'] ?? 4,
$data['is_active'] ?? 1 $data['is_active'] ?? 1
); );
@@ -111,7 +111,7 @@ try {
$stmt = $conn->prepare("UPDATE ticket_templates SET $stmt = $conn->prepare("UPDATE ticket_templates SET
template_name = ?, title_template = ?, description_template = ?, template_name = ?, title_template = ?, description_template = ?,
category = ?, type = ?, priority = ?, is_active = ? category = ?, type = ?, default_priority = ?, is_active = ?
WHERE template_id = ?"); WHERE template_id = ?");
$stmt->bind_param('sssssiii', $stmt->bind_param('sssssiii',
$data['template_name'], $data['template_name'],
@@ -119,7 +119,7 @@ try {
$data['description_template'], $data['description_template'],
$data['category'], $data['category'],
$data['type'], $data['type'],
$data['priority'] ?? 4, $data['default_priority'] ?? 4,
$data['is_active'] ?? 1, $data['is_active'] ?? 1,
$id $id
); );

View File

@@ -2595,8 +2595,9 @@ body.dark-mode select option {
.setting-row { .setting-row {
margin-bottom: 1rem; margin-bottom: 1rem;
display: flex; display: flex;
align-items: center; flex-wrap: wrap;
gap: 1rem; align-items: flex-start;
gap: 0.5rem 1rem;
} }
.setting-row:last-child { .setting-row:last-child {
@@ -2607,6 +2608,55 @@ body.dark-mode select option {
color: var(--terminal-green); color: var(--terminal-green);
font-family: var(--font-mono); font-family: var(--font-mono);
min-width: 180px; min-width: 180px;
padding-top: 0.5rem;
flex-shrink: 0;
}
/* Form elements within setting rows */
.setting-row input[type="text"],
.setting-row input[type="number"],
.setting-row input[type="date"],
.setting-row input[type="time"],
.setting-row select,
.setting-row textarea {
flex: 1;
min-width: 200px;
font-family: var(--font-mono);
background: var(--bg-primary);
color: var(--terminal-green);
border: 2px solid var(--terminal-green);
padding: 0.5rem;
}
.setting-row input:focus,
.setting-row select:focus,
.setting-row textarea:focus {
outline: none;
border-color: var(--terminal-amber);
box-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
}
.setting-row textarea {
resize: vertical;
min-height: 100px;
}
/* Checkbox in setting row */
.setting-row label:has(input[type="checkbox"]) {
display: flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
padding-top: 0;
}
.setting-row input[type="checkbox"] {
flex: none;
min-width: auto;
width: 1.2rem;
height: 1.2rem;
cursor: pointer;
accent-color: var(--terminal-green);
} }
.setting-select { .setting-select {
@@ -2757,11 +2807,23 @@ body.dark-mode select option {
.setting-row { .setting-row {
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: stretch;
} }
.setting-row label { .setting-row label {
min-width: auto; min-width: auto;
padding-top: 0;
margin-bottom: 0.25rem;
}
.setting-row input[type="text"],
.setting-row input[type="number"],
.setting-row input[type="date"],
.setting-row input[type="time"],
.setting-row select,
.setting-row textarea {
width: 100%;
min-width: auto;
} }
.setting-select { .setting-select {

View File

@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create New Ticket</title> <title>Create New Ticket</title>
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png"> <link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260124e"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260126a">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css?v=20260124e"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css?v=20260124e">
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260124e"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260124e"></script>
<script> <script>

View File

@@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ticket Dashboard</title> <title>Ticket Dashboard</title>
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png"> <link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260124e"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260126a">
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260124e"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260124e"></script>

View File

@@ -46,7 +46,7 @@ function formatDetails($details, $actionType) {
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ticket #<?php echo $ticket['ticket_id']; ?></title> <title>Ticket #<?php echo $ticket['ticket_id']; ?></title>
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png"> <link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260124e"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260126a">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css?v=20260124e"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css?v=20260124e">
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260124e"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260124e"></script>

View File

@@ -72,7 +72,7 @@
<td><strong><?php echo htmlspecialchars($tpl['template_name']); ?></strong></td> <td><strong><?php echo htmlspecialchars($tpl['template_name']); ?></strong></td>
<td><?php echo htmlspecialchars($tpl['category'] ?? 'Any'); ?></td> <td><?php echo htmlspecialchars($tpl['category'] ?? 'Any'); ?></td>
<td><?php echo htmlspecialchars($tpl['type'] ?? 'Any'); ?></td> <td><?php echo htmlspecialchars($tpl['type'] ?? 'Any'); ?></td>
<td>P<?php echo $tpl['priority'] ?? '4'; ?></td> <td>P<?php echo $tpl['default_priority'] ?? '4'; ?></td>
<td> <td>
<span style="color: <?php echo ($tpl['is_active'] ?? 1) ? 'var(--status-open)' : 'var(--status-closed)'; ?>;"> <span style="color: <?php echo ($tpl['is_active'] ?? 1) ? 'var(--status-open)' : 'var(--status-closed)'; ?>;">
<?php echo ($tpl['is_active'] ?? 1) ? 'Active' : 'Inactive'; ?> <?php echo ($tpl['is_active'] ?? 1) ? 'Active' : 'Inactive'; ?>
@@ -185,7 +185,7 @@
description_template: document.getElementById('description_template').value, description_template: document.getElementById('description_template').value,
category: document.getElementById('category').value || null, category: document.getElementById('category').value || null,
type: document.getElementById('type').value || null, type: document.getElementById('type').value || null,
priority: parseInt(document.getElementById('priority').value) || 4, default_priority: parseInt(document.getElementById('priority').value) || 4,
is_active: document.getElementById('is_active').checked ? 1 : 0 is_active: document.getElementById('is_active').checked ? 1 : 0
}; };
@@ -220,7 +220,7 @@
document.getElementById('description_template').value = tpl.description_template || ''; document.getElementById('description_template').value = tpl.description_template || '';
document.getElementById('category').value = tpl.category || ''; document.getElementById('category').value = tpl.category || '';
document.getElementById('type').value = tpl.type || ''; document.getElementById('type').value = tpl.type || '';
document.getElementById('priority').value = tpl.priority || 4; document.getElementById('priority').value = tpl.default_priority || 4;
document.getElementById('is_active').checked = (tpl.is_active ?? 1) == 1; document.getElementById('is_active').checked = (tpl.is_active ?? 1) == 1;
document.getElementById('modalTitle').textContent = 'Edit Template'; document.getElementById('modalTitle').textContent = 'Edit Template';
document.getElementById('templateModal').style.display = 'flex'; document.getElementById('templateModal').style.display = 'flex';