From c7dabebe172b95e057dcced8004196b303124033 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Thu, 28 May 2026 17:42:37 +0000 Subject: [PATCH] =?UTF-8?q?Adiciona=20bot=C3=A3o=20Duplicar=20nos=20modelo?= =?UTF-8?q?s=20de=20relat=C3=B3rio=20na=20aba=20de=20gerenciamento=20de=20?= =?UTF-8?q?templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/app.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/public/app.js b/public/app.js index 84b5d20..c921bda 100644 --- a/public/app.js +++ b/public/app.js @@ -2547,13 +2547,14 @@ const initApp = () => {
${t.nome}
${t.periodicidade} • ${t.finalidade || 'Sem finalidade'}
+
`).join(''); - // Eventos de clique na lista para editar/deletar + // Eventos de clique na lista para editar/deletar/duplicar templatesList.querySelectorAll('.obs-item').forEach(item => { item.addEventListener('click', (e) => { if (e.target.tagName === 'BUTTON') return; @@ -2563,6 +2564,21 @@ const initApp = () => { }); }); + templatesList.querySelectorAll('.template-duplicate-btn').forEach(btn => { + btn.addEventListener('click', (e) => { + e.stopPropagation(); + const id = btn.dataset.id; + const template = allTemplates.find(t => t.id == id); + if (template) { + fillTemplateForm(template); + templateFormId.value = ''; + templateFormNome.value = template.nome + ' (Cópia)'; + templateFormTitle.textContent = 'Duplicar Modelo'; + if (templateFormNome) templateFormNome.focus(); + } + }); + }); + templatesList.querySelectorAll('.template-edit-btn').forEach(btn => { btn.addEventListener('click', (e) => { e.stopPropagation();