diff --git a/views/CreateTicketView.php b/views/CreateTicketView.php index c668cce..7714d4c 100644 --- a/views/CreateTicketView.php +++ b/views/CreateTicketView.php @@ -344,12 +344,23 @@ include __DIR__ . '/layout_header.php'; var existingTitle = (document.getElementById('title').value || '').trim(); var existingDesc = (document.getElementById('description').value || '').trim(); if (existingTitle || existingDesc) { - if (!confirm('Applying this template will overwrite your current title and description. Continue?')) { - document.getElementById('templateSelect').value = ''; - return; - } + showConfirmModal( + 'Overwrite content?', + 'Applying this template will overwrite your current title and description. Continue?', + 'warning', + applyTemplate, + function () { document.getElementById('templateSelect').value = ''; } + ); + return; } + applyTemplate(); + } + + function applyTemplate() { + var tplId = document.getElementById('templateSelect').value; + if (!tplId) return; + lt.api.get('/api/get_template.php?template_id=' + encodeURIComponent(tplId)) .then(function (data) { if (!data.success || !data.template) {