PageSourceSearch

https://fixatrip-pr.vercel.app/assets/SettingsAdmin-BJ174rnB.js

js fixatrip-pr.vercel.app collected 2026-10-03 06:57:08 UTC 6,154 bytes, 1 lines download raw bytes

1import{r as a,k as T,a0 as W,j as e,L as B,$ as u}from"./index-9RYYQKcH.js";import{u as H}from"./adminTheme-D5INZgOb.js";import{A as I}from"./arrow-left-Ceyi697n.js";import{S as P}from"./save-DfFZdbWy.js";const E="https://crm-ia-production-c247.up.railway.app/api";function U(){const{C:t}=H(),[z,N]=a.useState(!!localStorage.getItem("crm_token")),[p,F]=a.useState(""),{data:r}=T(),l=W(),[x,m]=a.useState(""),[c,h]=a.useState(""),[d,g]=a.useState(""),[f,b]=a.useState(""),[y,j]=a.useState(""),[S,v]=a.useState(""),[k,w]=a.useState("");a.useEffect(()=>{const s=r==null?void 0:r.booking;s&&(m(s.phone??""),h(typeof s.maxSelfBook=="number"?s.maxSelfBook:""),g(typeof s.fareharborWindowHours=="number"?s.fareharborWindowHours:""));const i=r==null?void 0:r.contact;i&&(b(i.phone??""),j(i.email??""),v(i.facebook??""),w(i.instagram??""))},[r]);const A=async s=>{s.preventDefault();const C=await(await fetch(`${E}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:"[email protected]",password:p})})).json();C.token?(localStorage.setItem("crm_token",C.token),N(!0)):u.error("Contraseña incorrecta")},R=async()=>{try{await l.mutateAsync({booking:{phone:x.trim(),maxSelfBook:c===""?void 0:Number(c),fareharborWindowHours:d===""?void 0:Number(d)},contact:{phone:f.trim(),email:y.trim(),facebook:S.trim(),instagram:k.trim()}}),u.success("Ajustes guardados")}catch{u.error("No se pudo guardar")}},o={width:"100%",padding:"10px 12px",border:`1px solid ${t.inputBorder}`,background:t.inputBg,borderRadius:8,color:t.text,fontSize:14,outline:"none",boxSizing:"border-box"},n={display:"block",fontSize:12,fontWeight:600,color:t.textFaint,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6};return z?e.jsxs("div",{style:{background:t.bg,minHeight:"100vh",color:t.text},children:[e.jsx("header",{style:{background:t.surface,borderBottom:`1px solid ${t.border}`},className:"sticky top-0 z-10",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-5 h-16 flex items-center gap-3",children:[e.jsxs(B,{to:"/admin",style:{color:t.textMuted},className:"flex items-center gap-1.5 text-sm",children:[e.jsx(I,{className:"h-4 w-4"})," Panel"]}),e.jsx("span",{style:{color:t.textStrong},className:"font-bold",children:"Ajustes del sitio"})]})}),e.jsxs("main",{className:"max-w-2xl mx-auto px-5 py-10",children:[e.jsxs("section",{style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:16,padding:24},children:[e.jsx("h2",{style:{color:t.textStrong,fontSize:17,fontWeight:700,margin:"0 0 4px"},children:"Reserva"}),e.jsx("p",{style:{color:t.textMuted,fontSize:13,margin:"0 0 20px"},children:"Configuración de la ventana de reserva de los tours."}),e.jsxs("div",{style:{display:"grid",gap:18},children:[e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Teléfono / SMS de reservas"}),e.jsx("input",{value:x,onChange:s=>m(s.target.value),placeholder:"+17874880202",style:o}),e.jsx("span",{style:{fontSize:11.5,color:t.textFaint},children:'Formato internacional, sin espacios. Se usa para "Llamar" y "Texto".'})]}),e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Máx. personas para reserva directa"}),e.jsx("input",{type:"number",min:1,value:c,onChange:s=>h(s.target.value===""?"":Number(s.target.value)),placeholder:"4",style:o}),e.jsx("span",{style:{fontSize:11.5,color:t.textFaint},children:'Grupos más grandes ven "cotización / solicitud" en vez de reservar directo.'})]}),e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Ventana de horas (FareHarbor vs contacto)"}),e.jsx("input",{type:"number",min:0,value:d,onChange:s=>g(s.target.value===""?"":Number(s.target.value)),placeholder:"48",style:o}),e.jsx("span",{style:{fontSize:11.5,color:t.textFaint},children:"Si la fecha está dentro de estas horas, se abre FareHarbor; más lejos, solo contacto."})]})]})]}),e.jsxs("section",{style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:16,padding:24,marginTop:20},children:[e.jsx("h2",{style:{color:t.textStrong,fontSize:17,fontWeight:700,margin:"0 0 4px"},children:"Contacto"}),e.jsx("p",{style:{color:t.textMuted,fontSize:13,margin:"0 0 20px"},children:"Datos que se muestran en el footer y la página de contacto."}),e.jsxs("div",{style:{display:"grid",gap:18},children:[e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Teléfono (como se muestra)"}),e.jsx("input",{value:f,onChange:s=>b(s.target.value),placeholder:"+1 787 488 0202",style:o})]}),e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Email"}),e.jsx("input",{value:y,onChange:s=>j(s.target.value),placeholder:"[email protected]",style:o})]}),e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Facebook (URL)"}),e.jsx("input",{value:S,onChange:s=>v(s.target.value),placeholder:"https://www.facebook.com/fixatrippr/",style:o})]}),e.jsxs("div",{children:[e.jsx("span",{style:n,children:"Instagram (URL)"}),e.jsx("input",{value:k,onChange:s=>w(s.target.value),placeholder:"https://www.instagram.com/…",style:o}),e.jsx("span",{style:{fontSize:11.5,color:t.textFaint}
1,children:"Si lo dejas vacío, el ícono de Instagram no aparece."})]})]}),e.jsxs("button",{onClick:R,disabled:l.isPending,style:{marginTop:24,padding:"11px 20px",background:t.accent,color:"#fff",border:"none",borderRadius:10,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:8},children:[e.jsx(P,{className:"h-4 w-4"})," ",l.isPending?"Guardando…":"Guardar ajustes"]})]})]})]}):e.jsx("div",{style:{background:t.bg,minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("form",{onSubmit:A,style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:16,padding:28,width:320},children:[e.jsx("h2",{style:{color:t.textStrong,fontSize:18,fontWeight:700,margin:"0 0 16px"},children:"Ajustes — acceso"}),e.jsx("input",{type:"password",value:p,onChange:s=>F(s.target.value),placeholder:"Contraseña admin",style:o,autoFocus:!0}),e.jsx("button",{type:"submit",style:{width:"100%",marginTop:12,padding:"10px",background:t.accent,color:"#fff",border:"none",borderRadius:8,fontWeight:600,cursor:"pointer"},children:"Entrar"})]})})}export{U 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.