PageSourceSearch

https://app.stoqui.com.br/assets/CustomerImportDetailsPage-I2RCvF3g.js

js stoqui.com.br collected 2026-09-24 11:58:10 UTC 6,158 bytes, 17 lines download raw bytes

1import{j as e,a7 as i,X as E,ai as k,Z as q,aq as B,O as L,H as x,T as t,ao as h,Q as b,ad as A,I as R,R as S,ac as F,S as W}from"./mui-CRsYZxVY.js";import{r as p}from"./vendor-Dwao9eNC.js";import{u as N,w as P,J as z,b as H,dT as O,T as M,bo as Q,dO as U,dU as Y}from"./index-TALscxEc.js";import{u as $}from"./query-8ViTdhdk.js";import{L as y}from"./lab-DSem1Osk.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};a.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new a.Error().stack;r&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[r]="93d200e4-6acd-4d67-bf0b-acbaefaa425f",a._sentryDebugIdIdentifier="sentry-dbid-93d200e4-6acd-4d67-bf0b-acbaefaa425f")})()}catch{}const J=a=>{const{user:r}=N(),l=r==null?void 0:r.id;return $({queryKey:["customerImport",a],queryFn:async()=>{if(!l)throw new Error("Usuário não autenticado");const{data:n,error:o}=await P.from("importacao_cliente").select(`
2            id, 
3            user_id, 
4            quantidade_clientes, 
5            criado_em,
6            clientes:cliente(
7              id, 
8              nome, 
9              telefone, 
10              email, 
11              cpf, 
12              cpf_cnpj, 
13              importacao_cliente_id, 
14              observacoes, 
15              deletado_em
16            )
17          `).eq("id",a).eq("user_id",l).single();if(o)throw new Error(o.message);return n},enabled:!!a&&!!l})},K=({name:a,phone:r,email:l,cpf:n,deleted:o,onClick:c})=>e.jsxs(S,{button:!0,onClick:c,sx:{border:"1px solid",borderColor:"divider",mb:1,borderRadius:1,opacity:o?.5:1,backgroundColor:o?"action.hover":"background.paper"},disabled:o,children:[e.jsx(i,{sx:{mr:2},children:e.jsx(Y,{color:o?"disabled":"primary"})}),e.jsx(F,{primary:e.jsxs(i,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(t,{variant:"body1",fontWeight:"medium",children:a||"Nome não informado"}),o&&e.jsx(W,{label:"Excluído",size:"small",color:"error"})]}),secondary:e.jsxs(i,{children:[e.jsxs(t,{variant:"body2",color:"text.secondary",children:["Telefone: ",r]}),l&&e.jsxs(t,{variant:"body2",color:"text.secondary",children:["Email: ",l]}),n&&e.jsxs(t,{variant:"body2",color:"text.secondary",children:["CPF: ",n]})]})})]}),se=()=>{const{importId:a}=z(),r=H(),[l,n]=p.useState(!1),[o,c]=p.useState(!1),{data:f,isLoading:g,error:j,refetch:v}=J(Number(a)),w=O(),C=()=>{if(g)return e.jsxs(e.Fragment,{children:[e.jsxs(x,{elevation:0,sx:{p:2,mb:2,bgcolor:"white"},children:[e.jsx(t,{variant:"h6",gutterBottom:!0,color:"primary",fontWeight:"bold",children:"Informações da importação"}),["Data","Total de clientes","Clientes ativos","Clientes excluídos"].map((s,T)=>e.jsxs(i,{display:"flex",alignItems:"center",mb:1,children:[e.jsxs(t,{variant:"body2",color:"text.secondary",width:150,children:[s,":"]}),e.jsx(h,{width:100})]},T))]}),e.jsxs(x,{elevation:0,sx:{p:2,bgcolor:"white"},children:[e.jsx(t,{variant:"h6",gutterBottom:!0,color:"primary",fontWeight:"bold",children:"Clientes importados"}),e.jsx(b,{children:[1,2,3].map(s=>e.jsx(h,{variant:"rectangular",height:80,sx:{mb:1,borderRadius:1}},s))})]})]});if(j||!f)return e.jsx(A,{severity:"error",children:"Erro ao carregar detalhes da importação"});const{criado_em:m,clientes:d,quantidade_clientes:D}=f,u=d.filter(s=>!s.deletado_em),_=d.filter(s=>s.deletado_em);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{elevation:0,sx:{p:2,mb:2,bgcolor:"white"},children:[e.jsx(t,{variant:"h6",gutterBottom:!0,color:"primary",fontWeight:"bold",children:"Informações da importação"}),e.jsxs(i,{display:"flex",alignItems:"center",mb:1,justifyContent:"space-between",children:[e.jsx(t,{variant:"body2",color:"text.secondary",width:150,children:"Data:"}),e.jsx(t,{variant:"body1",children:Q(new Date(m),"dd/MM/yy 'às' HH:mm")})]}),e.jsxs(i,{display:"flex",alignItems:"center",mb:1,justifyContent:"space-between",children:[e.jsx(t,{variant:"body2",color:"text.secondary",width:150,children:"Total de clientes:"}),e.jsx(t,{variant:"body1",children:D})]}),e.jsxs(i,{display:"flex",alignItems:"center",mb:1,justifyContent:"space-between",children:[e.jsx(t,{variant:"body2",color:"text.secondary",width:150,children:"Clientes ativos:"}),e.jsx(t,{variant:"body1",children:u.length})]}),e.jsxs(i,{display:"flex",alignItems:"center",mb:1,justifyContent:"space-between",children:[e.jsx(t,{variant:"body2",color:"text.secondary",width:150,children:"Clientes excluídos:"}),e.jsx(t,{variant:"body1",textAlign:"right",children:_.length})]})]}),e.jsxs(x,{elevation:0,sx:{p:2,bgcolor:"white"},children:[e.jsxs(i,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[e.jsx(t,{variant:"h6",color:"primary",fontWeight:"bold",children:"Clientes importados"}),u.length>0&&e.jsx(R,{color:"error",onClick:()=>n(!0),size:"small",children:e.jsx(U,{})})]}),e.jsx(b,{children:d.map(s=>e.jsx(K,{name:s.nome,phone:s.telefone,email:s.email,cpf:s.cpf,deleted:!!s.deletado_em,onClick:()=>r(`/customers/${s.id}`)},s.id))})]})]})},I=async()=>{c(!0);const m=f.clientes.filter(d=>!d.deletado_em).map(d=>d.id);m.length>0&&await w.mutateAsync({customer_ids:m}),await v(),c(!1),n(!1)};return e.jsxs(i,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(M,{title:"Detalhes da importação de clientes",navigateBack:!0}),e.jsx(i,{sx:{flex:1,overflowY:"auto",padding:2},children:C()}),e.jsxs(E,{open:l,onClose:()=>!o&&n(!1),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[e.jsx(k,{id:"alert-dialog-title",children:"Confirmar exclusão"}),e.jsx(q,{children:e.jsx(B,{id:"alert-dialog-description",children:"Tem certeza que deseja excluir todos os clientes ativos desta importação? Esta ação não pode ser desfeita."})}),e.jsxs(L,{children:[e.jsx(y,{onClick:()=>n(!1),disabled:o,children:"Cancelar"}),e.jsx(y,{onClick:I,loading:o,color:"error",autoFocus:!0,children:"Confirmar"})]})]})]})};export{se 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.