From 092764eb98962b5d76c25a80be4c7982d401a9e2 Mon Sep 17 00:00:00 2001 From: Junior-Shyko Date: Wed, 14 Oct 2026 14:33:28 -0300 Subject: [PATCH] #601 - add tags PROJETO FINALISTICO no documento --- app/Services/Documents/DocumentPlaceholderResolver.php | 1 + resources/js/Components/DocumentViewerDialog.vue | 1 + resources/js/Schemas/Config/documentConfig.js | 1 + tests/Feature/Document/DocumentTest.php | 10 ++++++---- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Services/Documents/DocumentPlaceholderResolver.php b/app/Services/Documents/DocumentPlaceholderResolver.php index a0be4aed..a6d62533 100644 --- a/app/Services/Documents/DocumentPlaceholderResolver.php +++ b/app/Services/Documents/DocumentPlaceholderResolver.php @@ -75,6 +75,7 @@ public function resolve(Document $document): string '[project_name]' => $document->project?->title_project ?? '', '[allocation_code]' => $budgetAllocation?->allocation_code ?? '', '[allocation_number]' => $budgetAllocation?->allocation_number ?? '', + '[finalistic_project]' => $budgetAllocation?->finalistic_project ?? '', '[notice_installment_number]' => $currentInstallment?->notice_installment_number ?? '', '[bank]' => $opening?->bank ?? '', '[account_type]' => $opening?->account_type?->label() ?? '', diff --git a/resources/js/Components/DocumentViewerDialog.vue b/resources/js/Components/DocumentViewerDialog.vue index 497b7d02..e04c0786 100644 --- a/resources/js/Components/DocumentViewerDialog.vue +++ b/resources/js/Components/DocumentViewerDialog.vue @@ -47,6 +47,7 @@ const resolvedBody = computed(() => { '[project_name]': project.title_project ?? 'sem projeto', '[allocation_code]': budgetAllocation?.allocation_code ?? 'sem dotação orçamentária', '[allocation_number]': budgetAllocation?.allocation_number ?? 'sem dotação orçamentária', + '[finalistic_project]': budgetAllocation?.finalistic_project ?? 'sem projeto finalístico', }; return Object.entries(replacements).reduce( diff --git a/resources/js/Schemas/Config/documentConfig.js b/resources/js/Schemas/Config/documentConfig.js index e3c1aae4..bca5f8d2 100644 --- a/resources/js/Schemas/Config/documentConfig.js +++ b/resources/js/Schemas/Config/documentConfig.js @@ -57,6 +57,7 @@ const placeHoldersDocsSchema = [ { label: 'Nome do Fiscal', value: 'fiscal_name' }, { label: 'Código da dotação', value: 'allocation_code' }, { label: 'Número completo da dotação', value: 'allocation_number' }, + { label: 'Projeto Finalístico', value: 'finalistic_project' }, { label: 'Banco do Agente', value: 'bank' }, { label: 'Tipo de Conta do Agente', value: 'account_type' }, { label: 'Agência do Agente', value: 'branch' }, diff --git a/tests/Feature/Document/DocumentTest.php b/tests/Feature/Document/DocumentTest.php index 5b05f2b3..50bb5249 100644 --- a/tests/Feature/Document/DocumentTest.php +++ b/tests/Feature/Document/DocumentTest.php @@ -557,19 +557,20 @@ public function test_resolver_replaces_allocation_using_the_agent_macroregion_be 'planning_macroregion' => '01 – CARIRI', 'allocation_code' => '1001789', 'allocation_number' => '27200004.13.392.131.11687.01.339048.2.7199200000.1', + 'finalistic_project' => '272040102920251 - CAPITAL', ]); $document = Document::factory()->create([ 'project_id' => $project->id, 'notice_id' => $notice->id, 'type' => DocumentType::DO, 'phase' => DocumentPhase::BUDGET, - 'body' => '[allocation_code] / [allocation_number]', + 'body' => '[allocation_code] / [allocation_number] / [finalistic_project]', ]); $resolvedBody = app(DocumentPlaceholderResolver::class)->resolve($document); $this->assertSame( - $allocation->allocation_code.' / '.$allocation->allocation_number, + $allocation->allocation_code.' / '.$allocation->allocation_number.' / '.$allocation->finalistic_project, $resolvedBody ); } @@ -591,6 +592,7 @@ public function test_resolver_uses_the_allocation_linked_to_the_current_cycle(): 'notice_id' => $notice->id, 'allocation_code' => 'CURRENT-CODE', 'allocation_number' => 'CURRENT-NUMBER', + 'finalistic_project' => 'CURRENT-FINALISTIC-PROJECT', ]); Installment::factory()->create([ 'budget_id' => $budget->id, @@ -607,12 +609,12 @@ public function test_resolver_uses_the_allocation_linked_to_the_current_cycle(): 'notice_id' => $notice->id, 'type' => DocumentType::DO, 'phase' => DocumentPhase::BUDGET, - 'body' => '[allocation_code] / [allocation_number]', + 'body' => '[allocation_code] / [allocation_number] / [finalistic_project]', ]); $resolvedBody = app(DocumentPlaceholderResolver::class)->resolve($document); - $this->assertSame('CURRENT-CODE / CURRENT-NUMBER', $resolvedBody); + $this->assertSame('CURRENT-CODE / CURRENT-NUMBER / CURRENT-FINALISTIC-PROJECT', $resolvedBody); } public function test_resolver_does_not_guess_between_multiple_unmatched_allocations(): void