1import{d as J}from"./CN2tJOOH.js";import{D as r,E as c,On as a,Qn as k,_ as e,b as l,bt as C,ct as Q,g as T,k as K,mt as n,nr as i,o as N,qt as d,v as R,vn as I,y as j}from"./DJsGfdon.js";import{t as X}from"./C9WxONJa.js";import{t as Y}from"./5Je84SPf.js";import{t as Z}from"./BGe74o_12.js";import{t as E}from"./DCy4IW63.js";import{t as ee}from"./Df6PFzGg.js";import{t as te}from"./C_hbRtw3.js";import{t as se}from"./Bstvga7R.js";import{t as ae}from"./Y7Qq3Qq-.js";import{t as oe}from"./C-tZILqt2.js";import{t as ie}from"./D2XLt4R8.js";(function(){try{var _=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},h=new _.Error().stack;h&&(_._sentryDebugIds=_._sentryDebugIds||{},_._sentryDebugIds[h]="f86da65b-fe1d-4415-b380-d162a0315eab",_._sentryDebugIdIdentifier="sentry-dbid-f86da65b-fe1d-4415-b380-d162a0315eab")}catch{}})();var re={class:"h-full overflow-hidden"},ne={class:"flex-1 overflow-y-auto p-6 space-y-6"},de={key:0,class:"flex justify-center py-8"},le={key:1,class:"flex items-center gap-4"},ue={class:"flex-1 min-w-0"},ce={class:"text-base font-semibold text-highlighted"},ve={class:"text-sm text-muted"},me={key:0,class:"text-sm text-red-600 mt-2"},fe={key:2,class:"text-center py-8"},be={key:0,class:"space-y-4"},_e={class:"flex items-center justify-between mb-4"},xe={class:"min-w-0"},he={class:"text-base font-semibold text-highlighted"},ge={class:"text-sm text-muted"},pe={class:"flex items-center gap-2"},ye={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},Ie={class:"space-y-1 text-sm"},we={class:"flex justify-between"},De={class:"font-mono text-default"},Ae={class:"flex justify-between"},Se={class:"font-mono text-xs text-default"},Be={class:"flex justify-between"},ke={class:"text-default"},Ce={key:0,class:"space-y-1 text-sm"},Ne={class:"flex justify-between"},je={class:"flex justify-between"},Te={class:"flex justify-between"},Re={class:"flex justify-between"},Ee={class:"text-default"},He={key:1,class:"text-sm text-dimmed"},Le={key:0,class:"space-y-1 text-sm"},Oe={class:"flex justify-between mb-1"},Fe={class:"text-default"},Pe={class:"flex justify-between mb-2"},Ue={class:"text-default"},$e={class:"max-h-32 overflow-y-auto space-y-1"},We={class:"text-muted"},ze={class:"flex gap-1"},Ve={key:1,class:"text-sm text-dimmed"},Ge={key:1,class:"text-center py-8"},Me={key:0,class:"space-y-3"},qe={class:"flex items-start gap-3"},Je={class:"flex-1 min-w-0"},Qe={class:"flex items-center justify-between gap-2"},Ke={class:"font-medium text-highlighted"},Xe={class:"text-sm text-dimmed shrink-0"},Ye={class:"text-sm text-default mt-1"},Ze={key:0,class:"mt-2"},et={class:"text-xs"},tt={class:"mt-1 p-2 bg-red-50 border border-red-200 rounded text-red-800 overflow-x-auto"},st={key:1,class:"text-center py-8"},at=K({__name:"bobnet",setup(_){ae({layout:"back-office",middleware:[X(["ADMIN"])]});const{lockers:h,bobnetHealth:v,isLoadingBobnetHealth:H,getBobnetDeviceStatus:L,alerts:O,resolveAlert:F,refetchBobnetHealth:P,refetchAlerts:U}=ie(),w=I(!1),D=I(new Set),u=I({}),A=I(null),g=T(()=>h.value?.filter(o=>o.bobnetDeviceId)||[]),S=T(()=>O.value?.filter(o=>o.deviceId||o.message.toLowerCase().includes("bobnet"))||[]),$=async()=>{w.value=!0;try{await P(),await U();for(const o of g.value)o.bobnetDeviceId&&await B(o.bobnetDeviceId);E().add({title:"Actualisation terminée",description:"Les données Bobnet ont été mises à jour.",color:"success"})}catch{E().add({title:"Erreur d'actualisation",description:"Impossible de rafraîchir les données Bobnet.",color:"error"})}finally{w.value=!1}},B=async o=>{if(o){D.value.add(o);try{const{refetch:t}=L(o.toString()),f=await t();f.data&&(u.value[o]=f.data)}catch{}finally{D.value.delete(o)}}},W=async o=>{A.value=o;try{await F.mutateAsync(o)}catch{}finally{A.value=null}},z=o=>({CRITICAL:"border-red-200 bg-red-50",WARNING:"border-orange-200 bg-orange-50",INFO:"border-blue-200 bg-blue-50"})[o]||"border-default bg-elevated/40",V=o=>({CRITICAL:"i-heroicons-x-circle",WARNING:"i-heroicons-exclamation-triangle",INFO:"i-heroicons-information-circle"})[o]||"i-heroicons-question-mark-circle",G=o=>({CRITICAL:"text-red-600",WARNING:"text-orange-600",INFO:"text-blue-600"})[o]||"text-muted",p=o=>
1new Date(o).toLocaleString("fr-FR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return Q(()=>{g.value.forEach(o=>{o.bobnetDeviceId&&B(o.bobnetDeviceId)})}),(o,t)=>{const f=Z,M=oe,x=Y,b=ee,y=se,q=te;return n(),l("div",re,[r(q,{grow:""},{default:d(()=>[r(M,{title:"Santé Bobnet",description:"Ãtat des devices, alertes et synchronisation"},{left:d(()=>[r(f,{variant:"ghost",icon:"i-heroicons-arrow-left",onClick:t[0]||(t[0]=s=>("navigateTo"in o?o.navigateTo:a(J))("/dashboard/admin/lockers"))},{default:d(()=>[...t[2]||(t[2]=[c(" Retour ",-1)])]),_:1})]),right:d(()=>[r(f,{icon:"i-heroicons-arrow-path",loading:a(w),onClick:t[1]||(t[1]=()=>{$()})},{default:d(()=>[...t[3]||(t[3]=[c(" Actualiser ",-1)])]),_:1},8,["loading"])]),_:1}),e("div",ne,[r(y,null,{header:d(()=>[...t[4]||(t[4]=[e("h2",{class:"text-base font-semibold text-highlighted font-work-sans"}," Ãtat global de Bobnet ",-1)])]),default:d(()=>[a(H)?(n(),l("div",de,[r(x,{name:"i-heroicons-arrow-path",class:"animate-spin text-2xl text-muted"})])):a(v)?(n(),l("div",le,[r(x,{name:a(v).data.isHealthy?"i-heroicons-check-circle":"i-heroicons-x-circle",class:k([a(v).data.isHealthy?"text-green-600":"text-red-600","text-3xl shrink-0"])},null,8,["name","class"]),e("div",ue,[e("h3",ce,i(a(v).data.isHealthy?"Bobnet est opérationnel":"Bobnet rencontre des problèmes"),1),e("p",ve," Dernière vérification: "+i(p(a(v).data.timestamp)),1),a(v).data.error?(n(),l("p",me," Erreur: "+i(a(v).data.error),1)):j("",!0)]),r(b,{color:a(v).data.isHealthy?"success":"error",variant:"soft"},{default:d(()=>[c(i(a(v).data.isHealthy?"En ligne":"Hors ligne"),1)]),_:1},8,["color"])])):(n(),l("div",fe,[r(x,{name:"i-heroicons-exclamation-triangle",class:"text-4xl text-muted mx-auto mb-4"}),t[5]||(t[5]=e("p",{class:"text-muted"},"Impossible de récupérer l'état de Bobnet",-1))]))]),_:1}),r(y,null,{header:d(()=>[...t[6]||(t[6]=[e("h2",{class:"text-base font-semibold text-highlighted font-work-sans"}," Devices Bobnet ",-1)])]),default:d(()=>[a(g).length>0?(n(),l("div",be,[(n(!0),l(N,null,C(a(g),s=>(n(),R(y,{key:s.id,ui:{root:"bg-elevated/30"}},{default:d(()=>[e("div",_e,[e("div",xe,[e("h3",he,i(s.name),1),e("p",ge,i(s.address),1)]),e("div",pe,[r(b,{color:s.isOnline?"success":"error",variant:"soft"},{default:d(()=>[c(i(s.isOnline?"En ligne":"Hors ligne"),1)]),_:2},1032,["color"]),r(f,{size:"sm",variant:"outline",icon:"i-heroicons-arrow-path",loading:a(D).has(s.bobnetDeviceId),disabled:!s.bobnetDeviceId,onClick:m=>B(s.bobnetDeviceId)},{default:d(()=>[...t[7]||(t[7]=[c(" Actualiser ",-1)])]),_:1},8,["loading","disabled","onClick"])])]),e("div",ye,[e("div",null,[t[11]||(t[11]=e("h4",{class:"font-medium text-highlighted mb-2"},"Informations du device",-1)),e("dl",Ie,[e("div",we,[t[8]||(t[8]=e("dt",{class:"text-muted"},"Device ID:",-1)),e("dd",De,i(s.bobnetDeviceId),1)]),e("div",Ae,[t[9]||(t[9]=e("dt",{class:"text-muted"},"Série:",-1)),e("dd",Se,i(a(u)[s.bobnetDeviceId]?.deviceInfo?.serial_number||s.bobnetSerial||"N/A"),1)]),e("div",Be,[t[10]||(t[10]=e("dt",{class:"text-muted"},"Dernière sync:",-1)),e("dd",ke,i(s.lastSyncAt?p(s.lastSyncAt):"Jamais"),1)])])]),e("div",null,[t[16]||(t[16]=e("h4",{class:"font-medium text-highlighted mb-2"},"Statut du device",-1)),a(u)[s.bobnetDeviceId]?(n(),l("dl",Ce,[e("div",Ne,[t[12]||(t[12]=e("dt",{class:"text-muted"},"Ãtat:",-1)),e("dd",null,[r(b,{color:a(u)[s.bobnetDeviceId].deviceStatus?.state==="accepting_all_commands"?"success":"warning",variant:"soft"},{default:d(()=>[c(i(a(u)[s.bobnetDeviceId].deviceStatus?.state||"Inconnu"),1)]),_:2},1032,["color"])])]),e("div",je,[t[13]||(t[13]=e("dt",{class:"text-muted"},"Bridge:",-1)),e("dd",null,[r(b,{color:a(u)[s.bobnetDeviceId].deviceStatus?.bridge_up?"success":"error",variant:"soft"},{default:d(()=>[c(i(a(u)[s.bobnetDeviceId].deviceStatus?.bridge_up?"UP":"DOWN"),1)]),_:2},1032,["color"])])]),e("div",Te,[t[14]||(t[14]=e("dt",{class:"text-muted"},"Scanner:",-1)),e("dd",null,[r(b,{color:a(u)[s.bobnetDeviceId].deviceStatus?.scanner_up?"success":"error",variant:"soft"},{default:d(()=>
1[c(i(a(u)[s.bobnetDeviceId].deviceStatus?.scanner_up?"UP":"DOWN"),1)]),_:2},1032,["color"])])]),e("div",Re,[t[15]||(t[15]=e("dt",{class:"text-muted"},"Dernière vérification:",-1)),e("dd",Ee,i(p(a(u)[s.bobnetDeviceId].timestamp)),1)])])):(n(),l("div",He," Aucune donnée de statut disponible "))]),e("div",null,[t[20]||(t[20]=e("h4",{class:"font-medium text-highlighted mb-2"},"Portes",-1)),a(u)[s.bobnetDeviceId]?.doorsStatus?(n(),l("div",Le,[e("div",Oe,[t[17]||(t[17]=e("span",{class:"text-muted"},"Total:",-1)),e("span",Fe,i(a(u)[s.bobnetDeviceId].doorsStatus.max_doors_number)+" portes ",1)]),e("div",Pe,[t[18]||(t[18]=e("span",{class:"text-muted"},"Fermées:",-1)),e("span",Ue,i(a(u)[s.bobnetDeviceId].doorsStatus.closed_doors_number),1)]),e("div",$e,[(n(!0),l(N,null,C(a(u)[s.bobnetDeviceId].doorsStatus.doors_status.filter(m=>m.id>0),m=>(n(),l("div",{key:m.id,class:"flex justify-between text-xs py-1"},[e("span",We,"Porte "+i(m.id)+":",1),e("div",ze,[r(b,{color:m.is_opened?"error":"success",variant:"soft",size:"xs"},{default:d(()=>[c(i(m.is_opened?"Ouverte":"Fermée"),1)]),_:2},1032,["color"]),m.hardware_misbehaving?(n(),R(b,{key:0,color:"warning",variant:"soft",size:"xs"},{default:d(()=>[...t[19]||(t[19]=[c(" Problème ",-1)])]),_:1})):j("",!0)])]))),128))])])):(n(),l("div",Ve," Aucune donnée de portes disponible "))])])]),_:2},1024))),128))])):(n(),l("div",Ge,[r(x,{name:"i-heroicons-inbox-stack",class:"text-4xl text-muted mx-auto mb-4"}),t[21]||(t[21]=e("p",{class:"text-muted"},"Aucun locker avec device Bobnet configuré",-1))]))]),_:1}),r(y,null,{header:d(()=>[...t[22]||(t[22]=[e("h2",{class:"text-base font-semibold text-highlighted font-work-sans"}," Alertes Bobnet ",-1)])]),default:d(()=>[a(S)&&a(S).length>0?(n(),l("div",Me,[(n(!0),l(N,null,C(a(S),s=>(n(),l("div",{key:s.id,class:k(["rounded-lg p-4 border",z(s.alertType)])},[e("div",qe,[r(x,{name:V(s.alertType),class:k([G(s.alertType),"shrink-0"])},null,8,["name","class"]),e("div",Je,[e("div",Qe,[e("h4",Ke,i(s.title),1),e("span",Xe,i(p(s.createdAt)),1)]),e("p",Ye,i(s.message),1),s.error?(n(),l("div",Ze,[e("details",et,[t[23]||(t[23]=e("summary",{class:"cursor-pointer text-red-600 font-medium"}," Détails de l'erreur ",-1)),e("pre",tt,i(s.error),1)])])):j("",!0)]),r(f,{size:"sm",variant:"ghost",icon:"i-heroicons-check",loading:a(A)===s.id,onClick:m=>W(s.id)},{default:d(()=>[...t[24]||(t[24]=[c(" Résoudre ",-1)])]),_:1},8,["loading","onClick"])])],2))),128))])):(n(),l("div",st,[r(x,{name:"i-heroicons-check-circle",class:"text-4xl text-green-500 mx-auto mb-4"}),t[25]||(t[25]=e("p",{class:"text-muted"},"Aucune alerte Bobnet active",-1))]))]),_:1})])]),_:1})])}}}),_t=at;export{_t 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.