PageSourceSearch

https://deliverimates-production.up.railway.app/assets/HiringImport-CzFzjOd-.js

js deliverimates-production.up.railway.app collected 2026-10-03 12:12:36 UTC 7,570 bytes, 1 lines download raw bytes

1import{c as V,u as O,z as U,l as z,r as i,j as e,B as d,b4 as $,C as b,d as H,e as M,aF as q,b as w,n as T}from"./index-Db4qfLtJ.js";import{u as G,a as J,I as K}from"./HiringRecentImportsInk-CTvKdzV0.js";import{B as n}from"./badge-B13RZfEt.js";import{T as Q,a as W,b as R,c as m,d as X,e as p}from"./table-CDUJ619m.js";import{C as Y}from"./circle-alert-DtE7BSGF.js";import{R as Z}from"./rotate-ccw-DCFAe1CV.js";import{U as ee}from"./upload-BJ-_IMcl.js";import"./MonoValue-K8CjOq_0.js";import"./overlays-DOpP7ZKe.js";const te=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],se=V("file-up",te),ae={1:"T1 - Amazon",2:"T2 - Delivery",3:"T3 - Other"},re={1:"bg-emerald-100 text-emerald-800",2:"bg-blue-100 text-blue-800",3:"bg-slate-100 text-slate-800"};function D(c){if(c.receipt_recorded!==!1)return null;switch(c.receipt_reason){case"schema_pending":return"This import wasn't added to import history yet — the receipt table arrives with the next deploy";case"write_failed":return"Import history couldn't be written; the candidates were imported";case"no_file_name":return"This import wasn't added to import history because the file name wasn't captured; the candidates were imported";default:return"This import wasn't added to import history; the candidates were imported"}}function ue(){const c=O(),[E]=U(),N=E.get("list")==="offboarded",{toast:x}=z(),y=G(),f=J(),[o,j]=i.useState("upload"),[g,_]=i.useState([]),[P,C]=i.useState(""),[a,B]=i.useState({total:0,valid:0,errors:0,new_count:0,duplicate_count:0}),[u,k]=i.useState(null),[l,I]=i.useState(null),h=i.useCallback(async t=>{C(t.name);const r=await t.text();try{const s=await y.mutateAsync(r);_(s.rows),B({total:s.total,valid:s.valid,errors:s.errors,new_count:s.new_count,duplicate_count:s.duplicate_count}),j("preview")}catch(s){const v=s instanceof Error?s.message:"Failed to parse CSV";x({title:v,variant:"destructive"})}},[y,x]),A=i.useCallback(async t=>{const r=t.target.files?.[0];r&&await h(r)},[h]),F=i.useCallback(async t=>{t.preventDefault();const r=t.dataTransfer.files[0];r&&await h(r)},[h]),L=async()=>{const t=g.filter(s=>!s.error&&s.phone),r={file_name:P,row_count:a.total,error_count:a.errors,previously_blocked_count:g.filter(s=>s.previously_blocked).length};try{const s=await f.mutateAsync({candidates:t,receipt:r});k(r),I(s),j("done"),x({title:`Imported ${s.imported} candidates`})}catch(s){const v=s instanceof Error?s.message:"Import failed";x({title:v,variant:"destructive"})}},S=()=>{j("upload"),_([]),C(""),k(null),I(null)};return e.jsxs("div",{className:"space-y-4 max-w-5xl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(d,{variant:"ghost",size:"sm",onClick:()=>c("/dashboard/hiring"),children:[e.jsx($,{className:"h-4 w-4 mr-1"})," Back"]}),e.jsx("h1",{className:"text-2xl font-bold",children:N?"Import offboarded list":"Import Candidates"})]}),N&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Previously disqualified numbers are flagged and never re-texted."}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(n,{variant:o==="upload"?"default":"secondary",children:"1. Upload"}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx(n,{variant:o==="preview"?"default":"secondary",children:"2. Preview"}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx(n,{variant:o==="done"?"default":"secondary",children:"3. Done"})]}
1),o==="upload"&&e.jsxs(b,{children:[e.jsxs(H,{children:[e.jsx(M,{children:"Upload Indeed CSV"}),e.jsx(q,{children:"Export candidates from Indeed and upload the CSV file here."})]}),e.jsx(w,{children:e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-12 text-center cursor-pointer hover:border-blue-400 transition-colors",onDrop:F,onDragOver:t=>t.preventDefault(),onClick:()=>document.getElementById("csv-input")?.click(),children:[e.jsx(se,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop a CSV file, or click to browse"}),e.jsx("input",{id:"csv-input",type:"file",accept:".csv",className:"hidden",onChange:A})]})})]}),o==="preview"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(n,{variant:"secondary",children:[a.total," total"]}),e.jsxs(n,{className:"bg-emerald-100 text-emerald-800",children:[a.new_count," new"]}),a.duplicate_count>0&&e.jsxs(n,{className:"bg-slate-200 text-slate-700",children:[a.duplicate_count," duplicate"]}),a.errors>0&&e.jsxs(n,{className:"bg-rose-100 text-rose-800",children:[a.errors," errors"]})]}),e.jsx(b,{children:e.jsx(w,{className:"p-0",children:e.jsxs(Q,{children:[e.jsx(W,{children:e.jsxs(R,{children:[e.jsx(m,{children:"Name"}),e.jsx(m,{children:"Phone"}),e.jsx(m,{children:"Email"}),e.jsx(m,{children:"Tier"}),e.jsx(m,{children:"Status"})]})}),e.jsx(X,{children:g.map((t,r)=>e.jsxs(R,{className:t.error?"bg-rose-50":t.existing?"bg-slate-50":"",children:[e.jsxs(p,{className:"font-medium",children:[t.first_name," ",t.last_name||""]}),e.jsx(p,{className:"font-mono text-xs",children:t.phone||"—"}),e.jsx(p,{className:"text-xs",children:t.email||"—"}),e.jsx(p,{children:e.jsx(n,{className:`text-xs ${re[t.indeed_tier]}`,children:ae[t.indeed_tier]})}),e.jsx(p,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[t.error?e.jsxs("span",{className:"text-xs text-rose-600 flex items-center gap-1",children:[e.jsx(Y,{className:"h-3 w-3"})," ",t.error]}):t.existing?e.jsxs("span",{className:"text-xs text-slate-600 flex items-center gap-1",children:[e.jsx(Z,{className:"h-3 w-3"})," Duplicate"]}):e.jsxs("span",{className:"text-xs text-emerald-700 flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," New"]}),t.previously_blocked&&e.jsx(n,{variant:"outline",className:"bg-rose-50 text-rose-700 border-rose-200 text-xs w-fit",children:"Previously disqualified"})]})})]},r))})]})})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",onClick:S,children:"Start Over"}),e.jsxs(d,{onClick:L,disabled:f.isPending||a.valid===0,children:[e.jsx(ee,{className:"h-4 w-4 mr-1"}),f.isPending?"Importing...":a.duplicate_count>0?`Import ${a.new_count} new (${a.duplicate_count} dupes will be skipped)`:`Import ${a.new_count} Candidates`]})]})]}),o==="done"&&l&&u&&e.jsx(b,{children:e.jsxs(w,{className:"py-12 text-center",children:[e.jsx(T,{className:"h-12 w-12 mx-auto text-emerald-600 mb-4"}),e.jsx("h2",{className:"text-xl font-bold mb-2",children:"Import Complete"}),e.jsxs("p",{className:"text-muted-foreground",children:[l.imported," imported, ",l.skipped," skipped (duplicates), ",l.errors," errors"]}),e.jsx("div",{className:"mx-auto mt-6 max-w-3xl overflow-hidden rounded-lg border border-hairline bg-surface text-left",children:e.jsx(K,{ariaLabel:"Import receipt",rows:[{key:"this-import",date:"Just now",file:u.file_name||"file name unavailable",rows:u.row_count,newCount:l.imported,duplicates:l.skipped,previouslyDq:u.previously_blocked_count}]})}),D(l)&&e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:D(l)}),e.jsxs("div",{className:"flex gap-2 justify-center mt-6",children:[e.jsx(d,{variant:"outline",onClick:S,children:"Import More"}),e.jsx(d,{onClick:()=>c("/dashboard/hiring"),children:"Go to Pipeline"})]})]})})]})}export{ue as default,D as receiptSkippedCopy};

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.