3 lines
8.6 KiB
JavaScript
3 lines
8.6 KiB
JavaScript
import{d as $,a as C,s as D,g as R,r as o,l as r,v as p,T as M,w as E,x as O,y as F,z as U,j as e,I as c,S as z,B as I}from"./index-BTPmxtwM.js";import{M as B}from"./Modal-B8aWFZt2.js";const L=["Olivia","Liam","Emma","Noah","Ava","Ethan","Sophia","Mason","Priya","Diego","Yuki","Omar"],Q=["Chen","Patel","Kim","Garcia","Silva","Ahmed","Novak","Reyes","Khan","Costa"],q=[{i:"file",t:"Resume parsing",d:"Extract name, contact, experience, skills & education"},{i:"target",t:"ATS scoring",d:"Generate a match score against the requisition"},{i:"briefcase",t:"Job matching",d:"Suggest the best-matching open roles"},{i:"users",t:"Duplicate detection",d:"Flag candidates already in the system"},{i:"user-plus",t:"Profile creation",d:"Create a candidate profile in Applied stage"}];function Z(){const{toast:m}=$(),{data:f=[]}=C(D("jobs")),{data:K=[]}=C(D("candidates")),S=R("candidates"),[d,g]=o.useState([]),[P,N]=o.useState(!1),[j,u]=o.useState(null),h=o.useRef(new Set);o.useEffect(()=>{const s=h.current;return()=>{s.forEach(a=>{clearInterval(a),clearTimeout(a)}),s.clear()}},[]);const k=o.useCallback(s=>{const a=setInterval(()=>{g(i=>i.map(t=>{if(t.id!==s||t.status!=="Uploading")return t;const l=Math.min(100,t.progress+r(12,30));if(l>=100){clearInterval(a),h.current.delete(a);const n=setTimeout(()=>{g(b=>b.map(v=>v.id===s?{...v,status:"Ready",atsScore:r(52,96)}:v)),h.current.delete(n)},700+r(0,500));return h.current.add(n),{...t,progress:100,status:"Parsing"}}return{...t,progress:l}}))},220);h.current.add(a)},[]),x=o.useCallback((s,a)=>{const i=a?8:s,t=f.filter(n=>n.status==="Open"),l=[];for(let n=0;n<i;n++){const b=`${p(L)} ${p(Q)}`;l.push({id:`UP-${Math.random().toString(36).slice(2,8)}`,name:b,file:`${b.split(" ")[0]}_Resume.${p(["pdf","docx","doc"])}`,size:`${r(120,620)} KB`,progress:0,status:"Uploading",atsScore:null,job:p(t.length?t:f),duplicate:Math.random()<.18,imported:!1})}g(n=>[...n,...l]),l.forEach(n=>k(n.id)),m(a?"ZIP extracted — 8 resumes queued":`${i} file(s) uploaded`,"info")},[f,k,m]),y=o.useCallback(s=>{const a=d.find(t=>t.id===s);if(!a||a.imported)return;const i=a.job;S(t=>[{id:`CAN-${5001+t.length}`,name:a.name,initials:U(a.name),color:F(a.name),email:`${a.name.toLowerCase().replace(/ /g,".")}@email.com`,phone:"+1 (555) 000-0000",jobId:i.id,jobTitle:i.title,department:i.department,experience:r(2,12),currentCompany:p(O),currentTitle:i.title,location:p(E),stage:"Applied",status:"Applied",aiScore:a.atsScore,source:"Manual CV Upload",recruiter:i.recruiter,recruiterId:"",applied:new Date(M),education:"Bachelor's Degree",skills:i.skills.slice(0,4),rating:"4.0",salary:r(90,180)*1e3,matchedSkills:i.skills.slice(0,3),missingSkills:i.skills.slice(3),recommendation:a.atsScore>=82?"Strong Match":"Potential Match",subScores:{skills:a.atsScore,experience:80,education:80,keywords:a.atsScore,location:100,salary:90},noticePeriod:"1 month",availability:"2 weeks",certifications:[],favorite:!1,interviewStatus:"Not Scheduled"},...t]),g(t=>t.map(l=>l.id===s?{...l,imported:!0}:l)),m(`${a.name} imported → ${i.title}`,"success")},[d,S,m]);function w(s){s.duplicate?u(s):y(s.id)}function T(){const s=d.filter(a=>a.status==="Ready"&&!a.imported&&!a.duplicate);if(!s.length){m("No files ready to import","warning");return}s.forEach(a=>y(a.id)),m(`${s.length} candidates imported`,"success")}const A=d.filter(s=>s.imported).length;return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"page-head",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"page-title",children:"CV Import"}),e.jsx("p",{className:"page-sub",children:"Upload resumes — we parse, score, match, and dedupe automatically"})]}),e.jsx("div",{className:"page-head-actions",children:e.jsxs("span",{className:"integration-status pending",children:[e.jsx("span",{className:"pulse"}),"AI Resume Parser · Ready"]})})]}),e.jsxs("div",{className:"grid g-2-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"card mb-18",children:e.jsxs("div",{className:"card-body",children:[e.jsxs("div",{className:`dropzone${P?" drag":""}`,onClick:()=>x(r(2,4)),onDragOver:s=>{s.preventDefault(),N(!0)},onDragLeave:()=>N(!1),onDrop:s=>{s.preventDefault(),N(!1),x(s.dataTransfer.files.length||r(2,4))},children:[e.jsx("div",{className:"dz-icn",children:e.jsx(c,{name:"upload"})}),e.jsx("h3",{children:"Drag & drop resumes here"}),e.jsx("p",{className:"text-muted",style:{marginBottom:16},children:"or click to browse — PDF, DOC, DOCX and ZIP supported · up to 20 files"}),e.jsxs("button",{className:"btn btn-primary",onClick:s=>{s.stopPropagation(),x(r(2,4))},children:[e.jsx(c,{name:"upload"})," Browse Files"]}),e.jsx("div",{className:"flex items-center gap-8",style:{justifyContent:"center",marginTop:16},children:["PDF","DOC","DOCX","ZIP"].map(s=>e.jsx("span",{className:"badge b-gray badge-plain",children:s},s))})]}),e.jsxs("div",{className:"flex items-center gap-8",style:{marginTop:16,flexWrap:"wrap"},children:[e.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(3),children:[e.jsx(c,{name:"sparkles"})," Simulate 3 files"]}),e.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(1,!0),children:[e.jsx(c,{name:"layers"})," Simulate ZIP (8 CVs)"]}),e.jsx("span",{className:"text-muted text-sm",style:{marginLeft:"auto"},children:"Files are processed locally in this demo"})]})]})}),d.length>0&&e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{children:"Processing Queue"}),e.jsxs("span",{className:"ch-sub",children:[d.length," file",d.length===1?"":"s"," · ",A," imported"]})]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:T,children:[e.jsx(c,{name:"check"})," Import All"]})]}),e.jsx("div",{className:"card-body",children:d.map(s=>{var a;return e.jsxs("div",{className:"upload-row",children:[e.jsx("span",{className:"attach-icn",style:{width:38,height:38},children:e.jsx(c,{name:"file"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx("span",{className:"fw-600 text-sm",children:s.name}),s.duplicate&&e.jsx("span",{className:"badge b-red badge-plain",style:{padding:"1px 7px",fontSize:10},children:"DUPLICATE"})]}),e.jsxs("div",{className:"cell-sub",children:[s.file," · ",s.size]}),s.status==="Uploading"||s.status==="Parsing"?e.jsx("div",{className:"upload-progress",style:{marginTop:6},children:e.jsx("div",{className:"upload-progress-fill",style:{width:`${s.progress}%`}})}):e.jsxs("div",{className:"cell-sub",style:{marginTop:4},children:["Best match: ",e.jsx("b",{children:(a=s.job)==null?void 0:a.title})]})]}),e.jsx("div",{style:{textAlign:"right",flexShrink:0},children:s.status==="Ready"?e.jsx(z,{score:s.atsScore}):e.jsxs(I,{className:s.status==="Parsing"?"b-amber":"b-blue",children:[s.status,s.status==="Uploading"?` ${s.progress}%`:""]})}),e.jsx("div",{style:{flexShrink:0},children:s.imported?e.jsx(I,{className:"b-green",children:"Imported"}):s.status==="Ready"?e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>w(s),children:"Import"}):e.jsx("button",{className:"act-btn",disabled:!0,children:e.jsx(c,{name:"clock"})})})]},s.id)})})]})]}),e.jsxs("div",{className:"card",style:{alignSelf:"start"},children:[e.jsx("div",{className:"card-head",children:e.jsxs("div",{children:[e.jsx("h3",{children:"Auto-Processing"}),e.jsx("span",{className:"ch-sub",children:"What happens on upload"})]})}),e.jsx("div",{className:"card-body",children:e.jsx("div",{className:"timeline",children:q.map(s=>e.jsxs("div",{className:"tl-item",children:[e.jsx("div",{className:"tl-dot",children:e.jsx(c,{name:s.i})}),e.jsx("div",{className:"tl-title",children:s.t}),e.jsx("div",{className:"tl-desc",children:s.d})]},s.t))})})]})]}),j&&e.jsx(B,{title:"Duplicate Detected",subtitle:j.name,onClose:()=>u(null),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-secondary",onClick:()=>u(null),children:"Cancel"}),e.jsx("button",{className:"btn btn-secondary",onClick:()=>{u(null),m("Merged into existing profile","success")},children:"Merge"}),e.jsx("button",{className:"btn btn-primary",onClick:()=>{const s=j.id;u(null),y(s)},children:"Import Anyway"})]}),children:e.jsxs("div",{className:"flex gap-16 items-center",children:[e.jsx("span",{className:"kpi-icn i-amber",style:{width:48,height:48,borderRadius:12,flexShrink:0},children:e.jsx(c,{name:"users"})}),e.jsxs("div",{children:[e.jsx("p",{className:"fw-600",style:{fontSize:15},children:"A similar candidate already exists"}),e.jsxs("p",{className:"text-muted",style:{marginTop:4},children:[j.name," matches an existing profile (95% similarity on name + email). Importing will create a duplicate."]})]})]})})]})}export{Z as default};
|
|
//# sourceMappingURL=CvImport-CL-aCbqv.js.map
|