Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Services/Documents/DocumentPlaceholderResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ?? '',
Expand Down
1 change: 1 addition & 0 deletions resources/js/Components/DocumentViewerDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions resources/js/Schemas/Config/documentConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down
10 changes: 6 additions & 4 deletions tests/Feature/Document/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
Expand All @@ -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,
Expand All @@ -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
Expand Down
Loading