Actualizar Cruce de Cuentas: Panama, Reportar y dist validado

This commit is contained in:
2026-09-07 10:34:59 -04:00
parent c67cafa7aa
commit 8c841d9b67
19 changed files with 1047 additions and 305 deletions
+25 -3
View File
@@ -15,6 +15,7 @@ import {
} from 'lucide-react';
import { CountryConfig, HistoricalReport, PeriodRange, ReconciliationRow } from '../types';
import BambooCorrectionModal from './BambooCorrectionModal';
import ReportIssueButton from './ReportIssueButton';
import { supabase } from '../lib/supabase';
interface HistoryProps {
@@ -32,6 +33,13 @@ function getHistoryUrl(countryCode: string) {
return (import.meta.env.VITE_HISTORICOS_TT_URL as string | undefined) || '';
}
if (countryCode === 'PA') {
return (
(import.meta.env.VITE_HISTORICOS_PA_URL as string | undefined) ||
'https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-pa-historicos'
);
}
return (
(import.meta.env.VITE_HISTORICOS_GT_URL as string | undefined) ||
'https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-gt-historicos'
@@ -43,6 +51,13 @@ function getMarkResolvedUrl(countryCode: string) {
return (import.meta.env.VITE_MARCAR_RESUELTO_TT_URL as string | undefined) || '';
}
if (countryCode === 'PA') {
return (
(import.meta.env.VITE_MARCAR_RESUELTO_PA_URL as string | undefined) ||
'https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-pa-marcar-resuelto'
);
}
return (
(import.meta.env.VITE_MARCAR_RESUELTO_GT_URL as string | undefined) ||
'https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-gt-marcar-resuelto'
@@ -128,7 +143,7 @@ function normalizeReports(input: unknown, country: CountryConfig): HistoricalRep
return {
id: String(report.id ?? `reporte-${index + 1}`),
country: (rawCountry === 'TT' ? 'TT' : 'GT') as HistoricalReport['country'],
country: (rawCountry === 'TT' ? 'TT' : rawCountry === 'PA' ? 'PA' : 'GT') as HistoricalReport['country'],
date: formatDate(report.fecha ?? report.period_end ?? rawExecutionDate, country.locale),
executionDate: formatDateTime(rawExecutionDate, country.locale),
period: String(report.periodo ?? report.period_label ?? report.period ?? 'Período no especificado'),
@@ -442,7 +457,7 @@ export default function History({
if (!isCurrentRequest()) return;
// Respaldo temporal: webhook histórico existente. También se envía el país
// para impedir que se mezclen reportes de Guatemala y Trinidad y Tobago.
// para impedir que se mezclen reportes de Guatemala, Trinidad y Tobago y Panamá.
const historyUrl = getHistoryUrl(country.code);
if (!historyUrl) {
throw new Error(`No está configurado el origen histórico de ${country.name}.`);
@@ -708,7 +723,14 @@ export default function History({
<span className="truncate">Reportes Históricos - {country.name}</span>
</h1>
</div>
<div className="flex items-center gap-3 flex-shrink-0">
<div className="flex items-center gap-2 sm:gap-3 flex-shrink-0">
<ReportIssueButton
country={country}
operatorName={operatorName}
operatorEmail={operatorEmail}
section="Reportes Históricos"
onShowToast={onShowToast}
/>
<div className="hidden sm:flex items-center border border-neutral-200 bg-white px-2.5 py-2 shadow-sm" aria-label={`Bandera de ${country.name}`}>
<img src={country.flag} alt={`Bandera de ${country.name}`} className="h-5 sm:h-6 w-auto object-contain" />
</div>