1import{j as e,B as d,C as t,l as n,q as z,a as U,au as V,r as C,e as T,o as $,at as G,as as H,ar as I,ao as W,ap as B,E as x,g as D,h as L,U as Y,V as J}from"./index-DfOJmvz4.js";import{B as j}from"./badge-Dbl0Jwtm.js";import{c as u,T as K,a as Q,b as h}from"./tabs-Czrmf5jI.js";import{t as Z}from"./property-terreno-1-CHFRIEQg.js";import{P as ee,a as se}from"./constants-DaVU9HBM.js";import{U as ae}from"./users-BZXBZcrg.js";import{F as te}from"./file-text-f4n0A-yg.js";import{C as re}from"./clipboard-list-ChUY3Cec.js";import{C as ne}from"./chart-column-IirqYcLN.js";import{B as g}from"./building-2-Bsxya_X5.js";import{W as le}from"./warehouse-CBrQxZ6l.js";import{M as E}from"./map-pin-D2fhs9R-.js";import{B as ce}from"./briefcase-CcBOcOKF.js";import{S}from"./store-8wOh47OJ.js";import{A as ie}from"./arrow-left-DHLt5dfU.js";import{R as oe}from"./ruler-B4NcuWMz.js";import{B as de}from"./bed-BVXbQHTm.js";import{B as me}from"./bath-DZE1i9BC.js";import{C as xe}from"./car-Dbl4SIIZ.js";import"./index-ivjWPsw3.js";import"./index-6ZOEkj60.js";import"./categories-QEOJ_AnI.js";const p=a=>new Intl.NumberFormat("es-MX",{style:"currency",currency:"MXN",minimumFractionDigits:0}).format(a);function he({tenants:a,blockIfDemo:o}){return e.jsxs(u,{value:"inquilinos",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Inquilinos"}),e.jsx(d,{onClick:()=>o(),children:"+ Nuevo Inquilino"})]}),a.length===0?e.jsx(t,{children:e.jsxs(n,{className:"py-12 text-center",children:[e.jsx(ae,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No hay inquilinos registrados para esta propiedad"})]})}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:a.map(c=>e.jsx(t,{children:e.jsx(n,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:c.nombre}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c.email}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c.telefono})]}),e.jsx(j,{variant:"default",children:"Activo"})]})})},c.id))})]})}function pe({contracts:a,getTenantName:o,blockIfDemo:c}){return e.jsxs(u,{value:"contratos",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Contratos"}),e.jsx(d,{onClick:()=>c(),children:"+ Nuevo Contrato"})]}),a.length===0?e.jsx(t,{children:e.jsxs(n,{className:"py-12 text-center",children:[e.jsx(te,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No hay contratos registrados"})]})}):e.jsx("div",{className:"grid gap-4",children:a.map(i=>e.jsx(t,{children:e.jsx(n,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:o(i.inquilinoId)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[new Date(i.fechaInicio).toLocaleDateString("es-MX")," - ",new Date(i.fechaFin).toLocaleDateString("es-MX")]}),e.jsxs("p",{className:"text-sm font-medium text-primary",children:[p(i.montoMensual),"/mes"]})]}),e.jsx(j,{variant:i.estado==="activo"?"default":"secondary",children:i.estado})]})})},i.id))})]})}function je({incomes:a,expenses:o,blockIfDemo:c}){const i=a.reduce((r,N)=>r+N.monto,0),f=o.reduce((r,N)=>r+N.monto,0),m=i-f;return e.jsxs(u,{value:"finanzas",className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(t,{className:"bg-green-50 border-green-200",children:e.jsxs(n,{className:"p-4",children:[e.jsx("p",{className:"text-sm text-green-600",children:"Ingresos Totales"}),e.jsx("p",{className:"text-2xl font-bold text-green-700",children:p(i)})]})}),e.jsx(t,{className:"bg-red-50 border-red-200",children:e.jsxs(n,{className:"p-4",children:[e.jsx("p",{className:"text-sm text-red-600",children:"Egresos Totales"}),e.jsx("p",{className:"text-2xl font-bold text-red-700",children:p(f)})]})}),e.jsx(t,{className:m>=0?"bg-blue-50 border-blue-200":"bg-amber-50 border-amber-200",children:e.jsxs(n,{className:"p-4",children:[e.jsx("p",{className:`text-sm ${m>=0?"text-blue-600":"text-amber-600"}`,children:"Balance"}),e.jsx("p",{className:`text-2xl font-bold ${m>=0?"text-blue-700":"text-amber-700"}`,children:p(m)})]})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Ingresos"}),e.jsx(d,{size:"sm",onClick:()=>c(),children:"+ Agregar"})]}),a.length===0?e.jsx(t,{children:e.jsx(n,{className:"py-8 text-center text-muted-foreground",children:"Sin ingresos registrados"})}):e.jsx("div",{className:"space-y-2",children:a.slice(0,5).map(r=>e.jsx(t,{children:e.jsxs(n,{className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:r.concepto}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(r.fecha).toLocaleDateString("es-MX")})]}),e.jsxs("span",{className:"font-semibold text-green-600",children:["+",p(r.monto)]})]})},r.id))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Egresos"}),e.jsx(d,{size:"sm",onClick:()=>c(),children:"+ Agregar"})]}),o.length===0?e.jsx(t,{children:e.jsx(n,{className:"py-8 text-center text-muted-foreground",children:"Sin egresos registrados"})}):e.jsx("div",{className:"space-y-2",children:o.slice(0,5).map(r=>e.jsx(t,{children:e.jsxs(n,{className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:r.concepto}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(r.fecha).toLocaleDateString("es-MX")})]}),e.jsxs("span",{className:"font-semibold text-red-600",children:["-",p(r.monto)]})]})},r.id))})]})]})]})}function ue({blockIfDemo:a}){return e.jsxs(u,{value:"documentos",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Documentos"}),e.jsx(d,{onClick:()=>
1a(),children:"+ Subir Documento"})]}),e.jsx(t,{children:e.jsxs(n,{className:"py-12 text-center",children:[e.jsx(re,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No hay documentos registrados para esta propiedad"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Los documentos incluyen contratos, escrituras, avalúos, etc."})]})})]})}function Ne({blockIfDemo:a}){return e.jsxs(u,{value:"reportes",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Reportes"}),e.jsx(d,{onClick:()=>a(),children:"Generar Reporte"})]}),e.jsx(t,{children:e.jsxs(n,{className:"py-12 text-center",children:[e.jsx(ne,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Los reportes estarán disponibles cuando tengas datos financieros"})]})})]})}const fe={departamento:g,casa:$,local:S,local_comercial:S,oficina:ce,terreno:E,bodega:le},ge={departamento:"Departamento",casa:"Casa",local:"Local Comercial",local_comercial:"Local Comercial",oficina:"Oficina",terreno:"Terreno",bodega:"Bodega"},be={departamento:B,casa:W,local:I,local_comercial:I,oficina:H,terreno:Z,bodega:G};function Ue(){const{id:a}=z(),{properties:o,tenants:c,contracts:i,incomes:f,expenses:m}=U(),{blockIfDemo:r}=V(),[N,y]=C.useState(!1),[R,M]=C.useState("general"),s=o.find(l=>l.id===a),P=c.filter(l=>l.propiedadId===a),k=i.filter(l=>l.propiedadId===a),q=f.filter(l=>l.propiedadId===a),A=m.filter(l=>l.propiedadId===a),F=l=>{const b=c.find(_=>_.id===l);return(b==null?void 0:b.nombre)||"Inquilino"},v=l=>new Intl.NumberFormat("es-MX",{style:"currency",currency:"MXN",minimumFractionDigits:0}).format(l);if(!s)return e.jsx("div",{className:"container mx-auto p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx(g,{className:"h-16 w-16 text-muted-foreground mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Propiedad no encontrada"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"La propiedad que buscas no existe."}),e.jsx(d,{asChild:!0,children:e.jsx(T,{to:"/admin-propiedades",children:"Volver al Portal"})})]})});const O=fe[s.tipo]||g,X=be[s.tipo]||B,w=s.imagenExterior||s.imagen||X;return e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{variant:"ghost",asChild:!0,className:"gap-2",children:e.jsxs(T,{to:"/admin-propiedades",children:[e.jsx(ie,{className:"h-4 w-4"}),"Volver al Portal"]})}),e.jsxs(j,{variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50",children:[e.jsx(x,{className:"h-3 w-3 mr-1"}),"Modo Solo Lectura"]})]}),e.jsxs(K,{value:R,onValueChange:M,className:"w-full",children:[e.jsxs(Q,{className:"w-full grid grid-cols-6",children:[e.jsxs(h,{value:"general",className:"flex items-center gap-1",children:[e.jsx(g,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"General"})]}),e.jsxs(h,{value:"inquilinos",className:"flex items-center gap-1",children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Inquilinos"})]}),e.jsxs(h,{value:"contratos",className:"flex items-center gap-1",children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contratos"})]}),e.jsxs(h,{value:"finanzas",className:"flex items-center gap-1",children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Finanzas"})]}),e.jsxs(h,{value:"documentos",className:"flex items-center gap-1",children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documentos"})]}),e.jsxs(h,{value:"reportes",className:"flex items-center gap-1",children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Reportes"})]})]}),e.jsx(u,{value:"general",className:"space-y-6",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"relative aspect-[4/3] rounded-xl overflow-hidden cursor-pointer group",onClick:()=>y(!0),children:[e.jsx("img",{src:w,alt:`${s.titulo} - Exterior`,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors"}),e.jsx(j,{className:"absolute top-4 left-4 bg-primary",children:"Exterior"}),e.jsx(j,{className:`absolute top-4 right-4 ${se[s.estado]||"bg-gray-500"}`,children:ee[s.estado]||s.estado})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(t,{children:e.jsxs(D,{className:"pb-3",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs(j,{variant:"outline",className:"gap-1",children:[e.jsx(O,{className:"h-3 w-3"}),ge[s.tipo]]})}),e.jsx(L,{className:"text-2xl",children:s.titulo}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx("span",{children:s.direccion})]})]})}),e.jsx(t,{className:"bg-primary/5 border-primary/20",children:e.jsx(n,{className:"py-4",children:e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Renta mensual"}),e.jsx("p",{className:"text-3xl font-bold text-primary",children:v(s.precio)})]}),s.area&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[v(Math.round(s.precio/s.area)),"/m²"]})]})})}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.area&&e.jsx(t,{children:e.jsxs(n,{className:"py-4 text-center",children:[e.jsx(oe,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xl font-bold",children:s.area}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m²"})]})}),s.habitaciones&&s.habitaciones>0&&e.jsx(t,{children:e.jsxs(n,{className:"py-4 text-center",children:[e.jsx(de,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xl font-bold",children:s.habitaciones}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Recámaras"})]})}),s.banos&&s.banos>0&&e.jsx(t,{children:e.jsxs(n,{className:"py-4 text-center",children:[e.jsx(me,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xl font-bold",children:s.banos}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Baños"})]})}),s.estacionamientos&&s.estacionamientos>0&&e.jsx(t,{children:e.jsxs(n,{className:"py-4 text-center",children:[e.jsx(xe,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xl font-bold",children:s.estacionamientos}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Estac."})]})})]}),s.descripcion&&e.jsxs(t,{children:[e.jsx(D,{className:"pb-2",children:e.jsx(L,{className:"text-base",children:"Descripción"})}),e.jsx(n,{children:e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:s.descripcion})})]})]})]})}),e.jsx(he,{tenants:P,blockIfDemo:r}),e.jsx(pe,{contracts:k,getTenantName:F,blockIfDemo:r}),e.jsx(je,{incomes:q,expenses:A,blockIfDemo:r}),e.jsx(ue,{blockIfDemo:r}),e.jsx(Ne,{blockIfDemo:r})]}),e.jsx(Y,{open:N,onOpenChange:y,children:e.jsx(J,{className:"max-w-4xl p-0",children:e.jsx("img",{src:w,alt:s.titulo,className:"w-full h-auto rounded-lg"})})})]})}export{Ue 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.