PageSourceSearch

https://turacion.com.uy/assets/index-Bl_m3Jm0.js

js turacion.com.uy collected 2026-10-09 17:34:19 UTC 10,768 bytes, 1 lines download raw bytes

1import{r as u,j as e,ao as Q,a9 as m,ah as X,an as n,bR as W,bS as L,br as Z,ad as ee,aB as O,ay as I,b as $}from"./index-jr2Kx65m.js";import{P as te}from"./PageHeader-C83u4e9j.js";import{P as S}from"./PanelCard-8aV5-KeG.js";import{a as G}from"./Toolbar-5UfuufiZ.js";import{A as oe}from"./AsyncBoundary-DSM-Ftts.js";import{u as se}from"./useApi-DQ-w7EWy.js";import{C as ae}from"./Container-D38hzxjF.js";import{R as C}from"./Row-B5pwCZ5P.js";import"./Card-gQHc_kvo.js";import"./Alert-CV15NG0X.js";const w=({label:f,value:x,onChange:_,def:y})=>e.jsxs("div",{children:[e.jsx(n.Label,{style:{fontSize:"0.78rem"},children:f}),e.jsxs("div",{className:"d-flex align-items-center gap-1",children:[e.jsx(n.Control,{type:"color",style:{width:42,padding:2},value:x||y,onChange:a=>_(a.target.value)}),e.jsx(n.Control,{size:"sm",value:x??"",onChange:a=>_(a.target.value),placeholder:y})]})]}),be=()=>{const{data:f,loading:x,error:_,reload:y}=se(()=>$.sistema.config()),[a,k]=u.useState({}),[h,c]=u.useState([]),[E,P]=u.useState(!1),[j,p]=u.useState(null);u.useEffect(()=>{if(!f)return;const t={};Object.entries(f).forEach(([o,r])=>{t[o]=r?.valor??""}),k(t);try{const o=JSON.parse(f.footer_columnas?.valor||"[]");c(Array.isArray(o)?o:[])}catch{c([])}},[f]);const d=(t,o)=>k(r=>({...r,[t]:o})),A=(t,o)=>c(r=>r.map((s,l)=>l===t?{...s,...o}:s)),U=()=>c(t=>[...t,{titulo:"Nueva columna",visible:!0,items:[]}]),V=t=>c(o=>o.filter((r,s)=>s!==t)),T=(t,o)=>c(r=>{const s=t+o;if(s<0||s>=r.length)return r;const l=[...r];return[l[t],l[s]]=[l[s],l[t]],l}),R=(t,o,r)=>c(s=>s.map((l,v)=>v!==t?l:{...l,items:(l.items||[]).map((i,g)=>g===o?{...i,...r}:i)})),H=t=>c(o=>o.map((r,s)=>s!==t?r:{...r,items:[...r.items||[],{label:"Nuevo enlace",href:"/"}]})),J=(t,o)=>c(r=>r.map((s,l)=>l!==t?s:{...s,items:(s.items||[]).filter((v,i)=>i!==o)})),B=(t,o,r)=>c(s=>s.map((l,v)=>{if(v!==t)return l;const i=[...l.items||[]],g=o+r;return g<0||g>=i.length?l:([i[o],i[g]]=[i[g],i[o]],{...l,items:i})})),Y=["estetica_footer_bg","estetica_footer_texto","footer_contacto_activo","footer_contacto_titulo","footer_newsletter_activo","footer_newsletter_titulo","footer_newsletter_texto","footer_copyright_texto","footer_copyright_full","footer_copyright_bg","footer_copyright_fg"],q=async()=>{P(!0),p(null);try{const t={};Y.forEach(s=>{const l=a[s]??"";(f?.[s]?.valor??"")!==l&&(t[s]=l)});const o=JSON.stringify(h);if((f?.footer_columnas?.valor??"")!==o&&(t.footer_columnas=o),!Object.keys(t).length){p("Sin cambios para guardar");return}const r=await $.sistema.actualizarConfig(t);p(`Guardado ✓ (${r.updated} actualizados) · recargá la tienda con Ctrl+F5`),y()}catch(t){p("Error: "+(t?.data?.error||t.message))}finally{P(!1),setTimeout(()=>p(null),9e3)}},N=a.footer_contacto_activo!=="false",z=a.footer_newsletter_activo!=="false",b=u.useRef(null),D=u.useMemo(()=>({estetica:{footer_bg:(a.estetica_footer_bg||"").trim(),footer_texto:(a.estetica_footer_texto||"").trim()},footer:{columnas:h.filter(t=>t.visible!==!1).map(t=>({titulo:t.titulo||"",items:(t.items||[]).filter(o=>o&&o.label).map(o=>({label:o.label,href:o.href||"#"}))})),contacto_activo:N,contacto_titulo:a.footer_contacto_titulo??"Contacto",newsletter_activo:z,newsletter_titulo:a.footer_newsletter_titulo??"Suscribite",newsletter_texto:a.footer_newsletter_texto??"",copyright_texto:a.footer_copyright_texto??"",copyright_full:a.footer_copyright_full??"",copyright_bg:a.footer_copyright_bg||"",copyright_fg:a.footer_copyright_fg||""}}),[a,h,N,z]),F=()=>{try{b.current?.contentWindow?.postMessage({type:"tr-preview-theme",payload:D},"*")}catch{}},M=()=>{F(),setTimeout(()=>{try{b.current?.contentWindow?.postMessage({type:"tr-preview-scroll",selector:"footer.footer"},"*")}catch{}},500)};u.useEffect(()=>{F();const t=o=>{o.data&&o.data.type==="tr-preview-ready"&&M()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[D]);const K=()=>{b.current&&(b.current.src=b.current.src)};return e.jsxs(ae,{fluid:!0,className:"px-0",children:[e.jsx(te,{title:"Footer",subtitle:"Personalizá el pie de la web: columnas de enlaces, contacto, suscripción, copyright y colores.",actions:e.jsx(G,{icon:Q,variant:"primary",onClick:q,disabled:E,children:E?"Guardando…":"Guardar cambios"})}),j&&e.jsx("div",{className:"mb-3 px-3 py-2",style:{background:j.startsWith("Error")?"rgba(248,113,113,0.15)":"rgba(74,222,128,0.15)",color:j.startsWith("Error")?"#f87171":"#4ade80",border:"1px solid rgba(255,255,255,0.1)",borderRadius:12,fontSize:"0.85rem"},children:j}
1),e.jsxs(oe,{loading:x,error:_,children:[e.jsx(C,{className:"g-3 mb-3",children:e.jsx(m,{xs:12,children:e.jsxs(S,{title:"Vista previa en vivo",subtitle:"El footer real de la tienda con los cambios del editor (sin guardar todavía).",headerExtra:e.jsx(G,{icon:X,onClick:K,children:"Recargar"}),children:[e.jsx("div",{style:{border:"1px solid #e5e7eb",borderRadius:12,overflow:"hidden",background:"#fff"},children:e.jsx("iframe",{ref:b,src:"/",title:"Vista previa del footer",onLoad:M,style:{width:"100%",height:520,border:0,display:"block",background:"#fff"}})}),e.jsx("p",{className:"tr-soft mt-2 mb-0",style:{fontSize:"0.74rem"},children:"Se desplaza automáticamente al footer y refleja los cambios en vivo."})]})})}),e.jsx(C,{className:"g-3 mb-3",children:e.jsx(m,{xs:12,children:e.jsx(S,{title:"Colores, suscripción y copyright",children:e.jsxs(C,{className:"g-3",children:[e.jsx(m,{md:3,children:e.jsx(w,{label:"Fondo del footer",value:a.estetica_footer_bg,onChange:t=>d("estetica_footer_bg",t),def:"#dcfeff"})}),e.jsx(m,{md:3,children:e.jsx(w,{label:"Texto del footer",value:a.estetica_footer_texto,onChange:t=>d("estetica_footer_texto",t),def:"#133e41"})}),e.jsx(m,{md:3,children:e.jsx(w,{label:"Barra copyright · fondo",value:a.footer_copyright_bg,onChange:t=>d("footer_copyright_bg",t),def:"#0e4a4f"})}),e.jsx(m,{md:3,children:e.jsx(w,{label:"Barra copyright · texto",value:a.footer_copyright_fg,onChange:t=>d("footer_copyright_fg",t),def:"#ffffff"})}),e.jsxs(m,{md:12,children:[e.jsx(n.Label,{style:{fontSize:"0.78rem"},children:"Texto completo del copyright"}),e.jsx(n.Control,{as:"textarea",rows:2,size:"sm",value:a.footer_copyright_full??"",onChange:t=>d("footer_copyright_full",t.target.value),placeholder:`Copyright © {año} ${a.tienda_nombre||"Tu Ración"}${a.tienda_rut?` - RUT ${a.tienda_rut}`:""} - Todos los derechos reservados. Designed by SmartServ.`}),e.jsxs("p",{className:"tr-soft mb-0 mt-1",style:{fontSize:"0.7rem"},children:["Es el texto de la barra de copyright. Podés usar ",e.jsx("code",{children:"{año}"}),", ",e.jsx("code",{children:"{razon}"})," y ",e.jsx("code",{children:"{rut}"})," (se completan solos; la razón social y el RUT salen de «Datos de la tienda»)."]})]}),e.jsxs(m,{md:6,children:[e.jsx(n.Check,{type:"switch",id:"ft-news",className:"mb-1",checked:z,onChange:t=>d("footer_newsletter_activo",t.target.checked?"true":"false"),label:"Mostrar columna de suscripción"}),e.jsx(n.Control,{size:"sm",className:"mb-2",value:a.footer_newsletter_titulo??"",onChange:t=>d("footer_newsletter_titulo",t.target.value),placeholder:"Suscribite"}),e.jsx(n.Control,{as:"textarea",rows:2,size:"sm",value:a.footer_newsletter_texto??"",onChange:t=>d("footer_newsletter_texto",t.target.value),placeholder:"Texto de la suscripción…"})]}),e.jsxs(m,{md:6,children:[e.jsx(n.Check,{type:"switch",id:"ft-cont",className:"mb-1",checked:N,onChange:t=>d("footer_contacto_activo",t.target.checked?"true":"false"),label:"Mostrar columna de contacto"}),e.jsx(n.Control,{size:"sm",value:a.footer_contacto_titulo??"",onChange:t=>d("footer_contacto_titulo",t.target.value),placeholder:"Contacto"}),e.jsx("p",{className:"tr-soft mb-0 mt-1",style:{fontSize:"0.7rem"},children:"Las sucursales, email y teléfono se editan en «Datos de la tienda» / Sucursales."})]})]})})})}),e.jsx(C,{className:"g-3",children:e.jsx(m,{xs:12,children:e.jsx(S,{title:"Columnas de enlaces",subtitle:"Agregá/quitá columnas y enlaces. Ordená con las flechas.",children:e.jsxs("div",{className:"d-flex flex-column gap-4",children:[h.map((t,o)=>e.jsxs("div",{className:"p-3",style:{border:"1px solid var(--tr-border-soft, rgba(120,130,150,0.18))",borderRadius:12,opacity:t.visible===!1?.65:1},children:[e.jsxs("div",{className:"d-flex align-items-center gap-2 mb-2",children:[e.jsx(n.Control,{size:"sm",style:{maxWidth:280,fontWeight:700},value:t.titulo||"",onChange:r=>A(o,{titulo:r.target.value}),placeholder:"Título de la columna"}),e.jsxs("div",{className:"d-flex align-items-center ms-auto",children:[e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:o===0?"#cbd5e1":"#64748b"},disabled:o===0,title:"Subir",onClick:()=>T(o,-1),children:e.jsx(W,{size:14})}),e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:o===h.length-1?"#cbd5e1":"#64748b"},disabled:o===h.length-1,title:"Bajar",onClick:()=>T(o,1),children:e.jsx(L,{size:14})}),e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:t.visible===!1?"#9ca3af":"#4ade80"},title:t.visible===!1?"Oculta":"Visible",onClick:()=>A(o,{visible:t.visible===!1}),children:t.visible===!1?e.jsx(Z,{size:14}):e.jsx(ee,{size:14})}),e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:"#f87171"},title:"Eliminar columna",onClick:()=>V(o),children:e.jsx(O,{size:14})})]})]}),e.jsxs("div",{className:"d-flex flex-column gap-1",children:[(t.items||[]).map((r,s)=>e.jsxs("div",{className:"d-flex align-items-center gap-1",children:[e.jsx(n.Control,{size:"sm",value:r.label||"",onChange:l=>R(o,s,{label:l.target.value}),placeholder:"Texto del enlace"}),e.jsx(n.Control,{size:"sm",style:{maxWidth:220},value:r.href||"",onChange:l=>R(o,s,{href:l.target.value}),placeholder:"/ruta o https://…"}),e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:s===0?"#cbd5e1":"#64748b"},disabled:s===0,title:"Subir",onClick:()=>B(o,s,-1),children:e.jsx(W,{size:13})}),e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:s===t.items.length-1?"#cbd5e1":"#64748b"},disabled:s===t.items.length-1,title:"Bajar",onClick:()=>B(o,s,1),children:e.jsx(L,{size:13})}),e.jsx("button",{type:"button",className:"btn btn-sm p-1",style:{color:"#f87171"},title:"Eliminar",onClick:()=>J(o,s),children:e.jsx(O,{size:13})})]},s)),e.jsxs("button",{type:"button",className:"btn btn-sm btn-outline-secondary align-self-start mt-1",onClick:()=>H(o),children:[e.jsx(I,{size:13,className:"me-1"}),"Agregar enlace"]})]})]},o)),h.length===0&&e.jsx("p",{className:"tr-soft mb-0",style:{fontSize:"0.85rem"},children:"No hay columnas. Agregá la primera."}),e.jsxs("button",{type:"button",className:"btn btn-sm btn-outline-secondary align-self-start",onClick:U,children:[e.jsx(I,{size:14,className:"me-1"}),"Agregar columna"]})]})})})})]})]})};export{be 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.