From 5eac7782a12c8fa084412837d72490b51819a67a Mon Sep 17 00:00:00 2001 From: "ewerton.almeida" Date: Tue, 29 Jul 2025 17:09:58 -0300 Subject: [PATCH] =?UTF-8?q?Melhorias=20no=20upload=20de=20faturas:=20overl?= =?UTF-8?q?ay=20com=20bloqueio=20visual=20e=20barra=20de=20progresso,=20va?= =?UTF-8?q?lida=C3=A7=C3=B5es=20por=20status=20no=20backend,=20feedback=20?= =?UTF-8?q?final=20com=20contagem=20de=20duplicados,=20impedimento=20de=20?= =?UTF-8?q?novos=20envios=20at=C3=A9=20rein=C3=ADcio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 5 +- app/processor.py | 5 +- app/templates/upload.html | 371 +++++++++++++++++++++++++++++++------- 3 files changed, 312 insertions(+), 69 deletions(-) diff --git a/app/main.py b/app/main.py index 2dd3e77..393f33b 100644 --- a/app/main.py +++ b/app/main.py @@ -97,8 +97,11 @@ async def get_status(): "nome": nome, "status": status.get("status", "Erro"), "mensagem": status.get("mensagem", "---"), - "tempo": status.get("tempo", "---") # ✅ AQUI + "tempo": status.get("tempo", "---"), + "tamanho": f"{status.get('tamanho', 0)} KB", + "data": status.get("data", "") }) + else: files.append({ "nome": nome, diff --git a/app/processor.py b/app/processor.py index f01c0b9..27a20d0 100644 --- a/app/processor.py +++ b/app/processor.py @@ -108,8 +108,11 @@ async def processar_em_lote(): status_arquivos[item['nome_original']] = { "status": resultado.get("status"), "mensagem": resultado.get("mensagem", ""), - "tempo": resultado.get("tempo", "---") + "tempo": resultado.get("tempo", "---"), + "tamanho": os.path.getsize(item['caminho_pdf']) // 1024, # tamanho em KB + "data": time.strftime("%d/%m/%Y", time.localtime(os.path.getmtime(item['caminho_pdf']))) } + resultados.append(status_arquivos[item['nome_original']]) except Exception as e: status_arquivos[item['nome_original']] = { diff --git a/app/templates/upload.html b/app/templates/upload.html index f7f730b..c15782f 100755 --- a/app/templates/upload.html +++ b/app/templates/upload.html @@ -8,100 +8,184 @@

Arraste faturas em PDF aqui ou clique para selecionar

Apenas PDFs textuais (não escaneados)


- + +
- + {% if app_env != "producao" %} {% endif %}
- - - - - - - - - - - - - - -
ArquivoStatusMensagemTempo
Nenhum arquivo selecionado.
+ +
+ @@ -302,4 +529,14 @@ window.addEventListener("drop", e => { + + {% endblock %} \ No newline at end of file