PageSourceSearch

https://app.pratiqueemcasa.com.br/_next/static/chunks/pages/admin/api-go-slim-5caaeee40b16fd6d.js

js pratiqueemcasa.com.br collected 2026-09-24 11:00:36 UTC 7,176 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[74199],{79792:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/api-go-slim",function(){return a(74553)}])},74553:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return T}});var n=a(85893),s=a(25593),i=a(18922),o=a(66309),l=a(68872),r=a(83062),d=a(83622),c=a(4393),u=a(59157),x=a(17788),m=a(23345),f=a(25278),h=a(96074),p=a(72269),g=a(11163),y=a(9473),j=a(67294),k=a(89583),S=a(42952),Z=a(33160),v=a(60219),b=a(99611),w=a(90420),P=a(57132),C=a(98165),I=a(41664),N=a.n(I);let{Title:A,Text:_}=s.Z;function T(){let e=(0,g.useRouter)(),{usuario:t}=(0,y.v9)(e=>e.login),a=null==t?void 0:t.isAdminMaster,[s,I]=(0,j.useState)(!1),[T,E]=(0,j.useState)(""),[z,F]=(0,j.useState)(!1),[B,G]=(0,j.useState)(!1),[U,q]=(0,j.useState)(!1),[V,O]=(0,j.useState)(!1),[D]=i.Z.useForm(),[R,M]=(0,j.useState)([]),[X,J]=(0,j.useState)(!1);(0,j.useEffect)(()=>{a||e.push("/")},[a,e]),(0,j.useEffect)(()=>{a&&(K(),L())},[a]);let K=async()=>{try{let s=await fetch("/api/admin/go-slim/config");if(s.ok){var e,t,a,n;let i=await s.json();E(i.token||""),q(null!==(e=i.enableNewStudents)&&void 0!==e&&e),O(null!==(t=i.enableStatusUpdate)&&void 0!==t&&t),D.setFieldsValue({token:i.token||"",enableNewStudents:null!==(a=i.enableNewStudents)&&void 0!==a&&a,enableStatusUpdate:null!==(n=i.enableStatusUpdate)&&void 0!==n&&n})}}catch(e){console.error("Erro ao carregar configura\xe7\xf5es:",e)}},L=async()=>{try{J(!0);let e=await fetch("/api/admin/go-slim/students");if(e.ok){let t=await e.json();M(t.students||[])}}catch(e){console.error("Erro ao carregar alunos:",e)}finally{J(!1)}},H=e=>{if(!e)return"-";let t=e.replace(/\D/g,"");return 11!==t.length?e:"***.".concat(t.substring(3,6),".***-").concat(t.substring(9,11))},Q=e=>e?(0,n.jsx)(o.Z,{color:"green",children:"Ativo"}):(0,n.jsx)(o.Z,{color:"red",children:"Inativo"}),W=[{title:"Nome",dataIndex:"name",key:"name",ellipsis:!0},{title:"CPF",dataIndex:"cpf",key:"cpf",width:140,render:e=>H(e)},{title:"E-mail",dataIndex:"email",key:"email",ellipsis:!0},{title:"N\xba Contrato Pacto",dataIndex:"contract_number",key:"contract_number",width:150},{title:"Status",dataIndex:"active",key:"active",width:100,render:e=>Q(e)},{title:"Plano",dataIndex:"plan",key:"plan",ellipsis:!0},{title:"Data de Cadastro",dataIndex:"created_at",key:"created_at",width:150,render:e=>e?new Date(e).toLocaleDateString("pt-BR"):"-"}],Y=()=>{I(!1),F(!1)},$=async()=>{try{let e=await D.validateFields();G(!0);let t=await fetch("/api/admin/go-slim/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e.token,enableNewStudents:e.enableNewStudents,enableStatusUpdate:e.enableStatusUpdate})});if(t.ok)E(e.token),q(e.enableNewStudents),O(e.enableStatusUpdate),l.ZP.success("Configura\xe7\xf5es salvas com sucesso!"),Y();else{let e=await t.json();l.ZP.error(e.message||"Erro ao salvar configura\xe7\xf5es")}}catch(e){if(e.errorFields)return;l.ZP.error("Erro ao salvar configura\xe7\xf5es")}finally{G(!1)}};return a?(0,n.jsxs)("section",{className:"container",children:[(0,n.jsxs)("div",{style:{marginBottom:24,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsxs)(N(),{href:"/admin",style:{display:"inline-flex",alignItems:"center",gap:8,color:"#1890ff"},children:[(0,n.jsx)(k.x_l,{})," Voltar ao Painel Admin"]}),(0,n.jsx)(r.Z,{title:"Configura\xe7\xf5es",children:(0,n.jsx)(d.ZP,{type:"primary",icon:(0,n.jsx)(S.Z,{}),onClick:()=>{D.setFieldsValue({token:T,enableNewStudents:U,enableStatusUpdate:V}),I(!0)},children:"Configura\xe7\xf5es"})})]}),(0,n.jsx)(A,{level:2,className:"text-center",children:"API Go Slim"}),(0,n.jsx)(c.Z,{style:{marginTop:32},title:"Alunos Cadastrados via API",extra:(0,n.jsx)(d.ZP,{icon:(0,n.jsx)(Z.Z,{}),onClick:L,loading:X,children:"Atualizar"}),children:T?(0,n.jsx)(u.Z,{columns:W,dataSource:R,rowKey:"id",loading:X,pagination:{pageSize:10,showSizeChanger:!0,showTotal:(e,t)=>"".concat(t[0],"-").concat(t[1]," de ").concat(e," registros")},locale:{emptyText:"Nenhum aluno cadastrado via API"},scroll:{x:900}}):(0,n.jsx)("div",{style:{textAlign:"center",padding:40},children:(0,n.jsx)(_,{type:"secondary",children:"Configure o token de acesso para come\xe7ar."})})}),(0,n.jsx)(x.Z,{title:(0,n.jsxs)(m.Z,{children:[(0,n.jsx)(S.Z,{}),(0,n.jsx)("span",{children:"Configura\xe7\xf5es - API Go Slim"})]}),open:s,onCancel:Y,footer:[(0,n.jsx)(d.ZP,{onClick:Y,children:"Cancelar"},"cancel"),(0,n.jsx)(d.ZP,{type:"primary",icon:(0,n.jsx)(v.Z,{}),loading:B,onClick:$,children:"Salvar"},"save")],width:500,children:(0,n.jsxs)(i.Z,{form:D,layout:"vertical",style:{marginTop:24},children:[(0,n.jsx)(i.Z.Item,{label:"Token de Acesso",required:!0,style:{marginBottom:8},children:(0,n.jsxs)(m.Z.Compact,{style:{width:"100%"},children:[(0,n.jsx)(i.Z.Item,{name:"token",noStyle:!0,rules:[{required:!0,message:"Por favor, insira o token de acesso"}],children:(0,n.jsx)(f.Z.Password,{placeholder:"Insira o token da API Go Slim",visibilityToggle:{visible:z,onVisibleChange:F},iconRender:e=>e?(0,n.jsx)(b.Z,{}):(0,n.jsx)(w.Z,{})})}),(0,n.jsx)(r.Z,{title:"Copiar token",children:(0,n.jsx)(d.ZP,{icon:(0,n.jsx)(P.Z,{}),onClick:()=>{let e=D.getFieldValue("token");e?(navigator.clipboard.writeText(e),l.ZP.success("Token copiado!")):l.ZP.warning("Nenhum token para copiar")}})})]})}),(0,n.jsx)(d.ZP,{type:"dashed",icon:(0,n.jsx)(C.Z,{}),onClick:()=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let a=0;a<32;a++)t+=e.charAt(Math.floor(Math.random()*e.length));D.setFieldsValue({token:t}),F(!0),l.ZP.info("Token gerado! Clique em Salvar para confirmar.")},style:{marginBottom:16},block:!0,children:"Gerar Novo Token Aleat\xf3rio"}),(0,n.jsx)(_,{type:"secondary",style:{fontSize:12},children:"O token ser\xe1 armazenado de forma segura e usado para autenticar as requisi\xe7\xf5es \xe0 API Go Slim."}),(0,n.jsx)(h.Z,{orientation:"left",style:{marginTop:24,marginBottom:16},children:"Funcionalidades"}),(0,n.jsxs)("div",{style:{background:"#fafafa",borderRadius:8,padding:16,border:"1px solid #f0f
10f0"},children:[(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(_,{strong:!0,children:"Cadastro de novos alunos"}),(0,n.jsx)("br",{}),(0,n.jsx)(_,{type:"secondary",style:{fontSize:12},children:"Permite que a API Go Slim cadastre novos alunos automaticamente"})]}),(0,n.jsx)(i.Z.Item,{name:"enableNewStudents",valuePropName:"checked",style:{marginBottom:0},children:(0,n.jsx)(p.Z,{})})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(_,{strong:!0,children:"Atualiza\xe7\xe3o de status"}),(0,n.jsx)("br",{}),(0,n.jsx)(_,{type:"secondary",style:{fontSize:12},children:"Permite que a API Go Slim atualize o status dos alunos existentes"})]}),(0,n.jsx)(i.Z.Item,{name:"enableStatusUpdate",valuePropName:"checked",style:{marginBottom:0},children:(0,n.jsx)(p.Z,{})})]})]})]})})]}):null}}},function(e){e.O(0,[80640,5282,59157,11270,49774,92888,40179],function(){return e(e.s=79792)}),_N_E=e.O()}]);

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.