PageSourceSearch

https://propertysync-hq.lovable.app/assets/TerrenoInvoicesPage-BnOAnSdj.js

js propertysync-hq.lovable.app collected 2026-10-03 03:42:14 UTC 19,722 bytes, 1 lines download raw bytes

1import{n as Y,r as l,j as e,U as W,V as Z,W as J,Y as K,Z as Q,B as M,a8 as ee,a9 as y,aa as N,ae,ab as re,s as F,u as b,a5 as ge,e as ye,C as ve,l as _e,a1 as we,E as Ne}from"./index-DfOJmvz4.js";import{T as Fe}from"./TerrenoOperationalHeader-DxEviC4R.js";import{I as x}from"./input-Vet5F-CU.js";import{S as z,a as B,b as O,c as H,d as C}from"./select-CJff1OXZ.js";import{D as Ee,a as De,b as Ce,e as X}from"./dropdown-menu-By9cTOSf.js";import{A as be,a as Te,b as Se,c as Ie,d as Me,e as Re,f as Ae,g as Le}from"./alert-dialog-Bu3Oi65g.js";import{P as Ve}from"./paginated-table-BRmuN3pX.js";import{I as Pe,a as ke}from"./InvoiceTypeBadge-CqAn9ZhG.js";import{u as se,t as te,F as oe,a as c,b as i,c as d,d as m,e as u}from"./form-CGjVjtQi.js";import{T as ne}from"./textarea-BWprJflG.js";import{T as Xe}from"./TestDataFillButton-DxKkR1nf.js";import{C as qe}from"./ClearFormButton-DdLobLtx.js";import{c as le,a as ce}from"./InvoiceTypeSelector-B9-1zTi6.js";import{I as ie}from"./InvoiceFileUpload-wo-jMyL3.js";import{L as de}from"./loader-circle-rLXjDXa8.js";import{f as q}from"./format-9oAvKElA.js";import{M as $e}from"./map-pin-D2fhs9R-.js";import{A as Ue}from"./arrow-left-DHLt5dfU.js";import{P as ze}from"./plus-BrPtK6Sd.js";import{R as Be}from"./receipt-VIREyLjk.js";import{F as Oe}from"./file-text-f4n0A-yg.js";import{E as He}from"./ellipsis-ChaP9twA.js";import{P as Ge}from"./pencil-BjX4drB7.js";import{D as Ye}from"./download-Cj4N-sj-.js";import{T as We}from"./trash-2-Br_Yo4vG.js";import{e as Ze}from"./es-DYyshBza.js";import"./NavigationBreadcrumb-B1dQjj2a.js";import"./chevron-right-pbEstDsr.js";import"./useFinanzasOrigin-C61EshZI.js";import"./index-6ZOEkj60.js";import"./index-BtGj9Er1.js";import"./chevron-down-UE20mCyh.js";import"./check-XU_nGxmM.js";import"./index-ivjWPsw3.js";import"./table-DfwkKR6X.js";import"./pagination-DRFrlWwl.js";import"./chevron-left-B4fCo4Cf.js";import"./arrow-up-down-DTRvW7N4.js";import"./badge-Dbl0Jwtm.js";import"./label-B-DNcIAs.js";import"./localStorageStore-Csk9HjkB.js";import"./flask-conical-CYR3TkvV.js";import"./rotate-ccw-CiOcocQM.js";import"./eraser-ANQoMz1a.js";import"./file-up-C4HTCrjT.js";import"./differenceInCalendarDays-CyB0mb81.js";import"./getTimezoneOffsetInMilliseconds-vKak5z5M.js";const Je=ee({tipoFactura:re(ce),numeroFactura:y().min(1,"Número requerido").max(50),rfcEmisor:y().max(13).optional().or(N("")),rfcReceptor:y().max(13).optional().or(N("")),monto:ae().min(.01,"Monto debe ser mayor a 0"),fechaEmision:y().min(1,"Fecha requerida"),fechaVencimiento:y().optional().or(N("")),concepto:y().max(500).optional().or(N("")),emailDestinatario:y().email("Email inválido").optional().or(N(""))}),U=()=>({tipoFactura:"ingreso",numeroFactura:"",rfcEmisor:"",rfcReceptor:"",monto:0,fechaEmision:q(new Date,"yyyy-MM-dd"),fechaVencimiento:"",concepto:"",emailDestinatario:""}),Ke=()=>({tipoFactura:["ingreso","egreso","pasante_inquilino","pasante_proveedor"][Math.floor(Math.random()*4)],numeroFactura:`FT-${Math.floor(Math.random()*9e3)+1e3}`,rfcEmisor:"XAXX010101000",rfcReceptor:"XEXX010101000",monto:Math.floor(Math.random()*8e4)+5e3,fechaEmision:q(new Date,"yyyy-MM-dd"),fechaVencimiento:q(new Date(Date.now()+30*864e5),"yyyy-MM-dd"),concepto:["Renta mensual terreno","Uso de suelo","Servicio de vigilancia","Mantenimiento de acceso"][Math.floor(Math.random()*4)],emailDestinatario:"[email protected]"});function Qe({open:h,onOpenChange:p,terrenoId:s,onSuccess:_}){const{currentUser:f}=Y(),[E,j]=l.useState(!1),[g,t]=l.useState(null),o=se({resolver:te(Je),defaultValues:U()});l.useEffect(()=>{h&&(o.reset(U()),t(null))},[h,o]);const I=async a=>{const n=(f==null?void 0:f.parentId)||(f==null?void 0:f.profileId);if(n){j(!0);try{let v=null,R=null;if(g){const A=g.name.split(".").pop(),D=`terrenos/${n}/${s}/${Date.now()}.${A}`,{error:k}=await F.storage.from("invoices").upload(D,g);if(k)throw k;const{data:V}=F.storage.from("invoices").getPublicUrl(D);v=V.publicUrl,R=D}const{error:w}=await F.from("land_invoices").insert({owner_id:n,terreno_id:s,tipo_factura:a.tipoFactura,status:"pendiente",assignment_status:"disponible",numero_factura:a.numeroFactura,rfc_emisor:a.rfcEmisor||null,rfc_receptor:a.rfcReceptor||null,monto:a.monto,fecha_emision:a.fechaEmision,fecha_vencimiento:a.fechaVencimiento||null,concepto:a.concepto||null,email_destinatario:a.emailDestinatario||null,archivo_url:v,archivo_path:R});if(w)throw w;b.success("Factura registrada"),_==null||_(),p(!1)}catch(v){console.error(v),b.error(v.message||"Error al registrar factura")}finally{j(!1)}}};return e.jsx(W,{open:h,onOpenChange:p,children:e.jsxs(Z,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(J,{children:[e.jsx(K,{children:"Nueva Factura de Terreno"}),e.jsx(Q,{children:"Registra los datos fiscales. El estado se actualizará automáticamente al vincular con transacciones."})]}),e.jsx(oe,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(I),className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Xe,{onFill:()=>o.reset(Ke())}),e.jsx(qe,{onClear:()=>{o.reset(U()),t(null)}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(c,{control:o.control,name:"tipoFactura",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Tipo *"}),e.jsx(m,{children:e.jsx(le,{value:a.value,onChange:a.onChange})}),e.jsx(u,{})]})}),e.jsx(c,{control:o.control,name:"numeroFactura",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Número *"}),e.jsx(m,{children:e.jsx(x,{placeholder:"FT-001",...a})}),e.jsx(u,{})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(c,{control:o.control,name:"rfcEmisor",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"RFC Emisor"}),e.jsx(m,{children:e.jsx(x,{placeholder:"XAXX010101000",maxLength:13,...a})}),e.jsx(u,{})]})}),e.jsx(c,{control:o.control,name:"rfcReceptor",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"RFC Receptor"}),e.jsx(m,{children:e.jsx(x,{placeholder:"XAXX010101000",maxLength:13,...a})}),e.jsx(u,{})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(c,{control:o.control,name:"monto",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Monto *"}),e.jsx(m,{children:e.jsx(x,{type:"number",step:"0.01",min:"0.01",placeholder:"0.00",...a,onChange:n=>a.onChange(parseFloat(n.target.value)||0),value:a.value||""})}),e.jsx(u,{})]})}),e.jsx(c,{control:o.control,name:"fechaEmision",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Emisión *"}),e.jsx(m,{children:e.jsx(x,{type:"date",...a})}),e.jsx(u,{})]})})]}),e.jsx(c,{control:o.control,name:"fechaVencimiento",render:({field:a})=>
1e.jsxs(i,{children:[e.jsx(d,{children:"Vencimiento"}),e.jsx(m,{children:e.jsx(x,{type:"date",...a})}),e.jsx(u,{})]})}),e.jsx(c,{control:o.control,name:"concepto",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Concepto"}),e.jsx(m,{children:e.jsx(ne,{placeholder:"Descripción de la factura...",className:"resize-none h-16",...a})}),e.jsx(u,{})]})}),e.jsx(c,{control:o.control,name:"emailDestinatario",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Email Destinatario"}),e.jsx(m,{children:e.jsx(x,{type:"email",placeholder:"[email protected]",...a})}),e.jsx(u,{})]})}),e.jsx(ie,{selectedFile:g,onFileChange:a=>{var n;return t(((n=a.target.files)==null?void 0:n[0])||null)}}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(M,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancelar"}),e.jsxs(M,{type:"submit",disabled:E,children:[E&&e.jsx(de,{className:"h-4 w-4 animate-spin mr-2"}),"Guardar Factura"]})]})]})})]})})}const ea=ee({tipoFactura:re(ce),numeroFactura:y().min(1,"Número requerido").max(50),rfcEmisor:y().max(13).optional().or(N("")),rfcReceptor:y().max(13).optional().or(N("")),monto:ae().min(.01,"Monto debe ser mayor a 0"),fechaEmision:y().min(1,"Fecha requerida"),fechaVencimiento:y().optional().or(N("")),concepto:y().max(500).optional().or(N("")),emailDestinatario:y().email("Email inválido").optional().or(N(""))});function aa({open:h,onOpenChange:p,invoice:s,onSuccess:_}){const[f,E]=l.useState(!1),[j,g]=l.useState(null),t=se({resolver:te(ea),defaultValues:{tipoFactura:"ingreso",numeroFactura:"",rfcEmisor:"",rfcReceptor:"",monto:0,fechaEmision:"",fechaVencimiento:"",concepto:"",emailDestinatario:""}});l.useEffect(()=>{h&&s&&(t.reset({tipoFactura:s.tipo_factura||"ingreso",numeroFactura:s.numero_factura,rfcEmisor:s.rfc_emisor||"",rfcReceptor:s.rfc_receptor||"",monto:s.monto,fechaEmision:s.fecha_emision||"",fechaVencimiento:s.fecha_vencimiento||"",concepto:s.concepto||"",emailDestinatario:s.email_destinatario||""}),g(null))},[h,s,t]);const o=async a=>{if(s){E(!0);try{const n={tipo_factura:a.tipoFactura,numero_factura:a.numeroFactura,rfc_emisor:a.rfcEmisor||null,rfc_receptor:a.rfcReceptor||null,monto:a.monto,fecha_emision:a.fechaEmision,fecha_vencimiento:a.fechaVencimiento||null,concepto:a.concepto||null,email_destinatario:a.emailDestinatario||null};if(j){const R=j.name.split(".").pop(),w=`terrenos/${s.id}/${Date.now()}.${R}`,{error:A}=await F.storage.from("invoices").upload(w,j);if(A)throw A;const{data:D}=F.storage.from("invoices").getPublicUrl(w);n.archivo_url=D.publicUrl,n.archivo_path=w}const{error:v}=await F.from("land_invoices").update(n).eq("id",s.id);if(v)throw v;b.success("Factura actualizada"),_==null||_(),p(!1)}catch(n){console.error(n),b.error(n.message||"Error al actualizar")}finally{E(!1)}}},I=(s==null?void 0:s.status)==="pagada"||(s==null?void 0:s.status)==="cancelada";return e.jsx(W,{open:h,onOpenChange:p,children:e.jsxs(Z,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(J,{children:[e.jsx(K,{children:"Editar Factura"}),e.jsx(Q,{children:I?"Esta factura está cerrada. Solo puedes modificar datos fiscales y archivo.":"Modifica los datos de la factura. El estado se gestiona automáticamente."})]}),e.jsx(oe,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(o),className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(c,{control:t.control,name:"tipoFactura",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Tipo *"}),e.jsx(m,{children:e.jsx(le,{value:a.value,onChange:a.onChange})}),e.jsx(u,{})]})}),e.jsx(c,{control:t.control,name:"numeroFactura",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Número *"}),e.jsx(m,{children:e.jsx(x,{placeholder:"FT-001",...a})}),e.jsx(u,{})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(c,{control:t.control,name:"rfcEmisor",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"RFC Emisor"}),e.jsx(m,{children:e.jsx(x,{placeholder:"XAXX010101000",maxLength:13,...a})}),e.jsx(u,{})]})}),e.jsx(c,{control:t.control,name:"rfcReceptor",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"RFC Receptor"}),e.jsx(m,{children:e.jsx(x,{placeholder:"XAXX010101000",maxLength:13,...a})}),e.jsx(u,{})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(c,{control:t.control,name:"monto",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Monto *"}),e.jsx(m,{children:e.jsx(x,{type:"number",step:"0.01",min:"0.01",placeholder:"0.00",...a,onChange:n=>a.onChange(parseFloat(n.target.value)||0),value:a.value||""})}),e.jsx(u,{})]})}),e.jsx(c,{control:t.control,name:"fechaEmision",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Emisión *"}),e.jsx(m,{children:e.jsx(x,{type:"date",...a})}),e.jsx(u,{})]})})]}),e.jsx(c,{control:t.control,name:"fechaVencimiento",render:({field:a})=>
1e.jsxs(i,{children:[e.jsx(d,{children:"Vencimiento"}),e.jsx(m,{children:e.jsx(x,{type:"date",...a})}),e.jsx(u,{})]})}),e.jsx(c,{control:t.control,name:"concepto",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Concepto"}),e.jsx(m,{children:e.jsx(ne,{placeholder:"Descripción...",className:"resize-none h-16",...a})}),e.jsx(u,{})]})}),e.jsx(c,{control:t.control,name:"emailDestinatario",render:({field:a})=>e.jsxs(i,{children:[e.jsx(d,{children:"Email Destinatario"}),e.jsx(m,{children:e.jsx(x,{type:"email",placeholder:"[email protected]",...a})}),e.jsx(u,{})]})}),e.jsx(ie,{selectedFile:j,onFileChange:a=>{var n;return g(((n=a.target.files)==null?void 0:n[0])||null)}}),(s==null?void 0:s.archivo_path)&&!j&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Archivo actual: ",s.archivo_path.split("/").pop()]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(M,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancelar"}),e.jsxs(M,{type:"submit",disabled:f,children:[f&&e.jsx(de,{className:"h-4 w-4 animate-spin mr-2"}),"Guardar Cambios"]})]})]})})]})})}function ra(h){const{currentUser:p}=Y(),s=(p==null?void 0:p.parentId)||(p==null?void 0:p.profileId),[_,f]=l.useState([]),[E,j]=l.useState(!0),g=l.useCallback(async()=>{if(!s||!h){j(!1);return}j(!0);try{const{data:t,error:o}=await F.from("land_invoices").select("*").eq("owner_id",s).eq("terreno_id",h).is("deleted_at",null).is("bulk_session_id",null).order("created_at",{ascending:!1});if(o)throw o;f(t||[])}catch(t){console.error(t)}finally{j(!1)}},[s,h]);return l.useEffect(()=>{g()},[g]),{invoices:_,loading:E,refetch:g}}const G=h=>h?q(new Date(h),"dd MMM yyyy",{locale:Ze}):"—";function Ja(){const{selectedTerrenoId:h,isTerrenoSelected:p}=ge(),{invoices:s,loading:_,refetch:f}=ra(h||void 0),[E,j]=l.useState(!1),[g,t]=l.useState(null),[o,I]=l.useState(null),[a,n]=l.useState(!1),[v,R]=l.useState("all"),[w,A]=l.useState("all"),[D,k]=l.useState(""),[V,me]=l.useState(""),[$,ue]=l.useState(""),he=async()=>{if(o){n(!0);try{await F.from("land_invoices").update({deleted_at:new Date().toISOString()}).eq("id",o),b.success("Factura eliminada"),f()}catch{b.error("Error al eliminar")}finally{n(!1),I(null)}}},xe=async r=>{if(!r.archivo_path){b.error("No hay archivo adjunto");return}try{const{data:L,error:T}=await F.storage.from("invoices").createSignedUrl(r.archivo_path,3600);if(T)throw T;window.open(L.signedUrl,"_blank")}catch{b.error("No se pudo abrir el archivo")}},pe=async r=>{if(r.archivo_path)try{const{data:L,error:T}=await F.storage.from("invoices").download(r.archivo_path);if(T)throw T;const P=URL.createObjectURL(L),S=document.createElement("a");S.href=P,S.download=`factura_${r.numero_factura}.pdf`,S.click(),URL.revokeObjectURL(P)}catch{b.error("No se pudo descargar")}},fe=s.filter(r=>{var L,T,P;if(v!=="all"&&r.status!==v||w!=="all"&&r.tipo_factura!==w||D&&r.created_at&&r.created_at<D||V&&r.created_at&&r.created_at>V+"T23:59:59")return!1;if($){const S=$.toLowerCase();if(!(r.numero_factura.toLowerCase().includes(S)||((L=r.concepto)==null?void 0:L.toLowerCase().includes(S))||((T=r.rfc_emisor)==null?void 0:T.toLowerCase().includes(S))||((P=r.rfc_receptor)==null?void 0:P.toLowerCase().includes(S))))return!1}return!0}),je=[{header:"Número",accessor:"numero_factura",sortable:!0,cell:r=>e.jsx("span",{className:"font-mono text-sm",children:r.numero_factura})},{header:"Tipo",accessor:"tipo_factura",sortable:!0,cell:r=>e.jsx(Pe,{type:r.tipo_factura})},{header:"Monto",accessor:"monto",sortable:!0,cell:r=>e.jsx("span",{className:"font-semibold text-sm",children:we(r.monto)})},{header:"Emisión",accessor:"fecha_emision",sortable:!0,cell:r=>e.jsx("span",{className:"text-sm text-muted-foreground",children:G(r.fecha_emision)})},{header:"Estado",accessor:"status",sortable:!0,cell:r=>e.jsx(ke,{status:r.status||"pendiente"})},{header:"Asignación",accessor:"assignment_status",sortable:!0,cell:r=>e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${r.assignment_status==="asignada"?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:r.assignment_status==="asignada"?"Asignada":"Disponible"})},{header:"Archivo",cell:r=>
1r.archivo_path?e.jsx(Oe,{className:"h-4 w-4 text-primary"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}),className:"w-16 text-center"},{header:"Registro",accessor:"created_at",sortable:!0,cell:r=>e.jsx("span",{className:"text-sm text-muted-foreground",children:G(r.created_at)})},{header:"",cell:r=>e.jsxs(Ee,{children:[e.jsx(De,{asChild:!0,children:e.jsx(M,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(He,{className:"h-4 w-4"})})}),e.jsxs(Ce,{align:"end",children:[e.jsxs(X,{onClick:()=>t(r),children:[e.jsx(Ge,{className:"h-4 w-4 mr-2"}),"Editar"]}),r.archivo_path&&e.jsxs(e.Fragment,{children:[e.jsxs(X,{onClick:()=>xe(r),children:[e.jsx(Ne,{className:"h-4 w-4 mr-2"}),"Ver PDF"]}),e.jsxs(X,{onClick:()=>pe(r),children:[e.jsx(Ye,{className:"h-4 w-4 mr-2"}),"Descargar"]})]}),e.jsxs(X,{className:"text-destructive",onClick:()=>I(r.id),children:[e.jsx(We,{className:"h-4 w-4 mr-2"}),"Eliminar"]})]})]}),className:"w-10"}];return p?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Fe,{moduleTitle:"Facturas"}),e.jsxs("div",{className:"container mx-auto px-4 py-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsx(x,{placeholder:"Buscar por número, concepto o RFC...",value:$,onChange:r=>ue(r.target.value),className:"h-9"})}),e.jsxs(z,{value:v,onValueChange:R,children:[e.jsx(B,{className:"w-[140px] h-9",children:e.jsx(O,{placeholder:"Estado"})}
1),e.jsxs(H,{children:[e.jsx(C,{value:"all",children:"Todos"}),e.jsx(C,{value:"pendiente",children:"Pendiente"}),e.jsx(C,{value:"pagada",children:"Pagada"}),e.jsx(C,{value:"cancelada",children:"Cancelada"})]})]}),e.jsxs(z,{value:w,onValueChange:A,children:[e.jsx(B,{className:"w-[160px] h-9",children:e.jsx(O,{placeholder:"Tipo"})}),e.jsxs(H,{children:[e.jsx(C,{value:"all",children:"Todos"}),e.jsx(C,{value:"ingreso",children:"Ingreso"}),e.jsx(C,{value:"egreso",children:"Egreso"}),e.jsx(C,{value:"pasante_inquilino",children:"Pasante (Inquilino)"}),e.jsx(C,{value:"pasante_proveedor",children:"Pasante (Proveedor)"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(x,{type:"date",value:D,onChange:r=>k(r.target.value),className:"h-9 w-[140px]"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"–"}),e.jsx(x,{type:"date",value:V,onChange:r=>me(r.target.value),className:"h-9 w-[140px]"})]}),e.jsxs(M,{size:"sm",className:"h-9 gap-1",onClick:()=>j(!0),children:[e.jsx(ze,{className:"h-4 w-4"}),"Nueva Factura"]})]}),_?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Cargando facturas..."})}):e.jsx(ve,{children:e.jsx(_e,{className:"p-0",children:e.jsx(Ve,{data:fe,columns:je,keyExtractor:r=>r.id,emptyMessage:"No hay facturas registradas",emptyIcon:e.jsx(Be,{className:"h-12 w-12 text-muted-foreground/50 mx-auto"}),itemsPerPage:10})})})]}),e.jsx(Qe,{open:E,onOpenChange:j,terrenoId:h||"",onSuccess:f}),e.jsx(aa,{open:!!g,onOpenChange:r=>{r||t(null)},invoice:g,onSuccess:f}),e.jsx(be,{open:!!o,onOpenChange:()=>I(null),children:e.jsxs(Te,{children:[e.jsxs(Se,{children:[e.jsx(Ie,{children:"¿Eliminar factura?"}),e.jsx(Me,{children:"Esta acción enviará el registro a la papelera."})]}),e.jsxs(Re,{children:[e.jsx(Ae,{children:"Cancelar"}),e.jsx(Le,{onClick:he,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:a,children:a?"Eliminando...":"Eliminar"})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center gap-4",children:[e.jsx($e,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"Selecciona un terreno para ver sus facturas"}),e.jsx(M,{variant:"outline",asChild:!0,children:e.jsxs(ye,{to:"/dashboard/propiedades-tipo/terrenos",children:[e.jsx(Ue,{className:"h-4 w-4 mr-2"}),"Ver terrenos"]})})]})}export{Ja as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.