refactor(reports): remove atividades as default built-in tag

This commit is contained in:
Gabriel Menezes 2026-11-01 09:53:38 -04:00
parent fe1412de23
commit cc317e274b
5 changed files with 20 additions and 39 deletions

View file

@ -251,24 +251,6 @@ public class GenerateReportUseCase {
} }
} }
// Fallbacks para tags comuns se não foram explicitamente seções
if (!listSections.containsKey("atividades")) {
List<DocxReportEngine.TaskItem> allItems = new ArrayList<>();
for (Task t : taskList) {
long sec = calculateTaskSecondsInPeriod(t, user.getEmail(), startDt, endDt);
allItems.add(new DocxReportEngine.TaskItem(
t.getTitle(),
t.getFinishedAt() != null ? t.getFinishedAt().format(DATE_FORMATTER) : strEnd,
sec > 0 ? formatDuration(sec) : "",
formatStatus(t.getStatus()),
t.getCategory() != null ? t.getCategory().getName() : "",
t.getProject() != null ? t.getProject().getName() : "",
t.getDescription()
));
}
listSections.put("atividades", allItems);
}
// 5. Baixar o template do MinIO e gerar o documento preenchido // 5. Baixar o template do MinIO e gerar o documento preenchido
byte[] docxBytes; byte[] docxBytes;
try (InputStream templateStream = storageRepository.download(template.getStorageKey())) { try (InputStream templateStream = storageRepository.download(template.getStorageKey())) {

View file

@ -257,10 +257,9 @@ export const CreateTemplateModal: React.FC<CreateTemplateModalProps> = ({
<p className="font-bold text-brand">Tags Nativas Automáticas Disponíveis no Word:</p> <p className="font-bold text-brand">Tags Nativas Automáticas Disponíveis no Word:</p>
<p className="text-muted"> <p className="text-muted">
Você pode utilizar diretamente as tags{' '} Você pode utilizar diretamente as tags{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{atividades}}'}</code> (com todas as atividades realizadas no período),{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{nome}}'}</code> (usuário logado),{' '} <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{nome}}'}</code> (usuário logado),{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_inicio}}'}</code> e{' '} <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_inicio}}'}</code> e{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_fim}}'}</code> sem precisar cadastrar campos para elas. <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_fim}}'}</code> sem precisar cadastrar campos para elas. Para listagens de tarefas, cadastre uma seção do tipo <strong className="text-foreground">Listagem de Tarefas</strong> definindo a tag desejada.
</p> </p>
</div> </div>
</div> </div>

View file

@ -275,10 +275,9 @@ export const EditTemplateModal: React.FC<EditTemplateModalProps> = ({
<p className="font-bold text-brand">Tags Nativas Automáticas Disponíveis no Word:</p> <p className="font-bold text-brand">Tags Nativas Automáticas Disponíveis no Word:</p>
<p className="text-muted"> <p className="text-muted">
Você pode utilizar diretamente as tags{' '} Você pode utilizar diretamente as tags{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{atividades}}'}</code> (com todas as atividades realizadas no período),{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{nome}}'}</code> (usuário logado),{' '} <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{nome}}'}</code> (usuário logado),{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_inicio}}'}</code> e{' '} <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_inicio}}'}</code> e{' '}
<code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_fim}}'}</code> sem precisar cadastrar campos para elas. <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{data_fim}}'}</code> sem precisar cadastrar campos para elas. Para listagens de tarefas, cadastre uma seção do tipo <strong className="text-foreground">Listagem de Tarefas</strong> definindo a tag desejada.
</p> </p>
</div> </div>
</div> </div>

View file

@ -476,24 +476,26 @@ export const GenerateReportModal: React.FC<GenerateReportModalProps> = ({
</div> </div>
)} )}
{/* Listagens de Atividades e Tarefas Preenchidas Automaticamente */} {/* Listagens de Tarefas Configuradas no Modelo */}
<div className="p-4 rounded-2xl bg-surface-raised/40 border border-border-soft space-y-2.5"> {taskListSections.length > 0 && (
<div className="flex items-center justify-between"> <div className="p-4 rounded-2xl bg-surface-raised/40 border border-border-soft space-y-2.5">
<span className="text-xs font-bold text-foreground flex items-center gap-1.5"> <div className="flex items-center justify-between">
<CheckCircle2 className="w-4 h-4 text-emerald-500" /> <span className="text-xs font-bold text-foreground flex items-center gap-1.5">
Atividades Realizadas (Preenchimento Automático) <CheckCircle2 className="w-4 h-4 text-emerald-500" />
</span> Listagens de Tarefas Configuradas
<span className="text-[10px] text-muted font-mono font-semibold">{'{{atividades}}'}</span> </span>
</div> <span className="text-[10px] text-muted font-mono font-semibold">
{taskListSections.map((s) => `{{${s.sectionKey}}}`).join(', ')}
</span>
</div>
<p className="text-[11px] text-muted leading-relaxed"> <p className="text-[11px] text-muted leading-relaxed">
O BeeTask busca todas as atividades que você trabalhou ou concluiu no período de vigência selecionado e preenche automaticamente as tabelas e listas no Word sob a tag <code className="text-brand font-bold bg-brand/10 px-1 py-0.5 rounded">{'{{atividades}}'}</code>. O BeeTask busca as tarefas trabalhadas ou concluídas no período de acordo com as seções e filtros configurados neste modelo.
</p> </p>
{taskListSections.length > 0 && (
<div className="pt-2 border-t border-border-soft/60 space-y-1.5"> <div className="pt-2 border-t border-border-soft/60 space-y-1.5">
<span className="text-[10px] font-bold text-muted uppercase tracking-wider block"> <span className="text-[10px] font-bold text-muted uppercase tracking-wider block">
Listagens filtradas por categoria configuradas no modelo: Seções de listagem presentes no relatório:
</span> </span>
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2">
{taskListSections.map((sec) => ( {taskListSections.map((sec) => (
@ -511,8 +513,8 @@ export const GenerateReportModal: React.FC<GenerateReportModalProps> = ({
))} ))}
</div> </div>
</div> </div>
)} </div>
</div> )}
</form> </form>
{/* Footer */} {/* Footer */}

View file

@ -97,7 +97,6 @@ export const ReportsPage: React.FC = () => {
} }
const standardTags = [ const standardTags = [
{ tag: '{{atividades}}', desc: 'Lista de todas as atividades/tarefas trabalhadas ou concluídas no período' },
{ tag: '{{nome}}', desc: 'Nome do colaborador (pega automaticamente do usuário logado)' }, { tag: '{{nome}}', desc: 'Nome do colaborador (pega automaticamente do usuário logado)' },
{ tag: '{{data_inicio}}', desc: 'Data inicial do período escolhido (ex: 01/10/2026)' }, { tag: '{{data_inicio}}', desc: 'Data inicial do período escolhido (ex: 01/10/2026)' },
{ tag: '{{data_fim}}', desc: 'Data final do período escolhido (ex: 31/10/2026)' }, { tag: '{{data_fim}}', desc: 'Data final do período escolhido (ex: 31/10/2026)' },