PageSourceSearch

https://www.lotecontrol-ita.com.br/assets/ReajusteInflacao-ujvDDVxJ.js

js lotecontrol-ita.com.br collected 2026-10-10 02:36:50 UTC 21,466 bytes, 11 lines download raw bytes

1import{a8 as ee,ad as se,j as e,az as re,aC as oe,aD as ie,aE as ne,$ as le,V as E,p as U,a1 as ce,B as _,R as ae,au as Y,a7 as P,r as N,at as de,av as me,C as R,h as T,s as q,t as H,v as L,I as ue,H as $,a9 as b,cf as xe,l as pe,n as he,o as B,q as V,P as Q,N as X,O as G,X as je,a3 as z}from"./index-Ch-sIjyP.js";import{P as fe}from"./PageHeader-DETY3Uir.js";import{u as ge}from"./usePrintPage-7vKkPjAi.js";import{y as ve,u as Ne,z as ye,D as _e,M as be}from"./MainLayout-D6Je8ULQ.js";import{A as Ce,b as we,a as Me}from"./alert-DhPooruL.js";import{C as J}from"./calendar-C1vN0Y5l.js";import{u as K}from"./useFormatters-DmuVWwep.js";import{e as De,T as Ae,a as W,b as D,c as Re,d as A}from"./table-DAHMOqnD.js";import{T as O,C as I}from"./trending-up-BZD2llNn.js";import{f as g}from"./format-C9L_W0VQ.js";import{p as S}from"./pt-BR-BKigPSxY.js";import{H as Z}from"./history-CxM1yObi.js";import{F as Te}from"./file-down-BroV4N21.js";import"./useClientes-0Wk9ZrMj.js";import"./separator-xP0inQbM.js";import"./collapsible-MbLmojUE.js";import"./useParcelasQueries-C5xgI_0W.js";import"./menu-CAmV-GH0.js";import"./chevron-left-uRg9nSuW.js";import"./circle-check-big-Puu7TPrB.js";import"./shield-check-CFlOwCzq.js";import"./user-DR9eE_ZO.js";import"./circle-help-DydlzBM9.js";import"./WhatsAppContactDialog-DBOm3xvE.js";import"./whatsapp-CEmQwvMz.js";import"./phone-C7JZQb_5.js";import"./smartphone-CImkWCOo.js";import"./glossary-D6D41u7P.js";import"./startOfMonth-BNLeFsyT.js";import"./endOfMonth-U-Pgaq8B.js";import"./addMonths-mSLMwcM8.js";import"./differenceInCalendarMonths-C84unqmL.js";import"./lastDayOfMonth-CT8moWZ8.js";import"./endOfWeek-Cg1JmIa-.js";import"./validators-CiH_o_ky.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ke=ee("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Fe=ee("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),Ie=({contrato:r,indice:h,isPending:n,onConfirm:u,onClose:f})=>{const{formatCurrency:c}=K(),{data:l,isLoading:x}=se({queryKey:["parcelas-pendentes-reajuste",r?.id],queryFn:async()=>{if(!r)return[];const{data:d,error:s}=await P.from("parcelas").select("id, numero, valor, data_vencimento, obs_pagamento").eq("contrato_id",r.id).in("status",["pendente","atrasado"]).order("numero",{ascending:!0});if(s)throw s;return d},enabled:!!r});if(!r)return null;const j=d=>Math.round(d*(1+h/100)*100)/100,o=l?.reduce((d,s)=>d+Number(s.valor),0)||0,m=l?.reduce((d,s)=>d+j(Number(s.valor)),0)||0;return e.jsx(re,{open:!!r,onOpenChange:d=>!d&&f(),children:e.jsxs(oe,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(ie,{children:[e.jsxs(ne,{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-5 w-5 text-primary"}),"Reajuste de Parcelas"]}),e.jsxs(le,{children:[r.comprador_nome," — ",E(r.lote_quadra,r.lote_numero)]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 bg-primary/5 rounded-lg border border-primary/20",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Índice IPCA aplicado"}),e.jsxs("p",{className:"text-2xl font-bold text-primary",children:["+",h.toFixed(2),"%"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Parcelas em aberto"}),e.jsx("p",{className:"text-2xl font-bold",children:l?.length||0})]})]}),x?e.jsx("div",{className:"flex items-center justify-center h-24",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):l&&l.length>0?e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs(De,{children:[e.jsx(Ae,{children:e.jsxs(W,{children:[e.jsx(D,{children:"Parcela"}),e.jsx(D,{children:"Vencimento"}),e.jsx(D,{className:"text-right",children:"Valor Atual"}),e.jsx(D,{className:"text-right",children:"Valor Reajustado"}),e.jsx(D,{className:"text-right",children:"Diferença"})]})}),e.jsx(Re,{children:l.map(d=>{const s=Number(d.valor),t=j(s),a=t-s;return e.jsxs(W,{children:[e.jsxs(A,{className:"font-medium",children:["P",d.numero]}),e.jsx(A,{children:g(U(d.data_vencimento),"dd/MM/yyyy")}),e.jsx(A,{className:"text-right",children:c(s)}),e.jsx(A,{className:"text-right font-medium text-primary",children:c(t)}),e.jsxs(A,{className:"text-right text-muted-foreground",children:["+",c(a)]})]},d.id)})})]})}):e.jsx("div",{className:"text-center py-6 text-muted-foreground",children:"Nenhuma parcela em aberto encontrada."}),l&&l.length>0&&e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total atual"}),e.jsx("p",{className:"font-bold",children:c(o)})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Diferença"}),e.jsxs("p",{className:"font-bold text-primary",children:["+",c(m-o)]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total reajustado"}),e.jsx("p",{className:"font-bold text-primary",children:c(m)})]})]})]}),e.jsxs(ce,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:f,disabled:n,children:"Não, 
11Cancelar"}),e.jsx(_,{onClick:()=>u(r.id),disabled:n||!l?.length,children:n?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-4 w-4 mr-2 animate-spin"}),"Aplicando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"Sim, Aplicar Reajuste"]})})]})]})})};function Pe(r,h){let n=(h.getFullYear()-r.getFullYear())*12+(h.getMonth()-r.getMonth());return h.getDate()<r.getDate()&&n--,n}function qe(r,h){const n=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=n.getDate();return n.setMonth(n.getMonth()+h),n.getDate()<u&&n.setDate(0),n}function He(){return se({queryKey:["calendario-reajustes"],queryFn:async()=>{const{data:r,error:h}=await P.from("contratos").select("id, comprador_nome, nome_loteamento, lote_quadra, lote_numero, data_primeira_parcela, isento_reajuste, valor_parcela").eq("status","ativo");if(h)throw h;const{data:n,error:u}=await P.from("reajustes_inflacao").select("contrato_id, data_reajuste").order("data_reajuste",{ascending:!1});if(u)throw u;const{data:f,error:c}=await P.from("parcelas").select("contrato_id, valor, status").in("status",["pendente","atrasado"]);if(c)throw c;const l=new Map;for(const o of f||[]){const m=l.get(o.contrato_id);m?m.count++:l.set(o.contrato_id,{count:1,valor:Number(o.valor)})}const x=new Date;x.setHours(0,0,0,0);const j=[];for(const o of r||[]){const m=l.get(o.id),d=(n||[]).filter(i=>i.contrato_id===o.id),s=d[0]?.data_reajuste||null,t=s||o.data_primeira_parcela;if(!t)continue;const a=U(t);if(!a||isNaN(a.getTime()))continue;const p=Pe(a,x),C=Math.max(0,Math.floor(p/12)),w=qe(a,(C+(p>=12?0:1))*12||12),k=Math.ceil((w.getTime()-x.getTime())/864e5),F=Math.max(0,12-p%12);let y;o.isento_reajuste?y="isento":!m||m.count===0?y="sem_parcelas":p>=12?y="vencido":k<=60?y="proximo":y="aguardando",j.push({contrato_id:o.id,comprador_nome:o.comprador_nome,loteamento:o.nome_loteamento,lote_quadra:o.lote_quadra,lote_numero:o.lote_numero,valor_parcela:m?.valor??Number(o.valor_parcela||0),parcelas_pendentes:m?.count??0,data_base:t,base_referencia:s?"ultimo_reajuste":"primeira_parcela",proxima_data:w,dias_restantes:k,meses_restantes:F===12?0:F,situacao:y,isento:o.isento_reajuste,total_reajustes:d.length,ultimo_reajuste:s})}return j.sort((o,m)=>o.proxima_data.getTime()-m.proxima_data.getTime())}})}const Le={vencido:"Reajuste pendente",proximo:"Vence em breve",aguardando:"Aguardando aniversário",isento:"Isento de reajuste",sem_parcelas:"Sem parcelas em aberto"},Se={vencido:"destructive",proximo:"default",aguardando:"secondary",isento:"outline",sem_parcelas:"outline"},Ee=({onSelecionarContrato:r})=>{const{formatCurrency:h}=K(),{data:n,isLoading:u}=He(),[f,c]=N.useState(""),[l,x]=N.useState("todos"),j=N.useMemo(()=>{const s=f.trim().toLowerCase();return(n||[]).filter(t=>l!=="todos"&&t.situacao!==l?!1:s?String(t.contrato_id).includes(s)||(t.comprador_nome||"").toLowerCase().includes(s)||(t.loteamento||"").toLowerCase().includes(s):!0)},[n,f,l]),o=N.useMemo(()=>{const s=n||[];return{vencidos:s.filter(t=>t.situacao==="vencido").length,proximos:s.filter(t=>t.situacao==="proximo").length,aguardando:s.filter(t=>t.situacao==="aguardando").length,isentos:s.filter(t=>t.situacao==="isento").length}},[n]),m=N.useMemo(()=>{const s=new Map;for(const t of j){const a=g(t.proxima_data,"yyyy-MM"),p=s.get(a);p?p.push(t):s.set(a,[t])}return Array.from(s.entries()).sort(([t],[a])=>t.localeCompare(a))},[j]),d=[{chave:"vencido",label:"Reajustes pendentes",valor:o.vencidos,icone:de,cor:"text-destructive"},{chave:"proximo",label:"Vencem em até 60 dias",valor:o.proximos,icone:ke,cor:"text-primary"},{chave:"aguardando",label:"Aguardando aniversário",valor:o.aguardando,icone:me,cor:"text-muted-foreground"},{chave:"isento",label:"Isentos de reajuste",valor:o.isentos,icone:Fe,cor:"text-muted-foreground"}];return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:d.map(({chave:s,label:t,valor:a,icone:p,cor:C})=>e.jsx(R,{className:`cursor-pointer transition-colors ${l===s?"border-primary":""}`,onClick:()=>x(l===s?"todos":s),children:e.jsxs(T,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t}),e.jsx("p",{className:"text-2xl font-semibold",children:a})]}),e.jsx(p,{className:`h-6 w-6 ${C}`})]})},s))}),e.jsxs(R,{children:[e.jsxs(q,{className:"gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Calendário de próximos reajustes"}),e.jsx(L,{children:"Cada contrato é reajustado a cada 12 meses, contados da 1ª parcela ou do último reajuste aplicado."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ue,{placeholder:"Buscar contrato, comprador ou loteamento",value:f,onChange:s=>c(s.target.value),className:"sm:w-72"}),l!=="todos"&&e.jsx(_,{variant:"outline",onClick:()=>x("todos"),children:"Limpar"})]})]}),e.jsx(T,{children:u?e.jsx("p",{className:"py-8 text-center text-muted-foreground",children:"Carregando..."}):m.length===0?e.jsxs("div",{className:"py-10 text-center text-muted-foreground",children:[e.jsx(Y,{className:"mx-auto mb-2 h-8 w-8"}),"Nenhum contrato encontrado com os filtros atuais."]}):e.jsx("div",{className:"space-y-6",children:m.map(([s,t])=>e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide",children:g(new Date(`${s}-01T00:00:00`),"MMMM 'de' yyyy",{locale:S})}),e.jsx($,{variant:"secondary",children:t.length})]}),e.jsx("div",{className:"space-y-2",children:t.map(a=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border p-3 sm:flex-row sm:items-center sm:justify-between",role:r?"button":void 0,onClick:()=>r?.(a.contrato_id),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"truncate font-medium",children:["Contrato #",a.contrato_id," — ",a.comprador_nome]}),e.jsxs("p",{className:"truncate text-sm text-muted-foreground",children:[a.loteamento||"Sem loteamento"," · ",E(a.lote_quadra,a.lote_numero)," ·"," ",a.parcelas_pen
11dentes," parcela(s) em aberto de ",h(a.valor_parcela)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Base: ",a.base_referencia==="ultimo_reajuste"?"último reajuste":"1ª parcela"," em"," ",g(new Date(`${a.data_base.split("T")[0]}T00:00:00`),"dd/MM/yyyy"),a.total_reajustes>0&&` · ${a.total_reajustes} reajuste(s) já aplicado(s)`]})]}),e.jsxs("div",{className:"flex items-center gap-3 sm:flex-col sm:items-end",children:[e.jsx($,{variant:Se[a.situacao],children:Le[a.situacao]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:a.dias_restantes<=0?"Aniversário já completado":`Em ${g(a.proxima_data,"dd/MM/yyyy")} (${a.dias_restantes} dia(s))`})]})]},a.contrato_id))})]},s))})})]})]})},ys=()=>{const{formatCurrency:r}=K(),[h,n]=N.useState(null),[u,f]=N.useState(void 0),[c,l]=N.useState(void 0),{data:x,isLoading:j,refetch:o}=ve(),{data:m,isLoading:d}=Ne(),{data:s,isLoading:t}=ye(),a=_e(),p=N.useMemo(()=>s?s.filter(i=>{const v=U(i.data_reajuste.split("T")[0]);if(u&&v<u)return!1;if(c){const M=new Date(c);if(M.setHours(23,59,59,999),v>M)return!1}return!0}):[],[s,u,c]),C=()=>{f(void 0),l(void 0)},w=u||c,k=async i=>{if(x)try{(await a.mutateAsync({contratoIds:[i],indice:x.ipca_acumulado_12_meses})).filter(te=>te.emailEnviado).length>0?z.success("Reajuste aplicado com sucesso! Email de notificação enviado."):z.success("Reajuste aplicado com sucesso!"),n(null)}catch(v){console.error("Error applying adjustment:",v),z.error("Erro ao aplicar reajuste")}},{printReajusteInflacao:F}=ge(),y=()=>{F({dataInicio:u?g(u,"yyyy-MM-dd"):void 0,dataFim:c?g(c,"yyyy-MM-dd"):void 0})};return e.jsxs(be,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(fe,{title:"Reajuste por Inflação",description:"Atualização automática de parcelas pelo IPCA a cada 12 meses"}),e.jsxs(R,{className:"bg-primary/5 border-primary/20 animate-slide-up",children:[e.jsx(q,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-primary/10 p-3",children:e.jsx(O,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx(H,{children:"IPCA Acumulado 12 Meses"}),e.jsxs(L,{children:[x?.fonte||"Carregando..."," - Ref: ",x?.mes_referencia||"..."]})]})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>o(),disabled:j,children:[e.jsx(ae,{className:b("h-4 w-4 mr-2",j&&"animate-spin")}),"Atualizar"]})]})}),e.jsx(T,{children:j?e.jsx("div",{className:"flex items-center justify-center h-16",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-4xl font-bold text-primary",children:[x?.ipca_acumulado_12_meses?.toFixed(2),"%"]}),x?.aviso&&e.jsxs(Ce,{variant:"default",children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx(we,{children:"Atenção"}),e.jsx(Me,{children:x.aviso})]})]})})]}),e.jsxs(pe,{defaultValue:"elegiveis",className:"animate-slide-up",style:{animationDelay:"100ms"},children:[e.jsxs(he,{children:[e.jsxs(B,{value:"elegiveis",children:["Contratos Elegíveis (",m?.length||0,")"]}),e.jsxs(B,{value:"calendario",children:[e.jsx(I,{className:"h-4 w-4 mr-2"}),"Calendário de Reajustes"]}),e.jsxs(B,{value:"historico",children:[e.jsx(Z,{className:"h-4 w-4 mr-2"}),"Histórico de Reajustes"]})]}),e.jsx(V,{value:"calendario",className:"mt-4",children:e.jsx(Ee,{})}),e.jsx(V,{value:"elegiveis",className:"mt-4",children:e.jsxs(R,{children:[e.jsxs(q,{children:[e.jsx(H,{children:"Contratos para Reajuste"}),e.jsx(L,{children:"Clique sobre um contrato para visualizar as parcelas em aberto e aplicar o reajuste"})]}),e.jsx(T,{children:d?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m&&m.length>0?e.jsx("div",{className:"space-y-3",children:m.map((i,v)=>{const M=i.valor_parcela*(1+(x?.ipca_acumulado_12_meses||0)/100);return e.jsxs("div",{onClick:()=>n(i),className:b("flex items-center justify-between rounded-lg border p-4 transition-colors cursor-pointer hover:bg-primary/5 hover:border-primary/30"),style:{animationDelay:`${v*50}ms`},children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"rounded-full bg-primary/10 p-2",children:e.jsx(O,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:i.comprador_nome}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:E(i.lote_quadra,i.lote_numero)}),e.jsx($,{variant:"secondary",children:i.meses_desde_ultimo_reajuste?`${i.meses_desde_ultimo_reajuste} meses desde último reajuste`:`${i.meses_desde_inicio} meses desde início`})]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Parcela atual"}),e.jsx("p",{className:"font-medium",children:r(i.valor_parcela)}),e.jsxs("p",{className:"text-sm text-primary",children:["→ ",r(M)]})]})]},i.id)})}):e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(Y,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"Nenhum contrato elegível"}),e.jsx("p",{className:"text-sm",children:"Todos os contratos estão em dia com os reajustes ou ainda não completaram 12 meses."})]})})]})}),e.jsx(V,{value:"historico",className:"mt-4",children:e.jsxs(R,{children:[e.jsxs(q,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Histórico de Reajustes"}
11),e.jsx(L,{children:"Registro de todos os reajustes aplicados"})]}),e.jsxs(_,{variant:"outline",onClick:y,disabled:!p||p.length===0,children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"Exportar PDF"]})]}),e.jsxs(T,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4 p-3 bg-muted/30 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Filtrar por período:"})]}),e.jsxs(Q,{children:[e.jsx(X,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:b("w-[140px] justify-start text-left font-normal",!u&&"text-muted-foreground"),children:[e.jsx(I,{className:"mr-2 h-4 w-4"}),u?g(u,"dd/MM/yyyy"):"Início"]})}),e.jsx(G,{className:"w-auto p-0",align:"start",children:e.jsx(J,{mode:"single",selected:u,onSelect:f,initialFocus:!0,locale:S,className:b("p-3 pointer-events-auto")})})]}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"até"}),e.jsxs(Q,{children:[e.jsx(X,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:b("w-[140px] justify-start text-left font-normal",!c&&"text-muted-foreground"),children:[e.jsx(I,{className:"mr-2 h-4 w-4"}),c?g(c,"dd/MM/yyyy"):"Fim"]})}),e.jsx(G,{className:"w-auto p-0",align:"start",children:e.jsx(J,{mode:"single",selected:c,onSelect:l,initialFocus:!0,locale:S,className:b("p-3 pointer-events-auto")})})]}),w&&e.jsxs(_,{variant:"ghost",size:"sm",onClick:C,children:[e.jsx(je,{className:"h-4 w-4 mr-1"}),"Limpar"]}),w&&e.jsxs("span",{className:"text-sm text-muted-foreground ml-auto",children:[p.length," de ",s?.length||0," reajustes"]})]}),t?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p&&p.length>0?e.jsx("div",{className:"space-y-3",children:p.map((i,v)=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4 animate-slide-up",style:{animationDelay:`${v*50}ms`},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:i.contratos?.comprador_nome||"Contrato removido"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i.contratos&&e.jsx("span",{children:E(i.contratos.lote_quadra,i.contratos.lote_numero)}),e.jsx("span",{children:"•"}),e.jsx("span",{children:g(new Date(i.data_reajuste),"dd/MM/yyyy 'às' HH:mm",{locale:S})})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs($,{className:"bg-primary/10 text-primary",children:["+",Number(i.indice_aplicado).toFixed(2),"%"]}),e.jsxs("p",{className:"text-sm mt-1",children:[r(Number(i.valor_parcela_anterior))," → ",r(Number(i.valor_parcela_novo))]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.parcelas_afetadas," parcela(s) atualizada(s)"]})]})]},i.id))}):e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:s?.length?"Nenhum reajuste no período":"Nenhum reajuste registrado"}),e.jsx("p",{className:"text-sm",children:s?.length?"Ajuste os filtros de data para ver outros registros.":"O histórico de reajustes aparecerá aqui após aplicar o primeiro."})]})]})]})})]})]}),e.jsx(Ie,{contrato:h,indice:x?.ipca_acumulado_12_meses||0,isPending:a.isPending,onConfirm:k,onClose:()=>n(null)})]})};export{ys 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.