PageSourceSearch

https://encontreumnerd.com.br/assets/Vacancies-50kiqG95.js

js encontreumnerd.com.br collected 2026-09-29 08:54:26 UTC 57,677 bytes, 91 lines download raw bytes

1import{u as ge,j as e,a as rs}from"./vendor-query-Cuv1FQk6.js";import{J as ee,s as is,S as os}from"./SEO-C_Dunz7h.js";import{h as Oe,r as p,u as cs,L as Ee}from"./vendor-react-qWEbcnl5.js";import{s as M,c as te,L as Ie,I as Se,B as N,H as Te,J as Pe,K as ze,M as qe,u as H}from"./index-zfWpKczA.js";import{C as w,a as P,b as z,c as ls,d as k}from"./card-nIfhOB9l.js";import{B as R}from"./badge-DzLwprAn.js";import{T as Me,a as Re,b as me,c as D,d as Ge,e as O}from"./table-8EHVE-Kn.js";import{a as J,Z as se,M as fe,a7 as Ne,ar as ds,aV as ms,ab as us,cu as xs,bJ as ps,i as hs,aX as Be,b as we,P as ue,az as Ce,cU as js,aT as gs,a8 as fs,ag as $e,a5 as ke,g as Q,z as He,ac as xe,af as Ve,aA as Ns,bv as We,dd as bs,b8 as Ue,as as vs,aE as _s,a6 as ys,C as ws,f as Cs,e6 as Ss,bk as ks,bn as As,cB as Es,a2 as Fe}from"./vendor-icons-CQPDGG0w.js";import{c as Is,d as Ts,b as Ps,f as zs,a as qs}from"./useVacancies-JcJBzE_k.js";import{D as ce,C as Vs,W as Fs}from"./vacancyRequest-Ct9H-2lH.js";import{g as L}from"./defaultVacancyFields-Dkhgz4iC.js";import{S as Ls,a as Ds,b as Os,c as Ms}from"./StepLocation-CHcKxME0.js";import{C as Rs}from"./ClientSelector-CvVdqF8y.js";import{A as Qe,h as Gs,a as Je,b as Ke,c as Ze,d as Ye,e as Xe,f as es,g as ss}from"./alert-dialog-h9xbSdxk.js";import{F as Bs,V as $s,b as Hs,a as Ws}from"./VacancyReferralHistory-D0oq6LiJ.js";import{T as Us}from"./textarea-D-frvQVz.js";import{S as Qs}from"./switch-Cihyeft1.js";import as from"./purify.es-C5KSVp3G.js";import{M as Js}from"./MarkdownDescription-liB7PWBO.js";import{f as ts}from"./vendor-date-DPnnVmFc.js";import{p as ns}from"./pt-BR-CXtXmsVd.js";import{C as Le}from"./checkbox-DjMZVAqf.js";import{S as ne}from"./skeleton-D1mhoZfQ.js";import{S as Ks}from"./SeniorityBadge-Dkq2LzmW.js";import{V as Zs}from"./VacancyStatusBadge-tPEVsyuE.js";import{D as le,f as Ys,a as de,b as pe,c as he}from"./dialog-DuxVnlC8.js";import{P as Xs,a as ea,b as _e,c as sa,d as aa,e as ta}from"./pagination-NdWP9xPj.js";import{S as re}from"./stat-card-DZ9kCiz2.js";import{P as na}from"./pill-filter-BgyCXvlV.js";import{V as ra,W as ia}from"./vacancy-3jptRtg_.js";import{a as ie}from"./navConfig-CileBwpV.js";import{A as oa}from"./AppLayout-vWlYtVQ4.js";import"./vendor-helmet-OKLD9pxQ.js";import"./vendor-radix-C88Ak59v.js";import"./vendor-supabase-C_eKbu-8.js";import"./vendor-recharts-D60XYxEx.js";import"./v4-CtL-rcPH.js";import"./select-LTnkqeGx.js";import"./calendar-CbyiMHD1.js";import"./popover-Ioz91uHh.js";import"./viacep-BXvIbvJI.js";import"./useClients-vLJMR2YZ.js";import"./rich-text-editor-CW9AHJ8X.js";import"./vendor-editor-CCsn4aQE.js";import"./toggle-BWAlDfeY.js";import"./separator-BycvXsB5.js";import"./dropdown-menu-BVgbauwS.js";import"./useVacancyCandidateCount-jxZbRqc1.js";import"./sheet-7c-9XOXx.js";import"./useAutoAccessibleName-C2Hmhm1w.js";import"./candidate-Cq-TFxVZ.js";import"./useMyProviderProfile-wIl8oaTm.js";import"./techProfileOptions-EoQII7Zj.js";import"./useProviderImpersonation-CUWn8Arj.js";import"./auth-aC4rSeAl.js";import"./constants-DVjN3GEQ.js";import"./useImpersonation-B1LfuRj_.js";import"./avatar-Z2K9-Msq.js";import"./useUserPermissions-DXF2DUGf.js";import"./usePermissions-DnbGTUME.js";import"./Logo-DAXOQ50u.js";function ca(s){return ge({queryKey:["vacancy-candidate-search",s],queryFn:async()=>{if(!s||s.length<2)return[];const{data:a,error:l}=await M.from("candidates").select("id, nome, email, telefone, cidade, estado, etapa").or(`nome.ilike.%${s}%,email.ilike.%${s}%`).limit(20);if(l)throw l;if(!a||a.length===0)return[];const n=a.map(m=>m.id),{data:d,error:i}=await M.from("vacancy_applications").select("candidate_id, vacancy_id, status, vacancies!inner(title)").in("candidate_id",n);if(i)throw i;const u={};return(d||[]).forEach(m=>{const x=m.candidate_id;x&&(u[x]||(u[x]=[]),u[x].push({vacancy_id:m.vacancy_id,vacancy_title:m.vacancies?.title||"Sem título",status:m.status||"new"}))}),a.map(m=>({...m,vacancies:u[m.id]||[]}))},enabled:!!s&&s.length>=2,staleTime:6e4})}const la={triagem:"Triagem",entrevista:"Entrevista",proposta:"Proposta",contratado:"Contratado",arquivado:"Arquivado"};function da({searchTerm:s}){const a=Oe(),{data:l=[],isLoading:n}=ca(s);return!s||s.length<2?null:n?e.jsx(w,{variant:"clean",className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(J,{className:"h-4 w-4 animate-spin"}),"Buscando candidatos..."]})}):l.length===0?null:e.jsxs(w,{variant:"clean",className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 pb-2 border-b border-border/50",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold",children:"Candidatos encontrados"}),e.jsx(R,{variant:"secondary",className:"text-xs",children:l.length})]})}),e.jsxs(Me,{children:[e.jsx(Re,{children:e.jsxs(me,{className:"hover:bg-transparent",children:[e.jsx(D,{children:"Candidato"}),e.jsx(D,{children:"Localização"}),e.jsx(D,{children:"Etapa"}),e.jsx(D,{children:"Vagas associadas"})]})}),e.jsx(Ge,{children:l.map(d=>e.jsxs(me,{className:"cursor-pointer",onClick:()=>a(`/talentos?search=${encodeURIComponent(d.nome)}`),children:[e.jsx(O,{className:"py-3",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-sm",children:d.nome}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d.email})]})}),e.jsx(O,{children:e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(fe,{className:"h-3 w-3"}),d.cidade,"/",d.estado]})}),e.jsx(O,{children:e.jsx(R,{variant:"outline",className:"text-xs",children:la[d.etapa]||d.etapa})}),e.jsx(O,{children:d.vacancies.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:d.vacancies.map(i=>e.jsx(R,{variant:"muted",className:"text-xs cursor-pointer hover:bg-primary/20",onClick:u=>{u.stopPropagation(),a(`/vagas/view/${i.vacancy_id}`)},children:i.vacancy_title},i.vacancy_id))}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Nenhuma vaga"})})]},d.id))})]})]})}function ma(){return ge({queryKey:["vacancy-candidate-counts"],queryFn:async()=>{const{data:s,error:a}=await M.rpc("get_vacancy_application_counts");if(a)throw a;return s??{}},staleTime:6e4})}function ua(){return ge({queryKey:["vacancy-hired-counts"],queryFn:async()=>{const{data:s,error:a}=await M.rpc("get_vacancy_hired_counts");if(a)throw a;return s??{}},staleTime:6e4})}const oe=["scope","client","requirements","period","location","form_builder","review","candidates"],U=[{id:"scope",label:"Escopo",shortLabel:"1"},{id:"client",label:"Cliente",shortLabel:"2"},{id:"requirements",label:"Requisitos",shortLabel:"3"},{id:"period",label:"Período",shortLabel:"4"},{id:"location",label:"Local",shortLabel:"5"},{id:"form_builder",label:"Formulário",shortLabel:"6"},{id:"review",label:"Revisão IA",shortLabel:"7"},{id:"candidates",label:"Candidatos",shortLabel:"8"}],De={...ce,client_name:"",project_name:"",form_schema:L(),slug:"",selected_channels:["portal"]};function xa({currentStep:s,completedSteps:a}){const l=U.findIndex(n=>n.id===s);return e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"hidden md:flex items-center justify-between",children:U.map((n,d)=>
1{const i=a.includes(n.id),u=n.id===s,m=d<l;return e.jsxs("div",{className:"flex items-center flex-1",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:te("w-10 h-10 rounded-full flex items-center justify-center text-sm font-medium transition-all",i?"bg-primary text-primary-foreground":u?"bg-primary text-primary-foreground ring-4 ring-primary/20":"bg-muted text-muted-foreground"),children:i?e.jsx(Ne,{className:"h-5 w-5"}):d+1}),e.jsx("span",{className:te("mt-2 text-xs font-medium whitespace-nowrap",u?"text-primary":m||i?"text-foreground":"text-muted-foreground"),children:n.label})]}),d<U.length-1&&e.jsx("div",{className:te("flex-1 h-0.5 mx-2",m||i?"bg-primary":"bg-muted")})]},n.id)})}),e.jsxs("div",{className:"md:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Passo ",l+1," de ",U.length]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:U[l]?.label})]}),e.jsx("div",{className:"flex gap-1",children:U.map((n,d)=>e.jsx("div",{className:te("flex-1 h-2 rounded-full transition-all",d<=l?"bg-primary":"bg-muted")},n.id))})]})]})}const pa=[{id:"analista-suporte-jr",name:"Analista de Suporte Jr",description:"Profissional para atendimento de primeiro nível, suporte a usuários e resolução de problemas básicos de TI.",icon:e.jsx(ds,{className:"h-8 w-8"}),tags:["Suporte","Nível 1","Atendimento"],formData:{job_title:"Analista de Suporte Jr",job_area:"suporte",scope_of_services:`Atribuições:
2- Atendimento de chamados de primeiro nível via telefone, e-mail e chat
3- Suporte a usuários em questões de hardware e software
4- Instalação e configuração de sistemas operacionais e aplicativos
5- Manutenção preventiva de equipamentos
6- Documentação de procedimentos e atendimentos realizados
7- Escalonamento de chamados para níveis superiores quando necessário
8
9Requisitos:
10- Conhecimento em Windows e pacote Office
11- Noções de redes e hardware
12- Boa comunicação e atendimento ao cliente
13- Proatividade e organização`,contract_type:"pj",positions_count:1,client_name:"",project_name:"",form_schema:L()}},{id:"analista-service-desk",name:"Analista Service Desk",description:"Profissional para gerenciamento de incidentes, requisições e suporte técnico de segundo nível.",icon:e.jsx(ms,{className:"h-8 w-8"}),tags:["Service Desk","Nível 2","ITIL"],formData:{job_title:"Analista Service Desk",job_area:"tecnologia",scope_of_services:`Atribuições:
14- Gestão de incidentes e requisições de serviço
15- Atendimento de segundo nível para chamados escalados
16- Análise e resolução de problemas de infraestrutura
17- Configuração de VPN, e-mail corporativo e Active Directory
18- Suporte a aplicações corporativas
19- Elaboração de relatórios e indicadores de atendimento
20- Participação em projetos de melhoria contínua
21
22Requisitos:
23- Experiência em Service Desk ou suporte técnico
24- Conhecimento em ITIL (desejável certificação)
25- Domínio de Active Directory, Office 365 e ferramentas de ITSM
26- Capacidade analítica e foco em resolução de problemas`,contract_type:"pj",positions_count:1,client_name:"",project_name:"",form_schema:L()}},{id:"analista-field-services",name:"Analista Field Services",description:"Profissional para suporte técnico presencial, manutenção de equipamentos e atendimento em campo.",icon:e.jsx(us,{className:"h-8 w-8"}),tags:["Field","Presencial","Hardware"],formData:{job_title:"Analista Field Services",job_area:"tecnologia",scope_of_services:`Atribuições:
27- Suporte técnico presencial em clientes e filiais
28- Instalação e configuração de desktops, notebooks e periféricos
29- Manutenção corretiva e preventiva de hardware
30- Configuração de redes locais e wireless
31- Implantação de novos postos de trabalho
32- Acompanhamento de projetos de rollout e refresh tecnológico
33- Documentação técnica e controle de inventário
34
35Requisitos:
36- Experiência em suporte presencial/field services
37- Conhecimento avançado em hardware PC
38- Disponibilidade para deslocamentos
39- CNH categoria B (desejável)
40- Boa organização e autonomia`,contract_type:"pj",work_mode:"presencial",positions_count:1,client_name:"",project_name:"",form_schema:L()}},{id:"desenvolvedor-fullstack",name:"Desenvolvedor Full Stack",description:"Profissional para desenvolvimento web com React, Node.js e bancos de dados.",icon:e.jsx(xs,{className:"h-8 w-8"}),tags:["Tecnologia","Desenvolvimento","Web"],formData:{job_title:"Desenvolvedor Full Stack",job_area:"tecnologia",scope_of_services:`Atribuições:
41- Desenvolvimento de aplicações web com React e Node.js
42- Integração com APIs RESTful e GraphQL
43- Manutenção de bancos de dados SQL e NoSQL
44- Code review e mentoria de desenvolvedores júnior
45- Participação em cerimônias ágeis
46- Deploy e manutenção de aplicações em cloud
47
48Requisitos:
49- Experiência com React, TypeScript e Node.js
50- Conhecimento em PostgreSQL ou MongoDB
51- Familiaridade com Git e CI/CD
52- Inglês técnico para leitura de documentação`,contract_type:"pj",work_mode:"remoto",positions_count:1,client_name:"",project_name:"",form_schema:L()}},{id:"analista-dba",name:"Analista DBA",description:"Especialista em administração de bancos de dados, performance e backup.",icon:e.jsx(ps,{className:"h-8 w-8"}),tags:["Database","SQL","Performance"],formData:{job_title:"Analista DBA",job_area:"tecnologia",scope_of_services:`Atribuições:
53- Administração de bancos de dados SQL Server, Oracle e PostgreSQL
54- Monitoramento de performance e tuning de queries
55- Implementação e gerenciamento de políticas de backup
56- Gestão de usuários e permissões
57- Análise de capacidade e planejamento de crescimento
58- Suporte a equipes de desenvolvimento em otimização de queries
59
60Requisitos:
61- Experiência comprovada como DBA
62- Domínio de SQL Server, Oracle ou PostgreSQL
63- Conhecimento em alta disponibilidade e disaster recovery
64- Experiência com ferramentas de monitoramento`,contract_type:"pj",work_mode:"hibrido",positions_count:1,client_name:"",project_name:"",form_schema:L()}},{id:"analista-seguranca",name:"Analista de Segurança da Informação",description:"Profissional para gestão de segurança, análise de vulnerabilidades e compliance.",icon:e.jsx(hs,{className:"h-8 w-8"}),tags:["Segurança","Compliance","Pentest"],formData:{job_title:"Analista de Segurança da Informação",job_area:"tecnologia",scope_of_services:`Atribuições:
65- Gestão de políticas e procedimentos de segurança
66- Análise de vulnerabilidades e testes de penetração
67- Monitoramento de eventos de segurança (SIEM)
68- Gestão de incidentes de segurança
69- Implementação de controles de acesso
70- Conscientização de usuários sobre segurança
71- Apoio em auditorias e compliance (LGPD, ISO 27001)
72
73Requisitos:
74- Experiência em segurança da informação
75- Conhecimento em frameworks de segurança (NIST, ISO 27001)
76- Familiaridade com ferramentas de pentest e SIEM
77- Certificações desejáveis: CEH, CISSP, CompTIA Security+`,contract_type:"pj",work_mode:"hibrido",positions_count:1,client_name:"",project_name:"",form_schema:L()}},{id:"analista-infraestrutura",name:"Analista de Infraestrutura",description:"Profissional para gestão de servidores, redes e cloud computing.",icon:e.jsx(Be,{className:"h-8 w-8"}),tags:["Infraestrutura","Cloud","Redes"],formData:{job_title:"Analista de Infraestrutura",job_area:"tecnologia",scope_of_services:`Atribuições:
78- Administração de servidores Windows e Linux
79- Gestão de ambientes cloud (AWS, Azure, GCP)
80- Configuração e manutenção de redes corporativas
81- Implementação de soluções de virtualização
82- Monitoramento de disponibilidade e performance
83- Automação de tarefas com scripts (PowerShell, Bash)
84- Documentação técnica de ambientes
85
86Requisitos:
87- Experiência em administração de servidores
88- Conhecimento em cloud computing (AWS, Azure)
89- Familiaridade com virtualização (VMware, Hyper-V)
90- Noções de containerização (Docker, Kubernetes)
91- Certificações desejáveis: AWS, Azure, CCNA`,contract_type:"pj",work_mode:"hibrido",positions_count:1,client_name:"",project_name:"",form_schema:L()}}];function ha({onSelectTemplate:s}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Como você deseja começar?"}),e.jsx("p",{className:"text-muted-foreground",children:"Escolha um template para agilizar o preenchimento ou comece do zero"})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:pa.map(a=>e.jsxs(w,{className:"cursor-pointer hover:border-primary/50 hover:shadow-md transition-all group",onClick:()=>s(a),children:[e.jsxs(P,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary group-hover:bg-primary group-hover:text-primary-foreground transition-colors",children:a.icon}),e.jsx(we,{className:"h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]}),e.jsx(z,{className:"text-lg mt-3",children:a.name}),e.jsx(ls,{className:"text-sm line-clamp-2",children:a.description})]}),e.jsx(k,{className:"pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.tags.map(l
91=>e.jsx(R,{variant:"secondary",className:"text-xs",children:l},l))})})]},a.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"ou"})})]}),e.jsx(w,{className:"cursor-pointer hover:border-primary/50 hover:shadow-md transition-all group border-dashed",onClick:()=>s(null),children:e.jsxs(k,{className:"flex items-center justify-center gap-3 py-8",children:[e.jsx("div",{className:"p-2 rounded-lg bg-muted text-muted-foreground group-hover:bg-primary group-hover:text-primary-foreground transition-colors",children:e.jsx(ue,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Começar do Zero"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Preencha todos os campos manualmente"})]}),e.jsx(we,{className:"h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]})})]})}function ja({formData:s,onChange:a,errors:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Cliente e Projeto"}),e.jsx("p",{className:"text-muted-foreground",children:"Defina para qual cliente esta vaga será criada"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ie,{htmlFor:"client_name",children:"Cliente"}),e.jsx(Rs,{value:s.client_name,onChange:n=>a({client_name:n}),placeholder:"Selecione ou digite o cliente...",allowCreate:!0}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(Ce,{className:"h-3 w-3"}),"Se vazio, será considerada uma vaga interna da Eunerd"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ie,{htmlFor:"project_name",children:"Projeto (opcional)"}),e.jsx(Se,{id:"project_name",value:s.project_name,onChange:n=>a({project_name:n.target.value}),placeholder:"Nome do projeto"}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(Ce,{className:"h-3 w-3"}),"Identifique o projeto específico desta vaga"]})]})]})]})}function ga({formData:s,onChange:a}){const l=()=>{a({form_schema:L()})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Formulário de Candidatura"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure os campos que os candidatos preencherão ao se candidatar"})]}),e.jsxs(Qe,{children:[e.jsx(Gs,{asChild:!0,children:e.jsxs(N,{type:"button",variant:"outline",size:"sm",children:[e.jsx(js,{className:"h-4 w-4 mr-2"}),"Restaurar Padrão"]})}),e.jsxs(Je,{children:[e.jsxs(Ke,{children:[e.jsx(Ze,{children:"Restaurar campos padrão?"}),e.jsx(Ye,{children:"Esta ação substituirá os campos atuais pelos campos padrão do formulário."})]}),e.jsxs(Xe,{children:[e.jsx(es,{children:"Cancelar"}),e.jsx(ss,{onClick:l,children:"Restaurar"})]})]})]})]}),e.jsx("div",{className:"max-h-[400px] overflow-y-auto pr-2",children:e.jsx(Bs,{fields:s.form_schema,onChange:n=>a({form_schema:n})})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Arraste os campos para reordená-los. Use os ícones para editar ou remover."})]})}const fa={portal:e.jsx($e,{className:"h-5 w-5"}),google_jobs:e.jsx(ke,{className:"h-5 w-5"})};function je({channel:s,enabled:a,locked:l=!1,disabled:n=!1,issues:d=[],onChange:i}){const u=d.length>0,m=l||n||u;return e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-xl border transition-colors ${a?"bg-primary/5 border-primary/20":"bg-muted/30 border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${a?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:fa[s.id]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:s.name}),l&&e.jsx(Te,{children:e.jsxs(Pe,{children:[e.jsx(ze,{children:e.jsx(gs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx(qe,{children:e.jsx("p",{children:"Este canal está sempre ativo"})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[u&&e.jsx(Te,{children:e.jsxs(Pe,{children:[e.jsx(ze,{children:e.jsxs(R,{variant:"outline",className:"text-warning border-warning/30 bg-warning/10",children:[e.jsx(fs,{className:"h-3 w-3 mr-1"}
91),"Requisitos pendentes"]})}),e.jsx(qe,{className:"max-w-xs",children:e.jsx("ul",{className:"text-xs space-y-1",children:d.map((x,t)=>e.jsxs("li",{className:"flex items-start gap-1",children:[e.jsx("span",{className:"text-warning",children:"•"}),x]},t))})})]})}),e.jsx(Qs,{checked:a,onCheckedChange:i,disabled:m,"aria-label":`${a?"Desativar":"Ativar"} ${s.name}`})]})]})}function Na({formData:s,onChange:a}){const l=p.useMemo(()=>{const i=[],u=s.scope_of_services?as.sanitize(s.scope_of_services,{ALLOWED_TAGS:[]}):"";return(!u||u.length<100)&&i.push("Descrição precisa ter pelo menos 100 caracteres"),!s.work_mode&&!s.location_cep&&i.push("Defina modalidade de trabalho ou localização"),s.contract_type||i.push("Tipo de contrato não definido"),i},[s.scope_of_services,s.work_mode,s.location_cep,s.contract_type]),n=l.length===0,d=(i,u)=>{let m=[...s.selected_channels];u?m.includes(i)||m.push(i):m=m.filter(x=>x!==i),m.includes("portal")||m.unshift("portal"),a({selected_channels:m})};return e.jsxs(w,{children:[e.jsx(P,{className:"pb-3",children:e.jsx(z,{className:"text-sm font-medium flex items-center gap-2",children:"Canais de Publicação"})}),e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Escolha onde sua vaga será publicada. O Google Jobs ajuda candidatos a encontrar sua vaga diretamente nas buscas do Google."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(je,{channel:ee.portal,enabled:!0,locked:!0}),e.jsx(je,{channel:ee.google_jobs,enabled:s.selected_channels.includes("google_jobs"),disabled:!n,issues:l,onChange:i=>d("google_jobs",i)})]}),e.jsxs("div",{className:"flex items-start gap-2 pt-2 text-xs text-muted-foreground bg-muted/30 rounded-lg p-3",children:[e.jsx(Ce,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{children:"O Google Jobs indexa vagas automaticamente através de dados estruturados na página."}),e.jsx("p",{className:"mt-1",children:"A indexação pode levar até 24-72 horas após a publicação."})]})]})]})]})}const ba={skill:e.jsx(We,{className:"h-4 w-4"}),salary:e.jsx("span",{className:"text-base"}),requirement:e.jsx("span",{className:"text-base"}),general:e.jsx("span",{className:"text-base"})},va={skill:"bg-info/10 text-info dark:bg-info/30 dark:text-info",salary:"bg-success/10 text-success dark:bg-success/30 dark:text-success",requirement:"bg-info/10 text-info dark:bg-info/30 dark:text-info",general:"bg-warning/10 text-warning dark:bg-warning/30 dark:text-warning"};function _a({formData:s,aiResult:a,onAiResult:l,isOptimizing:n,setIsOptimizing:d,onFormDataChange:i}){const[u,m]=p.useState(!1),[x,t]=p.useState(""),[b,j]=p.useState(!1);p.useEffect(()=>{!a&&!n&&f()},[]),p.useEffect(()=>{a&&t(a.optimized_description)},[a]);const f=async(h=!1)=>{h?j(!0):d(!0);try{const A=s.salary_min?parseFloat(s.salary_min.replace(/\./g,"").replace(",",".")):void 0,I=s.salary_max?parseFloat(s.salary_max.replace(/\./g,"").replace(",",".")):void 0,{data:B,error:q}=await M.functions.invoke("optimize-vacancy-request",{body:{job_title:s.job_title,job_description:s.job_description,scope_of_services:s.scope_of_services,job_area:s.job_area,positions_count:s.positions_count,requires_epi:s.requires_epi,epi_items:s.epi_items,requires_aso:s.requires_aso,requires_integration:s.requires_integration,integration_details:s.integration_details,period_type:s.period_type,start_date:s.start_date?.toISOString(),end_date:s.end_date?.toISOString(),contract_type:s.contract_type,work_mode:s.work_mode,location_city:s.location_city,location_state:s.location_state,salary_min:A,salary_max:I,salary_type:s.salary_type,benefits_notes:s.benefits_notes,apply_suggestions:h,previous_suggestions:h?a?.suggestions:void 0,previous_description:h?a?.optimized_description:void 0}});if(q)throw q;l(B),h&&H.success("Sugestões aplicadas! Descrição atualizada.")}catch(A){console.error("Error optimizing with AI:",A),H.error("Erro ao otimizar com IA. Você pode continuar sem otimização."),h||l({optimized_description:s.scope_of_services||s.job_description||"",suggestions:[],job_title_suggestion:s.job_title,estimated_time_to_fill:"10-15 dias úteis"})}finally{d(!1),j(!1)}},c=()=>{a&&l({...a,optimized_description:x}),m(!1)},v=Vs.find(h=>h.value===s.contract_type)?.label||s.contract_type,g=s.work_mode?Fs[s.work_mode]?.label:null;return n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Otimizando..."}),e.jsx("p",{className:"text-muted-foreground",children:"Analisando sua vaga para sugerir melhorias"})]}),e.jsx(w,{children:e.jsxs(k,{className:"flex flex-col items-center justify-center py-12",children:[e.jsxs("div",{className:"relative",children:[e.jsx(J,{className:"h-12 w-12 animate-spin text-primary"}),e.jsx(Q,{className:"h-5 w-5 text-primary absolute -top-1 -right-1 animate-pulse"})]}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"Analisando sua vaga..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Isso pode levar alguns segundos"})]})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Revisão Final"}),e.jsx("p",{className:"text-muted-foreground",children:"Revise as informações e a descrição otimizada"})]}),e.jsxs(w,{children:[e.jsx(P,{className:"pb-3",children:e.jsx(z,{className:"text-sm font-medium",children:"Resumo da Vaga"})}),e.jsxs(k,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Título:"}),e.jsx("span",{className:"font-medium",children:s.job_title||"Não informado"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Cliente:"}),e.jsx("span",{className:"font-medium",children:s.client_name||"Interno (Eunerd)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Modalidade:"}),e.jsx("span",{className:"font-medium",children:g||"Não informado"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Contrato:"}),e.jsx("span",{className:"font-medium",children:v||"Não informado"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Vagas:"}),e.jsx("span",{className:"font-medium",children:s.positions_count})]}),s.start_date&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Início:"}),e.jsx("span",{className:"font-medium",children:ts(s.start_date,"dd/MM/yyyy",{locale:ns})})]})]}),s.form_schema.length>0&&e.jsx("div",{className:"pt-2 border-t",children:e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.form_schema.length," campos no formulário de candidatura"]})})]})]}),a&&e.jsxs(e.Fragment,{children:[a.job_title_suggestion&&a.job_title_suggestion!==s.job_title&&e.jsxs(w,{className:"border-primary/50",children:[e.jsx(P,{className:"pb-2",children:e.jsxs(z,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-primary"}),"Título Sugerido"]})}),e.jsxs(k,{children:[e.jsx("p",{className:"font-medium",children:a.job_title_suggestion}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Título original: ",s.job_title]})]})]}),e.jsxs(w,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(z,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-primary"}),"Descrição Otimizada"]}),e.jsxs(N,{variant:"ghost",size:"sm",onClick:()=>m(!u),children:[e.jsx(Ns,{className:"h-4 w-4 mr-1"}),u?"Cancelar":"Editar"]})]})}),e.jsx(k,{children:u?e.jsxs("div",{className:"space-y-2",children:[e.jsx(Us,{value:x,onChange:h=>t(h.target.value),rows:8}),e.jsxs(N,{size:"sm",onClick:c,children:[e.jsx(Ne,{className:"h-4 w-4 mr-1"}),"Salvar"]})]}):e.jsx("div",{className:"text-sm leading-relaxed max-h-48 overflow-y-auto prose-vacancy",children:e.jsx(Js,{content:a.optimized_description})})})]}),a.suggestions&&a.suggestions.length>0&&e.jsxs(w,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(z,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(We,{className:"h-4 w-4 text-warning"}),"Sugestões de Melhoria"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>f(!0),disabled:b||n,children:[b?e.jsx(J,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(bs,{className:"h-4 w-4 mr-2"}),"Aplicar Todas"]})]})}),e.jsx(k,{children:e.jsx("ul",{className:"space-y-3 max-h-40 overflow-y-auto",children:a.suggestions.map((h,A)=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`flex items-center justify-center w-6 h-6 rounded-full shrink-0 ${va[h.type]}`,children:ba[h.type]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs(R,{variant:"outline",className:"text-xs mb-1",children:[h.type==="skill"&&"Habilidade",h.type==="salary"&&"Remuneração",h.type==="requirement"&&"Requisito",h.type==="general"&&"Geral"]}),e.jsx("p",{className:"text-sm",children:h.text})]})]},A))})})]}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(N,{variant:"outline",onClick:()=>f(!1),disabled:n||b,children:[e.jsx(Q,{className:"h-4 w-4 mr-2"}),"Reotimizar"]})}),e.jsx(Na,{formData:s,onChange:i})]})]})}function ya({lastJobDate:s}){if(!s)return null;const a=Math.floor((Date.now()-new Date(s).getTime())/(1e3*60*60*24));return a<90?e.jsx("span",{className:"inline-flex items-center text-[11px] font-semibold text-success bg-success/10 border border-success/20 px-2 py-0.5 rounded-md",children:"Ativo"}):a<365?e.jsx("span",{className:"inline-flex items-center text-[11px] font-semibold text-warning bg-warning/10 border border-warning/20 px-2 py-0.5 rounded-md",children:"Semi-ativo"}):e.jsx("span",{className:"inline-flex items-center text-[11px] font-semibold text-muted-foreground bg-muted border border-border px-2 py-0.5 rounded-md",children:"Inativo"})}function wa({score:s}){const a=s>=50?"text-success bg-success/10 border-success/20":s>=30?"text-primary bg-primary/10 border-primary/20":"text-warning bg-warning/10 border-warning/20";return e.jsxs("div",{className:`flex flex-col items-center justify-center rounded-xl border px-3 py-1.5 ${a}`,children:[e.jsx("span",{className:"text-base font-bold leading-none",children:s}),e.jsx("span",{className:"text-[9px] font-medium opacity-70 leading-none mt-0.5",children:"pts"})]})}function Ca({vacancyId:s,vacancyTitle:a,onSendComplete:l}){const[n,d]=p.useState(new Set),[i,u]=p.useState(!1),m=rs(),{data:x,isLoading:t}=ge({queryKey:["wizard-candidate-suggestions",s],queryFn:async()=>{const{data:c}=await M.auth.getSession(),v=await M.functions.invoke("suggest-candidates-for-vacancy",{body:{vacancy_id:s},headers:{Authorization:`Bearer ${c.session?.access_token}`}});if(v.error)throw v.error;return v.data?.candidates||[]},enabled:!!s}),b=c=>{d(v=>{const g=new Set(v);return g.has(c)?g.delete(c):g.add(c),g})},j=()=>{x&&(n.size===x.length?d(new Set):d(new Set(x.map(c=>c.candidate_id))))},f=async()=>
91{if(n.size!==0){u(!0);try{const{data:c}=await M.auth.getSession(),v=await M.functions.invoke("send-vacancy-referrals",{body:{vacancy_id:s,candidate_ids:Array.from(n)},headers:{Authorization:`Bearer ${c.session?.access_token}`}});if(v.error)throw v.error;const g=v.data?.sent||0;H.success(`${g} convite${g!==1?"s":""} enviado${g!==1?"s":""} com sucesso!`),m.invalidateQueries({queryKey:["wizard-candidate-suggestions",s]}),m.invalidateQueries({queryKey:["vacancy-referrals",s]}),d(new Set),l?.()}catch(c){console.error(c),H.error("Erro ao enviar convites")}finally{u(!1)}}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(Q,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold",children:"Candidatos Recomendados"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:['Talentos compatíveis com "',a,'" — selecione para enviar convites.']})]})]}),t?e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((c,v)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-muted/30",children:[e.jsx(ne,{className:"h-4 w-4 rounded"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ne,{className:"h-4 w-40"}),e.jsx(ne,{className:"h-3 w-28"})]}),e.jsx(ne,{className:"h-10 w-12 rounded-xl"})]},v))}):x?.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(Le,{checked:n.size===x.length&&x.length>0,onCheckedChange:j}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n.size===x.length?"Desmarcar todos":"Selecionar todos"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length," encontrado",x.length!==1?"s":""]}),n.size>0&&e.jsxs("span",{className:"text-xs font-semibold text-primary bg-primary/10 px-2 py-0.5 rounded-full",children:[n.size," selecionado",n.size!==1?"s":""]})]})]}),e.jsx("div",{className:"space-y-1.5 max-h-[400px] overflow-y-auto",children:x.map(c=>{const v=n.has(c.candidate_id);return e.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-xl border cursor-pointer transition-all duration-150 ${v?"border-primary/40 bg-primary/[0.03] shadow-sm":"border-transparent bg-muted/30 hover:bg-muted/50"}`,children:[e.jsx(Le,{checked:v,onCheckedChange:()=>b(c.candidate_id),className:"shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm truncate max-w-[200px]",children:c.nome}),e.jsx(Ks,{level:c.nivel_senioridade}),e.jsx(ya,{lastJobDate:c.last_job_date})]}),e.jsxs("div",{className:"flex items-center gap-2.5 mt-1 text-[11px] text-muted-foreground",children:[c.cidade&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(fe,{className:"h-3 w-3 shrink-0"}),c.cidade]}),c.total_jobs_completed>0&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(vs,{className:"h-3 w-3 shrink-0"}),c.total_jobs_completed," jobs"]}),c.cnpj&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(xe,{className:"h-3 w-3 shrink-0"}),"PJ"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:c.match_reasons.map((g,h)=>e.jsx("span",{className:"text-[10px] font-medium bg-primary/8 text-primary/80 border border-primary/10 px-1.5 py-0.5 rounded-md",children:g},h))})]}),e.jsx(wa,{score:c.score})]},c.candidate_id)})}),n.size>0&&e.jsx(N,{onClick:f,disabled:i,className:"w-full h-11",children:i?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"h-4 w-4 animate-spin mr-2"}),"Enviando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_s,{className:"h-4 w-4 mr-2"}),"Enviar ",n.size," Convite",n.size!==1?"s":""]})})]}):e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(Ue,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-sm",children:"Nenhum candidato compatível encontrado"}),e.jsx("p",{className:"text-xs mt-1 max-w-[260px] mx-auto",children:"Não há candidatos na base que se encaixem nos critérios desta vaga. Você pode finalizar e indicar depois."})]})]})}function Sa({initialData:s,onSuccess:a,onCancel:l}){const[n,d]=p.useState(!s),[i,u]=p.useState("scope"),[m,x]=p.useState([]),[t,b]=p.useState({...De,...s}),[j,f]=p.useState({}),[c,v]=p.useState(null),[g,h]=p.useState(!1),[A,I]=p.useState(!1),[B,q]=p.useState(null),K=Is(),V=oe.indexOf(i),T=o=>{b(_=>({..._,...o}
91)),f({})},ae=()=>{const o={};switch(i){case"scope":t.job_title.trim()||(o.job_title="Título é obrigatório"),t.job_area||(o.job_area="Área é obrigatória"),(!t.scope_of_services.trim()||t.scope_of_services.length<50)&&(o.scope_of_services="Descrição deve ter pelo menos 50 caracteres");break;case"period":t.start_date||(o.start_date="Data de início é obrigatória"),t.period_type==="defined"&&!t.end_date&&(o.end_date="Data de término é obrigatória"),t.contract_type||(o.contract_type="Tipo de contrato é obrigatório");break;case"location":t.work_mode!=="remoto"&&!t.location_cep&&(o.location_cep="CEP é obrigatório para trabalho presencial/híbrido");break}return f(o),Object.keys(o).length===0},Z=async()=>{I(!0);try{const o=c?.optimized_description||t.scope_of_services,_=is(t.selected_channels),r=(await K.mutateAsync({title:c?.job_title_suggestion||t.job_title,slug:t.slug||void 0,description:o,form_schema:t.form_schema,job_area:t.job_area||void 0,contract_type:t.contract_type||void 0,work_mode:t.work_mode||void 0,client_name:t.client_name.trim()||null,project_name:t.project_name.trim()||null,location:t.location_city?`${t.location_city}, ${t.location_state}`:null,job_channels:_}))?.id;return r?(q(r),r):null}catch(o){return console.error("Error creating vacancy:",o),null}finally{I(!1)}},$=async()=>{ae()&&(m.includes(i)||x([...m,i]),!(i==="review"&&!await Z())&&V<oe.length-1&&u(oe[V+1]))},W=()=>{if(V>0){if(i==="candidates")return;u(oe[V-1])}},Y=o=>{o&&b({...De,...o.formData}),d(!1)},E=t,S=o=>{T(o)},be=p.useCallback(o=>{const _={};o.positions_count&&t.positions_count===ce.positions_count&&(_.positions_count=o.positions_count),o.work_mode&&t.work_mode===ce.work_mode&&(_.work_mode=o.work_mode),o.location_city&&!t.location_city&&(_.location_city=o.location_city),o.location_state&&!t.location_state&&(_.location_state=o.location_state),o.period_type&&t.period_type===ce.period_type&&(_.period_type=o.period_type),o.contract_type&&!t.contract_type&&(_.contract_type=o.contract_type),o.requires_epi!==void 0&&!t.requires_epi&&(_.requires_epi=o.requires_epi,o.epi_items&&o.epi_items.length>0&&(_.epi_items=o.epi_items)),o.requires_aso!==void 0&&!t.requires_aso&&(_.requires_aso=o.requires_aso),o.requires_integration!==void 0&&!t.requires_integration&&(_.requires_integration=o.requires_integration),Object.keys(_).length>0&&T(_)},[t]),ve=()=>{switch(i){case"scope":return e.jsx(Ms,{formData:E,onChange:S,errors:j,onFieldsExtracted:be});case"client":return e.jsx(ja,{formData:t,onChange:T,errors:j});case"requirements":return e.jsx(Os,{formData:E,onChange:S});case"period":return e.jsx(Ds,{formData:E,onChange:S,errors:j});case"location":return e.jsx(Ls,{formData:E,onChange:S,errors:j});case"form_builder":return e.jsx(ga,{formData:t,onChange:T});case"review":return e.jsx(_a,{formData:t,aiResult:c,onAiResult:v,isOptimizing:g,setIsOptimizing:h,onFormDataChange:T});case"candidates":return B?e.jsx(Ca,{vacancyId:B,vacancyTitle:c?.job_title_suggestion||t.job_title}):null;default:return null}};return n?e.jsxs("div",{className:"space-y-4",children:[e.jsx(ha,{onSelectTemplate:Y}),l&&e.jsx("div",{className:"flex justify-center",children:e.jsx(N,{variant:"ghost",onClick:l,children:"Cancelar"})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(xa,{currentStep:i,completedSteps:m}),e.jsx(w,{children:e.jsx(k,{className:"p-6",children:ve()})}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{className:"flex gap-2",children:[i!=="candidates"&&e.jsxs(N,{variant:"outline",onClick:()=>d(!0),disabled:A,children:[e.jsx(ys,{className:"h-4 w-4 mr-2"}),"Templates"]}),V>0&&i!=="candidates"&&e.jsx(N,{variant:"outline",onClick:W,disabled:A,children:"Voltar"})]}),i==="candidates"?e.jsxs(N,{onClick:()=>a?.(),children:[e.jsx(Ne,{className:"h-4 w-4 mr-2"}),"Finalizar"]}):i==="review"?e.jsxs(N,{onClick:$,disabled:A||g,children:[A?e.jsx(J,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(ue,{className:"h-4 w-4 mr-2"}),"Criar Vaga e Ver Candidatos"]}):e.jsxs(N,{onClick:$,disabled:g,children:["Próximo ",e.jsx(we,{className:"h-4 w-4 ml-2"})]})]})]})}const ka={published:{label:"Publicado",icon:e.jsx(ws,{className:"h-3 w-3"}),className:"bg-success/10 text-success border-success/20"},pending:{label:"Pendente",icon:e.jsx(Cs,{className:"h-3 w-3"}),className:"bg-warning/10 text-warning border-warning/20"},disabled:{label:"Desativado",icon:e.jsx(Ss,{className:"h-3 w-3"}),className:"bg-muted text-muted-foreground border-border"}};function Aa({status:s,size:a="default"}){const l=ka[s];return e.jsxs(R,{variant:"outline",className:`${l.className} ${a==="sm"?"text-xs px-1.5 py-0":""}`,children:[l.icon,e.jsx("span",{className:"ml-1",children:l.label})]})}const Ea={portal:e.jsx($e,{className:"h-4 w-4"}),google_jobs:e.jsx(ke,{className:"h-4 w-4"})};function Ia({channels:s,onUpdateChannels:a,isEditable:l=!0}){const[n,d]=p.useState(!1),i=s&&s.length>0?s:[{channel:"portal",status:"published",enabled_at:null,published_at:null}],u=t=>ee[t],m=(t,b)=>{if(!a)return;let j=[...i];const f=j.findIndex(c=>c.channel===t);b?f>=0?j[f]={...j[f],status:"pending",enabled_at:new Date().toISOString()}:j.push({channel:t,status:"pending",enabled_at:new Date().toISOString(),published_at:null}):f>=0&&(j[f]={...j[f],status:"disabled"}),a(j),d(!1)},x=t=>{const b=i.find(j=>j.channel===t);return b&&b.status!=="disabled"};return e.jsxs(w,{children:[e.jsx(P,{className:"pb-2",children:e.jsx(z,{className:"text-sm font-medium flex items-center gap-2",children:"Distribuição"})}),e.jsxs(k,{className:"space-y-3",children:[i.filter(t=>t.status!=="disabled").map(t=>{const b=u(t.channel);return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded bg-muted",children:Ea[t.channel]}),e.jsx("span",{className:"text-sm font-medium",children:b.name})]}),e.jsx(Aa,{status:t.status,size:"sm"})]},t.channel)}),i.filter(t=>t.status!=="disabled").length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"Nenhum canal configurado"}),l&&a&&e.jsxs(le,{open:n,onOpenChange:d,children:[e.jsx(Ys,{asChild:!0,children:e.jsxs(N,{variant:"outline",size:"sm",className:"w-full mt-2",children:[e.jsx(Be,{className:"h-4 w-4 mr-2"}),"Gerenciar Canais"]})}),e.jsxs(de,{className:"sm:max-w-md",children:[e.jsx(pe,{children:e.jsx(he,{children:"Canais de Publicação"})}),e.jsxs("div",{className:"space-y-3 py-4",children:[e.jsx(je,{channel:ee.portal,enabled:!0,locked:!0}),e.jsx(je,{channel:ee.google_jobs,enabled:x("google_jobs"),onChange:t=>m("google_jobs",t)})]})]})]})]})]})}function Ta({vacancy:s,onEdit:a,onClose:l}){const[n,d]=p.useState(!1),[i,u]=p.useState(!1),m=Ts();if(!s)return null;const x=`${window.location.origin}/vagas/${s.slug}`,t=()=>{navigator.clipboard.writeText(x),d(!0),H.success("Link copiado para a área de transferência!"),setTimeout(()=>d(!1),2e3)},b=()=>{window.open(x,"_blank")},j=async f=>{try{await m.mutateAsync({id:s.id,job_channels:f}),H.success("Canais atualizados com sucesso!")}catch(c){console.error("Error updating channels:",c),H.error("Erro ao atualizar canais")}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(pe,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(he,{className:"text-xl",children:s.title}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Criada em ",ts(new Date(s.created_at),"dd 'de' MMMM 'de' yyyy",{locale:ns})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(Zs,{status:s.status})})]})}),e.jsxs(w,{className:"border-primary/20 bg-primary/5",children:[e.jsx(P,{className:"pb-2",children:e.jsx(z,{className:"text-sm font-medium flex items-center gap-2",children:"Compartilhamento"})}),e.jsxs(k,{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Se,{value:x,readOnly:!0,className:"font-mono text-sm bg-background"}),e.jsx(N,{variant:"outline",size:"icon",onClick:t,children:n?e.jsx(Ne,{className:"h-4 w-4 text-success"}):e.jsx(ks,{className:"h-4 w-4"})})]}),e.jsxs(N,{variant:"outline",className:"w-full",onClick:b,children:[e.jsx(As,{className:"h-4 w-4 mr-2"}),"Visualizar Página"]})]})]}),e.jsx($s,{vacancyId:s.id}),e.jsx(Ia,{channels:s.job_channels,onUpdateChannels:j,isEditable:s.status==="published"}),s.description&&e.jsxs(w,{children:[e.jsx(P,{className:"pb-2",children:e.jsx(z,{className:"text-sm font-medium",children:"Descrição"})}),e.jsx(k,{children:e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:as.sanitize(s.description)}})})]}),e.jsxs(w,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs(z,{className:"text-sm font-medium",children:["Campos do Formulário (",s.form_schema.length,")"]})}),e.jsx(k,{children:s.form_schema.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum campo personalizado definido."}):e.jsx("div",{className:"space-y-2",children:s.form_schema.map((f,c)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm p-2 bg-muted/50 rounded",children:[e.jsxs("span",{className:"text-muted-foreground",children:[c+1,"."]}),e.jsx("span",{className:"font-medium",children:f.label||"(Sem rótulo)"}),e.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:[f.type,f.required&&" • Obrigatório"]})]},f.id))})})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(N,{variant:"outline",onClick:l,children:"Fechar"}),s.status==="published"&&e.jsxs(N,{variant:"outline",onClick:()=>u(!0),children:[e.jsx(se,{className:"h-4 w-4 mr-2"}),e.jsx(Q,{className:"h-3 w-3 mr-1"}),"Indicar Candidatos"]}),e.jsxs(N,{onClick:a,children:[e.jsx(Es,{className:"h-4 w-4 mr-2"}),"Editar"]})]}),e.jsx(Hs,{vacancy:s,open:i,onOpenChange:u})]})}const ye=12;function Pa(){const s=Oe(),[a,l]=cs(),{data:n=[],isLoading:d}=Ps(),{data:i={}}=ma(),{data:u={}}=ua(),m=zs();qs();const x=a.get("tipo"),[t,b]=p.useState(x||"todos"),[j,f]=p.useState(""),[c,v]=p.useState("published"),[g,h]=p.useState(1),[A,I]=p.useState(!1),[B,q]=p.useState(null),[K,V]=p.useState(null),[T,ae]=p.useState(null);p.useEffect(()=>{x&&x!==t&&b(x)},[x]);const Z=r=>{b(r),h(1),r==="todos"?a.delete("tipo"):a.set("tipo",r),l(a)},$=p.useMemo(()=>{const r=n.length,C=n.filter(G=>G.status==="published").length,y=Object.values(i).reduce((G,X)=>G+X,0),F=Object.values(u).reduce((G,X)=>G+X,0);return{totalVacancies:r,publishedCount:C,totalCandidates:y,totalHired:F}},[n,i,u]),W=p.useMemo(()=>{const r={all:n.length};
91return n.forEach(C=>{r[C.status]=(r[C.status]||0)+1}),r},[n]),Y=p.useMemo(()=>{const r=n.filter(y=>ie(y.client_name)).length,C=n.length-r;return{interno:r,clientes:C,todos:n.length}},[n]),E=p.useMemo(()=>n.filter(r=>{const C=r.title.toLowerCase().includes(j.toLowerCase()),y=c==="all"||r.status===c;let F=!0;return t==="interno"?F=ie(r.client_name):t==="clientes"&&(F=!ie(r.client_name)),C&&y&&F}),[n,j,c,t]),S=Math.ceil(E.length/ye),be=p.useMemo(()=>{const r=(g-1)*ye;return E.slice(r,r+ye)},[E,g]),ve=r=>{v(r),h(1)},o=r=>{f(r),h(1)},_=async()=>{T&&(await m.mutateAsync(T.id),ae(null))};if(d)return e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(J,{className:"h-8 w-8 animate-spin text-primary"})});const Ae=[{value:"published",label:"Publicadas",count:W.published||0},{value:"draft",label:"Rascunho",count:W.draft||0},{value:"closed",label:"Encerradas",count:W.closed||0},{value:"all",label:"Todas",count:W.all||0}];return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(re,{label:"Total de Vagas",value:$.totalVacancies,valueSize:"large"}),e.jsx(re,{label:"Candidaturas",value:$.totalCandidates,valueSize:"large"}),e.jsx(re,{label:"Publicadas",value:$.publishedCount,valueSize:"large"}),e.jsx(re,{label:"Contratados",value:$.totalHired,valueSize:"large"})]}),e.jsxs(w,{variant:"clean",className:"p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Vagas Cadastradas"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[E.length," ",E.length===1?"vaga":"vagas"]})]}),e.jsxs(N,{onClick:()=>I(!0),className:"rounded-full gap-2",children:[e.jsx(ue,{className:"h-4 w-4"}),"Nova Vaga"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pb-4 border-b border-border/50",children:[e.jsxs("button",{onClick:()=>Z("interno"),className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-medium transition-all ${t==="interno"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),"Interno (",Y.interno,")"]}),e.jsxs("button",{onClick:()=>Z("clientes"),className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-medium transition-all ${t==="clientes"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),"Clientes (",Y.clientes,")"]}),e.jsxs("button",{onClick:()=>Z("todos"),className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-medium transition-all ${t==="todos"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:["Todos (",Y.todos,")"]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between mt-4",children:[e.jsx(na,{options:Ae,value:c,onChange:ve}),e.jsxs("div",{className:"relative w-full lg:w-72",children:[e.jsx(ke,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Se,{placeholder:"Buscar vagas ou candidatos...",value:j,onChange:r=>o(r.target.value),className:"pl-11 rounded-full bg-muted/50 border-0"})]})]})]}),e.jsx(da,{searchTerm:j}),E.length===0?e.jsx("div",{className:"text-center py-16 text-muted-foreground",children:n.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{children:"Nenhuma vaga cadastrada ainda."}),e.jsxs(N,{onClick:()=>I(!0),className:"rounded-full",children:[e.jsx(ue,{className:"h-4 w-4 mr-2"}),"Criar Primeira Vaga"]})]}):e.jsx("p",{children:"Nenhuma vaga encontrada com os filtros aplicados."})}):e.jsx(w,{variant:"clean",className:"overflow-hidden",children:e.jsxs(Me,{children:[e.jsx(Re,{children:e.jsxs(me,{className:"hover:bg-transparent",children:[e.jsx(D,{className:"w-[40%]",children:"Vaga"}),e.jsx(D,{children:"Modalidade"}),e.jsx(D,{className:"text-center",children:"Candidatos"}),e.jsx(D,{className:"text-center",children:"Contratados"}),e.jsx(D,{className:"text-right",children:"Status"})]})}),e.jsx(Ge,{children:be.map(r=>{const C=i[r.id]||0,y=u[r.id]||0,F=ra[r.status],G=r.work_mode?ia[r.work_mode]?.label:null;return e.jsxs(me,{className:"cursor-pointer",onClick:()=>s(`/vagas/view/${r.id}`),children:[e.jsx(O,{className:"py-4",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"font-medium text-foreground",children:r.title}),e.jsx("span",{className:"text-sm text-muted-foreground",children:ie(r.client_name)?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fe,{className:"h-3 w-3 text-warning"}),"Time Eunerd"]}):r.client_name?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{className:"h-3 w-3"}),r.client_name]}):null})]})}),e.jsx(O,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[G&&e.jsxs(R,{variant:"muted",className:"w-fit text-xs",children:[e.jsx(fe,{className:"h-3 w-3 mr-1"}),G]}),r.contract_type&&e.jsx("span",{className:"text-xs text-muted-foreground",children:r.contract_type.toUpperCase()})]})}),e.jsx(O,{className:"text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:C})]})}),e.jsx(O,{className:"text-center",children:y>0?e.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[e.jsx(Ue,{className:"h-4 w-4 text-success"}),e.jsx("span",{className:"font-medium text-success",children:y})]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(O,{className:"text-right",children:e.jsx(R,{className:F.color,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[(()=>{const X=F.icon;return e.jsx(X,{className:"h-3 w-3"})})()," ",F.label]})})})]},r.id)})})]})}),S>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Página ",g," de ",S]}),e.jsx(Xs,{children:e.jsxs(ea,{children:[e.jsx(_e,{children:e.jsx(sa,{onClick:()=>h(r=>Math.max(1,r-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:Math.min(5,S)},(r,C)=>{let y;return S<=5||g<=3?y=C+1:g>=S-2?y=S-4+C:y=g-2+C,e.jsx(_e,{children:e.jsx(aa,{onClick:()=>h(y),isActive:g===y,className:"cursor-pointer rounded-full",children:y})},y)}),e.jsx(_e,{children:e.jsx(ta,{onClick:()=>h(r=>Math.min(S,r+1)),className:g===S?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]}),e.jsx(le,{open:A,onOpenChange:I,children:e.jsxs(de,{className:"max-w-5xl w-[95vw] max-h-[90vh] flex flex-col rounded-3xl p-0",children:[e.jsx(pe,{className:"px-6 pt-6 pb-0",children:e.jsx(he,{children:"Nova Vaga"})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-6",children:e.jsx(Sa,{onSuccess:()=>I(!1),onCancel:()=>I(!1)})})]})}),e.jsx(le,{open:!!B,onOpenChange:r=>!r&&q(null),children:e.jsxs(de,{className:"max-w-5xl w-[95vw] h-[85vh] flex flex-col rounded-3xl",children:[e.jsx(pe,{children:e.jsx(he,{children:"Editar Vaga"})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ws,{vacancy:B,onSuccess:()=>q(null),onCancel:()=>q(null)})})]})}),e.jsx(le,{open:!!K,onOpenChange:r=>!r&&V(null),children:e.jsx(de,{className:"max-w-2xl max-h-[90vh] overflow-y-auto rounded-3xl",children:e.jsx(Ta,{vacancy:K,onEdit:()=>{q(K),V(null)},onClose:()=>V(null)})})}),e.jsx(Qe,{open:!!T,onOpenChange:r=>!r&&ae(null),children:e.jsxs(Je,{className:"rounded-3xl",children:[e.jsxs(Ke,{children:[e.jsx(Ze,{children:"Excluir Vaga"}),e.jsxs(Ye,{children:['Tem certeza que deseja excluir a vaga "',T?.title,'"? Esta ação não pode ser desfeita.']})]}),e.jsxs(Xe,{children:[e.jsx(es,{className:"rounded-full",children:"Cancelar"}),e.jsx(ss,{onClick:_,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 rounded-full",children:"Excluir"})]})]})})]})}function Mt(){return e.jsxs(e.Fragment,{children:[e.jsx(os,{title:"Gestão de Vagas - euNerd",de
91scription:"Gerencie suas vagas de emprego"}),e.jsx(oa,{variant:"admin",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Vagas"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Gerencie vagas e acompanhe o recrutamento"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"outline",size:"sm",asChild:!0,className:"rounded-full",children:e.jsxs(Ee,{to:"/talentos",children:[e.jsx(se,{className:"h-4 w-4 mr-2"}),"Talentos"]})}),e.jsx(N,{variant:"outline",size:"sm",asChild:!0,className:"rounded-full",children:e.jsxs(Ee,{to:"/contratos",children:[e.jsx(He,{className:"h-4 w-4 mr-2"}),"Contratos"]})})]})]}),e.jsx(Pa,{})]})})]})}export{Mt 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.