{({dashboard:'Panel general',recepcion:'Recepción',atencion:'Atención en cubículo',usuarios:'Gestión de usuarios',pantalla:'Pantalla pública de turnos',reportes:'Reportes de atención'})[view]}
{b.name}{b.status==='busy'?'Atendiendo':b.status==='disabled'?'Fuera de servicio':'Disponible'}{b.student&&{b.student}}
)}
Cola actual
>}
function Queue({q=[]}){return
TicketPersonaHoraEstado
{q.length?q.map(x=>
{x.code}{x.name}{x.created_time}En espera
):
No hay personas esperando.
}
}
function Reception({d,load}){let[n,sn]=useState(''),[id,si]=useState(''),[phone,sp]=useState(''),[msg,sm]=useState('');async function add(e){e.preventDefault();try{let r=await api('ticket_create',{name:n,identification:id,phone});sm('Ticket generado: '+r.code);sn('');si('');sp('');load()}catch(e){sm(e.message)}}return
Generar nuevo turno
Personas en espera
}
function Attention({d,user,load}){let session=(d.sessions||[]).find(s=>+s.user_id===+user.id&&s.active),[booth,sb]=useState(''),[msg,sm]=useState(''),[details,sd]=useState(''),[obs,so]=useState('');let current=session&&(d.current||[]).find(x=>+x.session_id===+session.id);async function go(a,p={}){try{let r=await api(a,p);sm(r.message||'Actualizado');if(a==='finish'){sd('');so('')}load()}catch(e){sm(e.message)}}if(!session)return
Iniciar jornada
Selecciona el número del cubículo donde te sentaste hoy. Puedes usar cualquiera que esté disponible.
}}
function PublicScreen({d,standalone=false}){let calls=d.calls||[],last=calls[0],prev=useRef(null);useEffect(()=>{if(!last||prev.current===last.started_at)return;let first=prev.current===null;prev.current=last.started_at;if(first)return;try{speechSynthesis.cancel();let u=new SpeechSynthesisUtterance(`Turno ${last.code.replace('-', ' ')}, pase al ${last.booth}`);u.lang='es-EC';u.rate=.88;u.volume=1;speechSynthesis.speak(u)}catch(e){}},[last&&last.started_at]);return
CONSULTORIO JURÍDICOTurnos de atención
{last?<>
POR FAVOR DIRÍJASE A
TURNO{last.code}
PASE AL{last.booth}
>:
Esperando el próximo turno
}
Últimos llamados
{calls.slice(1,7).map(x=>
{x.code}{x.booth}
)}
{standalone&&
Por favor mantenga visible su turno y acérquese al cubículo cuando sea llamado.
}}
function UsersPage({d,load}){let[name,sn]=useState(''),[username,su]=useState(''),[password,sp]=useState(''),[role,sr]=useState('student');async function add(e){e.preventDefault();await api('user_create',{name,username,password,role});sn('');su('');sp('');load()}return