1import{r as c,j as e}from"./vendor-react-zpu3niaY.js";import{u as te,b as ie}from"./vendor-query-DL93OzBF.js";import{u as ae,a as re,p as ne,$ as D,b as G,d as L,e as O,f as k,g,I as le,F as de,k as q,U as z,j as H,P as ce,a7 as oe,O as me}from"./index-BoxmWKdd.js";import{E as J}from"./EmployerLayout-YuYLBnbb.js";import{C as y,b as N,c as b,d as w,a as v}from"./card-BIRgDOO3.js";import{B as _}from"./badge-C1IRWViS.js";import{d as K}from"./vendor-router-fEmgOTjS.js";import{S as ue}from"./SEOHead-Q-morWIB.js";import{C as x}from"./circle-check-big-BZtKjhpK.js";import{C as pe}from"./clock-B0U3dRWR.js";import{C as xe}from"./circle-x-CFgKls02.js";import"./vendor-editor-DP1cC4if.js";import"./textarea-CObcbyJ4.js";import"./shield-ban-CK8JKCUM.js";import"./shield-alert-ISthlpU4.js";import"./send-zJV5WQar.js";const he={company:["incorporation_certificate","pan_card","gst_certificate","shop_establishment","msme_registration","fssai_license"],sole_proprietor:["pan_card","shop_establishment","msme_registration","fssai_license","id_card","offer_letter"],firm:["pan_card","gst_certificate","shop_establishment","msme_registration","fssai_license"],trust:["pan_card","shop_establishment","offer_letter"]},W={incorporation_certificate:{label:"Certificate of Incorporation",description:"Certificate of Incorporation issued by MCA (Ministry of Corporate Affairs)"},registration_certificate:{label:"Registration Certificate",description:"Business registration certificate from the relevant authority"},pan_card:{label:"Company PAN Card",description:"Permanent Account Number (PAN) issued by the Income Tax Department"},gst_certificate:{label:"GST Certificate",description:"GST Registration Certificate issued by the GST Council"},udyam_certificate:{label:"Udyam Certificate",description:"Udyam Registration for MSME (Micro, Small & Medium Enterprises)"},shop_establishment:{label:"Shop & Establishment Certificate",description:"Shop and Establishment Act registration certificate issued by local authority"},msme_registration:{label:"MSME Registration",description:"MSME / Udyam registration certificate from Ministry of MSME"},fssai_license:{label:"FSSAI License",description:"Food Safety and Standards Authority of India license (for food businesses)"},id_card:{label:"Government-issued ID",description:"Proprietor's Aadhaar, Passport, or Voter ID for identification"},offer_letter:{label:"Offer Letter / Work Order",description:"Official offer letter or work order demonstrating business activity"},trust_deed:{label:"Trust Deed",description:"Registered trust deed or NGO registration certificate"},other:{label:"Other Document",description:"Any other official business registration or identity document"}};function Ve(){var A;const{user:S,loading:Y}=ae(),{toast:r}=re(),B=c.useRef(null),[C,P]=c.useState(""),[o,$]=c.useState(""),[u,T]=c.useState(""),[n,h]=c.useState(null),[F,l]=c.useState(0),[f,j]=c.useState(!1),{data:t,isLoading:Q}=te({queryKey:["/api/employer/verification-status"],enabled:!!S&&S.role==="employer"});c.useEffect(()=>{t!=null&&t.company?P(t.company.name):t!=null&&t.employer&&P(t.employer.companyName)},[t]),c.useEffect(()=>{T(""),h(null),l(0),j(!1)},[o]);const E=ie({mutationFn:s=>me("POST","/api/employer/submit-verification",{data:s}),onSuccess:()=>{oe.invalidateQueries({queryKey:["/api/employer/verification-status"]}),r({title:"Verification Submitted",description:"Your documents have been submitted for verification. We'll review them within 24-48 hours."}),h(null),T(""),l(0),j(!1)},onError:s=>{let m="Failed to submit verification";s instanceof Error?m=s.message:s!=null&&s.error&&(m=s.error),r({variant:"destructive",title:"Submission Failed",description:m})}});if(Y||Q)return e.jsx(J,{children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-64 mb-6"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 h-96 bg-muted rounded"}),e.jsx("div",{className:"h-64 bg-muted rounded"})]})]})})});if(!S||S.role!=="employer")return e.jsx(K,{to:"/employer/login",replace:!0});const X=s=>{if(!s||!u)return;if(s.size>5*1024*1024){r({variant:"destructive",title:"File Too Large",description:"File size must be less than 5MB"});return}if(!["image/jpeg","image/png","image/jpg","application/pdf"].includes(s.type)){r({variant:"destructive",title:"Invalid File Type",description:"Only JPG, PNG, and PDF files are allowed"});return}j(!0),l(0),h(null);const I=new FormData;I.append("document",s);const a=new XMLHttpRequest;a.open("POST","/api/employer/upload-document"),a.withCredentials=!0,a.upload.onprogress=d=>{d.lengthComputable&&l(Math.round(d.loaded/d.total*100))},a.onload=()=>
1{if(j(!1),a.status>=200&&a.status<300)try{const{documentPath:d}=JSON.parse(a.responseText);l(100),h({type:u,path:d,fileName:s.name,fileSize:s.size})}catch{r({variant:"destructive",title:"Upload Failed",description:"Unexpected server response."}),l(0)}else{let d="Failed to upload file. Please try again.";a.status===403?d="You don't have permission to upload files.":a.status===401&&(d="Session expired. Please log in again."),r({variant:"destructive",title:"Upload Failed",description:d}),l(0)}},a.onerror=()=>{j(!1),l(0),r({variant:"destructive",title:"Upload Failed",description:"Network error. Please try again."})},a.send(I)},Z=()=>{if(!C.trim()){r({variant:"destructive",title:"Validation Error",description:"Company name is required"});return}if(!o){r({variant:"destructive",title:"Validation Error",description:"Please select your business type"});return}if(!n){r({variant:"destructive",title:"Validation Error",description:"Please upload a document to proceed"});return}E.mutate({companyName:C.trim(),documents:[{type:n.type,path:n.path}]})},i=t==null?void 0:t.company,M=(t==null?void 0:t.documents)||[],V=(i==null?void 0:i.verificationStatus)==="verified",U=(i==null?void 0:i.verificationStatus)==="pending",R=(i==null?void 0:i.verificationStatus)==="rejected",ee=U&&M.length>0,p=V||ee;if(V)return e.jsx(K,{to:"/employer/dashboard",replace:!0});const se=!!o&&!!C.trim()&&!!n;return e.jsxs(J,{children:[e.jsx(ue,{title:"Get Verified",noindex:!0,nofollow:!0}),e.jsxs("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold","data-testid":"text-verification-title",children:"Get Verified"}),e.jsx("p",{className:"text-muted-foreground",children:"Verify your company ownership to gain trust and access premium features"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(y,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-5 w-5"}),"Business Information"]}),e.jsx(w,{children:"Select your business type to see applicable documents"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:"businessType",children:"Business Type"}),e.jsxs(G,{value:o,onValueChange:s=>$(s),children:[e.jsx(L,{disabled:p,children:e.jsx(O,{placeholder:"Select your business type"})}),e.jsxs(k,{children:[e.jsx(g,{value:"company",children:"Company (Private/Public Ltd)"}),e.jsx(g,{value:"sole_proprietor",children:"Sole Proprietor / Self-Employed"}),e.jsx(g,{value:"firm",children:"Partnership / LLP / Firm"}),e.jsx(g,{value:"trust",children:"Trust / NGO"})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This determines which documents you need to submit"})]}),o&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:"companyName",children:"Business Name"}),e.jsx(le,{id:"companyName",value:C,onChange:s=>P(s.target.value),placeholder:"Enter your registered business name",disabled:p,"data-testid":"input-company-name"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This should match the name on your registration documents"})]})]})]}),o&&e.jsxs(y,{children:[e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(de,{className:"h-5 w-5"}),"Upload Document"]}),e.jsx(w,{children:"Select the type of document and upload one clear, legible file (JPG, PNG, or PDF, max 5 MB)."})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsx("input",{ref:B,type:"file",accept:".jpg,.jpeg,.png,.pdf",className:"hidden","data-testid":"input-document-file",onChange:s=>{var m;return X(((m=s.target.files)==null?void 0:m[0])||null)},disabled:p||f}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:"docType",children:"Type of Document"}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(G,{value:u,onValueChange:s=>{T(s),h(null),l(0)},disabled:p||f,children:[e.jsx(L,{id:"docType","data-testid":"select-doc-type",children:e.jsx(O,{placeholder:"Select document type"})}),e.jsx(k,{children:he[o].map(s=>e.jsx(g,{value:s,children:W[s].label},s))})]})}),e.jsxs(q,{type:"button",variant:"outline",disabled:!u||p||f,onClick:()=>{var s;return(s=B.current)==null?void 0:s.click()},"data-testid":"button-browse-document",children:[e.jsx(z,{className:"h-4 w-4 mr-2"}),"Browse"]})]}),u&&e.jsx("p",{className:"text-xs text-muted-foreground",children:(A=W[u])==null?void 0:A.description})]}),(f||n)&&e.jsxs("div",{className:"space-y-2 p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate flex-1 mr-2",children:(n==null?void 0:n.fileName)??"Uploading..."}),n&&e.jsxs("span",{className:"text-muted-foreground text-xs shrink-0",children:[(n.fileSize/1024).toFixed(0)," KB"]}
1)]}),e.jsx("div",{className:"w-full h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-300 ${F===100?"bg-green-500":"bg-primary"}`,style:{width:`${F}%`}})}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:f?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"h-3 w-3 animate-spin text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:["Uploading⦠",F,"%"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"h-3 w-3 text-green-600"}),e.jsx("span",{className:"text-green-600 font-medium",children:"Upload complete"})]})})]}),!p&&e.jsx(q,{onClick:Z,disabled:E.isPending||!se,className:"w-full","data-testid":"button-submit-verification",children:E.isPending?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-2 h-4 w-4"}),"Submit for Verification"]})})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(y,{children:[e.jsxs(N,{children:[e.jsx(b,{children:"Verification Status"}),e.jsx(w,{children:"Current status of your verification"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"font-medium",children:"Status"}),V&&e.jsxs(_,{variant:"default","data-testid":"badge-status",children:[e.jsx(x,{className:"h-3 w-3 mr-1"}),"Verified"]}),U&&e.jsxs(_,{variant:"secondary","data-testid":"badge-status",children:[e.jsx(pe,{className:"h-3 w-3 mr-1"}),"Pending"]}),R&&e.jsxs(_,{variant:"destructive","data-testid":"badge-status",children:[e.jsx(xe,{className:"h-3 w-3 mr-1"}),"Rejected"]}),!i&&e.jsx(_,{variant:"outline","data-testid":"badge-status",children:"Not Submitted"})]}),U&&e.jsx("div",{className:"p-3 bg-muted rounded-md",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your documents are being reviewed. This typically takes 24-48 hours."})}),R&&(i==null?void 0:i.rejectionReason)&&e.jsxs("div",{className:"p-3 bg-destructive/10 rounded-md",children:[e.jsx("p",{className:"text-sm font-medium text-destructive mb-1",children:"Rejection Reason:"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.rejectionReason})]}),M.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Submitted Documents:"}),e.jsx("div",{className:"space-y-1",children:M.map(s=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(x,{className:"h-3 w-3 text-green-600"}),e.jsx("span",{children:s.documentType.replace("_"," ").toUpperCase()})]},s.id))})]})]})]}),e.jsxs(y,{children:[e.jsxs(N,{children:[e.jsx(b,{children:"Verification Benefits"}),e.jsx(w,{children:"Why verify your company?"})]}),e.jsxs(v,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x,{className:"h-5 w-5 text-green-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Build Trust"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Verified badge increases candidate confidence"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x,{className:"h-5 w-5 text-green-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Better Visibility"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Verified companies get priority in search results"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x,{className:"h-5 w-5 text-green-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Premium Features"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Access advanced analytics and reporting"})]})]})]})]}),e.jsxs(y,{children:[e.jsx(N,{children:e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Need Help?"]})}),e.jsx(v,{className:"space-y-2 text-sm text-muted-foreground",children:e.jsx("p",{children:"Having trouble with verification? Contact our support team at [email protected]"})})]})]})]})]})]})}export{Ve 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.