PageSourceSearch

https://www.visitecamposdojordao.org.br/assets/AssociadoApp-DggBhksf.js

js visitecamposdojordao.org.br collected 2026-10-02 22:26:37 UTC 24,495 bytes, 1 lines download raw bytes

1import{r as c,j as e,L as b}from"./vendor-react-CoH7wDUq.js";import{A as h,S as te,D as oe}from"./index-DarzfxaQ.js";import{P as g,p as u,a as x}from"./PublicFormLayout-DKoMZn_o.js";import"./vendor-pdf-DNjb9-t8.js";const re="siteconvention_associado_token";function w(){return""}function y(){try{localStorage.removeItem(re)}catch{}}async function S(a,o={}){return y(),fetch(a,{...o,credentials:"include"})}async function j(a,o={}){const n={"Content-Type":"application/json",...o.headers},t=await S(`${w()}/api/associado${a}`,{...o,headers:n});if(!t.ok){const m=await t.json().catch(()=>({error:t.statusText}));throw new Error(m.error||`API ${t.status}`)}if(t.status!==204)return t.json()}async function ne(a,o){const n=await S(`${w()}/api/associado/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nomeUsuario:a,senha:o})});if(!n.ok){const m=await n.json().catch(()=>({error:n.statusText}));throw new Error(m.error||"Falha no login")}const t=await n.json();return t.mustChangePassword,y(),t}async function le(a){const o=await S(`${w()}/api/associado/auth/primeiro-acesso`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!o.ok){const t=await o.json().catch(()=>({error:o.statusText}));throw new Error(t.error||"Falha no primeiro acesso")}const n=await o.json();return y(),n}async function ie(){y(),await S(`${w()}/api/associado/auth/logout`,{method:"POST"}).catch(()=>{})}async function de(){return await j("/me")}async function ce(){return j("/atas")}async function me(a){return j("/ocupacoes",{method:"POST",body:JSON.stringify(a)})}async function Q(){return j("/ocupacoes/minhas")}async function H(a){const o=new URLSearchParams;return"ano"in a?o.set("ano",String(a.ano)):(o.set("dataInicio",a.dataInicio),o.set("dataFim",a.dataFim)),j(`/ocupacao-geral?${o.toString()}`)}function K(a){return String(a||"").trim().toLowerCase()}const T="whitespace-nowrap rounded-xl border border-slate-600/90 bg-slate-800/90 px-3 py-2 text-xs font-semibold text-slate-100 shadow-sm transition-colors hover:border-slate-500 hover:bg-slate-700 sm:px-4 sm:text-sm",L="w-full rounded-xl bg-emerald-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-emerald-700 disabled:opacity-50 sm:w-auto sm:min-w-[140px]",xe="rounded-xl border border-slate-600/90 bg-slate-800/90 px-3 py-2 text-xs font-semibold text-slate-100 shadow-sm transition hover:border-slate-500 hover:bg-slate-700 sm:px-4 sm:text-sm";function ue({title:a,description:o,right:n}){return e.jsxs("header",{className:"sticky top-0 z-40 border-b border-slate-800 bg-slate-900/95 pt-[env(safe-area-inset-top,0px)] backdrop-blur-md",children:[e.jsxs("div",{className:"mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-3 px-4 py-3 sm:px-6 sm:py-3.5",children:[e.jsxs(b,{to:"/",className:"flex min-w-0 flex-1 basis-0 items-center gap-3","aria-label":h.name,children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-white/10 ring-1 ring-white/15 sm:h-11 sm:w-11",children:e.jsx("img",{src:h.logo.local,alt:"",className:"h-full w-full object-contain p-0.5",onError:t=>{const m=t.currentTarget;m.onerror=null,m.src=h.logo.fallback}})}),e.jsxs("div",{className:"min-w-0 text-left",children:[e.jsx("span",{className:"block truncate text-[11px] font-semibold uppercase tracking-[0.18em] text-emerald-400/95",children:h.name}),e.jsx("span",{className:"block truncate font-serif text-base font-bold text-white sm:text-lg",children:a}),o?e.jsx("span",{className:"mt-0.5 block truncate text-xs text-slate-400",children:o}):null]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-2 sm:gap-3",children:n})]}),e.jsx("div",{className:"h-0.5 bg-gradient-to-r from-emerald-500 via-sky-400 to-amber-400 opacity-90"})]})}function he(){const a=new Date().getFullYear();return e.jsxs("footer",{className:"relative mt-auto border-t border-slate-800 bg-slate-800 px-4 pb-[max(1.5rem,env(safe-area-inset-bottom,0px))] pt-10 text-slate-300 sm:px-8",children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-emerald-500 via-sky-400 to-amber-400 opacity-80"}),e.jsxs("div",{className:"relative z-10 mx-auto max-w-6xl",children:[e.jsxs("div",{className:"flex flex-col gap-8 border-b border-slate-700/80 pb-8 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"max-w-md",children:[e.jsx("img",{src:h.hero.logoLocal,alt:"",className:"mb-3 h-14 w-auto object-contain opacity-95 sm:h-16",onError:o=>{const n=o.currentTarget;n.onerror=null,n.src=h.logo.fallback}}),e.jsx("p",{className:"text-sm leading-relaxed text-slate-400",children:"Convention Bureau & portal de turismo — Campos do Jordão."})]}),e.jsx("div",{children:e.jsx(b,{to:"/",className:"inline-flex text-sm font-semibold text-emerald-300/90 transition-colors hover:text-white",children:"← Voltar ao site"})})]}),e.jsxs("div",{className:"mt-6 flex flex-col items-center justify-between gap-4 border-t border-slate-700/80 pt-6 sm:flex-row sm:items-center",children:[e.jsx(te,{}),e.jsx(oe,{})]}),e.jsxs("p",{className:"pt-6 text-center text-xs text-slate-500",children:["CJRC & VB · Campos do Jordão © ",a]})]})]})}function D({children:a,headerTitle:o,headerDescription:n,headerRight:t}){return e.jsxs("div",{className:"flex min-h-screen min-h-[100dvh] flex-col bg-[#F8F6F3]",children:[e.jsx(ue,{title:o,description:n,right:t}),e.jsx("main",{id:"main-content",className:"w-full min-w-0 flex-1 px-4 py-8 sm:px-6 sm:py-10 md:py-12",children:e.jsx("div",{className:"mx-auto w-full max-w-6xl min-w-0",children:a})}),e.jsx(he,{})]})}function je(){var Y;const[a,o]=c.useState({mode:"login"}),[n,t]=c.useState(""),[m,p]=c.useState(!1),[O,I]=c.useState([]),[$,C]=c.useState([]),[f,R]=c.useState(null),[v,U]=c.useState({dataInicio:"",dataFim
1:""}),[N,_]=c.useState("periodo"),[B,W]=c.useState(()=>new Date().getFullYear()),F=c.useRef(!1),[V,k]=c.useState(""),[G,A]=c.useState(""),[J,E]=c.useState(""),M=a.mode==="ready"?a.associado.id:null;c.useEffect(()=>{de().then(({associado:s})=>o({mode:"ready",associado:s})).catch(()=>{})},[]),c.useEffect(()=>{if(M==null)return;let s=!1;return Promise.all([ce(),Q()]).then(([r,l])=>{s||(I(r),C(l))}).catch(r=>{s||t(r instanceof Error?r.message:"Erro ao carregar painel")}),()=>{s=!0}},[M]),c.useEffect(()=>{a.mode==="first-access"&&(k(""),A(""),E(""),t(""))},[a.mode,a.mode==="first-access"?a.nomeUsuario:""]);async function X(s){s.preventDefault();const r=new FormData(s.currentTarget),l=String(r.get("nomeUsuario")||"").trim(),d=String(r.get("senha")||"");p(!0),t("");try{const i=await ne(l,d);i.mustChangePassword?o({mode:"first-access",nomeUsuario:l,senha:d}):o({mode:"ready",associado:i.associado})}catch(i){t(i instanceof Error?i.message:"Falha no login")}finally{p(!1)}}async function Z(s){if(s.preventDefault(),a.mode!=="first-access")return;const r=V.trim(),l=G,d=K(a.nomeUsuario);if(K(r)===d){t("Escolha um nome de usuário diferente do login temporário (o que você acabou de usar).");return}if(l===a.senha){t("A nova senha não pode ser igual à senha temporária. Crie uma senha nova.");return}if(l!==J){t("As senhas não coincidem. Digite a mesma senha nos dois campos.");return}if(r.length<4){t("O nome de usuário definitivo deve ter pelo menos 4 caracteres.");return}if(l.length<6){t("A nova senha deve ter pelo menos 6 caracteres.");return}p(!0),t("");try{const i=await le({nomeUsuario:a.nomeUsuario,senha:a.senha,novoNomeUsuario:r,novaSenha:l});o({mode:"ready",associado:i.associado}),k(""),A(""),E("")}catch(i){t(i instanceof Error?i.message:"Falha ao trocar senha")}finally{p(!1)}}async function ee(s){if(s.preventDefault(),F.current)return;const r=s.currentTarget,l=new FormData(r),d={dataInicio:String(l.get("dataInicio")||""),dataFim:String(l.get("dataFim")||""),quartosTotal:Number(l.get("quartosTotal")),quartosVendidos:Number(l.get("quartosVendidos"))};F.current=!0,p(!0),t("");try{await me(d);const i=await Q();C(i),r.reset()}catch(i){t(i instanceof Error?i.message:"Erro ao salvar ocupação")}finally{F.current=!1,p(!1)}}async function se(s){s.preventDefault(),p(!0),t("");try{const r=N==="anual"?await H({ano:B}):await H({dataInicio:v.dataInicio,dataFim:v.dataFim});R(r)}catch(r){t(r instanceof Error?r.message:"Erro ao calcular ocupação geral")}finally{p(!1)}}function ae(){ie().finally(()=>{o({mode:"login"}),I([]),C([]),R(null)})}if(a.mode==="login")return e.jsx(D,{headerTitle:"Painel do Associado",headerRight:e.jsx(b,{to:"/",className:T,children:"← Início"}),children:e.jsxs("div",{className:"mx-auto max-w-lg",children:[e.jsxs("div",{className:"relative mb-6 overflow-hidden rounded-2xl border border-white/10 bg-gradient-to-br from-slate-900 via-slate-800 to-emerald-950 shadow-xl sm:rounded-3xl sm:mb-8",children:[e.jsx("div",{className:"pointer-events-none absolute -right-16 -top-20 h-56 w-56 rounded-full bg-emerald-500/25 blur-3xl sm:h-72 sm:w-72"}),e.jsx("div",{className:"pointer-events-none absolute -bottom-16 -left-10 h-44 w-44 rounded-full bg-sky-500/20 blur-3xl"}),e.jsxs("div",{className:"relative px-5 py-7 sm:px-8 sm:py-9",children:[e.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.22em] text-emerald-300/95 sm:text-xs",children:"Área exclusiva"}),e.jsx("h1",{className:"font-serif text-2xl font-bold leading-tight text-white sm:text-3xl",children:"Acesso de associados"}),e.jsx("p",{className:"mt-3 max-w-md text-sm leading-relaxed text-slate-300 sm:text-base",children:"Entre com o usuário e a senha fornecidos pela equipe do Convention. Este espaço é reservado a empreendimentos associados ao CJRC & VB."})]})]}),e.jsx(g,{className:"p-6 sm:p-8",children:e.jsxs("form",{onSubmit:X,className:"space-y-4",children:[n&&e.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800",children:n}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"assoc-login-user",className:u,children:"Nome de usuário"}),e.jsx("input",{id:"assoc-login-user",name:"nomeUsuario",autoComplete:"username",placeholder:"Seu usuário",className:x,required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"assoc-login-pass",className:u,children:"Senha"}),e.jsx("input",{id:"assoc-login-pass",name:"senha",type:"password",autoComplete:"current-password",placeholder:"Senha",className:x,required:!0})]}),e.jsx("button",{type:"submit",disabled:m,className:`${L} !w-full`,children:m?"Entrando…":"Entrar"})]})})]})});if(a.mode==="first-access")return e.jsx(D,{headerTitle:"Painel do Associado",headerRight:e.jsx(b,{to:"/",className:T,children:"← Início"}),children:e.jsx("div",{className:"mx-auto max-w-lg",children:e.jsxs(g,{className:"overflow-hidden shadow-[0_8px_40px_-12px_rgba(15,23,42,0.18)] ring-1 ring-slate-200/80",children:[e.jsxs("div",{className:"relative border-b border-white/10 bg-gradient-to-br from-slate-900 via-slate-800 to-emerald-950 px-5 py-6 sm:px-8 sm:py-8",children:[e.jsx("div",{className:"pointer-events-none absolute -right-12 -top-16 h-40 w-40 rounded-full bg-emerald-500/20 blur-3xl"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"inline-flex rounded-full border border-amber-400/40 bg-amber-400/15 px-3 py-1 text-[11px] font-semibold uppercase tracking-wider text-amber-200",children:"Obrigatório antes do painel"}),e.jsx("h1",{className:"mt-4 font-serif text-2xl font-bold text-white sm:text-3xl",children:"Defina seu login definitivo"})]})]}),e.jsxs("div",{className:"space-y-4 p-6 sm:p-8",children:[e.jsxs("div",{className:"rounded-2xl border border-emerald-200/80 bg-gradient-to-br from-emerald-50/90 to-sky-50/50 p-4 text-sm leading-relaxed text-slate-800",children:[e.jsx("p",{className:"font-semibold text-slate-900",children:"Por que preciso informar novas credenciais?"}),e.jsxs("p",{className:"mt-2",children:["O usuário e a senha que você recebeu do administrador são ",e.jsx("strong",{children:"temporários"}
1)," e podem ter sido enviados por e-mail ou em papel. Para sua segurança, escolha agora um ",e.jsx("strong",{children:"nome de usuário"})," e uma"," ",e.jsx("strong",{children:"senha"})," que só você conheça."]}),e.jsxs("p",{className:"mt-2",children:["Só depois de salvar você entra no painel. Use ",e.jsx("strong",{children:"somente"})," essas novas credenciais — o acesso temporário deixa de funcionar."]})]}),n&&e.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800",children:n}),e.jsxs("form",{autoComplete:"off",onSubmit:Z,className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"Os campos abaixo começam vazios de propósito. Não reutilize o usuário nem a senha temporários — o sistema não aceita."}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"assoc-def-user",className:u,children:"Novo nome de usuário (seu login daqui em diante)"}),e.jsx("input",{id:"assoc-def-user",name:"assoc_definitive_username",value:V,onChange:s=>k(s.target.value),autoComplete:"off",placeholder:"Ex.: hotelnome ou sua marca",className:x,required:!0,minLength:4})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"assoc-def-pass",className:u,children:"Nova senha"}),e.jsx("input",{id:"assoc-def-pass",name:"assoc_def_pass",value:G,onChange:s=>A(s.target.value),type:"password",autoComplete:"new-password",placeholder:"Mínimo 6 caracteres",className:x,required:!0,minLength:6})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"assoc-def-pass2",className:u,children:"Confirmar nova senha"}),e.jsx("input",{id:"assoc-def-pass2",name:"assoc_def_pass_confirm",value:J,onChange:s=>E(s.target.value),type:"password",autoComplete:"new-password",placeholder:"Digite a mesma senha",className:x,required:!0,minLength:6})]}),e.jsx("button",{type:"submit",disabled:m,className:`${L} !w-full`,children:m?"Salvando credenciais…":"Salvar e entrar no painel"})]})]})]})})});const z=((Y=a.associado.local)==null?void 0:Y.nome)||a.associado.nomeUsuario;return e.jsxs(D,{headerTitle:"Painel do Associado",headerDescription:z,headerRight:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx(b,{to:"/",className:T,children:"← Início"}),e.jsx("button",{type:"button",onClick:ae,className:xe,children:"Sair"})]}),children:[e.jsxs("div",{className:"relative mb-6 overflow-hidden rounded-2xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-emerald-50/60 p-5 shadow-sm sm:rounded-3xl sm:p-7 md:mb-8",children:[e.jsx("div",{className:"pointer-events-none absolute -right-20 top-0 h-48 w-48 rounded-full bg-emerald-400/15 blur-3xl"}),e.jsx("div",{className:"relative flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[e.jsx("div",{className:"hidden h-14 w-14 shrink-0 overflow-hidden rounded-2xl bg-white shadow-md ring-1 ring-slate-200/80 sm:flex sm:h-16 sm:w-16 sm:items-center sm:justify-center",children:e.jsx("img",{src:h.logo.local,alt:"",className:"h-full w-full object-contain p-1",onError:s=>{const r=s.currentTarget;r.onerror=null,r.src=h.logo.fallback}})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.2em] text-emerald-700/90",children:"Bem-vindo"}),e.jsx("h2",{className:"font-serif text-xl font-bold text-slate-900 sm:text-2xl",children:z}),e.jsxs("p",{className:"mt-1 text-sm text-slate-600",children:["Consulte o estatuto, as ATAs e envie dados de ocupação em um ambiente alinhado ao portal ",h.name,"."]})]})]})})]}),e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsxs(g,{className:"p-5 md:p-7",children:[e.jsx("h2",{className:"font-serif text-xl font-bold text-slate-900",children:"Estatuto social"}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-slate-600",children:"O estatuto é o documento que define a identidade, fins e regras de funcionamento do CJRC e VB — incluindo a composição da assembleia, diretoria e fiscal, deliberações e relação com associados. Mantenha uma cópia para consulta institucional."}),e.jsx("a",{href:"/documentos/estatuto-cjrcvb.pdf",download:!0,className:"mt-4 inline-flex items-center gap-2 rounded-xl bg-slate-900 px-5 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-slate-800",children:"Baixar estatuto (PDF)"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-2 xl:gap-8",children:[e.jsxs(g,{className:"p-5 md:p-7",children:[e.jsx("h2",{className:"font-serif text-xl font-bold text-slate-900",children:"ATAs de reunião"}),O.length>0?e.jsx("div",{className:"mt-5 flex flex-col gap-5",children:O.map(s=>{var r,l;return e.jsxs("article",{className:"overflow-hidden rounded-2xl border border-slate-200/90 bg-white shadow-md shadow-slate-900/5 ring-1 ring-slate-900/[0.04]",children:[e.jsx("header",{className:"border-b border-slate-100 bg-gradient-to-br from-emerald-50/90 via-white to-slate-50/80 px-4 py-4 sm:px-5 sm:py-4",children:e.jsx("h3",{className:"font-serif text-lg font-bold leading-snug text-slate-900 sm:text-xl",children:s.titulo})}),e.jsxs("div",{className:"space-y-4 px-4 py-4 text-sm text-slate-700 sm:px-5 sm:py-5",children:[e.jsxs("dl",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-wide text-slate-500",children:"Local"}),e.jsx("dd",{className:"mt-0.5 text-slate-800",children:((r=s.local)==null?void 0:r.trim())||"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-wide text-slate-500",children:"Data"}),e.jsx("dd",{className:"mt-0.5 font-medium text-slate-800",children:s.dataReuniao?new Date(s.dataReuniao).toLocaleDateString("pt-BR"):"—"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-wide text-slate-500",children:"Integrantes"}),e.jsx("dd",{className:"mt-0.5 text-slate-800",children:((l=s.integrantesRaw)==null?void 0:l.trim())||"—"})]})]}),s.arquivoUrl?e.jsxs("a",{href:s.arquivoUrl,target:"_blank",rel:"noreferrer",className:"flex w-full items-center justify-center gap-2.5 rounded-xl bg-emerald-600 px-4 py-3 text-sm font-bold text-white shadow-md shadow-emerald-900/15 ring-1 ring-emerald-500/40 transition hover:bg-emerald-700 hover:shadow-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-emerald-400 focus-visible:ring-offset-2 sm:text-base",children:[e.jsx("svg",{className:"h-5 w-5 shrink-0",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":!0,
1children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"Baixar ATA"]}):null,e.jsx("div",{className:"max-h-64 overflow-auto whitespace-pre-wrap rounded-xl border border-slate-200 bg-slate-50/90 p-4 text-slate-800 leading-relaxed",children:s.conteudo}),Array.isArray(s.imagensJson)&&s.imagensJson.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-slate-500",children:"Imagens"}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:s.imagensJson.map((d,i)=>{const q=typeof d=="string"?d:d==null?void 0:d.url,P=typeof d=="string"?null:d==null?void 0:d.legenda;return q?e.jsxs("figure",{className:"overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm",children:[e.jsx("img",{src:q,alt:P||"",className:"h-auto max-h-48 w-full bg-slate-50 object-contain"}),P?e.jsx("figcaption",{className:"border-t border-slate-100 px-2 py-1.5 text-xs text-slate-600",children:P}):null]},`${s.id}-${q}-${i}`):null})})]}):null]})]},s.id)})}):e.jsx("p",{className:"mt-3 text-sm text-slate-500",children:"Nenhuma ATA disponível."})]}),e.jsxs(g,{className:"space-y-6 p-5 md:p-7",children:[n&&e.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800",children:n}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl font-bold text-slate-900",children:"Informar ocupação"}),e.jsxs("form",{onSubmit:ee,className:"mt-4 grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx("label",{className:u,children:"Início"}),e.jsx("input",{type:"date",name:"dataInicio",className:`${x} mt-2`,required:!0})]}),e.jsxs("div",{className:"md:col-span-1",children:[e.jsx("label",{className:u,children:"Fim"}),e.jsx("input",{type:"date",name:"dataFim",className:`${x} mt-2`,required:!0})]}),e.jsxs("div",{className:"md:col-span-1",children:[e.jsx("label",{className:u,children:"Quartos totais"}),e.jsx("input",{type:"number",name:"quartosTotal",placeholder:"Ex.: 100",className:`${x} mt-2`,required:!0,min:1})]}),e.jsxs("div",{className:"md:col-span-1",children:[e.jsx("label",{className:u,children:"Quartos vendidos"}),e.jsx("input",{type:"number",name:"quartosVendidos",placeholder:"Ex.: 72",className:`${x} mt-2`,required:!0,min:0})]}),e.jsx("button",{type:"submit",disabled:m,className:`${L} md:col-span-2 !w-full`,children:"Salvar ocupação"})]})]}),e.jsxs("div",{className:"border-t border-slate-200/80 pt-6",children:[e.jsx("h2",{className:"font-serif text-xl font-bold text-slate-900",children:"Ocupação geral da cidade"}),e.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Consolida os lançamentos enviados pelos associados (incluindo inseridos manualmente pelo admin). Use período livre ou visão anual."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>_("periodo"),className:`rounded-full px-4 py-1.5 text-xs font-semibold transition ${N==="periodo"?"bg-emerald-700 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"Por datas"}),e.jsx("button",{type:"button",onClick:()=>_("anual"),className:`rounded-full px-4 py-1.5 text-xs font-semibold transition ${N==="anual"?"bg-emerald-700 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:"Por ano"})]}),e.jsxs("form",{onSubmit:se,className:"mt-4 grid grid-cols-1 gap-3 md:grid-cols-2",children:[N==="periodo"?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"date",value:v.dataInicio,onChange:s=>U(r=>({...r,dataInicio:s.target.value})),className:x,required:!0}),e.jsx("input",{type:"date",value:v.dataFim,onChange:s=>U(r=>({...r,dataFim:s.target.value})),className:x,required:!0})]}):e.jsxs("label",{className:"md:col-span-2 flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Ano calendário"}),e.jsx("input",{type:"number",min:2e3,max:2100,value:B,onChange:s=>W(Number(s.target.value)),className:`${x} max-w-[10rem]`})]}),e.jsx("button",{type:"submit",disabled:m,className:"md:col-span-2 w-full rounded-xl bg-slate-900 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-slate-800 disabled:opacity-50",children:"Calcular ocupação geral"})]}),f&&e.jsxs("div",{className:"mt-4 rounded-xl border border-emerald-200/80 bg-gradient-to-br from-emerald-50 to-sky-50/40 p-4 text-sm text-emerald-950",children:[f.modo==="anual"&&f.ano!=null&&e.jsxs("p",{className:"mb-2 font-semibold text-slate-900",children:["Ano ",f.ano]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Taxa geral:"})," ",f.taxaGeral.toFixed(2),"%"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Registros no período:"})," ",f.registros]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Total quartos:"})," ",f.totalQuartos," · ",e.jsx("strong",{children:"Vendidos:"})," ",f.totalVendidos]})]})]}),e.jsxs("div",{className:"border-t border-slate-200/80 pt-6",children:[e.jsx("h3",{className:"font-serif text-lg font-bold text-slate-900",children:"Meus lançamentos"}),e.jsx("div",{className:"mt-3 max-h-48 overflow-auto rounded-xl border border-slate-200/90 bg-slate-50/50",children:$.length===0?e.jsx("p",{className:"p-4 text-sm text-slate-500",children:"Sem lançamentos ainda."}):e.jsx("ul",{className:"divide-y divide-slate-200/80",children:$.map(s=>e.jsxs("li",{className:"px-4 py-3 text-sm text-slate-700",children:[new Date(s.dataInicio).toLocaleDateString("pt-BR")," a ",new Date(s.dataFim).toLocaleDateString("pt-BR")," ·"," ",s.quartosVendidos,"/",s.quartosTotal," (",s.taxaOcupacao.toFixed(2),"%)"]},s.id))})})]})]})]})]})]})}export{je 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.