Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d7b70459d | ||
|
|
bd5166bd11 |
@@ -19,13 +19,15 @@ class SimulationTaxParameterController extends Controller
|
||||
$input['period_start'],
|
||||
$input['period_end'],
|
||||
$input['context'] ?? [],
|
||||
$input['component'] === 'IVA',
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'component' => $input['component'],
|
||||
'period' => ['start' => $input['period_start'], 'end' => $input['period_end']],
|
||||
'assumptions' => $input['context'] ?? [],
|
||||
'parameters' => $data,
|
||||
'parameters' => $input['component'] === 'IVA' ? $data['parameters'] : $data,
|
||||
'diagnostics' => $input['component'] === 'IVA' ? $data['diagnostics'] : [],
|
||||
])->header('Cache-Control', 'no-store');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ResolveSimulationTaxParametersRequest extends FormRequest
|
||||
'component' => ['required', 'in:IRPC,IVA,ISPC,IRPS,INSS,RETENCOES,DIREITOS_ADUANEIROS,ICE'],
|
||||
'period_start' => ['required', 'date_format:Y-m-d'],
|
||||
'period_end' => ['required', 'date_format:Y-m-d', 'after_or_equal:period_start'],
|
||||
'context' => ['sometimes', 'array:fiscal_periodicity,fiscal_operation,fiscal_residency_assessment,fiscal_residency_country,fiscal_income_category,fiscal_establishments,fiscal_documentation,fiscal_customs_code,fiscal_vat_refund_state'],
|
||||
'context' => ['sometimes', 'array:currency,fiscal_periodicity,fiscal_operation,fiscal_residency_assessment,fiscal_residency_country,fiscal_income_category,fiscal_establishments,fiscal_documentation,fiscal_customs_code,fiscal_vat_refund_state'],
|
||||
'context.*' => ['string', 'max:160'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class StoreSimulationFormDraftRequest extends FormRequest
|
||||
'environmental_category', 'community_benefits', 'tax_calculation', 'fiscal_scenario_mode', 'base', 'rate', 'reduction',
|
||||
'sales_taxable', 'sales_exempt', 'sales_zero_rate', 'exports', 'deductible_costs', 'non_deductible_costs',
|
||||
'carried_losses', 'payroll', 'outbound_payments', 'imports', 'claimed_benefits', 'reference_date',
|
||||
'fiscal_period', 'fiscal_periodicity', 'fiscal_month', 'fiscal_quarter', 'fiscal_reference_date', 'irps_salary_view', 'fiscal_component', 'fiscal_income_category', 'fiscal_residency_assessment',
|
||||
'fiscal_currency', 'fiscal_period', 'fiscal_periodicity', 'fiscal_month', 'fiscal_quarter', 'fiscal_reference_date', 'irps_salary_view', 'fiscal_component', 'fiscal_income_category', 'fiscal_residency_assessment',
|
||||
'fiscal_operation', 'fiscal_activity', 'fiscal_establishments', 'fiscal_documentation',
|
||||
'fiscal_customs_code', 'fiscal_vat_refund_state',
|
||||
'offer_or_demand', 'opportunity_type', 'opportunity_type_other', 'opportunity_description',
|
||||
@@ -279,7 +279,7 @@ class StoreSimulationFormDraftRequest extends FormRequest
|
||||
'currency', 'funds_origin_countries', 'environmental_category', 'tax_calculation', 'fiscal_scenario_mode', 'offer_or_demand',
|
||||
'opportunity_type', 'confidentiality', 'publish_requested', 'terms_accepted', 'truth_declaration',
|
||||
'reuse_simulation', 'contact_authorisation', 'publication_authorisation', 'public_fields_confirmation', 'validation_acknowledged',
|
||||
'fiscal_period', 'fiscal_periodicity', 'fiscal_month', 'fiscal_quarter', 'fiscal_reference_date', 'irps_salary_view', 'fiscal_component', 'fiscal_income_category', 'fiscal_residency_assessment', 'fiscal_operation',
|
||||
'fiscal_currency', 'fiscal_period', 'fiscal_periodicity', 'fiscal_month', 'fiscal_quarter', 'fiscal_reference_date', 'irps_salary_view', 'fiscal_component', 'fiscal_income_category', 'fiscal_residency_assessment', 'fiscal_operation',
|
||||
'fiscal_documentation', 'fiscal_vat_refund_state'],
|
||||
'personal_snapshot.selection_labels' => ['person_type', 'investor_origin', 'tax_residency_country', 'fiscal_residency_country', 'entity_stage', 'legal_form', 'preferred_channel'],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
/** Explains a failed selection; never changes answers, eligibility or calculation. */
|
||||
final class SimulationIvaDiagnostics
|
||||
{
|
||||
public function explain(array $versions, string $start, string $end, array $context): array
|
||||
{
|
||||
$diagnostics = [];
|
||||
foreach ($versions as $version) {
|
||||
$parameter = $version['parameters']['IVA_GENERAL_RATE'] ?? null;
|
||||
if (! is_array($parameter)) {
|
||||
continue;
|
||||
}
|
||||
$issues = [];
|
||||
$add = function (string $category, ?string $field, string $label, mixed $received, string $expected, string $message) use (&$issues): void {
|
||||
$issues[] = compact('category', 'field', 'label', 'received', 'expected', 'message');
|
||||
};
|
||||
if ($start < $version['valid_from'] || ($version['valid_until'] !== null && $end > $version['valid_until'])) {
|
||||
$add('period_unavailable', 'fiscal_period', 'Período', "$start a $end", $version['valid_from'].' a '.($version['valid_until'] ?? 'sem data final indicada'), 'Esta versão da regra não abrange todo o período seleccionado. Não altere a data real da operação para obter um resultado.');
|
||||
}
|
||||
foreach ($parameter['conditions'] ?? [] as $key => $expected) {
|
||||
$received = $context[$key] ?? null;
|
||||
if ($received === $expected) {
|
||||
continue;
|
||||
}
|
||||
if ($key === 'currency') {
|
||||
$category = $received === null || $received === '' ? 'missing_field' : (preg_match('/^[A-Z]{3}$/D', $received) ? 'out_of_scope' : 'invalid_value');
|
||||
$add($category, 'fiscal_currency', 'Moeda', $received, $expected, $category === 'missing_field' ? 'Indique a moeda da operação.' : 'Esta versão aceita apenas '.$expected.'. Reveja a moeda ou utilize um cálculo adequado à operação; a resposta não foi alterada.');
|
||||
} elseif ($key === 'operation' && ! array_key_exists('operation', $context) && $expected === 'internal_general_net' && in_array($context['fiscal_operation'] ?? null, ['import', 'export', 'non_resident', 'refund'], true)) {
|
||||
$add('out_of_scope', 'fiscal_operation', 'Operação', $context['fiscal_operation'], 'Operação interna à taxa geral, sobre base líquida já apurada', 'A operação declarada está excluída desta versão. Utilize um cálculo adequado à operação; não altere a resposta para obter um resultado.');
|
||||
} elseif ($key === 'operation' && ! array_key_exists('operation', $context)) {
|
||||
$add('system_configuration', 'fiscal_operation', 'Operação', $context['fiscal_operation'] ?? null, $expected === 'internal_general_net' ? 'Operação interna à taxa geral, sobre base líquida já apurada' : $expected, 'Limitação de integração do sistema: esta consulta não comunica o enquadramento específico exigido pela versão. A resposta genérica não permite inferi-lo. Utilize o formulário IVA — taxa geral, com declaração explícita do âmbito; não altere respostas para forçar compatibilidade.');
|
||||
} elseif ($key === 'operation') {
|
||||
$add($received === null || $received === '' ? 'missing_field' : 'out_of_scope', 'fiscal_operation', 'Operação', $received, $expected === 'internal_general_net' ? 'Operação interna à taxa geral, sobre base líquida já apurada' : $expected, 'A operação não está abrangida por esta versão; utilize um cálculo adequado à operação declarada.');
|
||||
} else {
|
||||
$add('system_configuration', null, 'Configuração da regra', null, 'Condições publicadas ligadas a campos deste formulário', 'O sistema não consegue relacionar todas as condições desta versão com o formulário. Não é uma falha das suas respostas.');
|
||||
}
|
||||
}
|
||||
if (! SimulationFiscalSourceAcceptance::eligible($version['source'] ?? [], $version['source_sha256'] ?? null)
|
||||
|| ($version['source_version_no'] ?? null) !== ($version['source']['version_no'] ?? null)
|
||||
|| ($version['rule_definition']['language'] ?? null) !== 'investmoz.tax.v1') {
|
||||
$add('system_configuration', null, 'Regra', null, 'Versão publicada com fonte e configuração coerentes', 'A configuração ou a fonte da regra não permite resolver este parâmetro. Não altere as respostas; é necessária correcção do sistema.');
|
||||
}
|
||||
if ($issues !== []) {
|
||||
$source = array_intersect_key($version['source'] ?? [], array_flip(['title', 'diploma', 'article', 'url']));
|
||||
$diagnostics[] = ['label' => 'IVA — taxa geral', 'rule_version' => $version['rule_version'], 'validity' => ['start' => $version['valid_from'], 'end' => $version['valid_until']], 'source' => $source, 'issues' => $issues];
|
||||
}
|
||||
}
|
||||
|
||||
return $diagnostics;
|
||||
}
|
||||
}
|
||||
@@ -53,9 +53,9 @@ final class SimulationTaxParameterResolver
|
||||
* never executes a tax formula and requires each parameter to declare context.
|
||||
*
|
||||
* @param array<string,string> $context
|
||||
* @return list<array<string,mixed>>
|
||||
* @return list<array<string,mixed>>|array{parameters:list<array<string,mixed>>,diagnostics:list<array<string,mixed>>}
|
||||
*/
|
||||
public function resolvePublishedForPeriod(string $component, string $periodStart, string $periodEnd, array $context): array
|
||||
public function resolvePublishedForPeriod(string $component, string $periodStart, string $periodEnd, array $context, bool $diagnostics = false): array
|
||||
{
|
||||
$start = $this->date($periodStart);
|
||||
$end = $this->date($periodEnd);
|
||||
@@ -67,14 +67,14 @@ final class SimulationTaxParameterResolver
|
||||
->join('investment_legal_sources as source', 'source.id', '=', 'rule.legal_source_id')
|
||||
->where('rule.component', $component)
|
||||
->where('rule.status', 'published')
|
||||
->whereDate('rule.valid_from', '<=', $periodEnd)
|
||||
->where(fn ($query) => $query->whereNull('rule.valid_until')->orWhereDate('rule.valid_until', '>=', $periodStart))
|
||||
->when(! $diagnostics, fn ($query) => $query->whereDate('rule.valid_from', '<=', $periodEnd)
|
||||
->where(fn ($query) => $query->whereNull('rule.valid_until')->orWhereDate('rule.valid_until', '>=', $periodStart)))
|
||||
->where(fn ($query) => $query->where('source.validation_status', 'validated')->orWhere(fn ($fiscal) => $fiscal->where('source.validation_status', 'pending')->where('source.fiscal_acceptance->scope', 'fiscal_parameters')
|
||||
->where('source.fiscal_acceptance->basis', 'Tempo-official-sources-20261008')
|
||||
->whereRaw("source.fiscal_acceptance->>'sha256'=rule.source_sha256")))
|
||||
->whereColumn('source.version_no', 'rule.source_version_no')
|
||||
->whereDate('source.valid_from', '<=', $periodStart)
|
||||
->where(fn ($query) => $query->whereNull('source.valid_until')->orWhereDate('source.valid_until', '>=', $periodEnd))
|
||||
->when(! $diagnostics, fn ($query) => $query->whereDate('source.valid_from', '<=', $periodStart)
|
||||
->where(fn ($query) => $query->whereNull('source.valid_until')->orWhereDate('source.valid_until', '>=', $periodEnd)))
|
||||
->select([
|
||||
'rule.id', 'rule.rule_code', 'rule.rule_version', 'rule.component', 'rule.scope_key',
|
||||
'rule.valid_from', 'rule.valid_until', 'rule.parameters', 'rule.rule_definition',
|
||||
@@ -121,7 +121,11 @@ final class SimulationTaxParameterResolver
|
||||
];
|
||||
})->all());
|
||||
|
||||
return $this->resolveAvailableParameters($versions, $component, $periodStart, $periodEnd, $context);
|
||||
$parameters = $this->resolveAvailableParameters($versions, $component, $periodStart, $periodEnd, $context);
|
||||
|
||||
$resolvedIva = array_filter($parameters, fn (array $parameter): bool => $parameter['parameter_code'] === 'IVA_GENERAL_RATE' && $parameter['status'] === 'resolved');
|
||||
|
||||
return $diagnostics ? ['parameters' => $parameters, 'diagnostics' => $resolvedIva !== [] ? [] : (new SimulationIvaDiagnostics)->explain($versions, $periodStart, $periodEnd, $context)] : $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -739,5 +739,497 @@
|
||||
"fiscal_acceptance_column": true,
|
||||
"active_database_changed": false
|
||||
}
|
||||
},
|
||||
"authorised_fiscal_rollout_execution_20261021": {
|
||||
"recorded_utc": "2026-10-21T10:57:04.072315+00:00",
|
||||
"authorisation": "Tempo authorised incorporating 4a4d1212 and the remaining source/rule registration, publication and consumer activation in current conversation",
|
||||
"integrated_delta": "4a4d1212751726da6a71d465b3ea2266e720cf28",
|
||||
"integration_completed": true,
|
||||
"served_revision": {
|
||||
"commit": "d3fe8a02ec7f5dcd01984c4f4a1eba18b5a0cf19",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-21T10:48:46.529930+00:00",
|
||||
"manifest_sha256": "f417509cfa060240801c6a956a787a90d0e283c3c08e77b5be655d63394a4cb9"
|
||||
},
|
||||
"team_merge": "d3fe8a02 includes 4a4d1212; fiscal files unchanged; additional team navigation/presentation changes preserved",
|
||||
"backup_restore": {
|
||||
"utc": "2026-10-21T10:43:03.077516+00:00",
|
||||
"source_database": "teste_investidor",
|
||||
"served_commit": "226fd308dd45d2805ef4678b20ca4398d7fef6c6",
|
||||
"backup_directory": "/var/backups/investmoz/iva-rollout-20261021_104253",
|
||||
"dump_sha256": "b37bf4aad0abd839bc81d70adf802535ad7738fabe75fda61d74f39dfc11e74b",
|
||||
"dump_bytes": 4584693,
|
||||
"environment_backup_sha256": "537eff52f0f28b83ccc56bf9a9b85c2d8fca1da2f678c30b929b46c67c09491b",
|
||||
"environment_path": "/var/www/html/teste-investidor.tempo.co.mz/.env",
|
||||
"restore_database": "iva_rollout_20261021_104253_test",
|
||||
"restore_database_public_connect": false,
|
||||
"restore_equal": true,
|
||||
"table_count": 171,
|
||||
"method": "Exported repeatable-read snapshot, custom pg_dump, isolated restore, all public table counts and canonical row hashes compared",
|
||||
"active_data_writes": false,
|
||||
"qa_fixture_imported": false
|
||||
},
|
||||
"schema_operation": {
|
||||
"utc": "2026-10-21T10:44:11.639087+00:00",
|
||||
"operation": "Explicit authenticated destination schema application of reviewed QA DDL; QA migration not executed or weakened",
|
||||
"authorisation": "Tempo current conversation",
|
||||
"ssh_actor": "root",
|
||||
"database": "teste_investidor",
|
||||
"migration": "2026_10_21_130000_correct_fiscal_maintenance_actor_constraints",
|
||||
"migration_sha256": "66102bc9f2f546c9a76df5c3cc03b0bf14e0b9f7afbcf4b2c75db6a047b223f9",
|
||||
"ddl_sha256": "89125b27f5a8ce3855c9a4c0d8abe4e5821a298f54a8e084607212bc10956cd2",
|
||||
"backup_directory": "/var/backups/investmoz/iva-rollout-20261021_104253",
|
||||
"existing_rows_preserved": true,
|
||||
"unrelated_constraints_preserved": true,
|
||||
"qa_fixture_imported": false
|
||||
},
|
||||
"schema_contract": {
|
||||
"utc": "2026-10-21T10:46:20.853594+00:00",
|
||||
"target": "4a4d1212751726da6a71d465b3ea2266e720cf28",
|
||||
"reviewed_schema_delta": [
|
||||
"database/migrations/2026_10_21_130000_correct_fiscal_maintenance_actor_constraints.php"
|
||||
],
|
||||
"compatibility_decision": "Tempo authorised correction; reviewed destination DDL applied with restored backup and preserved existing rows. Consumer remains off. Executor retains no-migration policy.",
|
||||
"schema_contract_sha256": "4bf1ed9c79a795e55f83785efad54ed6b5beb4ac205644887a9a672a352917ae"
|
||||
},
|
||||
"consumer_availability": {
|
||||
"enabled": true,
|
||||
"coverage_start": "2026-01-01",
|
||||
"coverage_end": "2026-12-31",
|
||||
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
|
||||
},
|
||||
"rule_publication_completed": true,
|
||||
"consumer_activation_completed": true,
|
||||
"qa_fixture_imported": false,
|
||||
"accepted_calculation_export_proofs_repeated": false,
|
||||
"user_local_file_review_claimed": false,
|
||||
"legal_opinion_attributed_to_user": false,
|
||||
"authentication_note": "Normal portal login and MFA completed by user through loopback-only browser helper. Real account nala@tempo.co.mz (ID15) performed source registration and all governance stages through existing HTTPS endpoints. Cookies remained in memory; password/MFA not logged or saved. Synthetic QA session not used. Tool-created console not visible to user and Edge automation timeouts were limitations of tooling; browser helper access succeeded manually.",
|
||||
"real_rule": {
|
||||
"id": "01a15e1a-5338-700f-8a45-f87707d696a7",
|
||||
"rule_code": "IVA-GERAL-BASE-LIQUIDA",
|
||||
"rule_version": 1,
|
||||
"component": "IVA",
|
||||
"scope_key": "mz.internal-general-net.mzn",
|
||||
"valid_from": "2023-01-01",
|
||||
"valid_until": null,
|
||||
"status": "published",
|
||||
"rule_definition": {
|
||||
"nodes": {
|
||||
"base": {
|
||||
"op": "input",
|
||||
"key": "base_tributavel"
|
||||
},
|
||||
"rate": {
|
||||
"op": "parameter",
|
||||
"key": "iva_general_rate"
|
||||
},
|
||||
"hundred": {
|
||||
"op": "literal",
|
||||
"value": "100"
|
||||
},
|
||||
"product": {
|
||||
"op": "multiply",
|
||||
"args": [
|
||||
"base",
|
||||
"rate"
|
||||
]
|
||||
},
|
||||
"intermediate": {
|
||||
"op": "divide",
|
||||
"args": [
|
||||
"product",
|
||||
"hundred"
|
||||
]
|
||||
}
|
||||
},
|
||||
"result": "intermediate",
|
||||
"language": "investmoz.tax.v1"
|
||||
},
|
||||
"parameters": {
|
||||
"IVA_GENERAL_RATE": {
|
||||
"unit": "percent",
|
||||
"value": "16",
|
||||
"conditions": {
|
||||
"currency": "MZN",
|
||||
"operation": "internal_general_net"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rounding_policy": {
|
||||
"ties": "not_applicable_without_rounding",
|
||||
"method": "none",
|
||||
"status": "not_applied",
|
||||
"purpose": "operation_tax_not_payment",
|
||||
"evidence": "Orientação expressa Tempo: calcular este lote IVA sem arredondamento automático; ficha v1.2",
|
||||
"precision": "exact_decimal",
|
||||
"aggregation": "single_declared_taxable_base",
|
||||
"coverage_end": "2026-12-31",
|
||||
"coverage_start": "2026-01-01"
|
||||
},
|
||||
"legal_source_id": "01a15e1a-44a8-7316-82ba-008c432609ef",
|
||||
"source_version_no": 1,
|
||||
"source_sha256": "ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53",
|
||||
"author_id": 15,
|
||||
"reviewer_id": 15,
|
||||
"approver_id": 15,
|
||||
"publisher_id": 15,
|
||||
"review_evidence": "Manutenção fiscal autorizada pela Tempo nesta conversa; ficha v1.2 e fontes oficiais aceites em08/10/2026. Mesma conta autorizada, sem parecer jurídico ou revisão independente. civa2016=01a15e1a-3f26-713b-8964-3511cb2fea08 SHA256 b90dc7c14ecea2e378c4a62e8e5a47d54a5644c457baeb8b8053b92fd2a5710b; iva2022=01a15e1a-44a8-7316-82ba-008c432609ef SHA256 ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53; iva2025=01a15e1a-4dc2-7021-bbd4-6052db9fcf36 SHA256 ccf2a8deeca820f2dd076b4b2141b1efe3f6a806568c3a587ca59a8e92f4c251. Conferência técnica do cadastro contra a ficha e os exemplares já documentados. Excluídos preço comIVA incluído, taxas reduzidas, isenções, regimes especiais, importações, digitais não residentes, dedução/crédito/reembolso, incentivos, pagamento/declaração e outros impostos. Não certifica elegibilidade individual.",
|
||||
"approval_evidence": "Manutenção fiscal autorizada pela Tempo nesta conversa; ficha v1.2 e fontes oficiais aceites em08/10/2026. Mesma conta autorizada, sem parecer jurídico ou revisão independente. civa2016=01a15e1a-3f26-713b-8964-3511cb2fea08 SHA256 b90dc7c14ecea2e378c4a62e8e5a47d54a5644c457baeb8b8053b92fd2a5710b; iva2022=01a15e1a-44a8-7316-82ba-008c432609ef SHA256 ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53; iva2025=01a15e1a-4dc2-7021-bbd4-6052db9fcf36 SHA256 ccf2a8deeca820f2dd076b4b2141b1efe3f6a806568c3a587ca59a8e92f4c251. Aprovação operacional do lote delimitado já autorizada pela Tempo; não é validação jurídica atribuída ao utilizador. Estimativa de IVA calculado sobre base declarada, sem apuramento final do imposto a pagar. Precisão calculada distinta de apresentação monetária.",
|
||||
"publication_evidence": "Manutenção fiscal autorizada pela Tempo nesta conversa; ficha v1.2 e fontes oficiais aceites em08/10/2026. Mesma conta autorizada, sem parecer jurídico ou revisão independente. civa2016=01a15e1a-3f26-713b-8964-3511cb2fea08 SHA256 b90dc7c14ecea2e378c4a62e8e5a47d54a5644c457baeb8b8053b92fd2a5710b; iva2022=01a15e1a-44a8-7316-82ba-008c432609ef SHA256 ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53; iva2025=01a15e1a-4dc2-7021-bbd4-6052db9fcf36 SHA256 ccf2a8deeca820f2dd076b4b2141b1efe3f6a806568c3a587ca59a8e92f4c251. Publicação apenas da versão1 fundamentada. Taxa eficaz desde01/01/2023, cobertura do consumidor01/01/2026–31/12/2026. Activação continua separada. Suspensão recusa novas admissões; execuções admitidas conservam versão congelada, históricos e relatórios.",
|
||||
"closure_evidence": null,
|
||||
"submitted_at": "2026-10-21 10:55:47+00",
|
||||
"reviewed_at": "2026-10-21T10:55:49.000000Z",
|
||||
"approved_at": "2026-10-21T10:55:51.000000Z",
|
||||
"published_at": "2026-10-21T10:55:53.000000Z",
|
||||
"suspended_at": null,
|
||||
"archived_at": null,
|
||||
"version_no": 5,
|
||||
"created_at": "2026-10-21T10:55:45.000000Z",
|
||||
"updated_at": "2026-10-21T10:55:53.000000Z"
|
||||
},
|
||||
"real_sources": {
|
||||
"civa2016": {
|
||||
"id": "01a15e1a-3f26-713b-8964-3511cb2fea08",
|
||||
"title": "Lei n.º 13/2016 — CIVA republicado",
|
||||
"url": "https://www.inm.gov.mz/pt-br/content/suplemento-n%C2%BA-10-de-301216-pag-1426-259-290-br-n%C2%BA-156-boletim-da-rep%C3%BAblica-i-serie",
|
||||
"diploma": "Lei 13/2016",
|
||||
"article": "Arts. 1–4, 6–7, 15, 17(2), 27 do CIVA; art. 4 da Lei",
|
||||
"competent_entity": "Assembleia da República de Moçambique",
|
||||
"valid_from": "2017-01-01",
|
||||
"valid_until": null,
|
||||
"validation_status": "pending",
|
||||
"owner_id": 15,
|
||||
"validator_id": null,
|
||||
"validated_at": null,
|
||||
"version_no": 1,
|
||||
"created_at": "2026-10-21T10:55:40.000000Z",
|
||||
"updated_at": "2026-10-21T10:55:40.000000Z",
|
||||
"fiscal_acceptance": {
|
||||
"basis": "Tempo-official-sources-20261008",
|
||||
"scope": "fiscal_parameters",
|
||||
"sha256": "b90dc7c14ecea2e378c4a62e8e5a47d54a5644c457baeb8b8053b92fd2a5710b",
|
||||
"citation": "BR156, 10.º suplemento, 30/12/2016. PDF6–8,13–14,17–18: âmbito, base tributável declarada e cálculo. Taxa histórica 17% não utilizada. Consulta dirigida da ficha v1.2; não certifica anexos ou elegibilidade individual.",
|
||||
"accepted_at": "2026-10-21T10:55:40.836454Z",
|
||||
"legal_opinion": false,
|
||||
"official_origin": "Boletim da República; exemplar do acervo oficial já aceite pela decisão Tempo de 08/10/2026, arquivado em docs/investmoz/simulations/source-archive/Lei-13-2016-CIVA-BR-156-10-suplemento.pdf. Cadastro fiscal rastreável; sem atribuição de parecer jurídico ou revisão independente à Tempo.",
|
||||
"independent_review": false,
|
||||
"responsible_user_id": 15
|
||||
}
|
||||
},
|
||||
"iva2022": {
|
||||
"id": "01a15e1a-44a8-7316-82ba-008c432609ef",
|
||||
"title": "Lei n.º 22/2022 — republicação oficial do IVA",
|
||||
"url": "https://www.inm.gov.mz/pt-br/content/assembleia-da-rep%C3%BAblica-suplemento-n%C2%BA-2-de-281222-pag-2252-25-42-br-n%C2%BA-250-boletim-da",
|
||||
"diploma": "Lei 22/2022",
|
||||
"article": "Art. 17(1) do CIVA e art. 6 da Lei",
|
||||
"competent_entity": "Assembleia da República de Moçambique",
|
||||
"valid_from": "2023-01-01",
|
||||
"valid_until": null,
|
||||
"validation_status": "pending",
|
||||
"owner_id": 15,
|
||||
"validator_id": null,
|
||||
"validated_at": null,
|
||||
"version_no": 1,
|
||||
"created_at": "2026-10-21T10:55:42.000000Z",
|
||||
"updated_at": "2026-10-21T10:55:42.000000Z",
|
||||
"fiscal_acceptance": {
|
||||
"basis": "Tempo-official-sources-20261008",
|
||||
"scope": "fiscal_parameters",
|
||||
"sha256": "ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53",
|
||||
"citation": "BR250, 2.º suplemento, 28/12/2022; PDF3/BR2252-(27): taxa geral 16%; PDF4, art.6: eficácia 01/01/2023. Exemplar republicado; publicação inicial sem efeito. Aplicação delimitada à base líquida declarada em MZN e cobertura do consumidor 2026, ficha v1.2.",
|
||||
"accepted_at": "2026-10-21T10:55:42.246583Z",
|
||||
"legal_opinion": false,
|
||||
"official_origin": "Boletim da República; exemplar do acervo oficial já aceite pela decisão Tempo de 08/10/2026, arquivado em docs/investmoz/simulations/source-archive/Lei-22-2022-IVA-republicada-BR-250-2-suplemento.pdf. Cadastro fiscal rastreável; sem atribuição de parecer jurídico ou revisão independente à Tempo.",
|
||||
"independent_review": false,
|
||||
"responsible_user_id": 15
|
||||
}
|
||||
},
|
||||
"iva2025": {
|
||||
"id": "01a15e1a-4dc2-7021-bbd4-6052db9fcf36",
|
||||
"title": "Lei n.º 10/2025 — alterações ao CIVA, BR248 suplemento1",
|
||||
"url": "https://www.at.gov.mz/api/webdav?path=%2FLEGISLA%C3%87%C3%83O%2FLEGISLA%C3%87%C3%83O%20FISCAL%2FLEI%2FBR_248_I_SERIE_SUPLEMENTO_2025.pdf",
|
||||
"diploma": "Lei 10/2025",
|
||||
"article": "Art. 1 (artigos alterados) e disposição de entrada em vigor",
|
||||
"competent_entity": "Assembleia da República de Moçambique",
|
||||
"valid_from": "2026-01-01",
|
||||
"valid_until": null,
|
||||
"validation_status": "pending",
|
||||
"owner_id": 15,
|
||||
"validator_id": null,
|
||||
"validated_at": null,
|
||||
"version_no": 1,
|
||||
"created_at": "2026-10-21T10:55:44.000000Z",
|
||||
"updated_at": "2026-10-21T10:55:44.000000Z",
|
||||
"fiscal_acceptance": {
|
||||
"basis": "Tempo-official-sources-20261008",
|
||||
"scope": "fiscal_parameters",
|
||||
"sha256": "ccf2a8deeca820f2dd076b4b2141b1efe3f6a806568c3a587ca59a8e92f4c251",
|
||||
"citation": "BR248, suplemento1, 29/12/2025, PDF12–15: Lei10/2025 efectiva 01/01/2026; não altera arts.15/17 nas disposições consultadas. Apoio à cadeia temporal 2026 do lote delimitado, não implementação de regimes ou obrigações adicionais.",
|
||||
"accepted_at": "2026-10-21T10:55:44.576628Z",
|
||||
"legal_opinion": false,
|
||||
"official_origin": "Boletim da República; exemplar do acervo oficial já aceite pela decisão Tempo de 08/10/2026, arquivado em docs/investmoz/simulations/source-archive/BR-248-I-Suplemento-1-2025.pdf. Cadastro fiscal rastreável; sem atribuição de parecer jurídico ou revisão independente à Tempo.",
|
||||
"independent_review": false,
|
||||
"responsible_user_id": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
"publication_events": [
|
||||
{
|
||||
"action": "submit",
|
||||
"status": "submitted",
|
||||
"version_no": 2,
|
||||
"utc": "2026-10-21T10:55:48.179954+00:00"
|
||||
},
|
||||
{
|
||||
"action": "review",
|
||||
"status": "reviewed",
|
||||
"version_no": 3,
|
||||
"utc": "2026-10-21T10:55:50.198403+00:00"
|
||||
},
|
||||
{
|
||||
"action": "approve",
|
||||
"status": "approved",
|
||||
"version_no": 4,
|
||||
"utc": "2026-10-21T10:55:52.268896+00:00"
|
||||
},
|
||||
{
|
||||
"action": "publish",
|
||||
"status": "published",
|
||||
"version_no": 5,
|
||||
"utc": "2026-10-21T10:55:54.303429+00:00"
|
||||
}
|
||||
],
|
||||
"activation": {
|
||||
"utc": "2026-10-21T10:55:58.330391+00:00",
|
||||
"authorisation": "Tempo current conversation, separate consumer activation",
|
||||
"served_revision": {
|
||||
"commit": "d3fe8a02ec7f5dcd01984c4f4a1eba18b5a0cf19",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-21T10:48:46.529930+00:00",
|
||||
"manifest_sha256": "f417509cfa060240801c6a956a787a90d0e283c3c08e77b5be655d63394a4cb9"
|
||||
},
|
||||
"rule": {
|
||||
"id": "01a15e1a-5338-700f-8a45-f87707d696a7",
|
||||
"rule_code": "IVA-GERAL-BASE-LIQUIDA",
|
||||
"rule_version": 1,
|
||||
"status": "published",
|
||||
"source_sha256": "ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53",
|
||||
"legal_source_id": "01a15e1a-44a8-7316-82ba-008c432609ef",
|
||||
"source_version_no": 1,
|
||||
"version_no": 5,
|
||||
"author_id": 15,
|
||||
"reviewer_id": 15,
|
||||
"approver_id": 15,
|
||||
"publisher_id": 15
|
||||
},
|
||||
"consumer_enabled": true,
|
||||
"configuration_keys_changed": [
|
||||
"INVESTMOZ_IVA_CONSUMER_ENABLED",
|
||||
"INVESTMOZ_IVA_CONSUMER_RULE_ID",
|
||||
"INVESTMOZ_IVA_CONSUMER_RULE_VERSION"
|
||||
],
|
||||
"other_configuration_preserved": true,
|
||||
"before_environment_sha256": "537eff52f0f28b83ccc56bf9a9b85c2d8fca1da2f678c30b929b46c67c09491b",
|
||||
"after_environment_sha256": "7cdaba591bb5787485a349c24db2fd7c8279436da0eb31502e44db2fffa21d03",
|
||||
"histories_preserved": true,
|
||||
"accepted_calculation_export_tests_repeated": false,
|
||||
"qa_fixture_imported": false
|
||||
},
|
||||
"destination_delta_read_only": {
|
||||
"utc": "2026-10-21T10:56:37.650967+00:00",
|
||||
"read_only": true,
|
||||
"served": {
|
||||
"commit": "d3fe8a02ec7f5dcd01984c4f4a1eba18b5a0cf19",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-21T10:48:46.529930+00:00",
|
||||
"manifest_sha256": "f417509cfa060240801c6a956a787a90d0e283c3c08e77b5be655d63394a4cb9"
|
||||
},
|
||||
"inventory": {
|
||||
"sources": [
|
||||
{
|
||||
"id": "01a15e1a-3f26-713b-8964-3511cb2fea08",
|
||||
"title": "Lei n.º 13/2016 — CIVA republicado",
|
||||
"diploma": "Lei 13/2016",
|
||||
"article": "Arts. 1–4, 6–7, 15, 17(2), 27 do CIVA; art. 4 da Lei",
|
||||
"version_no": 1,
|
||||
"validation_status": "pending",
|
||||
"owner_id": 15,
|
||||
"fiscal_acceptance": {
|
||||
"basis": "Tempo-official-sources-20261008",
|
||||
"scope": "fiscal_parameters",
|
||||
"sha256": "b90dc7c14ecea2e378c4a62e8e5a47d54a5644c457baeb8b8053b92fd2a5710b",
|
||||
"citation": "BR156, 10.º suplemento, 30/12/2016. PDF6–8,13–14,17–18: âmbito, base tributável declarada e cálculo. Taxa histórica 17% não utilizada. Consulta dirigida da ficha v1.2; não certifica anexos ou elegibilidade individual.",
|
||||
"accepted_at": "2026-10-21T10:55:40.836454Z",
|
||||
"legal_opinion": false,
|
||||
"official_origin": "Boletim da República; exemplar do acervo oficial já aceite pela decisão Tempo de 08/10/2026, arquivado em docs/investmoz/simulations/source-archive/Lei-13-2016-CIVA-BR-156-10-suplemento.pdf. Cadastro fiscal rastreável; sem atribuição de parecer jurídico ou revisão independente à Tempo.",
|
||||
"independent_review": false,
|
||||
"responsible_user_id": 15
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "01a15e1a-44a8-7316-82ba-008c432609ef",
|
||||
"title": "Lei n.º 22/2022 — republicação oficial do IVA",
|
||||
"diploma": "Lei 22/2022",
|
||||
"article": "Art. 17(1) do CIVA e art. 6 da Lei",
|
||||
"version_no": 1,
|
||||
"validation_status": "pending",
|
||||
"owner_id": 15,
|
||||
"fiscal_acceptance": {
|
||||
"basis": "Tempo-official-sources-20261008",
|
||||
"scope": "fiscal_parameters",
|
||||
"sha256": "ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53",
|
||||
"citation": "BR250, 2.º suplemento, 28/12/2022; PDF3/BR2252-(27): taxa geral 16%; PDF4, art.6: eficácia 01/01/2023. Exemplar republicado; publicação inicial sem efeito. Aplicação delimitada à base líquida declarada em MZN e cobertura do consumidor 2026, ficha v1.2.",
|
||||
"accepted_at": "2026-10-21T10:55:42.246583Z",
|
||||
"legal_opinion": false,
|
||||
"official_origin": "Boletim da República; exemplar do acervo oficial já aceite pela decisão Tempo de 08/10/2026, arquivado em docs/investmoz/simulations/source-archive/Lei-22-2022-IVA-republicada-BR-250-2-suplemento.pdf. Cadastro fiscal rastreável; sem atribuição de parecer jurídico ou revisão independente à Tempo.",
|
||||
"independent_review": false,
|
||||
"responsible_user_id": 15
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "01a15e1a-4dc2-7021-bbd4-6052db9fcf36",
|
||||
"title": "Lei n.º 10/2025 — alterações ao CIVA, BR248 suplemento1",
|
||||
"diploma": "Lei 10/2025",
|
||||
"article": "Art. 1 (artigos alterados) e disposição de entrada em vigor",
|
||||
"version_no": 1,
|
||||
"validation_status": "pending",
|
||||
"owner_id": 15,
|
||||
"fiscal_acceptance": {
|
||||
"basis": "Tempo-official-sources-20261008",
|
||||
"scope": "fiscal_parameters",
|
||||
"sha256": "ccf2a8deeca820f2dd076b4b2141b1efe3f6a806568c3a587ca59a8e92f4c251",
|
||||
"citation": "BR248, suplemento1, 29/12/2025, PDF12–15: Lei10/2025 efectiva 01/01/2026; não altera arts.15/17 nas disposições consultadas. Apoio à cadeia temporal 2026 do lote delimitado, não implementação de regimes ou obrigações adicionais.",
|
||||
"accepted_at": "2026-10-21T10:55:44.576628Z",
|
||||
"legal_opinion": false,
|
||||
"official_origin": "Boletim da República; exemplar do acervo oficial já aceite pela decisão Tempo de 08/10/2026, arquivado em docs/investmoz/simulations/source-archive/BR-248-I-Suplemento-1-2025.pdf. Cadastro fiscal rastreável; sem atribuição de parecer jurídico ou revisão independente à Tempo.",
|
||||
"independent_review": false,
|
||||
"responsible_user_id": 15
|
||||
}
|
||||
}
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "01a15e1a-5338-700f-8a45-f87707d696a7",
|
||||
"rule_code": "IVA-GERAL-BASE-LIQUIDA",
|
||||
"rule_version": 1,
|
||||
"status": "published",
|
||||
"valid_from": "2023-01-01",
|
||||
"valid_until": null,
|
||||
"legal_source_id": "01a15e1a-44a8-7316-82ba-008c432609ef",
|
||||
"source_sha256": "ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53",
|
||||
"source_version_no": 1,
|
||||
"version_no": 5,
|
||||
"author_id": 15,
|
||||
"reviewer_id": 15,
|
||||
"approver_id": 15,
|
||||
"publisher_id": 15
|
||||
}
|
||||
],
|
||||
"event_count": 5,
|
||||
"historical_counts": {
|
||||
"results": 0,
|
||||
"reports": 0
|
||||
}
|
||||
},
|
||||
"consumer": {
|
||||
"database": "teste_investidor",
|
||||
"binding": {
|
||||
"enabled": true,
|
||||
"rule_id": "01a15e1a-5338-700f-8a45-f87707d696a7",
|
||||
"rule_version": 1
|
||||
},
|
||||
"availability": {
|
||||
"enabled": true,
|
||||
"coverage_start": "2026-01-01",
|
||||
"coverage_end": "2026-12-31",
|
||||
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
|
||||
},
|
||||
"parameter_resolution_without_calculation": {
|
||||
"parameter_code": "IVA_GENERAL_RATE",
|
||||
"status": "resolved",
|
||||
"value": "16",
|
||||
"unit": "percent",
|
||||
"conditions": {
|
||||
"currency": "MZN",
|
||||
"operation": "internal_general_net"
|
||||
},
|
||||
"scope_key": "mz.internal-general-net.mzn",
|
||||
"rule_code": "IVA-GERAL-BASE-LIQUIDA",
|
||||
"rule_id": "01a15e1a-5338-700f-8a45-f87707d696a7",
|
||||
"rule_version": 1,
|
||||
"period": {
|
||||
"start": "2026-10-21",
|
||||
"end": "2026-10-21"
|
||||
},
|
||||
"validity": {
|
||||
"start": "2023-01-01",
|
||||
"end": null
|
||||
},
|
||||
"source": {
|
||||
"title": "Lei n.º 22/2022 — republicação oficial do IVA",
|
||||
"diploma": "Lei 22/2022",
|
||||
"article": "Art. 17(1) do CIVA e art. 6 da Lei",
|
||||
"url": "https://www.inm.gov.mz/pt-br/content/assembleia-da-rep%C3%BAblica-suplemento-n%C2%BA-2-de-281222-pag-2252-25-42-br-n%C2%BA-250-boletim-da",
|
||||
"declared_sha256": "ea1b0dc6f5cf6e595f6d9a19e7042f398999e0087caef1785f6e8fac571b5f53"
|
||||
}
|
||||
}
|
||||
},
|
||||
"qa_fixture_imported": false,
|
||||
"calculations_exporters_repeated": false
|
||||
},
|
||||
"remaining": []
|
||||
},
|
||||
"iva_query_diagnostic_qa_20261021": {
|
||||
"recorded_utc": "2026-10-21T11:35:00.737064+00:00",
|
||||
"scope": "QA only, parameter-query diagnosis; no calculation/export retest, no destination writes",
|
||||
"reported_surface": "Componentes fiscais e contributivas, IVA_GENERAL_RATE, annual 2026-01-01 to2026-12-31, indeterminate_context",
|
||||
"confirmed_origin": "Implementation integration gap: query sent fiscal_operation and no currency/operation, whereas the published IVA parameter requires operation=internal_general_net and currency=MZN. Resolver collapsed every mismatch to indeterminate_context and UI blamed responses without individual evidence.",
|
||||
"original_answers_known": "Only the period/component/message were provided. No original currency or operation is asserted; USD/domestic are explicit directed QA cases, not inferred original answers.",
|
||||
"diagnostic_categories": [
|
||||
"missing_field",
|
||||
"invalid_value",
|
||||
"out_of_scope",
|
||||
"period_unavailable",
|
||||
"system_configuration"
|
||||
],
|
||||
"changes": [
|
||||
"Server projects each failed criterion, field, received value, expected criterion, source and exact rule version; no expression projection",
|
||||
"Explicit fiscal_currency answer for IVA query, persisted and recovered; no copy/conversion from budget or IVA-base currency",
|
||||
"Generic domestic is never silently equated to internal_general_net; integration limitation is explained and links to explicit IVA form",
|
||||
"Inline notes plus summary links, human IVA — taxa geral label and Ver fundamento disclosure",
|
||||
"Period diagnostic can inspect published candidates outside queried period under existing visibility policy; selection/calculation eligibility unchanged",
|
||||
"No eligible visible candidate remains explicitly uncertain; no invented input fault"
|
||||
],
|
||||
"verification": {
|
||||
"new_unit_tests": 5,
|
||||
"new_unit_assertions": 24,
|
||||
"targeted_api_tests": 1,
|
||||
"targeted_api_assertions": 16,
|
||||
"existing_resolver_regression_tests": 7,
|
||||
"existing_resolver_regression_assertions": 25,
|
||||
"typescript": "passed",
|
||||
"build": "passed, exit0",
|
||||
"pint": "passed",
|
||||
"edge": "Normal simulator query, annual2026; missing currency then explicitly chosen USD; inline/summary linked fields focused; source/version disclosure; USD and generic operation preserved after save/recovery; internal code and expression absent from query text",
|
||||
"no_simulation_created_by_api_diagnostic": true
|
||||
},
|
||||
"qa_fixture": {
|
||||
"rule_version": 3,
|
||||
"state_after_proof": "suspended",
|
||||
"consumer_enabled": false,
|
||||
"database": "simulator_fiscal_delta_20261021_test",
|
||||
"imported_into_homologation": false
|
||||
},
|
||||
"test_database": "simulator_fiscal_checks_20261021_test, existing QA schema correction applied before targeted API test; isolated guard preserved",
|
||||
"proofs": [
|
||||
"outputs/simulator-continuation-20261020/iva-diagnostic-api-test.txt",
|
||||
"outputs/simulator-continuation-20261020/iva-diagnostic-summary.txt",
|
||||
"outputs/simulator-continuation-20261020/iva-diagnostic-summary.png",
|
||||
"outputs/simulator-continuation-20261020/iva-diagnostic-build-final.txt"
|
||||
],
|
||||
"main_integrated": false,
|
||||
"homologation_rule_changed": false,
|
||||
"legal_coverage_expanded": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1943,3 +1943,40 @@ O backup/restauro anterior à escrita ficou comprovado em21/10/2026 às10:18:00U
|
||||
3. **Activação do consumidor:** permanece separada da publicação. Aplicar a ligação aoID e `rule_version` reais autorizados e o interruptor de activação pelo procedimento já definido, conservando cálculo sobre base declarada como estimativa, sem apuramento final do imposto a pagar. Conferir somente a revisão/regra efectivamente servidas e o delta no destino. Desactivar o consumidor ou suspender a regra recusa novas admissões, preservando as já admitidas, históricos e relatórios.
|
||||
|
||||
**Saldo actual:** controlo corrigido e verificado emQA, fontes e funcionamento do cálculo não reabertos; sem nova publicação ou activação na homologação. A referência servida continua226fd308 e o consumidor desligado. A correcção não foi aplicada ao esquema activo. A indicação do responsável e a autorização operacional não são tratadas como conferência de ficheiros locais ou validação jurídica da Tempo. Esta actualização substitui a indicação anterior de que a simples falta de quatro listas configuradas bloqueava obrigatoriamente a disponibilização.
|
||||
|
||||
### Execução autorizada da correcção fiscal — 21/10/2026
|
||||
|
||||
A Tempo autorizou incorporar4a4d1212 e concluir apenas as operações pendentes. A correcção foi integrada emmain; a equipa integrou entretanto d3fe8a02, que inclui4a4d1212 e conserva o mesmo código fiscal. A revisão efectivamente servida, conferida em `/build/revision.json`, é `d3fe8a02ec7f5dcd01984c4f4a1eba18b5a0cf19`. Não se reinstalou226fd308.
|
||||
|
||||
Backup/restauro actualizado: `/var/backups/investmoz/iva-rollout-20261021_104253`, dumpSHA256 `b37bf4aad0abd839bc81d70adf802535ad7738fabe75fda61d74f39dfc11e74b`; restauro isolado `iva_rollout_20261021_104253_test`,171tabelas com contagens e hashes coincidentes. A operação técnica autenticada aplicou exclusivamente oDDL revisto, com registos/históricos e constraints alheias preservados. A migration protegida não foi executada na base activa nem teve a guarda enfraquecida. O contrato do executor foi actualizado apenas para essa migration, após registo da compatibilidade; a primeira disponibilização conservou a release anterior ao encontrar a alteração de esquema. A retoma usou o mesmo executor e não passou a executar migrations no destino.
|
||||
|
||||
Publicação e activação concluídas conforme recibo. O consumidor está activo. Não foram repetidas provas aceites do cálculo, precisão, exportadores ouPDF, nem importada a fixtureQA. A autenticação da infraestrutura não é identidade administrativa do portal. A conta Christiana/example.test reportada pelo utilizador pertence ao ensaio local anterior e não é usada no destino.
|
||||
|
||||
Mantém-se o procedimento único: **1)** código/controlo do esquema, agora integrados; **2)** cadastro das fontes reais com hash/citação e da versão1 `IVA-GERAL-BASE-LIQUIDA`, seguido das etapas autenticadas pelo mesmo responsável autorizado; **3)** activação separada, ligando o consumidor aoID e versão publicados. Cobertura2026, operação interna geral sobre base líquida declarada emMZN; excluídos preços comIVA incluído, taxas reduzidas, isenções, regimes especiais, importações, digitais não residentes, deduções/créditos/reembolsos, incentivos, pagamento/declaração e outros impostos. O resultado é estimativa deIVA sobre a base declarada, não apuramento final a pagar.
|
||||
|
||||
Para suspender, desligar `INVESTMOZ_IVA_CONSUMER_ENABLED` e reiniciar graciosamente os workers pelo mecanismo existente, ou suspender a versão publicada pela governação autenticada, com `version_no` corrente e evidência. Novas admissões são recusadas; as já admitidas concluem com snapshot congelado, mantendo históricos e relatórios. Não apagar fontes, versões ou execuções para reverter a exposição. A autorização e o cadastro não constituem conferência local dos ficheiros pelo utilizador nem validação jurídica atribuída à Tempo. O recibo JSON existente regista a revisão, a regra e o estado efectivamente observados.
|
||||
|
||||
**Recibo final das três operações:** código4a4d1212 integrado e servido dentro ded3fe8a02; três fontes oficiais reais cadastradas comversão1, hashes e citações; regra `IVA-GERAL-BASE-LIQUIDA`, **rule_version1**, ID `01a15e1a-5338-700f-8a45-f87707d696a7`, estado `published`, controlo optimista `version_no5`; autor/revisor/aprovador/publicador reais: conta indicada `nala@tempo.co.mz`, ID15. A sessão normal comMFA foi efectuada pelo utilizador numa página temporária de apoio ligada apenas a127.0.0.1; não se guardaram palavra-passe, códigoMFA ou cookies. Não há alegação de revisão independente ou parecer jurídico. A aceitação fiscal das fontes tem o fundamentoTempo08/10/2026; o estado geral permanecepending, sem validação automática noutros processos.
|
||||
|
||||
Activação separada aplicada em21/10/2026 às10:55:58UTC, alterando apenas as três chaves do consumidor. Ligação exacta aoID acima, rule_version1 eenabled=true; restante configuração preservada. `/api/v1/fiscal-consumer` confirmouenabled=true porHTTP200; a leitura do resolvedor, sem executar cálculo, confirmouIVA_GENERAL_RATE=16percent, mesmoID/versão/fonte no contextoMZN/internal_general_net de2026. Cinco eventos de governação; contagens de resultados/relatórios preservadas, sem simulações sintéticas no destino. O restauro de segurança e a configuração anterior estão conservados no arquivo privado identificado no recibo.
|
||||
|
||||
Suspensão concreta: configurar `INVESTMOZ_IVA_CONSUMER_ENABLED=false` e executar o reinício gracioso existente `php8.4 artisan queue:restart` na releaseactual como operador autorizado; ou `POST /api/v2/investment/admin/tax-rules/01a15e1a-5338-700f-8a45-f87707d696a7/suspend`, com `version_no:5` enquanto corrente e evidência verdadeira de pelo menos20caracteres, pela administração autenticada/MFA. Não repetir a suspensão se o estado/versão já tiver mudado. Conservar a ligação e todos os registos; futuras retomas respeitam o estado da regra e o procedimento de versão aplicável, sem escolher automaticamente outra regra.
|
||||
|
||||
|
||||
### Diagnóstico da consulta IVA — correcção em QA,21/10/2026
|
||||
|
||||
O caso reportado identifica «Componentes fiscais e contributivas», IVA_GENERAL_RATE, período01/01/2026–31/12/2026 e «As condições publicadas não correspondem às respostas indicadas». É consulta de parâmetros, não execução do consumidor IVA. O utilizador não forneceu a moeda ou a operação originais; não se afirma que tenha seleccionadoUSD, omitido um campo ou indicado uma operação excluída.
|
||||
|
||||
**Causa confirmada no contrato:** o formulário envia `fiscal_operation`, sem `operation` ou `currency`; a versão publicada exige `operation=internal_general_net` e `currency=MZN`. A validação da consulta nem aceitava esses nomes canónicos. O resolvedor reduzia qualquer condição falhada a `indeterminate_context`; a interface mostrava apenas a frase genérica e o código interno. Esta restrição de ligação é escolha de implementação, não condição organizacional ou jurídica adicional da Tempo. O mesmo contrato reproduziu o estado no período anual reportado, independentemente de se presumir uma moeda no caso original.
|
||||
|
||||
**Correcção delimitada:** cada condição não satisfeita tem categoria, campo, valor recebido e critério esperado, ligados à versão e fonte. Distinguem-se campo em falta, formato inválido, operação/moeda fora do âmbito, versão que não cobre o período e configuração do sistema. Quando não existe versão elegível visível e a evidência não permite separar ausência de cobertura de indisponibilidade de fonte/configuração, a interface mantém essa incerteza; não inventa uma causa nem atribui culpa às respostas.
|
||||
|
||||
A consulta IVA passa a ter moeda explícita (`fiscal_currency`), guardada no rascunho, sem presumirMZN ou copiar moeda do orçamento ou do cálculo IVA. A API recebe esse valor em `context.currency`. A operação genérica não se converte automaticamente no âmbito «operação interna à taxa geral sobre base líquida»: a limitação de integração é explicada com a resposta recebida e o critério esperado, e existe ligação para o formulário IVA com declaração explícita do âmbito. Uma importação/exportação/não residente/reembolso expressamente seleccionado é identificado como exclusão deste lote; não se altera a resposta para a fazer passar.
|
||||
|
||||
As notas aparecem junto dos campos e num resumo com ligações que focam o campo correspondente, mantendo o rascunho. O nome apresentado é «IVA — taxa geral»; «Ver fundamento» contém versão, vigência e fonte, sem expressãoDSL. As falhas de consulta/configuração são identificadas como sistema. O percurso de cálculo e as suas regras de admissão não foram ampliados. A consulta diagnóstica pode observar versões publicadas fora do período seleccionado, sob a mesma política de visibilidade, apenas para explicar a falta de cobertura; não as torna elegíveis.
|
||||
|
||||
**Prova dirigida:**5testes unitários novos/24asserções;1testeAPI/16asserções no clone isolado simulator_fiscal_checks_20261021_test;7testes existentes do resolvedor/25asserções; TypeScript, build(exit0), Pint e diff-check. A primeira execuçãoAPI detectou que esse clone ainda não tinha a coluna fiscal_acceptance; aplicou-se nele a correcção de esquema já aceite, com a guardaQA intacta, e repetiu-se apenas o testeAPI afectado. Não é diagnóstico da base de homologação. A comparação por índice do ensaio foi ajustada à ordem das chavesJSONB; não se alterou o critério fiscal.
|
||||
|
||||
No Edge, simulador normal QA em127.0.0.1:18580: consulta anual2026, operação genérica explicitamente escolhida para o ensaio; moeda inicialmente vazia, depoisUSD escolhido expressamente como caso dirigido. Confirmaram-se notas, resumo, foco em «Rever moeda»/«Rever operação», fundamento da versão sintética3, eUSD/ano/periodicidade/operação conservados após gravação e recuperação do mesmo rascunho. A captura de prova é um ensaioUSD, não evidência deUSD no caso original. Não se executou cálculo nem se exportou relatório. A fixture publicada apenas emQA para observar o diagnóstico foi depois suspensa; o consumidorQA permaneceu desligado. Nenhuma fixture foi importada, regra alterada ou consumidor activado na homologação nesta correcção.
|
||||
|
||||
Provas privadas na pasta `outputs/simulator-continuation-20261020`: iva-diagnostic-api-test.txt, iva-diagnostic-summary.txt, iva-diagnostic-summary.png e iva-diagnostic-build-final.txt. O reciboJSON existente tem o estado detalhado. A candidata permanece na branch `codex/iva-diagnostics-QA`, separada de main; não é uma nova publicação fiscal nem altera a entrega autorizada anteriormente.
|
||||
|
||||
File diff suppressed because one or more lines are too long
+409
-5
@@ -7,8 +7,413 @@
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@import './tempo-header.css';
|
||||
|
||||
/* Institutional shell adapted from Tempo; page content keeps its own theme. */
|
||||
.tempo-header {
|
||||
position: relative;
|
||||
z-index: 40;
|
||||
background: #090909;
|
||||
color: #fff;
|
||||
}
|
||||
.tempo-header-inner {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||
grid-template-rows: 72px;
|
||||
column-gap: 0.5rem;
|
||||
align-items: center;
|
||||
max-width: 1440px;
|
||||
margin-inline: auto;
|
||||
padding-inline: 0.75rem;
|
||||
}
|
||||
.tempo-logo-link {
|
||||
grid-area: 1 / 1;
|
||||
display: inline-flex;
|
||||
width: fit-content;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.tempo-header-logo {
|
||||
width: auto;
|
||||
height: 36px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.tempo-primary-navigation {
|
||||
display: none;
|
||||
grid-area: 2 / 1 / auto / -1;
|
||||
min-width: 0;
|
||||
border-top: 1px solid #ffffff1a;
|
||||
}
|
||||
.tempo-primary-navigation > ul {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.25rem 0.5rem;
|
||||
padding-block: 0.75rem;
|
||||
}
|
||||
.tempo-primary-navigation .tempo-nav-trigger {
|
||||
font-size: 0.9375rem;
|
||||
padding-inline: 0.5rem;
|
||||
}
|
||||
.tempo-nav-trigger {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.4rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 0.4rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
color: #eee;
|
||||
transition:
|
||||
color 0.2s,
|
||||
background 0.2s;
|
||||
}
|
||||
.tempo-nav-trigger:hover,
|
||||
.tempo-nav-trigger[data-state='open'] {
|
||||
background: #ffffff0d;
|
||||
color: #fff;
|
||||
}
|
||||
.tempo-nav-trigger[data-current-group] {
|
||||
color: #fff;
|
||||
box-shadow: inset 0 -2px #ed1c24;
|
||||
}
|
||||
.tempo-nav-trigger[data-state='open'] > svg {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.tempo-primary-navigation .tempo-nav-trigger > svg {
|
||||
transform: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tempo-section-bar {
|
||||
border-top: 1px solid #ffffff14;
|
||||
background: inherit;
|
||||
}
|
||||
.tempo-section-inner {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 0.25rem 0.75rem;
|
||||
max-width: 1440px;
|
||||
margin-inline: auto;
|
||||
padding: 0 0.75rem 0.5rem;
|
||||
}
|
||||
.tempo-section-navigation {
|
||||
grid-area: 1 / 1 / auto / -1;
|
||||
min-width: 0;
|
||||
}
|
||||
.tempo-section-navigation > ul {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.tempo-section-navigation .tempo-nav-trigger {
|
||||
justify-content: center;
|
||||
min-height: 44px;
|
||||
gap: 0.25rem;
|
||||
padding: 0.5rem 0.375rem;
|
||||
border-radius: 0;
|
||||
font-size: 0.8125rem;
|
||||
letter-spacing: normal;
|
||||
}
|
||||
@media (min-width: 640px) {
|
||||
.tempo-section-navigation .tempo-nav-trigger {
|
||||
min-height: 48px;
|
||||
gap: 0.5rem;
|
||||
padding-inline: 0.75rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.tempo-section-inner {
|
||||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||||
padding: 0.25rem 1.25rem;
|
||||
}
|
||||
.tempo-section-navigation {
|
||||
grid-area: 1 / 2;
|
||||
}
|
||||
.tempo-section-inner .tempo-panel-summary {
|
||||
grid-area: 1 / 1;
|
||||
}
|
||||
.tempo-section-inner .tempo-interest-button {
|
||||
grid-area: 1 / 3;
|
||||
}
|
||||
}
|
||||
.tempo-header-extras {
|
||||
display: none;
|
||||
grid-area: 3 / 1 / auto / -1;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
min-width: 0;
|
||||
padding-block: 0.75rem;
|
||||
border-top: 1px solid #ffffff1a;
|
||||
}
|
||||
.tempo-header[data-expanded] .tempo-primary-navigation {
|
||||
display: block;
|
||||
}
|
||||
.tempo-header[data-expanded] .tempo-header-extras {
|
||||
display: flex;
|
||||
}
|
||||
.tempo-header-utilities {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.tempo-utility-button {
|
||||
display: flex;
|
||||
min-height: 40px;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.4rem;
|
||||
border-radius: 0.5rem;
|
||||
font-size: 0.8125rem;
|
||||
color: #e2e8f0;
|
||||
}
|
||||
.tempo-utility-button:hover {
|
||||
background: #ffffff10;
|
||||
}
|
||||
.tempo-header-social {
|
||||
display: flex;
|
||||
width: 30px;
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--social-color);
|
||||
transition:
|
||||
transform 0.2s,
|
||||
opacity 0.2s;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
.tempo-header-social:hover {
|
||||
transform: translateY(-2px);
|
||||
opacity: 0.8;
|
||||
}
|
||||
.tempo-login-button {
|
||||
display: inline-flex;
|
||||
min-height: 40px;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
border: 1px solid #ffffff50;
|
||||
border-radius: 0.4rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
color: #fff;
|
||||
transition:
|
||||
background 0.2s,
|
||||
border-color 0.2s;
|
||||
}
|
||||
.tempo-login-button:hover {
|
||||
background: #ed1c24;
|
||||
border-color: #ed1c24;
|
||||
}
|
||||
.tempo-login-button > span {
|
||||
max-width: clamp(2rem, calc(100vw - 18rem), 6rem);
|
||||
}
|
||||
.tempo-header-actions {
|
||||
grid-area: 1 / 2;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
}
|
||||
.tempo-interest-button {
|
||||
display: inline-flex;
|
||||
grid-area: 2 / 2;
|
||||
justify-self: end;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 40px;
|
||||
padding: 0.5rem 0.65rem;
|
||||
border: 1px solid #ed1c24;
|
||||
border-radius: 0.4rem;
|
||||
background: #ed1c24;
|
||||
color: white;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.tempo-interest-button:hover {
|
||||
background: #c9151c;
|
||||
}
|
||||
.tempo-panel-summary {
|
||||
grid-area: 2 / 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
gap: 0.1rem;
|
||||
min-height: 44px;
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.4;
|
||||
color: #fff;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
.tempo-panel-summary:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.tempo-panel-count {
|
||||
color: #cbd5e1;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
.tempo-header-toggle {
|
||||
grid-area: 1 / 3;
|
||||
display: inline-flex;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid #ffffff33;
|
||||
border-radius: 0.4rem;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tempo-header-toggle:hover,
|
||||
.tempo-header-toggle[aria-expanded='true'] {
|
||||
background: #ffffff10;
|
||||
}
|
||||
@media (min-width: 640px) {
|
||||
.tempo-header-inner {
|
||||
padding-inline: 1.25rem;
|
||||
}
|
||||
.tempo-header-logo {
|
||||
height: 44px;
|
||||
}
|
||||
.tempo-primary-navigation > ul {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.tempo-header-inner {
|
||||
grid-template-rows: 88px;
|
||||
padding-inline: 1.5rem;
|
||||
}
|
||||
.tempo-header-logo {
|
||||
height: 56px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1280px) {
|
||||
/* Shared columns keep each portal area below its institutional link. */
|
||||
.tempo-header-layout {
|
||||
display: grid;
|
||||
grid-template-columns: auto repeat(4, max-content) minmax(0, 1fr) auto;
|
||||
column-gap: 0.25rem;
|
||||
max-width: 1440px;
|
||||
margin-inline: auto;
|
||||
padding-inline: 2rem;
|
||||
}
|
||||
.tempo-header-inner {
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
min-height: 88px;
|
||||
column-gap: normal;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.tempo-logo-link {
|
||||
margin-right: 0.75rem;
|
||||
}
|
||||
.tempo-header-logo {
|
||||
height: 64px;
|
||||
}
|
||||
.tempo-header[data-expanded] .tempo-primary-navigation,
|
||||
.tempo-primary-navigation {
|
||||
display: grid;
|
||||
grid-area: 1 / 2 / 2 / 6;
|
||||
grid-template-columns: subgrid;
|
||||
border: 0;
|
||||
}
|
||||
.tempo-primary-navigation > ul {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
gap: normal;
|
||||
padding: 0;
|
||||
}
|
||||
.tempo-nav-trigger {
|
||||
justify-content: center;
|
||||
padding-inline: 0.875rem;
|
||||
font-size: 1.125rem;
|
||||
letter-spacing: 0.025em;
|
||||
}
|
||||
.tempo-primary-navigation .tempo-nav-trigger {
|
||||
padding-inline: 0.625rem;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
.tempo-header-extras {
|
||||
display: flex;
|
||||
grid-area: 1 / 6;
|
||||
justify-self: end;
|
||||
flex-shrink: 0;
|
||||
padding: 0 0.75rem;
|
||||
border-top: 0;
|
||||
border-inline: 1px solid #ffffff1a;
|
||||
}
|
||||
.tempo-header-utilities {
|
||||
flex-wrap: nowrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.tempo-header-social {
|
||||
width: 26px;
|
||||
}
|
||||
.tempo-header-toggle {
|
||||
display: none;
|
||||
}
|
||||
.tempo-header-actions {
|
||||
grid-area: 1 / 7;
|
||||
}
|
||||
.tempo-section-bar {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
.tempo-section-inner {
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
gap: normal;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
padding-inline: 0;
|
||||
}
|
||||
.tempo-section-navigation {
|
||||
display: grid;
|
||||
grid-area: 1 / 2 / 2 / 5;
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
.tempo-section-navigation > ul {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
gap: normal;
|
||||
}
|
||||
.tempo-section-navigation .tempo-nav-trigger {
|
||||
padding-inline: 0.625rem;
|
||||
}
|
||||
.tempo-primary-navigation .tempo-nav-trigger,
|
||||
.tempo-section-navigation .tempo-nav-trigger {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.tempo-interest-button {
|
||||
padding-inline: 0.85rem;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
.tempo-section-inner .tempo-interest-button {
|
||||
grid-area: 1 / 6 / 2 / -1;
|
||||
}
|
||||
}
|
||||
.tempo-header :is(a, button):focus-visible {
|
||||
outline: 2px solid #fff;
|
||||
outline-offset: 4px;
|
||||
}
|
||||
.tempo-dropdown {
|
||||
z-index: 60;
|
||||
border: 1px solid #e2e8f0;
|
||||
@@ -36,7 +441,7 @@
|
||||
outline: none;
|
||||
}
|
||||
.tempo-footer {
|
||||
margin-top: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
background: #050505;
|
||||
color: #fff;
|
||||
}
|
||||
@@ -70,8 +475,7 @@
|
||||
.tempo-contact-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
min-height: 40px;
|
||||
gap: 1rem;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
.tempo-contact-link:hover {
|
||||
|
||||
@@ -1,321 +0,0 @@
|
||||
/* Presentation choice for Tempo's 21/10/2026 request: one shared navigation. */
|
||||
.tempo-header {
|
||||
position: relative;
|
||||
z-index: 40;
|
||||
background: #090909;
|
||||
color: #fff;
|
||||
border-bottom: 1px solid #ffffff14;
|
||||
}
|
||||
.tempo-header-inner {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||
grid-template-rows: 71px;
|
||||
align-items: center;
|
||||
column-gap: 0.5rem;
|
||||
max-width: 1600px;
|
||||
margin-inline: auto;
|
||||
padding-inline: 0.75rem;
|
||||
}
|
||||
.tempo-logo-link {
|
||||
grid-area: 1 / 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
width: 112px;
|
||||
max-width: 100%;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.tempo-header-logo {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
.tempo-primary-navigation {
|
||||
display: none;
|
||||
grid-area: 2 / 1 / auto / -1;
|
||||
min-width: 0;
|
||||
border-top: 1px solid #ffffff1a;
|
||||
padding-block: 0.75rem;
|
||||
}
|
||||
.tempo-primary-navigation > ul {
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.tempo-nav-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.4rem;
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
color: #e2e8f0;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
color 0.2s,
|
||||
background 0.2s;
|
||||
}
|
||||
.tempo-nav-trigger:hover,
|
||||
.tempo-nav-trigger[data-state='open'] {
|
||||
background: #ffffff0d;
|
||||
color: #fff;
|
||||
}
|
||||
.tempo-nav-trigger[data-current-group] {
|
||||
color: #fff;
|
||||
background: #ffffff08;
|
||||
box-shadow: inset 0 -2px #ed1c24;
|
||||
}
|
||||
.tempo-nav-trigger > svg {
|
||||
flex-shrink: 0;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.tempo-nav-trigger[data-state='open'] > svg {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.tempo-header-extras {
|
||||
display: none;
|
||||
grid-area: 3 / 1 / auto / -1;
|
||||
min-width: 0;
|
||||
padding-block: 0.75rem;
|
||||
border-top: 1px solid #ffffff1a;
|
||||
}
|
||||
.tempo-header-utilities {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.tempo-utility-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
min-height: 44px;
|
||||
padding: 0.4rem;
|
||||
border-radius: 0.5rem;
|
||||
color: #e2e8f0;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
.tempo-utility-button:hover {
|
||||
background: #ffffff10;
|
||||
}
|
||||
.tempo-header-actions {
|
||||
grid-area: 1 / 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.tempo-login-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-height: 44px;
|
||||
padding: 0.5rem 0.625rem;
|
||||
border: 1px solid #ffffff40;
|
||||
border-radius: 0.5rem;
|
||||
color: #fff;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
background 0.2s,
|
||||
border-color 0.2s;
|
||||
}
|
||||
.tempo-login-button:hover {
|
||||
background: #ffffff10;
|
||||
border-color: #ffffff80;
|
||||
}
|
||||
.tempo-login-button > span {
|
||||
max-width: clamp(2rem, calc(100vw - 18rem), 6rem);
|
||||
}
|
||||
.tempo-panel-summary {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 0.5rem;
|
||||
color: #e2e8f0;
|
||||
}
|
||||
.tempo-panel-summary:hover {
|
||||
background: #ffffff10;
|
||||
color: #fff;
|
||||
}
|
||||
.tempo-panel-count {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -0.125rem;
|
||||
min-width: 17px;
|
||||
padding-inline: 0.2rem;
|
||||
border: 2px solid #090909;
|
||||
border-radius: 999px;
|
||||
background: #ed1c24;
|
||||
color: #fff;
|
||||
font-size: 0.5625rem;
|
||||
line-height: 1.4;
|
||||
text-align: center;
|
||||
}
|
||||
.tempo-interest-button {
|
||||
display: none;
|
||||
grid-area: 4 / 1 / auto / -1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
min-height: 44px;
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.5rem 0.875rem;
|
||||
border: 1px solid #ed1c24;
|
||||
border-radius: 0.5rem;
|
||||
background: #ed1c24;
|
||||
color: #fff;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.tempo-interest-button:hover {
|
||||
background: #c9151c;
|
||||
}
|
||||
.tempo-header-toggle {
|
||||
grid-area: 1 / 3;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1px solid #ffffff33;
|
||||
border-radius: 0.5rem;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tempo-header-toggle:hover,
|
||||
.tempo-header-toggle[aria-expanded='true'] {
|
||||
background: #ffffff10;
|
||||
}
|
||||
.tempo-header[data-expanded] .tempo-primary-navigation {
|
||||
display: block;
|
||||
}
|
||||
.tempo-header[data-expanded] .tempo-header-extras {
|
||||
display: flex;
|
||||
}
|
||||
.tempo-header[data-expanded] .tempo-interest-button {
|
||||
display: inline-flex;
|
||||
}
|
||||
.tempo-header :is(a, button):focus-visible {
|
||||
outline: 2px solid #fff;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
.tempo-submenu {
|
||||
max-width: min(
|
||||
calc(100vw - 1.5rem),
|
||||
var(--radix-dropdown-menu-content-available-width)
|
||||
);
|
||||
}
|
||||
@media (min-width: 640px) {
|
||||
.tempo-header-inner {
|
||||
grid-template-columns: minmax(0, 1fr) auto auto auto;
|
||||
column-gap: 0.75rem;
|
||||
padding-inline: 1.5rem;
|
||||
}
|
||||
.tempo-logo-link {
|
||||
width: 132px;
|
||||
}
|
||||
.tempo-interest-button {
|
||||
display: inline-flex;
|
||||
grid-area: 1 / 3;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.tempo-header-toggle {
|
||||
grid-area: 1 / 4;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1280px) {
|
||||
.tempo-header-inner {
|
||||
grid-template-columns: auto minmax(0, 1fr) auto auto auto;
|
||||
column-gap: 0.25rem;
|
||||
padding-inline: 1.25rem;
|
||||
}
|
||||
.tempo-logo-link {
|
||||
width: 100px;
|
||||
}
|
||||
.tempo-login-button > span {
|
||||
max-width: 3rem;
|
||||
}
|
||||
.tempo-primary-navigation,
|
||||
.tempo-header[data-expanded] .tempo-primary-navigation {
|
||||
display: block;
|
||||
grid-area: 1 / 2;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
justify-self: center;
|
||||
}
|
||||
.tempo-primary-navigation > ul {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
.tempo-nav-trigger {
|
||||
justify-content: center;
|
||||
padding-inline: 0.25rem;
|
||||
font-size: 1.125rem;
|
||||
letter-spacing: 0.025em;
|
||||
}
|
||||
.tempo-header-extras,
|
||||
.tempo-header[data-expanded] .tempo-header-extras {
|
||||
display: flex;
|
||||
grid-area: 1 / 3;
|
||||
padding: 0 0.5rem 0 0;
|
||||
border: 0;
|
||||
border-right: 1px solid #ffffff1a;
|
||||
}
|
||||
.tempo-header-utilities {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.tempo-header-actions {
|
||||
grid-area: 1 / 4;
|
||||
}
|
||||
.tempo-interest-button {
|
||||
grid-area: 1 / 5;
|
||||
}
|
||||
.tempo-header-toggle {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1440px) {
|
||||
.tempo-header-inner {
|
||||
column-gap: 0.75rem;
|
||||
padding-inline: 2rem;
|
||||
}
|
||||
.tempo-nav-trigger {
|
||||
padding-inline: 0.375rem;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
.tempo-logo-link {
|
||||
width: 132px;
|
||||
}
|
||||
.tempo-login-button > span {
|
||||
max-width: 5rem;
|
||||
}
|
||||
.tempo-header-extras {
|
||||
padding-right: 0.75rem;
|
||||
}
|
||||
.tempo-primary-navigation > ul {
|
||||
gap: 0.125rem;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1536px) {
|
||||
.tempo-header-inner {
|
||||
column-gap: 1rem;
|
||||
}
|
||||
.tempo-nav-trigger {
|
||||
padding-inline: 0.75rem;
|
||||
}
|
||||
.tempo-login-button > span {
|
||||
max-width: 6rem;
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,14 @@ import { Link, router, usePage } from '@inertiajs/react';
|
||||
import {
|
||||
ChevronDown,
|
||||
ArrowUpRight,
|
||||
LayoutDashboard,
|
||||
LogOut,
|
||||
Menu,
|
||||
UserRound,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { Fragment, useEffect, useId, useRef, useState } from 'react';
|
||||
import { useIsMobile } from '@/hooks/use-mobile';
|
||||
import { useEffect, useId, useRef, useState } from 'react';
|
||||
import { useNavigationContext } from '@/components/navigation-context';
|
||||
import { tempoSocialLinks, useTempoUi } from '@/components/tempo-brand';
|
||||
import { TempoSocialLinks, useTempoUi } from '@/components/tempo-brand';
|
||||
import {
|
||||
TempoLanguageSelector,
|
||||
TempoWeather,
|
||||
@@ -54,7 +52,6 @@ export function PortalGroupedMenu() {
|
||||
scopedAdministration?: {label:string;href:string}[];
|
||||
}>();
|
||||
const { t, language, requestCount } = useTempoUi();
|
||||
const mobile = useIsMobile();
|
||||
const navigation = useNavigationContext();
|
||||
const groups = portalNavigation({
|
||||
context: navigation.view
|
||||
@@ -75,34 +72,24 @@ export function PortalGroupedMenu() {
|
||||
const currentItem = currentNavigationItem(groups, url);
|
||||
const [loggingOut, setLoggingOut] = useState(false);
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const navigationId = useId();
|
||||
const institutionalId = useId();
|
||||
const toolsId = useId();
|
||||
const interestId = useId();
|
||||
const toggle = useRef<HTMLButtonElement>(null);
|
||||
useEffect(() => router.on('navigate', () => setExpanded(false)), []);
|
||||
const items = (children: PortalNavItem[]) =>
|
||||
children.map((item) =>
|
||||
item.children ? (
|
||||
mobile ? (
|
||||
<Fragment key={item.id}>
|
||||
<DropdownMenuLabel className="mt-2 border-t px-3 pt-3 text-xs text-slate-500">
|
||||
{t(item.label)}
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSub key={item.id}>
|
||||
<DropdownMenuSubTrigger className="tempo-menu-item font-semibold">
|
||||
{t(item.label)}
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[min(70vh,34rem)] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
{items(item.children)}
|
||||
</Fragment>
|
||||
) : (
|
||||
<DropdownMenuSub key={item.id}>
|
||||
<DropdownMenuSubTrigger className="tempo-menu-item font-semibold">
|
||||
{t(item.label)}
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown tempo-submenu max-h-[min(70vh,34rem)] w-72 overflow-y-auto p-2"
|
||||
>
|
||||
{items(item.children)}
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuSub>
|
||||
)
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuSub>
|
||||
) : (
|
||||
<DropdownMenuItem
|
||||
key={item.id}
|
||||
@@ -124,8 +111,6 @@ export function PortalGroupedMenu() {
|
||||
(group) =>
|
||||
!['home', 'discovery', 'realization', 'support'].includes(group.id),
|
||||
);
|
||||
const panelLabel = `${t('O meu painel')} — ${requestCount} ${t(requestCount === 1 ? 'pedido recebido' : 'pedidos recebidos')}`;
|
||||
const institutionalCurrent = url.split('?')[0] === '/contacto';
|
||||
return (
|
||||
<header
|
||||
className="tempo-header"
|
||||
@@ -135,303 +120,245 @@ export function PortalGroupedMenu() {
|
||||
if (
|
||||
event.key === 'Escape' &&
|
||||
expanded &&
|
||||
!event.defaultPrevented &&
|
||||
!(
|
||||
event.target instanceof Element &&
|
||||
event.target.closest('[role="menu"]')
|
||||
)
|
||||
!event.defaultPrevented
|
||||
) {
|
||||
setExpanded(false);
|
||||
toggle.current?.focus();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="tempo-header-inner">
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="Tempo — início"
|
||||
className="tempo-logo-link"
|
||||
>
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="tempo-header-logo"
|
||||
/>
|
||||
</Link>
|
||||
<nav
|
||||
id={navigationId}
|
||||
aria-label="Áreas do portal"
|
||||
className="tempo-primary-navigation"
|
||||
>
|
||||
<ul>
|
||||
<li>
|
||||
<Link
|
||||
href="/"
|
||||
className="tempo-nav-trigger"
|
||||
aria-current={
|
||||
url.split('?')[0] === '/'
|
||||
? 'page'
|
||||
: undefined
|
||||
}
|
||||
data-current-group={
|
||||
url.split('?')[0] === '/' || undefined
|
||||
}
|
||||
>
|
||||
{t('Início')}
|
||||
</Link>
|
||||
</li>
|
||||
{groups
|
||||
.filter((group) =>
|
||||
[
|
||||
'discovery',
|
||||
'realization',
|
||||
'support',
|
||||
].includes(group.id),
|
||||
)
|
||||
.map((group) => (
|
||||
<li key={group.id}>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
className="tempo-nav-trigger"
|
||||
data-current-group={
|
||||
current === group.id ||
|
||||
undefined
|
||||
}
|
||||
>
|
||||
{t(group.label)}
|
||||
<ChevronDown
|
||||
size={14}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{current === group.id && (
|
||||
<span className="sr-only">
|
||||
Grupo actual
|
||||
</span>
|
||||
)}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
sideOffset={12}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[min(75vh,36rem)] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
{items(group.children ?? [])}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</li>
|
||||
))}
|
||||
<li>
|
||||
<Link
|
||||
href="/sobre"
|
||||
className="tempo-nav-trigger"
|
||||
aria-current={
|
||||
url.split('?')[0] === '/sobre'
|
||||
? 'page'
|
||||
: undefined
|
||||
}
|
||||
data-current-group={
|
||||
url.split('?')[0] === '/sobre' || undefined
|
||||
}
|
||||
>
|
||||
{t('Sobre nós')}
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
<div className="tempo-header-layout">
|
||||
<div className="tempo-header-inner">
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="InvesteMoz — início"
|
||||
className="tempo-logo-link"
|
||||
>
|
||||
<PortalProductIdentity />
|
||||
</Link>
|
||||
<nav
|
||||
id={institutionalId}
|
||||
aria-label="Navegação institucional"
|
||||
className="tempo-primary-navigation"
|
||||
>
|
||||
<ul>
|
||||
<li>
|
||||
<Link
|
||||
href="/"
|
||||
className="tempo-nav-trigger"
|
||||
aria-current={
|
||||
url.split('?')[0] === '/'
|
||||
? 'page'
|
||||
: undefined
|
||||
}
|
||||
data-current-group={
|
||||
institutionalCurrent || undefined
|
||||
url.split('?')[0] === '/' || undefined
|
||||
}
|
||||
>
|
||||
Tempo
|
||||
<ChevronDown size={14} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
sideOffset={12}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[75vh] w-64 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
{t('Início')}
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://revista.tempo.co.mz/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tempo-nav-trigger"
|
||||
aria-label={`${t('Revista Tempo')} — ${t('Abre num novo separador')}`}
|
||||
>
|
||||
<DropdownMenuItem
|
||||
asChild
|
||||
className="tempo-menu-item"
|
||||
{t('Revista Tempo')}
|
||||
<ArrowUpRight
|
||||
size={14}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
{[
|
||||
['/sobre', 'Sobre nós'],
|
||||
['/contacto', 'Contacto'],
|
||||
].map(([href, label]) => (
|
||||
<li key={href}>
|
||||
<Link
|
||||
href={href}
|
||||
className="tempo-nav-trigger"
|
||||
aria-current={
|
||||
url.split('?')[0] === href
|
||||
? 'page'
|
||||
: undefined
|
||||
}
|
||||
data-current-group={
|
||||
url.split('?')[0] === href ||
|
||||
undefined
|
||||
}
|
||||
>
|
||||
<a
|
||||
href="https://revista.tempo.co.mz/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`${t('Revista Tempo')} — ${t('Abre num novo separador')}`}
|
||||
>
|
||||
{t('Revista Tempo')}
|
||||
<ArrowUpRight
|
||||
size={14}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
{[['/contacto', 'Contacto']].map(
|
||||
([href, label]) => (
|
||||
<DropdownMenuItem
|
||||
key={href}
|
||||
asChild
|
||||
className="tempo-menu-item"
|
||||
>
|
||||
<Link
|
||||
href={href}
|
||||
aria-current={
|
||||
url.split('?')[0] ===
|
||||
href
|
||||
? 'page'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{t(label)}
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
),
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuLabel className="text-xs text-slate-500">
|
||||
Revista Tempo
|
||||
</DropdownMenuLabel>
|
||||
{tempoSocialLinks.map(
|
||||
({ name, href, icon: Icon }) => (
|
||||
<DropdownMenuItem
|
||||
key={name}
|
||||
asChild
|
||||
className="tempo-menu-item"
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`Revista Tempo — ${name}`}
|
||||
>
|
||||
<Icon
|
||||
size={16}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{name}
|
||||
<ArrowUpRight
|
||||
size={12}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
),
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div id={toolsId} className="tempo-header-extras">
|
||||
<div className="tempo-header-utilities">
|
||||
<div className="flex items-center gap-1">
|
||||
<TempoWeather />
|
||||
<TempoLanguageSelector />
|
||||
{t(label)}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<div id={toolsId} className="tempo-header-extras">
|
||||
<div className="tempo-header-utilities">
|
||||
<div className="flex items-center gap-1">
|
||||
<TempoWeather />
|
||||
<TempoLanguageSelector />
|
||||
</div>
|
||||
<TempoSocialLinks />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="tempo-header-actions">
|
||||
<Link
|
||||
href="/investidor/manifestacoes"
|
||||
className="tempo-panel-summary"
|
||||
aria-label={panelLabel}
|
||||
title={panelLabel}
|
||||
>
|
||||
<LayoutDashboard size={19} aria-hidden="true" />
|
||||
<span className="tempo-panel-count" aria-hidden="true">
|
||||
{requestCount}
|
||||
</span>
|
||||
</Link>
|
||||
<span
|
||||
className="sr-only"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
aria-atomic="true"
|
||||
>
|
||||
{panelLabel}
|
||||
</span>
|
||||
{props.auth?.user ? (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger className="tempo-login-button">
|
||||
<UserRound size={16} aria-hidden="true" />
|
||||
<span className="max-w-24 truncate">
|
||||
{props.auth.user.name || t('A minha área')}
|
||||
</span>
|
||||
<ChevronDown size={12} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
sideOffset={12}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[75vh] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
<DropdownMenuLabel className="truncate text-xs text-slate-500">
|
||||
{props.auth.user.email}
|
||||
</DropdownMenuLabel>
|
||||
{items(accountGroups)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
asChild
|
||||
className="tempo-menu-item text-red-700"
|
||||
<div className="tempo-header-actions">
|
||||
{props.auth?.user ? (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger className="tempo-login-button">
|
||||
<UserRound size={16} aria-hidden="true" />
|
||||
<span className="max-w-24 truncate">
|
||||
{props.auth.user.name ||
|
||||
t('A minha área')}
|
||||
</span>
|
||||
<ChevronDown size={12} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
sideOffset={12}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[75vh] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
<Link
|
||||
href={logout()}
|
||||
as="button"
|
||||
type="button"
|
||||
disabled={loggingOut}
|
||||
data-test="portal-logout-button"
|
||||
onClick={() => router.flushAll()}
|
||||
onStart={() => setLoggingOut(true)}
|
||||
onFinish={() => setLoggingOut(false)}
|
||||
<DropdownMenuLabel className="truncate text-xs text-slate-500">
|
||||
{props.auth.user.email}
|
||||
</DropdownMenuLabel>
|
||||
{items(accountGroups)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
asChild
|
||||
className="tempo-menu-item text-red-700"
|
||||
>
|
||||
<LogOut size={16} aria-hidden="true" />
|
||||
{loggingOut
|
||||
? 'A terminar sessão…'
|
||||
: t('Terminar sessão')}
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : (
|
||||
<Link href="/login" className="tempo-login-button">
|
||||
<UserRound size={15} aria-hidden="true" />
|
||||
{t('Entrar')}
|
||||
</Link>
|
||||
)}
|
||||
<Link
|
||||
href={logout()}
|
||||
as="button"
|
||||
type="button"
|
||||
disabled={loggingOut}
|
||||
data-test="portal-logout-button"
|
||||
onClick={() => router.flushAll()}
|
||||
onStart={() => setLoggingOut(true)}
|
||||
onFinish={() =>
|
||||
setLoggingOut(false)
|
||||
}
|
||||
>
|
||||
<LogOut
|
||||
size={16}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{loggingOut
|
||||
? 'A terminar sessão…'
|
||||
: t('Terminar sessão')}
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : (
|
||||
<Link href="/login" className="tempo-login-button">
|
||||
<UserRound size={15} aria-hidden="true" />
|
||||
{t('Entrar')}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
ref={toggle}
|
||||
type="button"
|
||||
className="tempo-header-toggle"
|
||||
aria-label={
|
||||
expanded
|
||||
? 'Fechar menu e ferramentas'
|
||||
: 'Abrir menu e ferramentas'
|
||||
}
|
||||
aria-expanded={expanded}
|
||||
aria-controls={`${institutionalId} ${toolsId}`}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
>
|
||||
{expanded ? (
|
||||
<X size={22} aria-hidden="true" />
|
||||
) : (
|
||||
<Menu size={22} aria-hidden="true" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<div className="tempo-section-bar">
|
||||
<div className="tempo-section-inner">
|
||||
<Link
|
||||
href="/investidor/manifestacoes"
|
||||
className="tempo-panel-summary"
|
||||
>
|
||||
<span>{t('O meu painel')}</span>
|
||||
<span
|
||||
className="tempo-panel-count"
|
||||
aria-live="polite"
|
||||
aria-atomic="true"
|
||||
>
|
||||
{requestCount}{' '}
|
||||
{t(
|
||||
requestCount === 1
|
||||
? 'pedido recebido'
|
||||
: 'pedidos recebidos',
|
||||
)}
|
||||
</span>
|
||||
</Link>
|
||||
<nav
|
||||
aria-label="Áreas do portal"
|
||||
className="tempo-section-navigation"
|
||||
>
|
||||
<ul>
|
||||
{groups
|
||||
.filter((group) =>
|
||||
[
|
||||
'discovery',
|
||||
'realization',
|
||||
'support',
|
||||
].includes(group.id),
|
||||
)
|
||||
.map((group) => (
|
||||
<li key={group.id}>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
className="tempo-nav-trigger"
|
||||
data-current-group={
|
||||
current === group.id ||
|
||||
undefined
|
||||
}
|
||||
>
|
||||
{t(group.label)}
|
||||
<ChevronDown
|
||||
size={14}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{current === group.id && (
|
||||
<span className="sr-only">
|
||||
Grupo actual
|
||||
</span>
|
||||
)}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
sideOffset={8}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[min(75vh,36rem)] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
{items(
|
||||
group.children ?? [],
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<Link
|
||||
href="/manifestar-interesse"
|
||||
className="tempo-interest-button"
|
||||
>
|
||||
{t('Manifestar interesse')}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Link
|
||||
id={interestId}
|
||||
href="/manifestar-interesse"
|
||||
className="tempo-interest-button"
|
||||
>
|
||||
{t('Manifestar interesse')}
|
||||
<ArrowUpRight size={15} aria-hidden="true" />
|
||||
</Link>
|
||||
<button
|
||||
ref={toggle}
|
||||
type="button"
|
||||
className="tempo-header-toggle"
|
||||
aria-label={
|
||||
expanded
|
||||
? 'Fechar menu e ferramentas'
|
||||
: 'Abrir menu e ferramentas'
|
||||
}
|
||||
aria-expanded={expanded}
|
||||
aria-controls={`${navigationId} ${toolsId} ${interestId}`}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
>
|
||||
{expanded ? (
|
||||
<X size={22} aria-hidden="true" />
|
||||
) : (
|
||||
<Menu size={22} aria-hidden="true" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { fiscalComponentCodes } from '@/lib/simulation-contract';
|
||||
import { ivaIssueText, type IvaDiagnostic, type IvaIssue } from '@/lib/iva-diagnostics';
|
||||
|
||||
type Parameter = {
|
||||
parameter_code: string;
|
||||
@@ -56,6 +57,8 @@ export function SimulationFiscalStatus({
|
||||
periodStart,
|
||||
periodEnd,
|
||||
context,
|
||||
onDiagnostics,
|
||||
onCorrect,
|
||||
}: {
|
||||
salaryView?: string;
|
||||
scenarioMode?: string;
|
||||
@@ -63,8 +66,11 @@ export function SimulationFiscalStatus({
|
||||
periodStart?: string;
|
||||
periodEnd?: string;
|
||||
context?: Record<string, string>;
|
||||
onDiagnostics?: (issues: IvaIssue[]) => void;
|
||||
onCorrect?: (field: string) => void;
|
||||
}) {
|
||||
const [parameters, setParameters] = useState<Parameter[]>([]);
|
||||
const [diagnostics, setDiagnostics] = useState<IvaDiagnostic[]>([]);
|
||||
const [requestState, setRequestState] = useState('idle');
|
||||
const [retry, setRetry] = useState(0);
|
||||
|
||||
@@ -79,10 +85,14 @@ export function SimulationFiscalStatus({
|
||||
!periodEnd
|
||||
) {
|
||||
setParameters([]);
|
||||
setDiagnostics([]);
|
||||
onDiagnostics?.([]);
|
||||
setRequestState('idle');
|
||||
return;
|
||||
}
|
||||
const abort = new AbortController();
|
||||
setDiagnostics([]);
|
||||
onDiagnostics?.([]);
|
||||
setRequestState('loading');
|
||||
void fetch('/api/v1/tax-parameters/resolve', {
|
||||
method: 'POST',
|
||||
@@ -104,11 +114,15 @@ export function SimulationFiscalStatus({
|
||||
if (!response.ok) throw new Error('lookup_failed');
|
||||
const payload = (await response.json()) as {
|
||||
parameters?: Parameter[];
|
||||
diagnostics?: IvaDiagnostic[];
|
||||
};
|
||||
if (abort.signal.aborted) return;
|
||||
setParameters(
|
||||
Array.isArray(payload.parameters) ? payload.parameters : [],
|
||||
);
|
||||
const details = Array.isArray(payload.diagnostics) ? payload.diagnostics : [];
|
||||
setDiagnostics(details);
|
||||
onDiagnostics?.(details.flatMap((detail) => detail.issues));
|
||||
setRequestState('done');
|
||||
})
|
||||
.catch((error: unknown) => {
|
||||
@@ -158,7 +172,7 @@ export function SimulationFiscalStatus({
|
||||
{requestState === 'loading'
|
||||
? 'A consultar parâmetros aprovados para o período e âmbito indicados…'
|
||||
: requestState === 'error'
|
||||
? 'Não foi possível consultar os parâmetros; o resultado permanece indeterminado.'
|
||||
? 'Falha na consulta do sistema: não foi possível obter os parâmetros. O problema não é atribuído às respostas; estas foram preservadas. Tente novamente.'
|
||||
: !periodStart || !periodEnd
|
||||
? 'Indique um período exacto. Para periodicidade mensal ou trimestral, seleccione o mês ou trimestre.'
|
||||
: `Período consultado: ${periodStart} a ${periodEnd}.`}
|
||||
@@ -186,6 +200,22 @@ export function SimulationFiscalStatus({
|
||||
{salaryViewMessages[salaryView]}
|
||||
</p>
|
||||
)}
|
||||
{diagnostics.length > 0 && <div role="alert" className="space-y-3 rounded border border-amber-700 p-3">
|
||||
<h4 className="font-semibold">IVA — taxa geral: condições não satisfeitas</h4>
|
||||
<p>Não foi possível resolver este parâmetro. As respostas foram preservadas; esta consulta não executa o cálculo do imposto.</p>
|
||||
{diagnostics.map((detail, index) => <div key={index}>
|
||||
<ul className="list-disc pl-5">{detail.issues.map((issue, issueIndex) => <li key={issueIndex}>
|
||||
{ivaIssueText(issue)}{' '}
|
||||
{issue.field && <a className="underline" href={`#field-${issue.field}`} onClick={(event) => { if (onCorrect) { event.preventDefault(); onCorrect(issue.field!); } }}>Rever {issue.label.toLowerCase()}</a>}
|
||||
{issue.category === 'system_configuration' && issue.field === 'fiscal_operation' && <a className="ml-2 underline" href="#published-iva">Abrir IVA — taxa geral</a>}
|
||||
</li>)}</ul>
|
||||
<details className="mt-2"><summary className="cursor-pointer underline">Ver fundamento</summary>
|
||||
<p>IVA — taxa geral · versão {detail.rule_version}. Vigência: {detail.validity.start} a {detail.validity.end ?? 'sem data final indicada'}.</p>
|
||||
<p>{detail.source.title} — {detail.source.diploma}, {detail.source.article}</p>
|
||||
{detail.source.url?.startsWith('https://') && <a className="underline" href={detail.source.url} target="_blank" rel="noreferrer">Consultar fonte</a>}
|
||||
</details>
|
||||
</div>)}
|
||||
</div>}
|
||||
<ul className="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{fiscalComponentCodes.map((code) => {
|
||||
const selected =
|
||||
@@ -211,13 +241,13 @@ export function SimulationFiscalStatus({
|
||||
</p>
|
||||
) : parameters.length === 0 ? (
|
||||
<p className="text-sm">
|
||||
Indeterminado — nenhum parâmetro publicado
|
||||
{code === 'IVA' ? 'Indeterminado — não existe uma versão elegível visível nesta consulta. Consulte o diagnóstico do período acima, quando disponível. Sem esse diagnóstico, não é possível distinguir ausência de cobertura de indisponibilidade da regra ou da fonte; não se atribui o problema às suas respostas.' : <>Indeterminado — nenhum parâmetro publicado
|
||||
aplicável. Faltam parâmetros aprovados para{' '}
|
||||
{code}, no período {periodStart} a{' '}
|
||||
{periodEnd} e no âmbito indicado. A consulta
|
||||
não identifica um conjunto obrigatório de
|
||||
parâmetros; não é possível determinar o
|
||||
imposto nem substituir as lacunas por zero.
|
||||
imposto nem substituir as lacunas por zero.</>}
|
||||
</p>
|
||||
) : (
|
||||
<div className="space-y-2 text-sm">
|
||||
@@ -227,7 +257,7 @@ export function SimulationFiscalStatus({
|
||||
className="border-t pt-2"
|
||||
>
|
||||
<strong>
|
||||
{parameter.parameter_code}
|
||||
{parameter.parameter_code === 'IVA_GENERAL_RATE' ? 'IVA — taxa geral' : parameter.parameter_code}
|
||||
</strong>
|
||||
{parameter.status === 'resolved' ? (
|
||||
<>
|
||||
@@ -238,10 +268,10 @@ export function SimulationFiscalStatus({
|
||||
</p>
|
||||
<p>
|
||||
Regra{' '}
|
||||
{parameter.rule_code} v
|
||||
{parameter.parameter_code === 'IVA_GENERAL_RATE' ? 'IVA — taxa geral' : parameter.rule_code} v
|
||||
{parameter.rule_version}
|
||||
; âmbito{' '}
|
||||
{parameter.scope_key}
|
||||
{parameter.parameter_code === 'IVA_GENERAL_RATE' ? 'operação interna geral sobre base líquida em MZN' : parameter.scope_key}
|
||||
</p>
|
||||
<p>
|
||||
Vigência:{' '}
|
||||
@@ -279,13 +309,13 @@ export function SimulationFiscalStatus({
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Consultar fundamento
|
||||
Ver fundamento
|
||||
</a>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p>
|
||||
{labels[parameter.status] ??
|
||||
{(parameter.parameter_code === 'IVA_GENERAL_RATE' && diagnostics.length ? 'Consulte acima cada condição e o fundamento da versão.' : labels[parameter.status]) ??
|
||||
'Indeterminado — não foi possível validar o parâmetro.'}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -56,6 +56,7 @@ import { SimulationFinancialTools } from '@/components/simulation-financial-tool
|
||||
import { SimulationCashflowPlanner } from '@/components/simulation-cashflow-planner';
|
||||
import { SimulationBusinessPlan } from '@/components/simulation-business-plan';
|
||||
import { SimulationFiscalStatus } from '@/components/simulation-fiscal-status';
|
||||
import { ivaIssueText, type IvaIssue } from '@/lib/iva-diagnostics';
|
||||
import {
|
||||
ProjectMilestonePlanner,
|
||||
ProjectTeamPlanner,
|
||||
@@ -810,6 +811,7 @@ export function SimulationForm() {
|
||||
});
|
||||
const [step, setStep] = useState(0);
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
const [ivaIssues, setIvaIssues] = useState<IvaIssue[]>([]);
|
||||
const [serverFieldErrors, setServerFieldErrors] = useState<
|
||||
Record<string, string>
|
||||
>({});
|
||||
@@ -1936,6 +1938,7 @@ export function SimulationForm() {
|
||||
) {
|
||||
if (!ready) return;
|
||||
setContinueLaterSaved(false);
|
||||
setIvaIssues((previous) => previous.filter((issue) => issue.field !== key));
|
||||
setServerFieldErrors((previous) => {
|
||||
const next = { ...previous };
|
||||
delete next[key];
|
||||
@@ -3285,6 +3288,7 @@ export function SimulationForm() {
|
||||
: Boolean(field.required);
|
||||
const fieldError =
|
||||
serverFieldErrors[field.key] ?? errors[field.key];
|
||||
const ivaNotes = ivaIssues.filter((issue) => issue.field === field.key).map((issue, index) => <p key={index} role="note" className="mt-1 text-sm text-amber-950">{ivaIssueText(issue)}</p>);
|
||||
if (field.options) {
|
||||
const parentKey =
|
||||
field.key === 'district_id'
|
||||
@@ -3331,6 +3335,7 @@ export function SimulationForm() {
|
||||
}
|
||||
/>
|
||||
<FieldGuidance fieldKey={field.key} />
|
||||
{ivaNotes}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3405,6 +3410,7 @@ export function SimulationForm() {
|
||||
{fieldError}
|
||||
</p>
|
||||
)}
|
||||
{ivaNotes}
|
||||
{field.key === 'reduction' && (
|
||||
<p className="mt-1 text-sm text-slate-600">
|
||||
Hipótese sua, não representa um
|
||||
@@ -3609,6 +3615,12 @@ export function SimulationForm() {
|
||||
aria-label="Consulta de parâmetros fiscais"
|
||||
>
|
||||
<SimulationFiscalStatus
|
||||
onDiagnostics={setIvaIssues}
|
||||
onCorrect={(key) => {
|
||||
const target = journeySections.findIndex((section) => (simulationFieldGroups[section.id] ?? []).some((field) => field.key === key));
|
||||
if (target >= 0) setStep(target);
|
||||
window.requestAnimationFrame(() => document.getElementById(`field-${key}`)?.focus());
|
||||
}}
|
||||
salaryView={String(draft.irps_salary_view ?? '')}
|
||||
scenarioMode={
|
||||
openedTool === 'fiscal'
|
||||
@@ -3618,7 +3630,7 @@ export function SimulationForm() {
|
||||
component={String(draft.fiscal_component ?? '')}
|
||||
periodStart={getFiscalPeriodRange(draft)?.start}
|
||||
periodEnd={getFiscalPeriodRange(draft)?.end}
|
||||
context={Object.fromEntries(
|
||||
context={{ ...Object.fromEntries(
|
||||
[
|
||||
'fiscal_periodicity',
|
||||
'fiscal_operation',
|
||||
@@ -3635,7 +3647,7 @@ export function SimulationForm() {
|
||||
? [[key, draft[key] as string]]
|
||||
: [],
|
||||
),
|
||||
)}
|
||||
), ...(typeof draft.fiscal_currency === 'string' && draft.fiscal_currency !== '' ? {currency: draft.fiscal_currency} : {}) }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -51,8 +51,8 @@ export function SimulationPublishedIva({ busy, onCalculate }: {
|
||||
} catch { /* The execution flow already preserves and reports connection errors. */ }
|
||||
}
|
||||
|
||||
return <section aria-label="IVA geral sobre base líquida" className="space-y-3 rounded border border-emerald-700 p-4">
|
||||
<h4 className="font-semibold">IVA geral sobre base líquida</h4>
|
||||
return <section id="published-iva" tabIndex={-1} aria-label="IVA — taxa geral" className="space-y-3 rounded border border-emerald-700 p-4">
|
||||
<h4 className="font-semibold">IVA — taxa geral</h4>
|
||||
<p role="status">{message}</p>
|
||||
<p className="text-sm">Cobertura: exigibilidade em 2026, operação interna à taxa geral. A base tributável é indicada por si; não é copiada do orçamento. Sem isenções, taxas reduzidas, bases especiais, importações, deduções, declaração ou pagamento. O cálculo não valida o enquadramento jurídico.</p>
|
||||
<fieldset disabled={busy} className="space-y-3">
|
||||
|
||||
@@ -10,16 +10,14 @@ const navigation = [
|
||||
|
||||
export function TempoFooter() {
|
||||
const { t, language } = useTempoUi();
|
||||
const { portalInstitutionalContactEmail } = usePage<{
|
||||
portalInstitutionalContactEmail?: string | null;
|
||||
}>().props;
|
||||
const { portalInstitutionalContactEmail } = usePage<{ portalInstitutionalContactEmail?: string | null }>().props;
|
||||
return (
|
||||
<footer
|
||||
className="tempo-footer border-t border-white/5"
|
||||
lang={language}
|
||||
>
|
||||
<div className="mx-auto grid max-w-7xl grid-cols-1 gap-6 px-6 py-6 md:grid-cols-2 lg:grid-cols-5 lg:gap-8 lg:px-12">
|
||||
<div className="space-y-4">
|
||||
<div className="mx-auto grid max-w-7xl grid-cols-1 gap-12 px-6 py-10 md:grid-cols-2 lg:grid-cols-5 lg:gap-16 lg:px-12">
|
||||
<div className="space-y-8">
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="InvesteMoz — início"
|
||||
@@ -39,9 +37,9 @@ export function TempoFooter() {
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-8">
|
||||
<h2 className="tempo-footer-heading">{t('Contactos')}</h2>
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-5">
|
||||
{[
|
||||
['+258868010880', '+258 86 801 0880'],
|
||||
['+258833219644', '+258 83 321 9644'],
|
||||
@@ -60,26 +58,21 @@ export function TempoFooter() {
|
||||
</a>
|
||||
))}
|
||||
<a
|
||||
href={
|
||||
portalInstitutionalContactEmail
|
||||
? `mailto:${portalInstitutionalContactEmail}`
|
||||
: '/apoio'
|
||||
}
|
||||
href={portalInstitutionalContactEmail ? `mailto:${portalInstitutionalContactEmail}` : '/apoio'}
|
||||
className="tempo-contact-link"
|
||||
>
|
||||
<span className="tempo-contact-icon">
|
||||
<Mail size={16} aria-hidden="true" />
|
||||
</span>
|
||||
<strong className="min-w-0 text-[13px] leading-5 font-medium [overflow-wrap:anywhere]">
|
||||
{portalInstitutionalContactEmail ??
|
||||
t('Apoio ao investidor')}
|
||||
<strong className="min-w-0 text-sm font-medium [overflow-wrap:anywhere]">
|
||||
{portalInstitutionalContactEmail ?? t('Apoio ao investidor')}
|
||||
</strong>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<nav aria-label="Navegação do rodapé" className="space-y-4">
|
||||
<nav aria-label="Navegação do rodapé" className="space-y-8">
|
||||
<h2 className="tempo-footer-heading">{t('Navegação')}</h2>
|
||||
<ul className="space-y-2">
|
||||
<ul className="space-y-4">
|
||||
{navigation.map(([href, label]) => (
|
||||
<li key={href}>
|
||||
<Link href={href} className="tempo-footer-link">
|
||||
@@ -93,9 +86,9 @@ export function TempoFooter() {
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<nav aria-label="Informação legal" className="space-y-4">
|
||||
<nav aria-label="Informação legal" className="space-y-8">
|
||||
<h2 className="tempo-footer-heading">Legal</h2>
|
||||
<ul className="space-y-2">
|
||||
<ul className="space-y-4">
|
||||
{[
|
||||
[
|
||||
'politica-de-privacidade',
|
||||
@@ -118,7 +111,7 @@ export function TempoFooter() {
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-8">
|
||||
<h2 className="tempo-footer-heading">Social</h2>
|
||||
<p className="text-xs leading-relaxed font-medium text-slate-300">
|
||||
{t(
|
||||
@@ -128,8 +121,8 @@ export function TempoFooter() {
|
||||
<TempoSocialLinks footer />
|
||||
</div>
|
||||
</div>
|
||||
<div className="border-t border-white/10 py-1.5">
|
||||
<div className="mx-auto flex max-w-7xl flex-col items-center justify-between gap-1 px-6 text-center text-[10px] tracking-[0.1em] text-slate-400 md:flex-row md:text-left md:text-[11px]">
|
||||
<div className="border-t border-white/10 py-2">
|
||||
<div className="mx-auto flex max-w-7xl flex-col items-center justify-between gap-6 px-6 text-center text-[10px] tracking-[0.2em] text-slate-400 md:flex-row md:text-left md:text-xs">
|
||||
<p>
|
||||
© {new Date().getFullYear()}{' '}
|
||||
<span className="text-[#ed1c24]">Tempo</span>.{' '}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
export type IvaIssue = {
|
||||
category: 'missing_field' | 'invalid_value' | 'out_of_scope' | 'period_unavailable' | 'system_configuration';
|
||||
field: string | null;
|
||||
label: string;
|
||||
received: unknown;
|
||||
expected: string;
|
||||
message: string;
|
||||
};
|
||||
export type IvaDiagnostic = {
|
||||
label: string;
|
||||
rule_version: number;
|
||||
validity: { start: string; end: string | null };
|
||||
source: { title?: string; diploma?: string; article?: string; url?: string };
|
||||
issues: IvaIssue[];
|
||||
};
|
||||
export const ivaIssueCategories = {
|
||||
missing_field: 'Campo em falta', invalid_value: 'Valor inválido', out_of_scope: 'Fora do âmbito',
|
||||
period_unavailable: 'Regra indisponível para o período', system_configuration: 'Configuração do sistema',
|
||||
};
|
||||
export function ivaReceived(value: unknown): string {
|
||||
const labels: Record<string, string> = { domestic: 'Operação interna', internal_general_net: 'Operação interna à taxa geral, sobre base líquida', import: 'Importação', export: 'Exportação', refund: 'Reembolso', unknown: 'Não sei', non_resident: 'Operação com não residente', other: 'Outra operação' };
|
||||
return typeof value === 'string' && value !== '' ? (labels[value] ?? value) : 'Não recebido';
|
||||
}
|
||||
export function ivaIssueText(issue: IvaIssue): string {
|
||||
return `${issue.label}: ${ivaIssueCategories[issue.category]}. Recebido: ${ivaReceived(issue.received)}. Esperado: ${issue.expected}. ${issue.message}`;
|
||||
}
|
||||
@@ -444,6 +444,7 @@ export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
id: 'discovery',
|
||||
label: 'Descoberta',
|
||||
children: [
|
||||
link('home', 'Início', '/'),
|
||||
link(
|
||||
'idea-entry',
|
||||
'Partir de uma ideia',
|
||||
|
||||
@@ -965,6 +965,12 @@ export const simulationFieldGroups: Record<
|
||||
},
|
||||
],
|
||||
tax: [
|
||||
{
|
||||
key: 'fiscal_currency',
|
||||
label: 'Moeda da operação fiscal (sem conversão automática)',
|
||||
options: 'currency',
|
||||
showWhen: (d) => d.fiscal_component === 'iva' && d.fiscal_scenario_mode !== 'custom_planning',
|
||||
},
|
||||
{
|
||||
key: 'fiscal_period',
|
||||
label: 'Ano do período fiscal a simular',
|
||||
|
||||
@@ -76,6 +76,33 @@ class SimulationPublishedFiscalTest extends TestCase
|
||||
return Simulation::with('reports')->findOrFail($id);
|
||||
}
|
||||
|
||||
public function test_iva_query_diagnostics_explain_the_reported_contract_gap_without_calculating_or_changing_answers(): void
|
||||
{
|
||||
$count = Simulation::count();
|
||||
$input = ['component' => 'IVA', 'period_start' => '2026-01-01', 'period_end' => '2026-12-31',
|
||||
'context' => ['fiscal_operation' => 'domestic', 'currency' => 'USD']];
|
||||
$this->actingAs($this->consumer)->postJson('/api/v1/tax-parameters/resolve', $input)->assertOk()
|
||||
->assertJsonPath('assumptions.currency', 'USD')
|
||||
->assertJsonPath('parameters.0.status', 'indeterminate_context')
|
||||
->assertJsonPath('diagnostics.0.label', 'IVA — taxa geral')
|
||||
->assertJsonPath('diagnostics.0.rule_version', 1)
|
||||
->assertJsonPath('diagnostics.0.issues.1.category', 'system_configuration')
|
||||
->assertJsonPath('diagnostics.0.issues.1.received', 'domestic')
|
||||
->assertJsonPath('diagnostics.0.issues.0.category', 'out_of_scope')
|
||||
->assertJsonPath('diagnostics.0.issues.0.received', 'USD')
|
||||
->assertJsonPath('diagnostics.0.issues.0.expected', 'MZN');
|
||||
unset($input['context']['currency']);
|
||||
$this->postJson('/api/v1/tax-parameters/resolve', $input)->assertOk()
|
||||
->assertJsonPath('diagnostics.0.issues.0.category', 'missing_field');
|
||||
$input['context']['currency'] = 'MZN';
|
||||
$input['period_start'] = '2022-01-01';
|
||||
$input['period_end'] = '2022-12-31';
|
||||
$this->postJson('/api/v1/tax-parameters/resolve', $input)->assertOk()
|
||||
->assertJsonPath('parameters', [])
|
||||
->assertJsonPath('diagnostics.0.issues.0.category', 'period_unavailable');
|
||||
self::assertSame($count, Simulation::count());
|
||||
}
|
||||
|
||||
public function test_normal_simulator_admits_published_rule_and_reuses_history_and_reports(): void
|
||||
{
|
||||
$key = (string) Str::uuid();
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Services\SimulationIvaDiagnostics;
|
||||
use App\Services\SimulationTaxParameterResolver;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class SimulationIvaDiagnosticsTest extends TestCase
|
||||
{
|
||||
private function version(): array
|
||||
{
|
||||
return ['id' => 'synthetic-qa', 'rule_code' => 'IVA-GERAL-BASE-LIQUIDA', 'rule_version' => 1,
|
||||
'component' => 'IVA', 'status' => 'published', 'scope_key' => 'mz.internal-general-net.mzn',
|
||||
'valid_from' => '2023-01-01', 'valid_until' => null, 'source_version_no' => 1,
|
||||
'source_sha256' => str_repeat('a', 64), 'rule_definition' => ['language' => 'investmoz.tax.v1'],
|
||||
'parameters' => ['IVA_GENERAL_RATE' => ['value' => '16', 'unit' => 'percent', 'conditions' => ['operation' => 'internal_general_net', 'currency' => 'MZN']]],
|
||||
'source' => ['validation_status' => 'validated', 'version_no' => 1, 'valid_from' => '2023-01-01', 'valid_until' => null,
|
||||
'title' => 'Synthetic source', 'diploma' => 'QA only', 'article' => 'Fixture', 'url' => 'https://example.invalid/official']];
|
||||
}
|
||||
|
||||
public function test_reported_annual_query_contract_reproduces_the_generic_failure_and_identifies_both_missing_links(): void
|
||||
{
|
||||
$version = $this->version();
|
||||
$context = ['fiscal_operation' => 'domestic'];
|
||||
$original = $context;
|
||||
$before = (new SimulationTaxParameterResolver)->resolveAvailableParameters([$version], 'IVA', '2026-01-01', '2026-12-31', $context);
|
||||
self::assertSame('indeterminate_context', $before[0]['status']);
|
||||
$details = (new SimulationIvaDiagnostics)->explain([$version], '2026-01-01', '2026-12-31', $context);
|
||||
self::assertSame(['system_configuration', 'missing_field'], array_column($details[0]['issues'], 'category'));
|
||||
self::assertSame('domestic', $details[0]['issues'][0]['received']);
|
||||
self::assertSame('MZN', $details[0]['issues'][1]['expected']);
|
||||
self::assertSame($original, $context);
|
||||
self::assertArrayNotHasKey('rule_definition', $details[0]);
|
||||
self::assertArrayNotHasKey('rule_code', $details[0]);
|
||||
}
|
||||
|
||||
public function test_all_failed_conditions_are_separate_and_currency_is_not_assumed(): void
|
||||
{
|
||||
foreach (['' => 'missing_field', 'usd' => 'invalid_value', 'USD' => 'out_of_scope'] as $value => $category) {
|
||||
$details = (new SimulationIvaDiagnostics)->explain([$this->version()], '2026-01-01', '2026-12-31', ['operation' => 'import', 'currency' => $value]);
|
||||
self::assertCount(2, $details[0]['issues']);
|
||||
self::assertSame('out_of_scope', $details[0]['issues'][0]['category']);
|
||||
self::assertSame($category, $details[0]['issues'][1]['category']);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_period_and_broken_source_are_not_reported_as_incorrect_answers(): void
|
||||
{
|
||||
$version = $this->version();
|
||||
$version['source_version_no'] = 2;
|
||||
$details = (new SimulationIvaDiagnostics)->explain([$version], '2022-01-01', '2022-12-31', ['operation' => 'internal_general_net', 'currency' => 'MZN']);
|
||||
self::assertSame(['period_unavailable', 'system_configuration'], array_column($details[0]['issues'], 'category'));
|
||||
self::assertSame('2022-01-01 a 2022-12-31', $details[0]['issues'][0]['received']);
|
||||
self::assertSame(1, $details[0]['rule_version']);
|
||||
self::assertSame('Synthetic source', $details[0]['source']['title']);
|
||||
}
|
||||
|
||||
public function test_matching_context_has_no_diagnostic_and_does_not_evaluate_an_expression(): void
|
||||
{
|
||||
self::assertSame([], (new SimulationIvaDiagnostics)->explain([$this->version()], '2026-01-01', '2026-12-31', ['operation' => 'internal_general_net', 'currency' => 'MZN']));
|
||||
}
|
||||
|
||||
public function test_an_explicitly_excluded_generic_operation_is_reported_without_inferring_a_domestic_scope(): void
|
||||
{
|
||||
$details = (new SimulationIvaDiagnostics)->explain([$this->version()], '2026-01-01', '2026-12-31', ['fiscal_operation' => 'import', 'currency' => 'MZN']);
|
||||
self::assertCount(1, $details[0]['issues']);
|
||||
self::assertSame('out_of_scope', $details[0]['issues'][0]['category']);
|
||||
self::assertSame('import', $details[0]['issues'][0]['received']);
|
||||
}
|
||||
}
|
||||
@@ -1,389 +0,0 @@
|
||||
// Isolated UI fixture: real header/providers, synthetic Inertia props, no database.
|
||||
// Requires the local Vite server. No requests to Laravel or external services.
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { createRequire } from 'node:module';
|
||||
import { portalNavigation } from '../resources/js/lib/portal-navigation.ts';
|
||||
|
||||
const root = process.cwd();
|
||||
const dir = path.join(root, 'outputs/header-navbar-20261021');
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
const require = createRequire(import.meta.url);
|
||||
const { chromium } = require(process.env.HEADER_QA_PLAYWRIGHT || 'playwright');
|
||||
const { expect } = require(
|
||||
(process.env.HEADER_QA_PLAYWRIGHT || 'playwright') + '/test',
|
||||
);
|
||||
const base = process.env.HEADER_QA_VITE || 'http://127.0.0.1:5173';
|
||||
assert.equal(new URL(base).hostname, '127.0.0.1');
|
||||
const before = process.argv.includes('--before');
|
||||
if (before && fs.existsSync(path.join(dir, 'before-results.json'))) {
|
||||
throw new Error(
|
||||
'The original baseline already exists and must be preserved.',
|
||||
);
|
||||
}
|
||||
fs.writeFileSync(
|
||||
path.join(dir, 'fixture.html'),
|
||||
`<!doctype html>
|
||||
<html lang="pt"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>InvesteMoz · revisão do header</title></head><body><div id="app"></div>
|
||||
<script type="module" src="/outputs/header-navbar-20261021/fixture.tsx"></script></body></html>`,
|
||||
);
|
||||
fs.writeFileSync(
|
||||
path.join(dir, 'fixture.tsx'),
|
||||
`
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { createInertiaApp } from '@inertiajs/react';
|
||||
import { PortalGroupedMenu } from '../../resources/js/components/portal-grouped-menu';
|
||||
import { TempoUiProvider, useTempoUi } from '../../resources/js/components/tempo-brand';
|
||||
import '../../resources/css/app.css';
|
||||
const role = new URLSearchParams(location.search).get('role') || 'guest';
|
||||
const props = {
|
||||
auth: { user: role === 'guest' ? null : { id: 1, name: 'Investidor de demonstração com nome extenso', email: 'qa@example.invalid' }, canManagePortal: role === 'manager' },
|
||||
existingBusinessEnabled: true, businessReviewUrl: role === 'manager' ? '/management/negocios' : null,
|
||||
educationEnabled: true, aiEnabled: true, legacyContentEnabled: true,
|
||||
};
|
||||
function Fixture() {
|
||||
const ui = useTempoUi();
|
||||
return <><PortalGroupedMenu /><main style={{padding:'48px 24px',maxWidth:1200,margin:'auto'}}>
|
||||
<p style={{color:'#b91c1c',fontSize:12,fontWeight:600,letterSpacing:2}}>INVESTEMOZ · REVISÃO LOCAL</p>
|
||||
<h1 style={{fontSize:36,fontWeight:600,margin:'16px 0'}}>O seu próximo investimento começa aqui</h1>
|
||||
<p style={{color:'#64748b'}}>Navegação real do portal com dados fictícios para testar a apresentação.</p>
|
||||
<button data-test="increment" onClick={ui.registerSubmittedInterest}>Simular pedido no contador</button>
|
||||
</main></>;
|
||||
}
|
||||
await createInertiaApp({page:{component:'fixture',props,url:'/',version:null},resolve:()=>Fixture,
|
||||
setup({el,App,props}) {createRoot(el).render(<TempoUiProvider><App {...props}/></TempoUiProvider>);}});
|
||||
`,
|
||||
);
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
...(process.env.HEADER_QA_CHROMIUM
|
||||
? { executablePath: process.env.HEADER_QA_CHROMIUM }
|
||||
: {}),
|
||||
});
|
||||
const results = [];
|
||||
const errors = [];
|
||||
try {
|
||||
for (const [width, role, language] of before
|
||||
? [
|
||||
[1440, 'guest', 'pt'],
|
||||
[390, 'guest', 'pt'],
|
||||
]
|
||||
: [
|
||||
[1280, 'manager', 'fr'],
|
||||
[1280, 'manager', 'pt'],
|
||||
[1440, 'manager', 'fr'],
|
||||
[320, 'guest', 'pt'],
|
||||
[320, 'investor', 'pt'],
|
||||
[390, 'guest', 'pt'],
|
||||
[390, 'manager', 'pt'],
|
||||
[768, 'investor', 'pt'],
|
||||
[1024, 'manager', 'pt'],
|
||||
[1440, 'guest', 'pt'],
|
||||
[1920, 'investor', 'en'],
|
||||
]) {
|
||||
const context = await browser.newContext({
|
||||
viewport: { width, height: 900 },
|
||||
});
|
||||
await context.addInitScript(
|
||||
(lang) => localStorage.setItem('tempo-navigation-language', lang),
|
||||
language,
|
||||
);
|
||||
await context.route('**/*', (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (url.origin === base && url.pathname.startsWith('/images/')) {
|
||||
const asset = path.resolve(root, 'public', `.${url.pathname}`);
|
||||
if (
|
||||
asset.startsWith(
|
||||
path.join(root, 'public', 'images') + path.sep,
|
||||
) &&
|
||||
fs.existsSync(asset)
|
||||
) {
|
||||
return route.fulfill({ path: asset });
|
||||
}
|
||||
}
|
||||
if (url.origin === base || url.protocol === 'data:')
|
||||
return route.continue();
|
||||
return route.abort();
|
||||
});
|
||||
const page = await context.newPage();
|
||||
page.on('pageerror', (e) => {
|
||||
errors.push(e.message);
|
||||
console.error(e.message);
|
||||
});
|
||||
await page.goto(
|
||||
`${base}/outputs/header-navbar-20261021/fixture.html?role=${role}`,
|
||||
{ waitUntil: 'domcontentloaded', timeout: 60000 },
|
||||
);
|
||||
const header = page.locator('.tempo-header');
|
||||
await header.waitFor();
|
||||
await page.screenshot({
|
||||
path: path.join(
|
||||
dir,
|
||||
`${before ? 'before' : 'after'}-${width}-${role}-${language}.png`,
|
||||
),
|
||||
});
|
||||
if (before) {
|
||||
results.push({
|
||||
width,
|
||||
height: await header.evaluate(
|
||||
(el) => el.getBoundingClientRect().height,
|
||||
),
|
||||
});
|
||||
await context.close();
|
||||
continue;
|
||||
}
|
||||
assert.equal(
|
||||
await header.locator('nav').count(),
|
||||
1,
|
||||
'One navigation landmark in header',
|
||||
);
|
||||
assert.equal(await header.locator('.tempo-section-bar').count(), 0);
|
||||
const collapsedHeight = await header.evaluate(
|
||||
(el) => el.getBoundingClientRect().height,
|
||||
);
|
||||
assert.ok(collapsedHeight <= 80, `Header height ${collapsedHeight}`);
|
||||
if (width < 1280) {
|
||||
const toggle = header.locator('.tempo-header-toggle');
|
||||
await toggle.click();
|
||||
assert.equal(await toggle.getAttribute('aria-expanded'), 'true');
|
||||
await page.screenshot({
|
||||
path: path.join(
|
||||
dir,
|
||||
`expanded-${width}-${role}-${language}.png`,
|
||||
),
|
||||
});
|
||||
await page.keyboard.press('Escape');
|
||||
assert.equal(await toggle.getAttribute('aria-expanded'), 'false');
|
||||
await expect(toggle).toBeFocused();
|
||||
await toggle.click();
|
||||
}
|
||||
const nav = header.locator('nav');
|
||||
if (width >= 1280) {
|
||||
const boxes = await Promise.all(
|
||||
[
|
||||
'.tempo-logo-link',
|
||||
'.tempo-primary-navigation',
|
||||
'.tempo-header-extras',
|
||||
'.tempo-header-actions',
|
||||
'.tempo-interest-button',
|
||||
].map((selector) => header.locator(selector).boundingBox()),
|
||||
);
|
||||
for (let i = 1; i < boxes.length; i++)
|
||||
assert.ok(
|
||||
boxes[i - 1].x + boxes[i - 1].width <= boxes[i].x + 1,
|
||||
`Header elements overlap at ${width}px: ${JSON.stringify(boxes)}`,
|
||||
);
|
||||
}
|
||||
assert.deepEqual(
|
||||
await nav
|
||||
.locator(':scope > ul > li')
|
||||
.evaluateAll((nodes) =>
|
||||
nodes.map(
|
||||
(node) =>
|
||||
node
|
||||
.querySelector('a,button')
|
||||
?.getAttribute('href') ||
|
||||
node.textContent.trim(),
|
||||
),
|
||||
),
|
||||
language === 'pt'
|
||||
? [
|
||||
'/',
|
||||
'Descoberta',
|
||||
'Realização',
|
||||
'Suporte',
|
||||
'/sobre',
|
||||
'Tempo',
|
||||
]
|
||||
: language === 'fr'
|
||||
? [
|
||||
'/',
|
||||
'Découvrir',
|
||||
'Investir',
|
||||
'Assistance',
|
||||
'/sobre',
|
||||
'Tempo',
|
||||
]
|
||||
: ['/', 'Discover', 'Invest', 'Support', '/sobre', 'Tempo'],
|
||||
);
|
||||
assert.equal(await nav.locator('a[href="/sobre"]').count(), 1);
|
||||
assert.equal(
|
||||
await nav
|
||||
.locator('a')
|
||||
.first()
|
||||
.evaluate((el) => getComputedStyle(el).fontSize),
|
||||
width >= 1280 ? '18px' : '16px',
|
||||
);
|
||||
const destinations = new Set(
|
||||
await header
|
||||
.locator('a[href]')
|
||||
.evaluateAll((nodes) =>
|
||||
nodes.map((node) => node.getAttribute('href')),
|
||||
),
|
||||
);
|
||||
async function inspectMenu(menu) {
|
||||
await menu.waitFor();
|
||||
menu = page.locator(`[id="${await menu.getAttribute('id')}"]`);
|
||||
try {
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const box = await menu.boundingBox();
|
||||
return (
|
||||
!!box &&
|
||||
box.x >= 0 &&
|
||||
box.x + box.width <= width + 1
|
||||
);
|
||||
})
|
||||
.toBe(true);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
JSON.stringify({
|
||||
width,
|
||||
role,
|
||||
menu: await menu.getAttribute('aria-labelledby'),
|
||||
box: await menu.boundingBox(),
|
||||
}),
|
||||
);
|
||||
await page.screenshot({
|
||||
path: path.join(dir, 'submenu-failure.png'),
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
for (const href of await menu
|
||||
.locator('a[href]')
|
||||
.evaluateAll((nodes) =>
|
||||
nodes.map((node) => node.getAttribute('href')),
|
||||
))
|
||||
destinations.add(href);
|
||||
const subIds = await menu
|
||||
.locator('[role="menuitem"][aria-haspopup="menu"]')
|
||||
.evaluateAll((nodes) => nodes.map((node) => node.id));
|
||||
for (const subId of subIds) {
|
||||
const sub = page.locator(`[id="${subId}"]`);
|
||||
await sub.focus();
|
||||
await page.keyboard.press('ArrowRight');
|
||||
await expect(sub).toHaveAttribute('aria-expanded', 'true');
|
||||
await inspectMenu(page.locator('[role="menu"]').last());
|
||||
await page.keyboard.press('ArrowLeft');
|
||||
await expect(sub).toBeFocused();
|
||||
}
|
||||
}
|
||||
for (const trigger of await nav
|
||||
.locator(':scope > ul > li > button')
|
||||
.all()) {
|
||||
await trigger.focus();
|
||||
await page.keyboard.press('Enter');
|
||||
assert.equal(await trigger.getAttribute('aria-expanded'), 'true');
|
||||
const menu = page.locator('[role="menu"]').last();
|
||||
await inspectMenu(menu);
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(trigger).toBeFocused();
|
||||
}
|
||||
await header
|
||||
.getByRole('button', { name: 'Tempo', exact: true })
|
||||
.click();
|
||||
for (const href of [
|
||||
'/contacto',
|
||||
'https://revista.tempo.co.mz/',
|
||||
'https://www.facebook.com/revistatempo.mz/',
|
||||
'https://www.instagram.com/revistatempo.mz/',
|
||||
'https://www.linkedin.com/company/revistatempo/',
|
||||
'https://www.youtube.com/@RevistaTempoMz/',
|
||||
]) {
|
||||
assert.equal(
|
||||
await page.locator(`[role="menu"] a[href="${href}"]`).count(),
|
||||
1,
|
||||
href,
|
||||
);
|
||||
}
|
||||
await page.keyboard.press('Escape');
|
||||
assert.ok(
|
||||
await header
|
||||
.getByRole('button', { name: 'Idioma da navegação' })
|
||||
.isVisible(),
|
||||
);
|
||||
assert.ok(
|
||||
await header
|
||||
.getByRole('button', { name: 'Temperatura em Maputo' })
|
||||
.isVisible(),
|
||||
);
|
||||
assert.ok(
|
||||
await header.locator('a[href="/manifestar-interesse"]').isVisible(),
|
||||
);
|
||||
const dashboard = header.locator('a[href="/investidor/manifestacoes"]');
|
||||
assert.ok(await dashboard.isVisible());
|
||||
await page.locator('[data-test="increment"]').click();
|
||||
assert.match(await dashboard.getAttribute('aria-label'), /1 /);
|
||||
if (role !== 'guest') {
|
||||
await header.locator('.tempo-login-button').click();
|
||||
await inspectMenu(page.locator('[role="menu"]').last());
|
||||
assert.ok(
|
||||
await page
|
||||
.locator('[data-test="portal-logout-button"]')
|
||||
.isVisible(),
|
||||
);
|
||||
const hasManagement = await page
|
||||
.getByRole('menu')
|
||||
.getByText('Gestão', { exact: true })
|
||||
.count();
|
||||
assert.equal(hasManagement > 0, role === 'manager');
|
||||
await page.keyboard.press('Escape');
|
||||
} else {
|
||||
assert.ok(await header.locator('a[href="/login"]').isVisible());
|
||||
}
|
||||
const catalog = portalNavigation({
|
||||
authenticated: role !== 'guest',
|
||||
manager: role === 'manager',
|
||||
businesses: true,
|
||||
businessReviewUrl:
|
||||
role === 'manager' ? '/management/negocios' : null,
|
||||
education: true,
|
||||
ai: true,
|
||||
legacyContent: true,
|
||||
});
|
||||
function checkDestinations(groups) {
|
||||
for (const group of groups) {
|
||||
if (group.children) checkDestinations(group.children);
|
||||
else if (group.href)
|
||||
assert.ok(
|
||||
destinations.has(group.href),
|
||||
`Preserved destination: ${group.href}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
checkDestinations(
|
||||
role === 'guest'
|
||||
? catalog.filter((group) => group.id !== 'account')
|
||||
: catalog,
|
||||
);
|
||||
const overflow = await header.evaluate((el) =>
|
||||
Array.from(el.querySelectorAll('a,button,img'))
|
||||
.filter((n) => {
|
||||
const r = n.getBoundingClientRect();
|
||||
return r.width && (r.x < -1 || r.right > innerWidth + 1);
|
||||
})
|
||||
.map((n) => n.textContent),
|
||||
);
|
||||
assert.deepEqual(overflow, []);
|
||||
results.push({
|
||||
width,
|
||||
role,
|
||||
language,
|
||||
collapsedHeight,
|
||||
destinations: destinations.size,
|
||||
result: 'passed',
|
||||
});
|
||||
await context.close();
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
fs.writeFileSync(
|
||||
path.join(dir, before ? 'before-results.json' : 'qa-results.json'),
|
||||
JSON.stringify({ results, errors }, null, 2),
|
||||
);
|
||||
console.log(JSON.stringify({ results, errors }));
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user