import{l as f,az as m,X as T,a3 as a,b2 as e,ck as H,a2 as v,bM as Q,cx as I,cj as F,y as r,J as L,cV as P,U as R,Y as p,d3 as U,b4 as D,V,bW as z,bX as b,cn as O,bS as M,c_ as k,F as w,ct as E,d9 as J,bT as W,dN as S,bv as X,bI as j,bJ as x,bK as G,bL as K,bq as Y,W as Z,bN as aa,B as A,cG as N,ch as ea,cw as la,at as ta,aH as sa,dO as oa,cl as y,dP as na,cs as ua,bR as $,bQ as B}from"./index.69621fe4.js";const ca={__name:"CanaisHeader",setup(h){const t=f(!1);function n(){t.value=!t.value}return(u,l)=>(m(),T(L,null,[a(F,{class:"cabecalho_esquerda shadow-1"},{default:e(()=>[a(H,null,{default:e(()=>[v(" Canais de Texto ")]),_:1}),a(Q,{flat:"",round:"",dense:"",icon:"add_comment",onClick:n},{default:e(()=>[a(I,null,{default:e(()=>[v("Novo canal de texto")]),_:1})]),_:1})]),_:1}),a(r(pa),{modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s)},null,8,["modelValue"])],64))}},ia={class:"row no-wrap full-height ellipsis"},ra={class:"col"},da={__name:"CanaisList",props:{canais:Array},setup(h){const t=P(),n=R(()=>t.params.idCanal),u=function(l,s){return l.data_hora_last_msg||s.data_hora_last_msg?new Date(s.data_hora_last_msg)-new Date(l.data_hora_last_msg):l.id-s.id};return(l,s)=>(m(),T("div",ia,[p("div",ra,[a(W,{class:"column full-height"},{default:e(()=>[a(U,{class:"menu_esquerda",style:{height:"90vh"},items:h.canais.slice(0).sort(u),"virtual-scroll-item-size":32,"visible-items":10},{default:e(({item:c,index:_})=>[D((m(),V(z,{key:_,exact:"",clickable:"","active-class":"lista_sel",icon:"perm_identity","header-class":r(n)==c.id?"ativo":"",to:"/canaisdetexto/"+c.id},{default:e(()=>[a(b,{avatar:""},{default:e(()=>[a(O,null,{default:e(()=>[a(M,{name:"forum"})]),_:1})]),_:1}),a(b,null,{default:e(()=>[a(k,{class:"item-label-tamanho"},{default:e(()=>[v(w(c.nome),1)]),_:2},1024),a(k,{caption:""},{default:e(()=>[v(w(c.numero),1)]),_:2},1024)]),_:2},1024),a(b,{side:""},{default:e(()=>[v(w(r(E).formatDate(c.data,"DD/MM HH:mm")),1)]),_:2},1024)]),_:2},1032,["header-class","to"])),[[J]])]),_:1},8,["items"])]),_:1})])]))}},_a={class:"full-width row"},fa={class:"full-width"},ma=p("div",{class:"col text-h6"},"Novo Canal de Texto",-1),pa={__name:"NovoCanalDeTexto",setup(h){const{criarCanalDeTexto:t}=S(),{agente:n}=X(),u=f(null),l=f(null),s=f([]),c=f([]);async function _(){try{const o=await la.get("/v2/agentes?max=-1&page=1&order=%5B%7B%22campo%22%3A%22nome%22%2C%22ordem%22%3A%22ASC%22%7D%5D");o.data.dados.map(i=>(i.filasNome=i.filas.map(d=>d.fila),i)),s.value=o.data.dados,c.value=o.data.dados}catch(o){console.error(o)}}function g(){l.value=null}function C(){_()}function q(){l.value.findIndex(o=>o===n.value.fullname)===-1&&l.value.push(n.value.fullname),t(l.value,u.value)}return(o,i)=>(m(),V(ea,{onBeforeShow:C},{default:e(()=>[p("div",_a,[p("form",fa,[a(j,{flat:"",class:"full-width"},{default:e(()=>[a(x,null,{default:e(()=>[ma]),_:1}),a(x,null,{default:e(()=>[a(G,{filled:"",modelValue:u.value,"onUpdate:modelValue":i[0]||(i[0]=d=>u.value=d),label:"Nome"},null,8,["modelValue"])]),_:1}),a(x,null,{default:e(()=>[a(K,{filled:"",modelValue:l.value,"onUpdate:modelValue":i[1]||(i[1]=d=>l.value=d),options:s.value.map(d=>d.nome),"stack-label":"",label:"Agente",multiple:""},{append:e(()=>[l.value!==null?(m(),V(M,{key:0,class:"cursor-pointer q-mr-sm",name:"clear",onClick:Y(g,["stop","prevent"])},null,8,["onClick"])):Z("",!0)]),_:1},8,["modelValue","options"])]),_:1}),a(aa,{align:"right"},{default:e(()=>[D(a(Q,{flat:"",class:A(o.$q.dark.isActive?"bg-[#2F3136] text-white":""),label:"Criar Canal",onClick:q},null,8,["class"]),[[N]]),D(a(Q,{flat:"",class:A(o.$q.dark.isActive?"bg-[#2F3136] text-white":""),label:"Cancelar"},null,8,["class"]),[[N]])]),_:1})]),_:1})])])]),_:1}))}},va={class:"row"},ha={class:"col menu_principal"},ga={class:"col"},ba={__name:"CanaisDeTextoMain",setup(h){const t=f(!1),{canais:n,getCanaisDeTexto:u}=S();function l(){setTimeout(()=>{u()},500)}l(),ta(()=>{});function s(){t.value=!t.value}return(c,_)=>{const g=sa("router-view");return m(),T("div",va,[p("div",ha,[a(r(oa))]),p("div",ga,[a($,{view:"hHh LpR lFr",container:"",style:{height:"100vh"}},{default:e(()=>[a(y,{class:"cabecalho"},{default:e(()=>[a(r(na),{onBtMenu:s})]),_:1}),a(ua,{"show-if-above":"",modelValue:t.value,"onUpdate:modelValue":_[0]||(_[0]=C=>t.value=C),side:"left",width:"350"},{default:e(()=>[a($,{view:"hHh lpR fFf",container:""},{default:e(()=>[a(y,{class:"cabecalho"},{default:e(()=>[a(r(ca))]),_:1}),a(B,null,{default:e(()=>[a(r(da),{canais:r(n)},null,8,["canais"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),a(B,{style:{height:"100vh"}},{default:e(()=>[a(g)]),_:1})]),_:1})])])}}};export{ba as default};
