1import{r as q,v as te,p as oe,a as d,b as ae,o as u,c as f,w as s,f as t,d as a,t as g,u as c,i as p,g as w,h as S,F as $,j as ne,k as se,N as m}from"./app-5fc1912d.js";import{_ as le}from"./AdminGeralLayout-a3455019.js";import{C as j}from"./Card-511e1ef8.js";import{v as E}from"./validacaoNome-49cf0a9d.js";import"./AdminLayout-c73cece3.js";import"./ApplicationLogo-e0d31125.js";import"./Footer-af4780d1.js";import"./iconify-03d69e80.js";import"./icon-df62cc88.js";import"./_plugin-vue_export-helper-c27b6911.js";const de={class:"tw-text-xl tw-font-bold"},re=a("span",{class:"tw-text-base tw-leading-3 tw-font-black tw-text-gray-700"},"Nome",-1),ie={class:"tw-grid tw-grid-cols-5 tw-gap-4"},ce={class:"tw-col-span-1"},ue=a("span",{class:"tw-text-base tw-leading-3 tw-font-black tw-text-gray-700"},"UF",-1),me={class:"tw-col-span-4"},pe=a("span",{class:"tw-text-base tw-leading-3 tw-font-black tw-text-gray-700"},"Cidade",-1),we=a("span",{class:"tw-text-base tw-leading-3 tw-font-black tw-text-gray-700"},"Endereço",-1),_e={class:"tw-flex tw-w-full tw-justify-end tw-gap-4"},fe=["onClick"],ge=["onClick"],be={class:"tw-text-xl tw-font-bold"},ve={class:"tw-font-title tw-text-gray-600 tw-text-base"},he={key:0},xe={class:"tw-flex tw-flex-row tw-gap-4 tw-justify-end"},ye=["onClick"],qe=["onClick"],ke={key:1,class:"tw-font-semibold tw-text-base tw-text-left"},Ce={class:"tw-flex tw-justify-between tw-items-center"},Ve=a("div",{class:"tw-flex"},[a("div",{class:"text-h6"},"Confirme sua ação")],-1),Ue=a("div",null," Você deseja realmente remover esse unidade? ",-1),Ne={class:"tw-my-2 tw-flex"},Fe=["onClick"],Ie={__name:"Unidades",props:{unidades:{type:Array}},setup(D){const k=D,C=q([]),V=q([]),_=q(!1),e=te({id:"",nome:"",uf:"GO",cidade:"",endereco:""});oe.get("https://servicodados.ibge.gov.br/api/v1/localidades/estados/GO/municipios").then(o=>V.value=o.data.map(n=>({label:n.nome,value:n.nome})));function z(o){e.id=o.id,e.nome=o.nome,e.uf=o.uf,e.cidade=o.cidade,e.endereco=o.endereco}function A(o){e.id=o.id,e.nome=o.nome,e.uf=o.uf,e.cidade=o.cidade,e.endereco=o.endereco,_.value=!0}function B(){_.value=!1,e.reset()}function O(){if(E(e.nome)){if(!e.cidade){m.create({message:"Campo cidade obrigatório",color:"negative",position:"top-right"});return}e.post(route("admin.geral.unidades.store"),{preserveScroll:!0,onSuccess:o=>{e.reset(),m.create({message:"Unidade registrada com sucesso.",color:"primary"})},onError:o=>{m.create({message:"Não foi possÃvel registrar a Unidade.",color:"negative"})}})}}function G(){e.delete(route("admin.geral.unidades.destroy"),{preserveScroll:!0,onSuccess:o=>{e.reset(),m.create({message:"Unidade removida com sucesso.",color:"primary"})},onError:o=>{m.create({message:"Não foi possÃvel remover a Unidade.",color:"negative"})}})}function I(){const o=e.nome;if(E(o)){if(!e.cidade){m.create({message:"Campo cidade obrigatório",color:cor,position:"top-right"});return}e.patch(route("admin.geral.unidades.update"),{preserveScroll:!0,onSuccess:n=>{e.reset(),m.create({message:"Unidade atualizada com sucesso.",color:"primary"})},onError:n=>{m.create({message:"Não foi possÃvel remover a Unidade.",color:"negative"})}})}}const L={year:"numeric",month:"numeric",day:"numeric"},M=[{name:"id",label:"",field:"id"},{name:"nome",label:"Nome",field:"nome",sortable:!0,align:"left"},{name:"uf",label:"UF",field:"uf",sortable:!0,align:"left"},{name:"cidade",label:"Cidade",field:"cidade",sortable:!0,align:"left"},{name:"created_at",label:"Data de Criação",field:"created_at",sortable:!0,format:o=>`${new Date(o).toLocaleString("pt-BR",L)}`||"IndisponÃvel",align:"left"},{name:"user",label:"Usuário",field:"created_by",format:o=>o||"IndisponÃvel",align:"left"},{name:"actions",label:"Ações",field:"actions",align:"right"}],R=["nome","uf","cidade","created_at","user","actions"];return(o,n)=>{const b=d("q-separator"),v=d("q-input"),T=d("q-select"),U=d("q-checkbox"),h=d("q-td"),H=d("q-th"),N=d("q-tr"),x=d("q-icon"),J=d("q-table"),F=d("q-card-section"),K=d("q-item-label"),P=d("q-item-section"),Q=d("q-item"),W=d("q-btn"),X=d("q-card-actions"),Y=d("q-card"),Z=d("q-dialog"),ee=ae("close-popup");return u(),f(le,null,{default:s(()=>[t(j,null,{default:s(()=>[a("h4",de,g(c(e).id?"Editar ":"Nova ")+" Unidade ",1),t(b),re,t(v,{outlined:"",required:"",autofocus:"",modelValue:c(e).nome,"onUpdate:modelValue":n[0]||(n[0]=r=>c(e).nome=r),placeholder:"Nome da unidade"},null,8,["modelValue"]),a("div",ie,[a("div",ce,[ue,t(v,{outlined:"",required:"",autofocus:"",modelValue:c(e).uf,"onUpdate:modelValue":n[1]||(n[1]=r=>c(e).uf=r),placeholder:"UF da unidade",maxlength:"2",disable:!0},null,8,["modelValue"])]),a("div",me,[pe,t(T,{outlined:"",required:"",autofocus:"",placeholder:"Cidade da unidade",options:V.value,"emit-value":"",modelValue:c(e).cidade,"onUpdate:modelValue":n[2]||(n[2]=r=>c(e).cidade=r)},null,8,["options","modelValue"])])]),we,t(v,{outlined:"",required:"",autofocus:"",modelValue:c(e).endereco,"onUpdate:modelValue":n[3]||(n[3]=r=>c(e).endereco=r),placeholder:"Endereço da unidade"},null,8,["modelValue"]),a("div",_e,[a("button",{onClick:n[4]||(n[4]=p(r=>c(e).reset(),["prevent"])),class:"tw-rounded-full tw-px-10 tw-h-10 tw-border tw-border-primary tw-bg-white tw-text-primary tw-items-center tw-justify-center"}," Cancelar "),c(e).id?(u(),w("button",{key:0,onClick:p(I,["prevent"]),class:"tw-rounded-full tw-px-10 tw-h-10 tw-bg-primary tw-text-white tw-items-center tw-justify-center"}," Salvar ",8,fe)):(u(),w("button",{key:1,onClick:p(O,["prevent"]),class:"tw-rounded-full tw-px-10 tw-h-10 tw-bg-primary tw-text-white tw-items-center tw-justify-center"}," Cadastrar ",8,ge))])]),_:1}),t(j,null,{default:s(()=>{var r;return[a("h4",be,g((r=k.unidades)==null?void 0:r.length)+" Unidade(s) ",1),t(b),t(J,{flat:"",rows:k.unidades,columns:M,"visible-columns":R,"row-key":"id",selection:"multiple",selected:C.value,"onUpdate:selected":n[5]||(n[5]=l=>C.value=l),"no-data-label":"Não há informações cadastradas.","no-results-label":"Não foi possÃvel localizar informações com o filtro inserido.","rows-per-page-label":"Registros por página","rows-per-page-options":[30,40,60],"pagination-label":(l,i,y)=>`${l} à ${i} de ${y} registros`,"selected-rows-label":l=>l+" registro(s) selecionado(s)"},{header:s(l=>[t(N,{props:l,class:"tw-h-16"},{default:s(()=>[t(h,{"auto-width":""},{default:s(()=>[t(U,{dense:"",modelValue:l.selected,"onUpdate:modelValue":i=>l.selected=i},null,8,["modelValue","onUpdate:modelValue"])]),_:2}
1,1024),(u(!0),w($,null,S(l.cols,i=>(u(),f(H,{key:i.name,props:l},{default:s(()=>[a("span",ve,g(i.label),1)]),_:2},1032,["props"]))),128))]),_:2},1032,["props"])]),body:s(l=>[t(N,{props:l,"no-hover":""},{default:s(()=>[t(h,{"auto-width":""},{default:s(()=>[t(U,{dense:"",modelValue:l.selected,"onUpdate:modelValue":i=>l.selected=i},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),(u(!0),w($,null,S(l.cols,i=>(u(),f(h,{key:i.name,props:l},{default:s(()=>[i.name==="actions"?(u(),w("div",he,[a("div",xe,[a("button",{onClick:p(y=>z(l.row),["prevent"])},[t(x,{size:"24px",class:"tw-text-gray-800",name:"mode_edit"})],8,ye),a("button",{onClick:p(y=>A(l.row),["prevent"])},[t(x,{size:"24px",class:"tw-text-red-700",name:"delete_outline"})],8,qe)])])):(u(),w("div",ke,g(i.value),1))]),_:2},1032,["props"]))),128))]),_:2},1032,["props"])]),_:1},8,["rows","selected","pagination-label","selected-rows-label"])]}),_:1}),t(Z,{modelValue:_.value,"onUpdate:modelValue":n[7]||(n[7]=r=>_.value=r)},{default:s(()=>[t(Y,{class:"tw-rounded-3xl tw-h-56 tw-w-72 tw-overflow-hidden"},{default:s(()=>[t(F,null,{default:s(()=>[a("div",Ce,[Ve,a("div",null,[t(x,{name:"close",class:"tw-cursor-pointer tw-text-gray-500",size:"25px",onClick:n[6]||(n[6]=r=>_.value=!1)})])])]),_:1}),t(F,null,{default:s(()=>[Ue,t(b,{class:"tw-mt-2"}),t(X,{align:"right"},{default:s(()=>[a("div",Ne,[a("button",{onClick:p(B,["prevent"]),class:"tw-bg-white tw-text-[#6F797A] tw-border-[#6F797A] tw-rounded-full tw-mr-5 tw-items-center tw-px-4 tw-py-2 tw-border tw-font-semibold tw-text-xs tw-text-[[#6F797A] tw-tracking-widest focus:tw-outline-none tw-ease-in-out tw-duration-150"}," Cancelar ",8,Fe),t(W,{rounded:"",class:"tw-bg-primary tw-font-bold","no-caps":"","text-color":"white"},{default:s(()=>[ne((u(),f(Q,{clickable:"",onClick:p(G,["prevent"])},{default:s(()=>[t(P,null,{default:s(()=>[t(K,null,{default:s(()=>[se("Confirmar")]),_:1})]),_:1})]),_:1},8,["onClick"])),[[ee]])]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})}}};export{Ie 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.