1import{r as j,u as _e,j as e,L as Ie}from"./vendor-react-DIA7vK4g.js";import{E as Le}from"./EmployeeParceiroLayout-C-RGM9D8.js";import{u as Oe,t as Be}from"./zod-GH4GTJRD.js";import{u as Me}from"./useHubSpotPropertyCache-By0WJBNk.js";import{ba as G,ax as Ue,aE as O,a$ as F,X as ae,bc as N,bz as C,aa as B,y as M,e as re,bA as ie,bB as oe,bC as ne,bD as le,bE as ce,bG as Je,cf as Ge,bH as ze,at as me,b2 as qe,o as He,a_ as Qe,cd as de,d as ve,aF as Ke,b9 as _}from"./index-DtUVjOr4.js";import{u as Xe}from"./useCnpjLookup-DPrsaiIm.js";import{F as We,c as u,f as he,a as xe,b as pe,d as ue,e as je}from"./form-CPGvB4ii.js";import{G as ge,a as we,b as Ye,c as Ze}from"./GlowCard-eEGJc4nM.js";import{G as b}from"./GlowButton-DmpRcAFP.js";import{P as et}from"./phone-input-DRTEOMnt.js";import{C as fe}from"./circle-check-big-CW4zvNj2.js";import{S as be}from"./scan-DymKVHqq.js";import{aB as tt,aD as T,aP as U}from"./vendor-utils-DWHjTIse.js";import{u as st}from"./useEmployeeReferrals-1CemtFY2.js";import"./vendor-docs-BA9xu9ak.js";import"./parceiro-pontua-simbolo-BHn6Fgkh.js";import"./scroll-area-DFJSP9HM.js";import"./asArray-CTPHXM1A.js";import"./useIsEmployee-Cwr-rJfu.js";import"./BlurBackground-ClCPgGtR.js";import"./parceiro-pontua-principal-Gg013pNI.js";import"./trophy-BCwqMM8W.js";import"./log-out-CMftDkmm.js";import"./vendor-supabase-_bOAMmkC.js";import"./document-utils-DQEVigHH.js";import"./phone-BgqrZNH1.js";function at(){const[P,g]=j.useState(null),[S,i]=j.useState(!1),[l,m]=j.useState(null);return{searchClient:async n=>{i(!0),m(null),g(null);try{const{data:d,error:h}=await G.rpc("get_tt_client_by_code",{client_code:n.trim().toUpperCase()});if(h)throw h;if(!d||d.length===0)return m("Cliente TT não encontrado"),null;const p=d[0];return g(p),p}catch(d){return m(d instanceof Error?d.message:"Erro ao buscar cliente"),null}finally{i(!1)}},searchClientByCnpj:async n=>{i(!0),m(null),g(null);try{const d=n.replace(/\D/g,""),{data:h,error:p}=await G.from("tt_clients").select("*").eq("is_active",!0).or(`cnpj.ilike.%${d}%,cnpj.ilike.%${n}%`).limit(1).single();if(p){if(p.code==="PGRST116")return m("Cliente TT não encontrado com este CNPJ"),null;throw p}const v=h;return g(v),v}catch(d){return m(d instanceof Error?d.message:"Erro ao buscar cliente por CNPJ"),null}finally{i(!1)}},clientData:P,isSearching:S,error:l,clearClient:()=>{g(null),m(null)}}}const Ne=/^\d{2}-\d{5}$/,J=[{value:"ponto_remoto",label:"Ponto Remoto"},{value:"ponto_eletronico",label:"Ponto Eletrônico"},{value:"outros_tron",label:"Outros produtos Tron"}],rt=tt({tt_code:T().optional(),empresa_nome:T().min(2,"Razão social é obrigatória"),empresa_cnpj:T().optional(),employee_count:U().optional(),monthly_value:U().optional(),facial_recognition_count:U().optional(),produto_origem:T().optional(),necessidades:T().optional(),observacoes:T().optional()});function it({onSubmit:P,isLoading:g}){var se;const S=_e(),[i,l]=j.useState(1),[m,$]=j.useState("tt"),[w,E]=j.useState(""),[n,d]=j.useState([]),[h,p]=j.useState(!1),[v,R]=j.useState(null),[z,q]=j.useState(!1),V=j.useRef(!1),{options:A,isLoading:ye}=Me("cargo_select"),{searchClient:Ce,clientData:f,isSearching:H,error:Te,clearClient:I}=at(),{isLookingUp:Q,lookupFailed:Pe,triggerLookup:Se,resetLookup:K}=Xe({maxAttempts:3,onSuccess:t=>{(t.razao_social||t.nome_fantasia)&&s.setValue("empresa_nome",t.razao_social||t.nome_fantasia)}}),s=Oe({resolver:Be(rt),defaultValues:{tt_code:"",empresa_nome:"",empresa_cnpj:"",employee_count:void 0,monthly_value:void 0,facial_recognition_count:void 0,produto_origem:"",necessidades:"",observacoes:""}}),X=[{id:1,title:"Cliente TT",icon:O},{id:2,title:"Contatos",icon:F},{id:3,title:"Confirmação",icon:ae}],W=t=>{const a=t.replace(/\D/g,"");return a.length<=2?a:`${a.slice(0,2)}-${a.slice(2,7)}`},L=t=>t.replace(/\D/g,"").replace(/^(\d{2})(\d)/,"$1.$2").replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3").replace(/\.(\d{3})(\d)/,".$1/$2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,18),Y=async(t,a)=>{if(R(null),!t&&!a)return!1;q(!0);try{const{data:r,error:o}=await G.rpc("check_existing_migration_referral",{p_tt_client_code:t||null,p_empresa_cnpj:a||null});if(o)return console.error("Erro ao checar duplicidade:",o),!1;const x=Array.isArray(r)&&r.length>0?r[0]:null;return x?(R({employee_name:x.employee_name,created_at:x.created_at,matched_by:x.matched_by}),!0):!1}finally{q(!1)}},Ee=()=>{p(!0),I(),K(),R(null),m==="cnpj"&&w&&s.setValue("empresa_cnpj",w),s.setValue("tt_code",""),s.setValue("empresa_nome",""),d([{id:crypto.randomUUID(),name:"",email:"",ph
1one:"",cargo:"",isPrimary:!0}])},Z=async()=>{if(!w.trim()){_.error("Digite um código para buscar");return}if(p(!1),R(null),m==="tt"){const t=W(w);if(!Ne.test(t)){_.error("Código TT inválido. Use o formato 00-00000");return}const a=await Ce(t);a&&(De(a),await Y(t,a.cnpj||void 0)&&_.error("Este cliente já possui uma indicação ativa"))}else w.replace(/\D/g,"").length===14?Se(L(w),"cnpj"):_.error("CNPJ inválido")},De=t=>{var k;s.setValue("tt_code",t.tt_code),s.setValue("empresa_nome",t.company_name||""),s.setValue("empresa_cnpj",t.cnpj||""),s.setValue("employee_count",t.employee_count||0),s.setValue("monthly_value",t.monthly_value||0),s.setValue("facial_recognition_count",t.facial_recognition_count||0);const a=((k=t.contact_email)==null?void 0:k.split(/[;,]/).map(y=>y.trim()).filter(Boolean))||[],r=a[0]||"",o=a.slice(1),x=[];(t.contact_name||r)&&x.push({id:crypto.randomUUID(),name:t.contact_name||"",email:r,phone:t.contact_phone||"",cargo:"",isPrimary:!0}),o.forEach(y=>{x.push({id:crypto.randomUUID(),name:"",email:y,phone:"",cargo:"",isPrimary:!1})}),d(x)},ee=()=>{d([...n,{id:crypto.randomUUID(),name:"",email:"",phone:"",cargo:"",isPrimary:n.length===0}])},Re=t=>{const a=n.find(o=>o.id===t),r=n.filter(o=>o.id!==t);a!=null&&a.isPrimary&&r.length>0&&(r[0].isPrimary=!0),d(r)},D=(t,a,r)=>{d(n.map(o=>o.id===t?{...o,[a]:r}:a==="isPrimary"&&r===!0?{...o,isPrimary:o.id===t}:o))},ke=()=>{const t=s.watch("empresa_nome"),a=s.watch("produto_origem"),r=s.watch("tt_code");return!t||t.length<2?!1:h?!!a:!!(r&&Ne.test(r))},Fe=()=>{const t=n.find(r=>r.isPrimary);if(!t)return!1;const a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return t.name.length>=2&&a.test(t.email)&&t.cargo.length>0},$e=async()=>{if(i===1&&!ke()){_.error(h?"Preencha a Razão Social e selecione o Produto de Origem":"Busque e selecione um cliente TT válido");return}if(i===1){const t=s.watch("tt_code"),a=s.watch("empresa_cnpj");if(await Y(h?void 0:t,a)){_.error("Este cliente já possui uma indicação ativa. Não é possÃvel duplicar.");return}}if(i===2&&!Fe()){_.error("Preencha os dados obrigatórios do contato principal (nome, email e cargo)");return}i<3&&l(i+1)},Ve=()=>{i>1&&l(i-1)},te=async t=>{var y;if(i!==3||!V.current)return;V.current=!1;const a=n.find(c=>c.isPrimary);if(!a){_.error("Selecione um contato principal");return}const r=((y=J.find(c=>c.value===t.produto_origem))==null?void 0:y.label)||t.produto_origem;let o=`ð Dados da Migração Ponto Remoto 2`;h?(o+=` 3â ï¸ Cliente sem cadastro na base TT`,o+=` 4Produto de origem: ${r||"Não informado"}`,t.empresa_cnpj&&(o+=` 5CNPJ: ${t.empresa_cnpj}`)):o+=` 6Código TT: ${t.tt_code}`,o+=` 7Quantidade de empregados no PR: ${t.employee_count||0}`,o+=` 8Reconhecimento Facial ativo: ${t.facial_recognition_count||0} usuários`,t.necessidades&&(o+=` 9 10ðï¸ Necessidades/Dores: 11${t.necessidades}`),t.observacoes&&(o+=` 12 13ð Observações: 14${t.observacoes}`),n.length>1&&(o+=` 15 16ð¥ Contatos Adicionais:`,n.filter(c=>!c.isPrimary).forEach(c=>{o+=` 17- ${c.name} (${c.email})${c.phone?` - ${c.phone}`:""}${c.cargo?` - ${c.cargo}`:""}`}));const x=n.filter(c=>!c.isPrimary).map(c=>({name:c.name,email:c.email,phone:c.phone||void 0,cargo:c.cargo||void 0})),k={company_name:t.empresa_nome,contact_name:a.name,contact_email:a.email||void 0,contact_phone:a.phone||void 0,contact_cargo:a.cargo||void 0,estimated_employees:t.employee_count,estimated_mrr:t.monthly_value,notes:o,referral_type:"migracao",tt_client_code:h?"":t.tt_code||"",additional_contacts:x.length>0?x:void 0,facial_recognition_count:t.facial_recognition_count,empresa_cnpj:t.empresa_cnpj||void 0,produto_origem:h&&t.produto_origem||void 0};await P(k)},Ae=t=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(t);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ge,{variant:"gradient",children:e.jsxs(we,{className:"flex items-start gap-4 py-5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-[hsl(1,100%,50%)]/20",children:e.jsx(Ue,{className:"h-5 w-5 text-[hsl(1,100%,50%)]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:"Migração de Cliente TT"}),e.jsx("p",{className:"text-sm text-white/60",children:"Busque pelo código TT ou CNPJ para preencher automaticamente os dados do cliente do Ponto Remoto."})]})]})}),e.jsx("div",{className:"flex items-center justify-between px-4",children:X.map((t,a)=>{const r=t.icon,o=i===t.id,x=i>t.id;return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("button",{onClick:()=>{t.id<i&&l(t.id)},className:N("flex flex-col items-center gap-2 transition-all",t.id<=i?"cursor-pointer":"cursor-not-allowed opacity-50"),children:[e.jsx("div",{className:N("w-12 h-12 rounded-full flex items-center justify-center transition-all duration-300",o&&"bg-[hsl(1,100%,50%)] shadow-[0_0_20px_hsla(1,100%,50%,0.5)]",x&&"bg-[hsl(142,71%,45%)]",!o&&!x&&"bg-white/10 border border-white/20"),children:x?e.jsx(fe,{className:"h-5 w-5 text-white"}):e.jsx(r,{className:N("h-5 w-5",o?"text-white":"text-white/50")})}),e.jsx("span",{className:N("text-xs font-medium",o?"text-white":"text-white/50"),children:t.title})]}),a<X.length-1&&e.jsx("div",{className:N("w-16 sm:w-24 h-0.5 mx-2",i>t.id?"bg-[hsl(142,71%,45%)]":"bg-white/10")})]},t.id)})}),e.jsxs(ge,{children:[e.jsxs(Ye,{children:[e.jsxs(Ze,{className:"flex items-center gap-2",children:[i===1&&e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-5 w-5 text-[hsl(1,100%,50%)]"}),"Buscar Cliente TT"]}),i===2&&e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"h-5 w-5 text-[hsl(1,100%,50%)]"}),"Contatos da Empresa"]}),i===3&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-5 w-5 text-[hsl(1,100%,50%)]"}),"Confirmação e Observações"]})]}),e.jsxs("p",{className:"text-sm text-white/50",children:[i===1&&"Busque pelo código TT (00-00000) ou CNPJ do cliente.",i===2&&"Revise e edite os contatos. O contato principal receberá as comunicações.",i===3&&"Revise os dados e adicione observações se necessário."]})]}),e.jsx(we,{children:e.jsx(We,{...s,children:e.jsxs("form",{onSubmit:s.handleSubmit(te),className:"space-y-6",onKeyDown:t=>{t.key==="Enter"&&!(t.target instanceof HTMLTextAreaElement)&&(t.preventDefault(),t.stopPropagation())},children:[i===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{$("tt"),E(""),I(),p(!1)}
17,className:N("flex-1 py-2 px-4 rounded-xl transition-all text-sm font-medium",m==="tt"?"bg-[hsl(1,100%,50%)] text-white":"bg-white/5 text-white/60 border border-white/10 hover:bg-white/10"),children:"Código TT"}),e.jsx("button",{type:"button",onClick:()=>{$("cnpj"),E(""),I(),K(),p(!1)},className:N("flex-1 py-2 px-4 rounded-xl transition-all text-sm font-medium",m==="cnpj"?"bg-[hsl(1,100%,50%)] text-white":"bg-white/5 text-white/60 border border-white/10 hover:bg-white/10"),children:"CNPJ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{className:"text-white/80",children:m==="tt"?"Código do Cliente TT *":"CNPJ *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{value:w,onChange:t=>{E(m==="tt"?W(t.target.value):L(t.target.value))},placeholder:m==="tt"?"00-00000":"00.000.000/0000-00",maxLength:m==="tt"?8:18,className:"flex-1 bg-white/5 border-white/20 text-white placeholder:text-white/40",onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),Z())}}),e.jsx(b,{type:"button",onClick:Z,disabled:H||Q||!w.trim(),children:H||Q?e.jsx(B,{className:"h-4 w-4 animate-spin"}):e.jsx(O,{className:"h-4 w-4"})})]}),e.jsx(he,{className:"text-white/40",children:m==="tt"?"O código TT está no formato 00-00000 (ex: 03-06621)":"Digite o CNPJ completo para buscar na API"})]}),(Te||Pe)&&!h&&!f&&e.jsxs("div",{className:"p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(M,{className:"h-5 w-5 text-amber-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Não encontramos esse cliente em nossa base TT"}),e.jsx("p",{className:"text-xs text-amber-200/80 mt-1",children:"Sem problema! Você pode seguir mesmo assim informando manualmente os dados e o produto que o cliente usa hoje."})]})]}),e.jsxs(b,{type:"button",variant:"outline",onClick:Ee,className:"w-full",children:["Continuar sem cliente TT",e.jsx(re,{className:"ml-2 h-4 w-4"})]})]}),h&&e.jsxs("div",{className:"p-4 bg-white/5 border border-white/10 rounded-xl space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-white flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-amber-400"}),"Cadastro manual (sem TT)"]}),e.jsx("p",{className:"text-xs text-white/50 mt-1",children:"Preencha os dados abaixo para seguir com a indicação."})]}),e.jsx("button",{type:"button",onClick:()=>{p(!1),s.setValue("empresa_nome",""),s.setValue("produto_origem","")},className:"text-white/40 hover:text-white text-xs",children:"Cancelar"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Razão Social / Nome da Empresa *"}),e.jsx(C,{value:s.watch("empresa_nome")||"",onChange:t=>s.setValue("empresa_nome",t.target.value),placeholder:"Nome da empresa",className:"bg-white/5 border-white/20 text-white placeholder:text-white/40 mt-1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"CNPJ"}),e.jsx(C,{value:s.watch("empresa_cnpj")||"",onChange:t=>s.setValue("empresa_cnpj",L(t.target.value)),placeholder:"00.000.000/0000-00",maxLength:18,className:"bg-white/5 border-white/20 text-white placeholder:text-white/40 mt-1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Produto de Origem *"}),e.jsxs(ie,{value:s.watch("produto_origem")||"",onValueChange:t=>s.setValue("produto_origem",t),children:[e.jsx(oe,{className:"bg-white/5 border-white/20 text-white mt-1",children:e.jsx(ne,{placeholder:"Qual produto o cliente usa hoje?"})}),e.jsx(le,{className:"bg-[hsl(222,47%,11%)] border-white/20",children:J.map(t=>e.jsx(ce,{value:t.value,className:"text-white hover:bg-white/10",children:t.label},t.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Colaboradores (estimado)"}),e.jsx(C,{type:"number",min:0,value:s.watch("employee_count")??"",onChange:t=>s.setValue("employee_count",t.target.value?Number(t.target.value):void 0),placeholder:"0",className:"bg-white/5 border-white/20 text-white placeholder:text-white/40 mt-1"})]})]})]}),v&&e.jsxs(Je,{variant:"destructive",className:"bg-destructive/10 border-destructive/40",children:[e.jsx(M,{className:"h-4 w-4"}),e.jsx(Ge,{children:"Cliente já indicado"}),e.jsxs(ze,{children:["Este cliente já possui uma indicação de migração registrada por"," ",e.jsx("strong",{children:v.employee_name||"outro colaborador"})," ","em ",new Date(v.created_at).toLocaleDateString("pt-BR"),". Não é possÃvel duplicar a indicação. Em caso de dúv
17ida, fale com o time responsável."]})]}),f&&e.jsxs("div",{className:"p-4 bg-[hsl(142,71%,45%)]/10 border border-[hsl(142,71%,45%)]/30 rounded-xl space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(fe,{className:"h-5 w-5 text-[hsl(142,71%,45%)] mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-[hsl(142,71%,60%)]",children:"Cliente encontrado!"}),e.jsx("p",{className:"text-lg font-semibold text-white mt-1",children:f.company_name})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2 border-t border-white/10",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/50",children:"Código TT"}),e.jsx("p",{className:"text-sm text-white font-mono",children:f.tt_code})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/50",children:"CNPJ/CPF"}),e.jsx("p",{className:"text-sm text-white",children:f.cnpj||"Não informado"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/50",children:"Colaboradores"}),e.jsx("p",{className:"text-sm text-white",children:f.employee_count||0})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/50",children:"Mensalidade Atual"}),e.jsx("p",{className:"text-sm text-white font-semibold",children:Ae(f.monthly_value||0)})]}),f.facial_recognition_count>0&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-xs text-white/50",children:"Reconhecimento Facial"}),e.jsxs("p",{className:"text-sm text-white flex items-center gap-1",children:[e.jsx(be,{className:"h-4 w-4 text-[hsl(1,100%,50%)]"}),f.facial_recognition_count," usuários ativos"]})]})]})]}),e.jsx("input",{type:"hidden",...s.register("tt_code")}),e.jsx("input",{type:"hidden",...s.register("empresa_nome")}),e.jsx("input",{type:"hidden",...s.register("empresa_cnpj")})]}),i===2&&e.jsx("div",{className:"space-y-4",children:n.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(F,{className:"h-12 w-12 text-white/30 mx-auto mb-3"}),e.jsx("p",{className:"text-white/50 mb-4",children:"Nenhum contato cadastrado"}),e.jsxs(b,{type:"button",onClick:ee,children:[e.jsx(me,{className:"h-4 w-4 mr-2"}),"Adicionar Contato"]})]}):e.jsxs(e.Fragment,{children:[n.map((t,a)=>e.jsxs("div",{className:N("p-4 rounded-xl border space-y-3",t.isPrimary?"border-[hsl(142,71%,45%)]/50 bg-[hsl(142,71%,45%)]/5":"border-white/10 bg-white/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:t.isPrimary?e.jsx("span",{className:"text-xs bg-[hsl(142,71%,45%)] text-white px-2 py-0.5 rounded-full",children:"Principal"}):e.jsx("button",{type:"button",onClick:()=>D(t.id,"isPrimary",!0),className:"text-xs text-white/50 hover:text-white border border-white/20 px-2 py-0.5 rounded-full",children:"Definir como principal"})}),n.length>1&&e.jsx("button",{type:"button",onClick:()=>Re(t.id),className:"text-white/40 hover:text-[hsl(0,70%,60%)]",children:e.jsx(qe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Nome *"}),e.jsx(C,{value:t.name,onChange:r=>D(t.id,"name",r.target.value),placeholder:"Nome completo",className:"bg-white/5 border-white/20 text-white placeholder:text-white/40 mt-1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Email *"}),e.jsx(C,{type:"email",value:t.email,onChange:r=>D(t.id,"email",r.target.value),placeholder:"[email protected]",className:"bg-white/5 border-white/20 text-white placeholder:text-white/40 mt-1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Telefone"}),e.jsx(et,{value:t.phone||"",onChange:r=>D(t.id,"phone",r),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40 mt-1"})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-white/80 text-sm",children:"Cargo *"}),e.jsxs(ie,{value:t.cargo,onValueChange:r=>D(t.id,"cargo",r),children:[e.jsx(oe,{className:"bg-white/5 border-white/20 text-white mt-1",children:e.jsx(ne,{placeholder:ye?"Carregando...":"Selecione..."})}),e.jsx(le,{className:"bg-[hsl(222,47%,11%)] border-white/20",children:A==null?void 0:A.map(r=>e.jsx(ce,{value:r.value,className:"text-white hover:bg-white/10",children:r.label},r.value))})]})]})]})]},t.id)),e.jsxs(b,{type:"button",variant:"outline",onClick:ee,className:"w-full",children:[e.jsx(me,{className:"h-4 w-4 mr-2"}),"Adicionar Outro Contato"]})]})}),i===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 bg-white/5 rounded-xl border border-white/10 space-y-4",children:[e.jsxs("h4",{className:"font-semibold text-white flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4 text-[hsl(1,100%,50%)]"}),"Resumo da Migração"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/50",children:"Empresa"}),e.jsx("p",{className:"text-sm text-white font-medium",children:s.watch("empresa_nome")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/50",children:h?"Produto de Origem":"Código TT"}),e.jsx("p",{className:"text-sm text-white font-mono",children:h?((se=J.find(t=>t.value===s.watch("produto_origem")))==null?void 0:se.label)||"â":s.watch("tt_code")}),h&&e.jsx("span",{className:"inline-block mt-1 text-[10px] bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded",children:"Sem cadastro TT"})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-white/50 flex items-center gap-1",children:[e.jsx(F,{className:"h-3 w-3"}),"Colaboradores no PR"]}),e.jsx("p",{className:"text-sm text-white",children:s.watch("employee_count")||0})]}),(s.watch("facial_recognition_count")||0)>0&&e.jsxs("div",{className:"col-span-2",children:[e.jsxs("p",{className:"text-xs text-white/50 flex items-center gap-1",children:[e.jsx(be,{className:"h-3 w-3"}),"Reconhecimento Facial"]}),e.jsxs("p",{className:"text-sm text-white",children:[s.watch("facial_recognition_count")," usuários ativos"]})]})]}),e.jsxs("div",{className:"pt-3 border-t border-white/10",children:[e.jsxs("p",{className:"text-xs text-white/50 mb-2",children:["Contatos (",n.length,")"]}),n.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/80",children:[e.jsx(Qe,{className:"h-3 w-3"}),e.jsx("span",{children:t.name}),e.jsxs("span",{className:"text-white/40",children:["(",t.email,")"]}),t.isPrimary&&e.jsx("span",{className:"text-xs bg-[hsl(1,100%,50%)]/20 text-[hsl(1,100%,60%)] px-1.5 py-0.5 rounded",children:"Principal"})]},t.id))]})]}),e.jsx(xe,{control:s.control,name:"necessidades",render:({field:t})=>e.jsxs(pe,{children:[e.jsx(u,{className:"text-white/80",children:"Necessidades/Dores"}),e.jsx(ue,{children:e.jsx(de,{placeholder:"Quais são as principais necessidades ou problemas que motivam a migração?",className:"min-h-[80px] bg-white/5 border-white/20 text-white placeholder:text-white/40",...t})}),e.jsx(he,{className:"text-white/40",children:"Opcional - Ajuda nossa equipe a preparar uma abordagem mais assertiva"}),e.jsx(je,{className:"text-[hsl(1,100%,60%)]"})]})}),e.jsx(xe,{control:s.control,name:"observacoes",render:({field:t})=>e.jsxs(pe,{children:[e.jsx(u,{className:"text-white/80",children:"Observações"}),e.jsx(ue,{children:e.jsx(de,{placeholder:"Alguma informação adicional relevante sobre a migração?",className:"min-h-[60
17px] bg-white/5 border-white/20 text-white placeholder:text-white/40",...t})}),e.jsx(je,{className:"text-[hsl(1,100%,60%)]"})]})})]}),e.jsxs("div",{className:"flex gap-3 pt-4 border-t border-white/10",children:[i>1?e.jsxs(b,{type:"button",variant:"outline",onClick:Ve,className:"flex-1",children:[e.jsx(ve,{className:"mr-2 h-4 w-4"}),"Voltar"]}):e.jsx(b,{type:"button",variant:"outline",onClick:()=>S(-1),className:"flex-1",children:"Cancelar"}),i<3?e.jsx(b,{type:"button",onClick:$e,disabled:z||i===1&&!!v,className:"flex-1",children:z?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"mr-2 h-4 w-4 animate-spin"}),"Verificando..."]}):e.jsxs(e.Fragment,{children:["Próximo",e.jsx(re,{className:"ml-2 h-4 w-4"})]})}):e.jsx(b,{type:"button",disabled:g,className:"flex-1",onClick:async()=>{V.current=!0,await s.handleSubmit(te)()},children:g?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"mr-2 h-4 w-4"}),"Enviar Migração"]})})]})]})})})]})]})}function kt(){const{createReferral:P,isCreating:g}=st(),S=_e(),i=async l=>{await P({company_name:l.company_name,contact_name:l.contact_name,contact_email:l.contact_email,contact_phone:l.contact_phone,contact_cargo:l.contact_cargo,estimated_employees:l.estimated_employees,estimated_mrr:l.estimated_mrr,notes:l.notes,referral_type:"migracao",tt_client_code:l.tt_client_code,empresa_cnpj:l.empresa_cnpj,additional_contacts:l.additional_contacts,facial_recognition_count:l.facial_recognition_count,produto_origem:l.produto_origem},{onSuccess:()=>{S("/parceiro-pontua/colaborador/historico")}})};return e.jsx(Le,{children:e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Ie,{to:"/parceiro-pontua/colaborador",children:e.jsx(b,{variant:"ghost",size:"sm",children:e.jsx(ve,{className:"h-4 w-4"})})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"Migração de Cliente TT"}),e.jsx("p",{className:"text-white/60",children:"Migre um cliente do Ponto Remoto para o Pontua"})]})]}),e.jsx(it,{onSubmit:i,isLoading:g})]})})}export{kt 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.