|
@@ -1,17 +1,20 @@
|
|
|
"use client"
|
|
"use client"
|
|
|
|
|
|
|
|
|
|
+import { useState } from "react"
|
|
|
import { FacturaHeader } from "@/components/factura/FacturaHeader"
|
|
import { FacturaHeader } from "@/components/factura/FacturaHeader"
|
|
|
import { InfoTributariaForm } from "@/components/factura/InfoTributariaForm"
|
|
import { InfoTributariaForm } from "@/components/factura/InfoTributariaForm"
|
|
|
import { InfoFacturaForm } from "@/components/factura/InfoFacturaForm"
|
|
import { InfoFacturaForm } from "@/components/factura/InfoFacturaForm"
|
|
|
import { DetallesList } from "@/components/factura/DetallesList"
|
|
import { DetallesList } from "@/components/factura/DetallesList"
|
|
|
import { ResumenTotales } from "@/components/factura/ResumenTotales"
|
|
import { ResumenTotales } from "@/components/factura/ResumenTotales"
|
|
|
import { FacturaActions } from "@/components/factura/FacturaActions"
|
|
import { FacturaActions } from "@/components/factura/FacturaActions"
|
|
|
-import { XmlViewer } from "@/components/factura/XmlViewer"
|
|
|
|
|
|
|
+import { XmlGenerationDialog } from "@/components/factura/XmlGenerationDialog"
|
|
|
import { useFacturaState } from "@/hooks/factura/useFacturaState"
|
|
import { useFacturaState } from "@/hooks/factura/useFacturaState"
|
|
|
import { useFacturaCalculations } from "@/hooks/factura/useFacturaCalculations"
|
|
import { useFacturaCalculations } from "@/hooks/factura/useFacturaCalculations"
|
|
|
import { useXmlGeneration } from "@/hooks/factura/useXmlGeneration"
|
|
import { useXmlGeneration } from "@/hooks/factura/useXmlGeneration"
|
|
|
|
|
|
|
|
export default function FacturaPage() {
|
|
export default function FacturaPage() {
|
|
|
|
|
+ const [dialogOpen, setDialogOpen] = useState(false)
|
|
|
|
|
+
|
|
|
const {
|
|
const {
|
|
|
infoTributaria,
|
|
infoTributaria,
|
|
|
infoFactura,
|
|
infoFactura,
|
|
@@ -27,7 +30,7 @@ export default function FacturaPage() {
|
|
|
} = useFacturaState()
|
|
} = useFacturaState()
|
|
|
|
|
|
|
|
const { calcularTotalesImpuestos } = useFacturaCalculations(detalles, updateInfoFactura)
|
|
const { calcularTotalesImpuestos } = useFacturaCalculations(detalles, updateInfoFactura)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const { generarXml, descargarXml } = useXmlGeneration()
|
|
const { generarXml, descargarXml } = useXmlGeneration()
|
|
|
|
|
|
|
|
const handleGenerarXml = () => {
|
|
const handleGenerarXml = () => {
|
|
@@ -39,6 +42,7 @@ export default function FacturaPage() {
|
|
|
totalesImpuestos,
|
|
totalesImpuestos,
|
|
|
setXmlGenerado
|
|
setXmlGenerado
|
|
|
)
|
|
)
|
|
|
|
|
+ setDialogOpen(true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleDescargarXml = () => {
|
|
const handleDescargarXml = () => {
|
|
@@ -77,14 +81,15 @@ export default function FacturaPage() {
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
{/* Acciones */}
|
|
{/* Acciones */}
|
|
|
- <FacturaActions
|
|
|
|
|
- onGenerarXml={handleGenerarXml}
|
|
|
|
|
- onDescargarXml={handleDescargarXml}
|
|
|
|
|
|
|
+ <FacturaActions onGenerarXml={handleGenerarXml} />
|
|
|
|
|
+
|
|
|
|
|
+ {/* Modal de XML Generado */}
|
|
|
|
|
+ <XmlGenerationDialog
|
|
|
|
|
+ open={dialogOpen}
|
|
|
|
|
+ onOpenChange={setDialogOpen}
|
|
|
xmlGenerado={xmlGenerado}
|
|
xmlGenerado={xmlGenerado}
|
|
|
|
|
+ onDescargarXml={handleDescargarXml}
|
|
|
/>
|
|
/>
|
|
|
-
|
|
|
|
|
- {/* XML Generado */}
|
|
|
|
|
- <XmlViewer xmlGenerado={xmlGenerado} />
|
|
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|