feat: facturación primer pago, fixes SAT/MP, autocompletado RFCs/conceptos
Backend: - Notificación email al admin cuando llega primer pago aprobado (sin factura auto) - Endpoints GET /pagos-sin-factura y POST /emitir-factura-pago para admin global - Fix vinculación org Facturapi Horux 360 (69f23a5a242e0af47a41fa0d) - Fix webhook MP: validación defensiva de x-signature header - Fix autocompleto RFCs: eliminado filtro por contribuyenteId - Fix autocompleto conceptos: eliminado filtro por contribuyenteId - SAT fixes: anti-bot CSF scraper, request reuse, date range fix, stale job thresholds - SAT sync request reuse across jobs para evitar agotar cuota diaria - Typo fix MP_ACCESS_TOKEN en .env - Trial invitations system backend Frontend: - Nueva página /admin/facturas-pendientes con tabla y emisión manual - Métrica 'Facturas pendientes' en /clientes (clickable) - Navegación onboarding FIEL/CSD corregida - Sidebar themes sincronizados - Fix SAT portal migration scraper (NetIQ) - Trial invitation acceptance pages
This commit is contained in:
22
apps/web/lib/hooks/use-pagos-sin-factura.ts
Normal file
22
apps/web/lib/hooks/use-pagos-sin-factura.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
'use client';
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { getPagosSinFactura, emitirFacturaPago } from '../api/facturacion';
|
||||
|
||||
export function usePagosSinFactura() {
|
||||
return useQuery({
|
||||
queryKey: ['pagos-sin-factura'],
|
||||
queryFn: () => getPagosSinFactura(),
|
||||
staleTime: 10 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useEmitirFacturaPago() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (paymentId: string) => emitirFacturaPago(paymentId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['pagos-sin-factura'] });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { getTenants, createTenant, updateTenant, deleteTenant, type CreateTenantData, type UpdateTenantData } from '@/lib/api/tenants';
|
||||
import { useAuthStore } from '@/stores/auth-store';
|
||||
import { isGlobalAdminRfc } from '@horux/shared';
|
||||
|
||||
export function useTenants() {
|
||||
const user = useAuthStore(s => s.user);
|
||||
const isGlobal = isGlobalAdminRfc(user?.tenantRfc, user?.role, user?.platformRoles);
|
||||
return useQuery({
|
||||
queryKey: ['tenants'],
|
||||
queryFn: getTenants,
|
||||
enabled: isGlobal,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user