1import{r as b,j as e}from"./vendor-react-zpu3niaY.js";import{a as xe,r as ge,t as he,p as _,B as ye,y as be,z as l,A as c,E as d,G as j,I as v,H as m,ac as $,k as h,b as P,d as E,e as I,f as D,g as x,h as fe,i as ve,j as z,l as U,X as Ne,a9 as we,O as L,J as Ce,ae as Te,K as p}from"./index-BoxmWKdd.js";import{u as Se,d as ke}from"./vendor-router-fEmgOTjS.js";import{T as W}from"./textarea-CObcbyJ4.js";import{C as X,a as Z,b as Fe,c as Ve,d as Pe}from"./card-BIRgDOO3.js";import{c as Ee,u as C}from"./vendor-query-DL93OzBF.js";import{B as ee}from"./badge-C1IRWViS.js";import{G as te}from"./GuestEmployerLayout-Do9NI3yF.js";import{L as Ie}from"./LocationAutocomplete-DYqwi0lM.js";import{S as se}from"./SEOHead-Q-morWIB.js";import{C as De}from"./circle-check-big-BZtKjhpK.js";import{A as ae}from"./arrow-right-sLZQ5QXa.js";import{M as Le}from"./map-pin-DqmTzp0w.js";import"./vendor-editor-DP1cC4if.js";import"./award-Cl1_jcWl.js";import"./command-D4kzHtHE.js";import"./popover-D3pVBibN.js";const Re=Ce({companyName:p().min(2,"Company name must be at least 2 characters"),companyDescription:p().optional(),contactEmail:p().email("Please enter a valid email"),jobTitle:p().min(3,"Job title must be at least 3 characters"),jobLocation:p().min(2,"Please enter the job location"),jobType:p().min(1,"Please select job type"),workMode:p().min(1,"Please select work mode"),jobDescription:p().min(50,"Job description must be at least 50 characters"),salaryRange:p().optional(),category:p().optional(),tags:Te(p()).max(3,"Maximum 3 tags allowed").optional()});function et(){var Q;const T=Se(),{toast:u}=xe(),S=Ee(),[R,J]=b.useState(!1),[g,M]=b.useState("company"),[q,A]=b.useState(!1),[k,O]=b.useState([]),[G,K]=b.useState(!1),[N,Y]=b.useState(""),{data:F,isLoading:re}=C({queryKey:["/api/employer/verification-status"]}),{data:V,isLoading:ie}=C({queryKey:["/api/employer/jobs"]});if(re||ie)return e.jsxs(te,{children:[e.jsx(se,{title:"Post Your First Job - Rojgar Hub",noindex:!0,nofollow:!0}),e.jsx("div",{className:"container py-12 max-w-2xl",children:e.jsx(X,{children:e.jsx(Z,{className:"p-8",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-20 bg-muted rounded"})]})})})})]});const ne=((Q=F==null?void 0:F.company)==null?void 0:Q.verificationStatus)==="verified",oe=((V==null?void 0:V.jobs)||[]).length;if(!ne&&oe>=1)return e.jsx(ke,{to:"/employer/get-verified",replace:!0});const{data:Je}=C({queryKey:["/api/current-country"]}),{data:y}=C({queryKey:["/api/categories/hierarchy"]}),le=((y==null?void 0:y.categories)||[]).reduce((t,a)=>{if(!a.parentId){const r=((y==null?void 0:y.categories)||[]).filter(n=>n.parentId===a.id);t.push({...a,children:r})}return t},[]),s=ge({resolver:he(Re),defaultValues:{companyName:"",companyDescription:"",contactEmail:"",jobTitle:"",jobLocation:"",jobType:"",workMode:"",jobDescription:"",salaryRange:"",category:"",tags:[]}}),ce=async t=>{var a;J(!0);try{await fetch("/api/employer/profile",{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({companyName:t.companyName,companyDescription:t.companyDescription,contactEmail:t.contactEmail})}),await L("POST","/api/employer/jobs",{data:{title:t.jobTitle,location:t.jobLocation,type:t.jobType,workMode:t.workMode,description:t.jobDescription,salaryRange:t.salaryRange||void 0,category:t.category||void 0,company:t.companyName,source:"Rojgar Hub",status:"published",tags:t.tags||[]}}),S.invalidateQueries({queryKey:["/api/employer/profile"]}),S.invalidateQueries({queryKey:["/api/employer/jobs"]}),S.invalidateQueries({queryKey:["/api/auth/me"]}),u({title:"You're all set!",description:"Your company profile and first job have been created."}),T("/employer/dashboard")}catch(r){if((a=r==null?void 0:r.message)!=null&&a.includes("EMPLOYER_NOT_VERIFIED")||(r==null?void 0:r.error)==="EMPLOYER_NOT_VERIFIED"){u({title:"Account Verification Required",description:"Complete your account verification to post jobs. We'll guide you through the process."}),T("/employer/get-verified");return}u({title:"Failed to create job",description:r instanceof Error?r.message:"Please try again",variant:"destructive"})}finally{J(!1)}},de=async()=>{await s.trigger(["companyName","contactEmail"])&&M("job")},me=async()=>{const t=s.getValues("jobTitle"),a=s.getValues("companyName"),r=s.getValues("jobType"),n=s.getValues("workMode"),i=s.getValues("jobLocation"),o=s.getValues("category");if(!t||t.length<3){u({title:"Job title required",description:"Please enter a job title first to generate the description.",variant:"destructive"});return}if(!a||a.length<2){u({title:"Company name required",description:"Please enter the company name first.",variant:"destructive"});return}A(!0);try{const f=await(await L("POST","/api/employer/generate-job-description",{jobTitle:t,companyName:a,jobType:r||"Full-time",workMode:n||"On-site",location:i||"",category:o||""})).json();if(f.success&&f.formattedDescription)s.setValue("jobDescription",f.formattedDescription),B(t,f.formattedDescription,o||""),u({title:"Description generated",description:"AI has created a job description for you. Feel free to edit it."});else throw new Error(f.error||"Failed to generate description")}catch(w){u({title:"Generation failed",description:w.message||"Unable to generate job description. Please try again.",variant:"destructive"})}finally{A(!1)}},B=async(t,a,r)=>{K(!0);try{const i=await(await L("POST","/api/employer/suggest-skills-tags",{jobTitle:t,description:a,category:r})).json();i.success&&i.suggestions&&O(i.suggestions)}catch(n){console.error("Failed to fetch skill suggestions:",n)}finally{K(!1)}},H=()=>{const t=s.getValues("tags")||[];if(t.length>=3){u({title:"Maximum 3 tags allowed",description:"Remove an existing tag before adding a new one.",variant:"destructive"});return}N.trim()&&!t.includes(N.trim())&&(s.setValue("tags",[...t,N.trim()]),Y(""))},pe=t=>{const a=s.getValues("tags")||[];if(a.length>=3){u({title:"Maximum 3 tags allowed",description:"Remove an existing tag before adding a new one.",variant:"destructive"});return}a.includes(t)||(s.setValue("tags",[...a,t]),O(r=>r.filter(n=>n!==t)))},ue=t=>{const a=s.getValues("tags")||[];s.setValue("tags",a.filter(r=>r!==t))},je=t=>{t.key==="Enter"&&(t.preventDefault(),H())};return e.jsxs(te,{children:[e.jsx(se,{title:"Post Your First Job",noindex:!0,nofollow:!0}),e.jsxs("div",{className:"container max-w-2xl py-12",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center",children:e.jsx(_,{className:"w-8 h-8 text-primary"})})}),e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Welcome to Rojgar Hub"}),e.jsx("p",{className:"text-muted-foreground",children:"Let's set up your company profile and post your first job"})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8",children:[e.jsxs("div",{className:`flex items-center gap-2 ${g==="company"?"text-primary":"text-muted-foreground"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center ${g==="company"?"bg-primary text-primary-foreground":"bg-muted"}`,children:g==="job"?e.jsx(De,{className:"w-5 h-5"}):"1"}),e.jsx("span",{className:"font-medium",children:"Company"})]}),e.jsx("div",{className:"w-12 h-0.5 bg-muted"}),e.jsxs("div",{className:`flex items-center gap-2 ${g==="job"?"text-primary":"text-muted-foreground"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center ${g==="job"?"bg-primary text-primary-foreground":"bg-muted"}`,children:"2"}),e.jsx("span",{className:"font-medium",children:"First Job"})]})]}),e.jsxs(X,{children:[e.jsxs(Fe,{children:[e.jsx(Ve,{className:"flex items-center gap-2",children:g==="company"?e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"w-5 h-5"}),"Company Information"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:"w-5 h-5"}),"Post Your First Job"]})}),e.jsx(Pe,{children:g==="company"?"Tell us about your company":"Create your first job posting to start receiving applications"})]}),e.jsx(Z,{children:e.jsx(be,{...s,children:e.jsx("form",{onSubmit:s.handleSubmit(ce),className:"space-y-6",children:g==="company"?e.jsxs(e.Fragment,{children:[e.jsx(l,{control:s.control,name:"companyName",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Company Name *"}),e.jsx(j,{children:e.jsx(v,{...t,"data-testid":"input-company-name",placeholder:"Enter your company name"})}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"contactEmail",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Contact Email *"}),e.jsx(j,{children:e.jsx(v,{...t,type:"email","data-testid":"input-contact-email",placeholder:"[email protected]"})}),e.jsx($,{children:"This email will receive job application notifications"}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"companyDescription",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"About Your Company"}),e.jsx(j,{children:e.jsx(W,{...t,"data-testid":"input-company-description",placeholder:"Tell job seekers about your company, culture, and what makes it a great place to work...",rows:4})}),e.jsx(m,{})]})}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsx(h,{type:"button",variant:"outline",onClick:()=>
1T("/employer/dashboard"),className:"flex-1","data-testid":"button-skip",children:"Skip for now"}),e.jsxs(h,{type:"button",onClick:de,className:"flex-1","data-testid":"button-next",children:["Next: Post Job",e.jsx(ae,{className:"ml-2 h-4 w-4"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{control:s.control,name:"jobTitle",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Job Title *"}),e.jsx(j,{children:e.jsx(v,{...t,"data-testid":"input-job-title",placeholder:"e.g., Software Engineer, Sales Executive"})}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"jobLocation",render:({field:t})=>e.jsxs(c,{children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"w-4 h-4"}),"Job Location *"]}),e.jsx(j,{children:e.jsx(Ie,{value:t.value,onValueChange:t.onChange,placeholder:"Select city","data-testid":"input-job-location"})}),e.jsx(m,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(l,{control:s.control,name:"jobType",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Job Type *"}),e.jsxs(P,{onValueChange:t.onChange,value:t.value,children:[e.jsx(j,{children:e.jsx(E,{"data-testid":"select-job-type",children:e.jsx(I,{placeholder:"Select type"})})}),e.jsxs(D,{children:[e.jsx(x,{value:"Full-time",children:"Full-time"}),e.jsx(x,{value:"Part-time",children:"Part-time"}),e.jsx(x,{value:"Contract",children:"Contract"}),e.jsx(x,{value:"Internship",children:"Internship"}),e.jsx(x,{value:"Freelance",children:"Freelance"})]})]}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"workMode",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Work Mode *"}),e.jsxs(P,{onValueChange:t.onChange,value:t.value,children:[e.jsx(j,{children:e.jsx(E,{"data-testid":"select-work-mode",children:e.jsx(I,{placeholder:"Select mode"})})}),e.jsxs(D,{children:[e.jsx(x,{value:"On-site",children:"On-site"}),e.jsx(x,{value:"Remote",children:"Remote"}),e.jsx(x,{value:"Hybrid",children:"Hybrid"})]})]}),e.jsx(m,{})]})})]}),e.jsx(l,{control:s.control,name:"salaryRange",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Salary Range (Optional)"}),e.jsx(j,{children:e.jsx(v,{...t,"data-testid":"input-salary",placeholder:"e.g., â¹5-8 LPA or â¹25,000-35,000/month"})}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"category",render:({field:t})=>e.jsxs(c,{children:[e.jsx(d,{children:"Job Category (Optional)"}),e.jsxs(P,{onValueChange:t.onChange,value:t.value,children:[e.jsx(j,{children:e.jsx(E,{"data-testid":"select-category",children:e.jsx(I,{placeholder:"Select a category"})})}),e.jsx(D,{children:le.map(a=>{var r;return e.jsxs(fe,{children:[e.jsx(ve,{className:"font-semibold",children:a.name}),(r=a.children)==null?void 0:r.map(n=>e.jsx(x,{value:n.slug,children:n.name},n.id))]},a.id)})})]}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"jobDescription",render:({field:t})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(d,{children:"Job Description *"}),e.jsx(h,{type:"button",variant:"outline",size:"sm",onClick:me,disabled:q,className:"text-primary border-primary/30",children:q?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),"Generate with AI"]})})]}),e.jsx(j,{children:e.jsx(W,{...t,"data-testid":"input-job-description",placeholder:"Describe the role, responsibilities, requirements, and what you're looking for in an ideal candidate...",rows:10})}),e.jsx($,{children:"Include key responsibilities, required skills, and qualifications. Use the AI button to auto-generate content."}),e.jsx(m,{})]})}),e.jsx(l,{control:s.control,name:"tags",render:({field:t})=>{var a,r,n;return e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(d,{children:"Skills & Tags (Max 3)"}),!k.length&&!G&&e.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:()=>{const i=s.getValues("jobTitle"),o=s.getValues("jobDescription"),w=s.getValues("category");if(!i||i.length<3){u({title:"Job title required",description:"Please enter a job title first to get suggestions.",variant:"destructive"});return}B(i,o||"",w||"")},className:"text-primary border-primary/30",children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),"Suggest with AI"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{placeholder:"Add a skill or tag",value:N,onChange:i=>Y(i.target.value),onKeyPress:je,disabled:(((a=t.value)==null?void 0:a.length)||0)>=3}),e.jsx(h,{type:"button",onClick:H,variant:"outline",disabled:(((r=t.value)==null?void 0:r.length)||0)>=3,children:"Add"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:(n=t.value)==null?void 0:n.map((i,o)=>e.jsxs(ee,{variant:"secondary",className:"gap-1",children:[i,e.jsx("button",{type:"button",onClick:()=>ue(i),className:"ml-1",children:e.jsx(Ne,{className:"w-3 h-3"})})]},o))}),G&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(z,{className:"h-4 w-4 animate-spin"}),"Getting AI suggestions..."]}),k.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"AI Suggestions (click to add):"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:k.filter(i=>{var o;return!((o=t.value)!=null&&o.includes(i))}).map((i,o)=>e.jsxs(ee,{variant:"outline",className:"cursor-pointer hover-elevate gap-1",onClick:()=>pe(i),children:[e.jsx(we,{className:"w-3 h-3"}),i]},o))})]})]}),e.jsx(m,{})]})}}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsx(h,{type:"button",variant:"outline",onClick:()=>M("company"),className:"flex-1","data-testid":"button-back",children:"Back"}),e.jsx(h,{type:"submit",className:"flex-1",disabled:R,"data-testid":"button-post-job",children:R?"Creating...":e.jsxs(e.Fragment,{children:["Post Job & Get Started",e.jsx(ae,{className:"ml-2 h-4 w-4"})]})})]})]})})})})]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground mt-6",children:"You can always add more details and post additional jobs from your dashboard"})]})]})}export{et 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.