PageSourceSearch

https://antoniolopezisturiz.eu/assets/configuracion.notificaciones-BaobbEl0.js

js antoniolopezisturiz.eu collected 2026-10-03 20:50:10 UTC 1,933 bytes, 1 lines download raw bytes

1import{a as b,u as j,r as a,s as d,j as e,t as o}from"./index-B2Cgu50P.js";import{B as N}from"./button-DU1WPY5R.js";import{L as _,I as v}from"./label-CWnLh9ms.js";import{C as y}from"./card-CzrJ3rJk.js";import"./utils-BQHNewu7.js";function q(){const{user:f,hasRole:n,loading:i}=b(),u=j(),[c,h]=a.useState(null),[l,r]=a.useState(""),[x,p]=a.useState(!1);a.useEffect(()=>{!i&&!n("Administrador")&&u({to:"/configuracion/equipo",replace:!0})},[i,n,u]),a.useEffect(()=>{d.from("ai_settings").select("id, mep_whatsapp_number").order("updated_at",{ascending:!1}).limit(1).maybeSingle().then(({data:s})=>{s&&(h(s.id),r(s.mep_whatsapp_number??""))})},[]);const g=async s=>{s.preventDefault();const t=l.replace(/\D/g,"");if(t.length<8||t.length>15){o.error("Introduce el número con prefijo de país, p. ej. 34 684 785 255");return}if(!c){o.error("No hay configuración guardada");return}p(!0);const{error:m}=await d.from("ai_settings").update({mep_whatsapp_number:t,updated_by:f?.id??null,updated_at:new Date().toISOString()}).eq("id",c);p(!1),m?o.error(m.message):(r(t),o.success("Teléfono actualizado"))};return e.jsxs("div",{className:"mx-auto max-w-3xl p-8",children:[e.jsx("h1",{className:"mb-1 text-xl font-semibold",children:"Teléfono de notificación (WhatsApp)"}),e.jsx("p",{className:"mb-6 text-sm text-muted-foreground",children:"Número al que se abre WhatsApp al pulsar «Avisar al MEP» en un asunto."}),e.jsx(y,{className:"p-6",children:e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"phone",children:"Número con prefijo de país"}),e.jsx(v,{id:"phone",inputMode:"tel",value:l,onChange:s=>r(s.target.value),placeholder:"34684785255"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sin «+» ni espacios; se limpian automáticamente."})]}),e.jsx(N,{type:"submit",disabled:x,children:"Guardar cambios"})]})})]})}export{q as component};

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.