1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2168,5387],{48778:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(52808).A)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]])},72798:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(52808).A)("pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},74283:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(52808).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},76155:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(52808).A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},28304:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/job-management",function(){return a(34291)}])},92168:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>n});var s=a(68001),l=a(58757);let n=e=>{let{onChange:t,value:a,name:n,id:i,nestedName:r}=e,d=(0,l.useRef)(null),c=(0,l.useRef)(null),o=(0,l.useRef)(a),m=(0,l.useRef)(!1),x=(0,l.useRef)(!1);return o.current=a,(0,l.useEffect)(()=>{if(window.CKEDITOR)e();else{let t=document.createElement("script");t.src="/ckeditor/ckeditor.js",t.onload=()=>{window.CKEDITOR&&e()},document.body.appendChild(t)}function e(){window.CKEDITOR.instances[i]&&window.CKEDITOR.instances[i].destroy(),window.CKEDITOR.replace(i,{skin:"bootstrapck",toolbar:[{name:"basicstyles",items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","RemoveFormat"]},{name:"paragraph",items:["NumberedList","BulletedList","-","Outdent","Indent","-","Blockquote"]},{name:"alignment",items:["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]},{name:"insert",items:["Image","HorizontalRule"]},{name:"clipboard",items:["Cut","Copy","Paste","-","Undo","Redo"]}],allowedContent:!0,extraAllowedContent:"h1 h2 h3 h4 h5 h6",enterMode:window.CKEDITOR.ENTER_BR,shiftEnterMode:window.CKEDITOR.ENTER_P,autoParagraph:!1,on:{save:function(e){return t(e.editor.getData(),n,r),!1}}}),c.current=window.CKEDITOR.instances[i],c.current&&(c.current.on("instanceReady",()=>{m.current=!0,x.current=!0,c.current.setData(o.current,{callback:()=>{x.current=!1}})}),c.current.on("change",()=>{x.current||t(c.current.getData(),n,r)}))}return()=>{if(c.current){try{c.current.destroy()}catch(e){}c.current=null}m.current=!1}},[]),(0,l.useEffect)(()=>{m.current&&c.current&&(c.current.getData()||"").trim()!==(a||"").trim()&&(x.current=!0,c.current.setData(a,{callback:()=>{x.current=!1}}))},[a]),(0,s.jsx)("textarea",{ref:d,id:i,name:n})}},34291:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>ea});var s=a(68001),l=a(13658),n=a(58757),i=a(67910),r=a(57514),d=a(85305),c=a(93774),o=a(25685),m=a(48198),x=a(63239),u=a(30269),p=a(99489),h=a(18696),g=a(27678),y=a(90162),b=a(48778),j=a(94868),f=a(6400),v=a(89432),N=a(60269),w=a(74283),k=a(86476),C=a(94579),S=a(72798),A=a(72217),M=a(30409),P=a(34768),E=a(61633),D=a(70128),T=a(68068),R=a(7484),F=a(24386),I=a(76551),_=a.n(I),B=a(52774),J=a(76155);let L={status:[],applicants:"",applicantsMin:"",matches:"",companyName:"",location:"",skill:"",postedBy:"",workMode:[],employmentType:[],category:[],expMin:"",expMax:"",salary:"",datePreset:"",fromDate:"",toDate:"",expiry:"",flagged:!1},z=[{value:"newest",label:"Newest first"},{value:"oldest",label:"Oldest first"},{value:"applicants",label:"Most applicants"},{value:"matches",label:"Most matches"},{value:"updated",label:"Recently updated"}],O=[{value:"active",label:"Active"},{value:"closed",label:"Closed"},{value:"draft",label:"Draft"}],q=[{value:"onsite",label:"On-site"},{value:"remote",label:"Remote"},{value:"hybrid",label:"Hybrid"}],K=[{value:"full-time",label:"Full-time"},{value:"part-time",label:"Part-time"},{value:"contract",label:"Contract"},{value:"internship",label:"Internship"},{value:"freelance",label:"Freelance"}
1],H=e=>e.toISOString().slice(0,10);function U(e){let t={},a=(e,a)=>{a&&(t[e]=a)};a("status",e.status.join(",")),a("applicants",e.applicants),a("applicantsMin",e.applicantsMin.trim()),a("matches",e.matches),a("companyName",e.companyName.trim()),a("location",e.location.trim()),a("skill",e.skill.trim()),a("postedBy",e.postedBy.trim()),a("workMode",e.workMode.join(",")),a("employmentType",e.employmentType.join(",")),a("category",e.category.join(",")),a("expMin",e.expMin.trim()),a("expMax",e.expMax.trim()),a("salary",e.salary);let{fromDate:s,toDate:l}=function(e){let t=new Date;return"today"===e.datePreset?{fromDate:H(t)}:"7d"===e.datePreset?{fromDate:H(new Date(t.getTime()-7*864e5))}:"30d"===e.datePreset?{fromDate:H(new Date(t.getTime()-30*864e5))}:"custom"===e.datePreset?{fromDate:e.fromDate||void 0,toDate:e.toDate||void 0}:{}}(e);return a("fromDate",s),a("toDate",l),e.datePreset&&"custom"!==e.datePreset&&(t.datePreset=e.datePreset),a("expiry",e.expiry),e.flagged&&(t.flagged="true"),t}let W=(e,t)=>{var a;return(null===(a=e.find(e=>e.value===t))||void 0===a?void 0:a.label)||t},V="block text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1.5",X="w-full border rounded-lg px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500 bg-white";function G(e){let{on:t,onClick:a,children:l}=e;return(0,s.jsx)("button",{type:"button",onClick:a,"aria-pressed":t,className:"px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ".concat(t?"bg-blue-50 border-blue-300 text-blue-700":"bg-white border-gray-200 text-gray-600 hover:border-gray-300"),children:l})}function Y(e){let{title:t,children:a}=e;return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-800",children:t}),a]})}function Q(e){let{open:t,initial:a,categories:l,onApply:i,onClose:r}=e,[d,c]=(0,n.useState)(a);if((0,n.useEffect)(()=>{t&&c(a)},[t,a]),(0,n.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&r()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,r]),!t)return null;let o=(e,t)=>c(a=>({...a,[e]:a[e].includes(t)?a[e].filter(e=>e!==t):[...a[e],t]})),m=(e,t)=>c(a=>({...a,[e]:a[e]===t?L[e]:t})),x=e=>t=>c(a=>({...a,[e]:t.target.value}));return(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/30",onClick:r,children:(0,s.jsxs)("div",{role:"dialog","aria-label":"Job filters",className:"bg-white w-full max-w-md h-full flex flex-col shadow-xl",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800",children:"Filters"}),(0,s.jsx)("button",{onClick:r,className:"p-1 hover:bg-gray-100 rounded-md","aria-label":"Close filters",children:(0,s.jsx)(j.A,{className:"w-5 h-5 text-gray-500"})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-5 py-5 space-y-6",children:[(0,s.jsx)(Y,{title:"Status",children:(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:O.map(e=>(0,s.jsx)(G,{on:d.status.includes(e.value),onClick:()=>o("status",e.value),children:e.label},e.value))})}),(0,s.jsxs)(Y,{title:"Candidate activity",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Applicants"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[(0,s.jsx)(G,{on:"has"===d.applicants,onClick:()=>m("applicants","has"),children:"Has applicants"}),(0,s.jsx)(G,{on:"none"===d.applicants,onClick:()=>m("applicants","none"),children:"No applicants"}),(0,s.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-gray-600",children:["At least",(0,s.jsx)("input",{type:"number",min:1,value:d.applicantsMin,onChange:x("applicantsMin"),className:"w-16 border rounded-md px-2 py-1 text-xs","aria-label":"Minimum applicants"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Matched candidates"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(G,{on:"has"===d.matches,onClick:()=>m("matches","has"),children:"Has matches"}),(0,s.jsx)(G,{on:"none"===d.matches,onClick:()=>m("matches","none"),children:"No matches"})]})]})]}),(0,s.jsxs)(Y,{title:"Company & location",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:V,htmlFor:"jf-company",children:"Company"}),(0,s.jsx)("input",{id:"jf-company",value:d.companyName,onChange:x("companyName"),placeholder:"e.g. Edutinker",className:X})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:V,htmlFor:"jf-location",children:"Location"}),(0,s.jsx)("input",{id:"jf-location",value:d.location,onChange:x("location"),placeholder:"City, state or country (Bengaluru also finds Bangalore)",className:X})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Work mode"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:q.map(e=>(0,s.jsx)(G,{on:d.workMode.includes(e.value),onClick:()=>o("workMode",e.value),children:e.label},e.value))})]})]}),(0,s.jsxs)(Y,{title:"Role",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Employment type"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:K.map(e=>(0,s.jsx)(G,{on:d.employmentType.includes(e.value),onClick:()=>o("employmentType",e.value),children:e.label},e.value))})]}),l.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Category"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 max-h-40 overflow-y-auto",children:l.map(e=>(0,s.jsxs)(G,{on:d.category.includes(e.value),onClick:()=>o("category",e.value),children:["(none)"===e.value?"No category":e.value," ",(0,s.jsxs)("span",{className:"text-gray-400",children:["(",e.count.toLocaleStr
1ing("en-IN"),")"]})]},e.value))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:V,htmlFor:"jf-skill",children:"Skill"}),(0,s.jsx)("input",{id:"jf-skill",value:d.skill,onChange:x("skill"),placeholder:"e.g. Python",className:X})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Experience (years)"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"number",min:0,value:d.expMin,onChange:x("expMin"),placeholder:"Min",className:X,"aria-label":"Minimum experience"}),(0,s.jsx)("span",{className:"text-gray-400",children:"â"}),(0,s.jsx)("input",{type:"number",min:0,value:d.expMax,onChange:x("expMax"),placeholder:"Max",className:X,"aria-label":"Maximum experience"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Salary"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(G,{on:"disclosed"===d.salary,onClick:()=>m("salary","disclosed"),children:"Disclosed"}),(0,s.jsx)(G,{on:"undisclosed"===d.salary,onClick:()=>m("salary","undisclosed"),children:"Not disclosed"})]})]})]}),(0,s.jsxs)(Y,{title:"Dates",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Date posted"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(G,{on:"today"===d.datePreset,onClick:()=>m("datePreset","today"),children:"Today"}),(0,s.jsx)(G,{on:"7d"===d.datePreset,onClick:()=>m("datePreset","7d"),children:"Last 7 days"}),(0,s.jsx)(G,{on:"30d"===d.datePreset,onClick:()=>m("datePreset","30d"),children:"Last 30 days"}),(0,s.jsx)(G,{on:"custom"===d.datePreset,onClick:()=>m("datePreset","custom"),children:"Custom"})]}),"custom"===d.datePreset&&(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,s.jsx)("input",{type:"date",value:d.fromDate,onChange:x("fromDate"),className:X,"aria-label":"Posted from"}),(0,s.jsx)("span",{className:"text-gray-400",children:"â"}),(0,s.jsx)("input",{type:"date",value:d.toDate,onChange:x("toDate"),className:X,"aria-label":"Posted to"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:V,children:"Expiry"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(G,{on:"expired"===d.expiry,onClick:()=>m("expiry","expired"),children:"Expired"}),(0,s.jsx)(G,{on:"expiring"===d.expiry,onClick:()=>m("expiry","expiring"),children:"Expiring in 7 days"}),(0,s.jsx)(G,{on:"valid"===d.expiry,onClick:()=>m("expiry","valid"),children:"Not expired"})]})]})]}),(0,s.jsxs)(Y,{title:"Other",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:V,htmlFor:"jf-postedby",children:"Posted by (email)"}),(0,s.jsx)("input",{id:"jf-postedby",value:d.postedBy,onChange:x("postedBy"),placeholder:"e.g. @edutinker.com",className:X})]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-700 cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:d.flagged,onChange:e=>c(t=>({...t,flagged:e.target.checked})),className:"accent-blue-600 w-4 h-4"}),"Flagged for moderation only"]})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-t bg-gray-50",children:[(0,s.jsxs)("button",{onClick:()=>c(L),className:"flex items-center gap-1.5 px-3 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg font-medium",children:[(0,s.jsx)(J.A,{className:"w-4 h-4"})," Reset"]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:r,className:"px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg font-medium",children:"Cancel"}),(0,s.jsx)("button",{onClick:()=>i(d),className:"px-5 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 font-medium",children:"Apply filters"})]})]})]})})}let Z=e=>{let{status:t}=e;return(0,s.jsx)("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-medium capitalize ".concat({draft:"bg-yellow-100 text-yellow-700",active:"bg-green-100 text-green-700",closed:"bg-red-100 text-red-700"}[t]||"bg-gray-100 text-gray-600"),children:t})},$=e=>e?new Date(e).toLocaleDateString("en-IN",{day:"2-digit",month:"short",year:"numeric"}):"-",ee=()=>{var e,t;
1let[a,l]=(0,n.useState)([]),[I,J]=(0,n.useState)(!0),[H,V]=(0,n.useState)({page:1,limit:20,totalPages:0,totalCount:0}),[X,G]=(0,n.useState)(new Set),[Y,ee]=(0,n.useState)(!1),et=e=>{G(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},ea=async()=>{var e,t,a;if(0===X.size){r.toast.error("Select at least one job");return}try{ee(!0);let t=await i.default.post("/admin-job/admin-jobs/send-mail",{jobIds:Array.from(X)});(null===(e=t.data)||void 0===e?void 0:e.success)&&(r.toast.success(t.data.message||"Emails sent"),G(new Set))}catch(e){r.toast.error((null===(a=e.response)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.message)||"Failed to send emails")}finally{ee(!1)}},es=(0,B.useRouter)(),[el,en]=(0,n.useState)("client"),[ei,er]=(0,n.useState)(""),[ed,ec]=(0,n.useState)("newest"),[eo,em]=(0,n.useState)(L),[ex,eu]=(0,n.useState)(!1),[ep,eh]=(0,n.useState)([]),[eg,ey]=(0,n.useState)(!1),eb=function(e){let t=[],a=(a,s,l)=>{e[a].forEach(e=>t.push({key:"".concat(a,":").concat(e),label:"".concat(s,": ").concat(l?W(l,e):e),clear:t=>({...t,[a]:t[a].filter(t=>t!==e)})}))},s=(e,a)=>{a&&t.push({key:e,label:a,clear:t=>({...t,[e]:L[e]})})};if(a("status","Status",O),s("applicants","has"===e.applicants?"Has applicants":"none"===e.applicants&&"No applicants"),s("applicantsMin",!!e.applicantsMin&&"⥠".concat(e.applicantsMin," applicants")),s("matches","has"===e.matches?"Has matches":"none"===e.matches&&"No matches"),s("companyName",!!e.companyName&&"Company: ".concat(e.companyName)),s("location",!!e.location&&"Location: ".concat(e.location)),s("skill",!!e.skill&&"Skill: ".concat(e.skill)),s("postedBy",!!e.postedBy&&"Posted by: ".concat(e.postedBy)),a("workMode","Work mode",q),a("employmentType","Type",K),a("category","Category"),(e.expMin||e.expMax)&&t.push({key:"exp",label:"Experience: ".concat(e.expMin||"0","â").concat(e.expMax||"any"," yrs"),clear:e=>({...e,expMin:"",expMax:""})}),s("salary","disclosed"===e.salary?"Salary disclosed":"undisclosed"===e.salary&&"Salary not disclosed"),e.datePreset){let a="today"===e.datePreset?"Posted today":"7d"===e.datePreset?"Posted in last 7 days":"30d"===e.datePreset?"Posted in last 30 days":"Posted ".concat(e.fromDate||"â¦"," â ").concat(e.toDate||"â¦");t.push({key:"date",label:a,clear:e=>({...e,datePreset:"",fromDate:"",toDate:""})})}return s("expiry","expired"===e.expiry?"Expired":"expiring"===e.expiry?"Expiring in 7 days":"valid"===e.expiry&&"Not expired"),s("flagged",!!e.flagged&&"Flagged for moderation"),t}
1(eo),ej=eb.length,[ef,ev]=(0,n.useState)(null),[eN,ew]=(0,n.useState)(null),[ek,eC]=(0,n.useState)(null),[eS,eA]=(0,n.useState)(""),[eM,eP]=(0,n.useState)(!1),[eE,eD]=(0,n.useState)(null),[eT,eR]=(0,n.useState)([]),[eF,eI]=(0,n.useState)(!1),[e_,eB]=(0,n.useState)(null),[eJ,eL]=(0,n.useState)([]),[ez,eO]=(0,n.useState)({matchedAt:null,totalEmailed:0,totalNotified:0}),[eq,eK]=(0,n.useState)(!1),[eH,eU]=(0,n.useState)(!1),[eW,eV]=(0,n.useState)(new Set),eX=async(e,t)=>{eB({jobId:e,jobTitle:t}),eK(!0);try{var a,s,l,n,d,c;let t=await i.default.get("/admin-job/admin-jobs/".concat(e,"/matched-candidates"));(null===(a=t.data)||void 0===a?void 0:a.success)&&(eL((null===(s=t.data.data)||void 0===s?void 0:s.candidates)||[]),eO({matchedAt:(null===(l=t.data.data)||void 0===l?void 0:l.matchedAt)||null,totalEmailed:(null===(n=t.data.data)||void 0===n?void 0:n.totalEmailed)||0,totalNotified:(null===(d=t.data.data)||void 0===d?void 0:d.totalNotified)||0}),((null===(c=t.data.data)||void 0===c?void 0:c.totalEmailed)||0)>0&&eV(t=>new Set(t).add(e)))}catch(e){r.toast.error("Failed to load matched candidates")}finally{eK(!1)}},eG=async()=>{var e,t,a,s,l,n,d,c,o,m;if(e_){if(0===eJ.filter(e=>!e.emailed).length){r.toast.info("All candidates have already been emailed");return}eU(!0);try{let o=await i.default.post("/admin-job/admin-jobs/".concat(e_.jobId,"/send-match-emails"));if(null===(e=o.data)||void 0===e?void 0:e.success){r.toast.success(o.data.message||"Sent ".concat((null===(t=o.data.data)||void 0===t?void 0:t.sent)||0," emails"));let e=await i.default.get("/admin-job/admin-jobs/".concat(e_.jobId,"/matched-candidates"));(null===(a=e.data)||void 0===a?void 0:a.success)&&(eL((null===(s=e.data.data)||void 0===s?void 0:s.candidates)||[]),eO({matchedAt:(null===(l=e.data.data)||void 0===l?void 0:l.matchedAt)||null,totalEmailed:(null===(n=e.data.data)||void 0===n?void 0:n.totalEmailed)||0,totalNotified:(null===(d=e.data.data)||void 0===d?void 0:d.totalNotified)||0})),eV(e=>new Set(e).add(e_.jobId))}else r.toast.error((null===(c=o.data)||void 0===c?void 0:c.message)||"Failed to send emails")}catch(e){r.toast.error((null==e?void 0:null===(m=e.response)||void 0===m?void 0:null===(o=m.data)||void 0===o?void 0:o.message)||"Failed to send emails")}finally{eU(!1)}}},eY=async(e,t)=>{eD({jobId:e,jobTitle:t}),eI(!0);try{var a;let t=await i.default.get("/admin-job/admin-jobs/".concat(e,"/applicants"));(null===(a=t.data)||void 0===a?void 0:a.success)&&eR(t.data.data||[])}catch(e){r.toast.error("Failed to load applicants")}finally{eI(!1)}},eQ=(0,d.wA)(),{showJobForm:eZ}=(0,d.d4)(e=>e.eventReducer),{isCreatingJob:e$,isUpdatingJob:e0}=(0,d.d4)(e=>e.clientReducer),{jobDetails:e1}=(0,d.d4)(e=>e.commonReducer),[e5,e4]=(0,n.useState)(1),e2=(0,n.useRef)(null),e3=(null==eZ?void 0:eZ.edit)?e0:e$,e6=e=>{eQ((0,o.gY)({jobId:e,cb:()=>{eQ((0,c.L)({showJobForm:{modal:!0,jobId:e,draftId:null,edit:!0}})),e4(1)}}))},e7=async()=>{e2.current&&await e2.current.validateCurrentStep()&&e5<3&&e4(e5+1)},e8=(0,n.useRef)(null),e9=(0,n.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;try{var t;J(!0);let a={page:e,limit:H.limit,source:el,sort:ed,...U(eo)};ei&&(a.search=ei);let s=await i.default.get("/admin-job/admin-jobs",{params:a});(null===(t=s.data)||void 0===t?void 0:t.success)&&(l(s.data.data||[]),V(s.data.pagination||{page:1,limit:20,totalPages:0,totalCount:0}))}catch(e){r.toast.error("Failed to load jobs")}finally{J(!1)}},[ei,eo,ed,el,H.limit]);(0,n.useEffect)(()=>{if(!es.isReady||eg)return;let e=es.query,t="string"==typeof e.source?e.source:"";("client"===t||"api"===t||"migrated"===t||"all"===t)&&en(t),"string"==typeof e.search&&er(e.search),"string"==typeof e.sort&&z.some(t=>t.value===e.sort)&&ec(e.sort),em(function(e){let t=t=>"string"==typeof e[t]?e[t]:"",a=e=>t(e).split(",").map(e=>e.trim()).filter(Boolean),s=t("datePreset"),l=!s&&(t("fromDate")||t("toDate")),n=(e,t)=>t.includes(e)?e:"";return{status:a("status"),applicants:n(t("applicants"),["has","none"]),applicantsMin:t("applicantsMin"),matches:n(t("matches"),["has","none"]),companyName:t("companyName"),location:t("location"),skill:t("skill"),postedBy:t("postedBy"),workMode:a("workMode"),employmentType:a("employmentType"),category:a("category"),expMin:t("expMin"),expMax:t("expMax"),salary:n(t("salary"),["disclosed","undisclosed"]),datePreset:l?"custom"
1:n(s,["today","7d","30d","custom"]),fromDate:l?t("fromDate"):"",toDate:l?t("toDate"):"",expiry:n(t("expiry"),["expired","expiring","valid"]),flagged:"true"===t("flagged")}}(e)),ey(!0)},[es.isReady,es.query,eg]),(0,n.useEffect)(()=>{if(!eg)return;e9(1);let e={...U(eo)};"client"!==el&&(e.source=el),"newest"!==ed&&(e.sort=ed),ei&&(e.search=ei),es.replace({pathname:es.pathname,query:e},void 0,{shallow:!0,scroll:!1})},[eo,el,ed,eg]);let te=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(eg){if(!te.current){te.current=!0;return}return e8.current&&clearTimeout(e8.current),e8.current=setTimeout(()=>{e9(1);let e={...es.query};ei?e.search=ei:delete e.search,es.replace({pathname:es.pathname,query:e},void 0,{shallow:!0,scroll:!1})},400),()=>{e8.current&&clearTimeout(e8.current)}}},[ei,eg]),(0,n.useEffect)(()=>{i.default.get("/admin-job/admin-jobs/filter-options").then(e=>{var t,a;return eh((null===(a=e.data)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.categories)||[])}).catch(e=>console.warn("filter-options failed",null==e?void 0:e.message))},[]);let tt=e=>er(e),ta=async e=>{if(confirm('Approve "'.concat(e.jobTitle,'"?')))try{eP(!0),await i.default.put("/admin-job/admin-jobs/".concat(e._id,"/approve")),r.toast.success("Job approved"),e9(H.page)}catch(e){var t,a;r.toast.error((null===(a=e.response)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.message)||"Failed to approve")}finally{eP(!1)}},ts=async()=>{if(!eN||!eS.trim()){r.toast.error("Please provide rejection feedback");return}try{eP(!0),await i.default.put("/admin-job/admin-jobs/".concat(eN._id,"/reject"),{feedback:eS}),r.toast.success("Job rejected"),ew(null),eA(""),e9(H.page)}catch(a){var e,t;r.toast.error((null===(t=a.response)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.message)||"Failed to reject")}finally{eP(!1)}},tl=async e=>{if(confirm('Close "'.concat(e.jobTitle,'"?')))try{eP(!0),await i.default.put("/admin-job/admin-jobs/".concat(e._id,"/close")),r.toast.success("Job closed"),e9(H.page)}catch(e){var t,a;r.toast.error((null===(a=e.response)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.message)||"Failed to close")}finally{eP(!1)}},tn=async()=>{if(ek)try{eP(!0),await i.default.delete("/admin-job/admin-jobs/".concat(ek._id)),r.toast.success("Job deleted"),eC(null),e9(H.page)}catch(a){var e,t;r.toast.error((null===(t=a.response)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.message)||"Failed to delete")}finally{eP(!1)}},ti=(0,n.useCallback)(()=>eu(!1),[]);return(0,s.jsxs)("div",{className:"space-y-6 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-gray-800",children:"Job Management"}),(0,s.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:[H.totalCount.toLocaleString("en-IN")," ","client"===el?"client-posted jobs":"api"===el?"API-imported jobs":"migrated"===el?"migrated jobs":"total jobs"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[X.size>0&&(0,s.jsxs)("button",{onClick:ea,disabled:Y,className:"flex items-center gap-2 bg-green-600 text-white px-4 py-2.5 rounded-lg hover:bg-green-700 disabled:opacity-50 transition-colors text-sm font-medium",children:[Y?(0,s.jsx)(u.A,{className:"w-4 h-4 animate-spin"}):(0,s.jsx)(p.A,{className:"w-4 h-4"}),"Send Mail (",X.size,")"]}),(0,s.jsxs)(_(),{href:"/admin/job-category",className:"flex items-center gap-2 border border-gray-300 text-gray-700 px-4 py-2.5 rounded-lg hover:bg-gray-50 transition-colors text-sm font-medium",children:[(0,s.jsx)(h.A,{className:"w-4 h-4"})," Categories"]}),(0,s.jsxs)("button",{onClick:()=>{eQ((0,c.L)({showJobForm:{modal:!0,jobId:null,draftId:null,edit:!1}})),e4(1)},className:"flex items-center gap-2 bg-blue-600 text-white px-4 py-2.5 rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium",children:[(0,s.jsx)(g.A,{className:"w-4 h-4"})," Add Job"]})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border p-4 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsxs)("div",{className:"relative flex-1 min-w-0 sm:min-w-[250px]",children:[(0,s.jsx)(y.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,s.jsx)("input",{type:"text",value:ei,onChange:e=>tt(e.target.value),placeholder:"Search job title...",className:"w-full pl-10 pr-3 py-2 border rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none"})]}),(0,s.jsx)("div",{className:"flex items-center gap-0.5 bg-gray-100 rounded-lg p-0.5",role:"tablist","aria-label":"Job source",children:[{key:"client",label:"Client jobs",hint:"Posted by clients (and Olibr staff) on Olibr"},{key:"api",label:"API imports",hint:"Pulled in automatically from JSearch"},{key:"migrated",label:"Migrated",hint:"Older jobs migrated from the previous platform"},{key:"all",label:"All",hint:"Every job"}].map(e=>(0,s.jsx)("button",{role:"tab","aria-selected":el===e.key,title:e.hint,onClick:()=>en(e.key),className:"px-3 py-1.5 text-sm font-medium rounded-md whitespace-nowrap transition-colors ".concat(el===e.key?"bg-white text-blue-700 shadow-sm":"text-gray-500 hover:text-gray-800"),children:e.label},e.key))}),(0,s.jsxs)("button",{onClick:()=>eu(!0),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm border ".concat(ej>0?"bg-blue-50 border-blue-300 text-blue-700":"text-gray-600 hover:bg-gray-50"),children:[(0,s.jsx)(b.A,{className:"w-4 h-4"})," Filters",ej>0&&(0,s.jsx)("span",{className:"bg-blue-600 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center",children:ej})]}),(0,s.jsx)("select",{value:ed,onChange:e=>ec(e.target.value),"aria-label":"Sort jobs",className:"px-3 py-2 rounded-lg text-sm border text-gray-600 bg-white outline-none focus:ring-2 focus:ring-blue-500",children:z.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})]}),eb.length>0&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-3 pt-3 border-t",children:[eb.map(e=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 pl-2.5 pr-1 py-1 rounded-full bg-blue-50 border border-blue-200 text-xs text-blue-800",children:[e.label,(0,s.jsx)("button",{onClick:()=>em(t=>e.clear(t)),className:"p-0.5 rounded-full hover:bg-blue-100","aria-label":"Remove ".concat(e.label),children:(0,s.jsx)(j.A,{className:"w-3 h-3"})})]},e.key)),(0,s.jsx)("button",{onClick:()=>{em(L)},className:"text-xs font-medium text-red-500 hover:text-red-700 ml-1",children:"Clear all"})]})]}),I?(0,s.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,s.jsx)(u.A,{className:"w-6 h-6 animate-spin text-blue-600"})}):0===a.length?(0,s.jsxs)("div",{className:"bg-white rounded-xl border p-12 text-center",children:[(0,s.jsx)(f.A,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),(0,s.jsx)("h3",{className:"text-lg font-medium text-gray-700 mb-2",children:"No Jobs Found"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Try adjusting your filters"})]}):(0,s.jsxs)("div",{className:"bg-white rounded-xl border overflow-hidden",children:[(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-sm min-w-[1000px]",children:[(0,s.jsx)("thead",{className:"bg-gray-50 border-b",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 w-10",children:(0,s.jsx)("input",{type:"checkbox",checked:a.length>0&&X.size===a.length,onChange:()=>{X.size===a.length?G(new Set):G(new Set(a.map(e=>e._id)))},className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600 w-10",children:"#"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Job Title"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Company"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Location"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Skills"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Applicants"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Matched"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Status"}),(0,s.jsx)("th",{className:"text-left px-4 py-3 font-medium text-gray-600",children:"Posted"}),(0,s.jsx)("th",{className:"text-right px-4 py-3 font-medium text-gray-600",children:"Actions"})]})}),(0,s.jsx)("tbody",{className:"divide-y",children:a.map((e,t)=>{var a,l,n,i;return(0,s.jsxs)("tr",{className:"hover:bg-gray-50 transition-colors",children:[(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("input",{type:"checkbox",checked:X.has(e._id
1),onChange:()=>et(e._id),className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500",children:(H.page-1)*H.limit+t+1}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsxs)("button",{onClick:()=>ev(e),className:"text-left hover:text-blue-600 transition-colors",children:[(0,s.jsx)("span",{className:"font-medium text-gray-800",children:e.jobTitle}),e.isExternalJob&&"api"!==el&&(0,s.jsx)("span",{className:"ml-1.5 align-middle px-1.5 py-0.5 rounded bg-gray-100 text-gray-500 text-[10px] font-medium",title:"Imported from JSearch",children:"API"}),e.employmentType&&(0,s.jsxs)("span",{className:"block text-xs text-gray-400 capitalize",children:[e.employmentType," ",e.workMode?"/ ".concat(e.workMode):""]})]})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600",children:(null===(a=e.companySnapshot)||void 0===a?void 0:a.name)||"-"}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600 text-xs",children:(null===(l=e.jobLocation)||void 0===l?void 0:l.slice(0,2).join(", "))||"-"}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(e.jobSkill||[]).slice(0,3).map((e,t)=>(0,s.jsx)("span",{className:"px-1.5 py-0.5 bg-blue-50 text-blue-600 rounded text-xs",children:e.title},t)),((null===(n=e.jobSkill)||void 0===n?void 0:n.length)||0)>3&&(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["+",((null===(i=e.jobSkill)||void 0===i?void 0:i.length)||0)-3]})]})}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsxs)("button",{onClick:()=>eY(e._id,e.jobTitle),className:"flex items-center gap-1 text-blue-600 hover:text-blue-800 hover:underline transition-colors",children:[(0,s.jsx)(v.A,{className:"w-3.5 h-3.5"})," ",e.applicantCount||0]})}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsxs)("button",{onClick:()=>e.matchedCandidateCount?eX(e._id,e.jobTitle):null,className:"flex items-center gap-1 transition-colors ".concat(eW.has(e._id)?"text-green-600 hover:text-green-800 hover:underline cursor-pointer":e.matchedCandidateCount?"text-purple-600 hover:text-purple-800 hover:underline cursor-pointer":"text-gray-400 cursor-default"),children:[(0,s.jsx)(p.A,{className:"w-3.5 h-3.5"})," ",e.matchedCandidateCount||0]})}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)(Z,{status:e.jobStatus})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 text-xs",children:$(e.createdAt)}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,s.jsx)("button",{onClick:()=>ev(e),className:"p-1.5 text-gray-500 hover:bg-gray-100 rounded-md",title:"View Details",children:(0,s.jsx)(N.A,{className:"w-4 h-4"})}),(0,s.jsx)("button",{onClick:()=>e6(e._id),className:"p-1.5 text-blue-500 hover:bg-blue-50 rounded-md",title:"Edit Job",children:(0,s.jsx)(w.A,{className:"w-4 h-4"})}),"draft"===e.jobStatus&&(0,s.jsx)("button",{onClick:()=>ta(e),disabled:eM,className:"p-1.5 text-green-600 hover:bg-green-50 rounded-md",title:"Approve",children:(0,s.jsx)(k.A,{className:"w-4 h-4"})}),"draft"===e.jobStatus&&(0,s.jsx)("button",{onClick:()=>{ew(e),eA("")},className:"p-1.5 text-orange-500 hover:bg-orange-50 rounded-md",title:"Reject",children:(0,s.jsx)(C.A,{className:"w-4 h-4"})}),"active"===e.jobStatus&&(0,s.jsx)("button",{onClick:()=>tl(e),disabled:eM,className:"p-1.5 text-yellow-600 hover:bg-yellow-50 rounded-md",title:"Close",children:(0,s.jsx)(S.A,{className:"w-4 h-4"})}),(0,s.jsx)("button",{onClick:()=>eC(e),className:"p-1.5 text-red-500 hover:bg-red-50 rounded-md",title:"Delete",children:(0,s.jsx)(A.A,{className:"w-4 h-4"})})]})})]},e._id)})})]})}),H.totalPages>1&&(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t bg-gray-50",children:[(0,s.jsxs)("p",{className:"text-sm text-gray-500",children:["Page ",H.page," of ",H.totalPages," (",H.totalCount," jobs)"]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{onClick:()=>e9(H.page-1),disabled:H.page<=1,className:"p-1.5 rounded-md hover:bg-gray-200 disabled:opacity-30 disabled:cursor-not-allowed",children:(0,s.jsx)(M.A,{className:"w-4 h-4"})}),Array.from({length:Math.min(5,H.totalPages)},(e,t)=>{let a=Math.max(1,Math.min(H.page-2,H.totalPages-4))+t;return a>H.totalPages?null:(0,s.jsx)("button",{onClick:()=>e9(a),className:"px-3 py-1 rounded-md text-sm ".concat(a===H.page?"bg-blue-600 text-white":"hover:bg-gray-200 text-gray-700"),children:a},a)}),(0,s.jsx)("button",{onClick:()=>e9(H.page+1),disabled:H.page>=H.totalPages,className:"p-1.5 rounded-md hover:bg-gray-200 disabled:opacity-30 disabled:cursor-not-allowed",children:(0,s.jsx)(P.A,{className:"w-4 h-4"})})]})]})]}),ef&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-2xl mx-4 max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)("div",{className:"sticky top-0 bg-white border-b px-6 py-4 flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800",children:ef.jobTitle}),(0,s.jsx)("button",{onClick:()=>ev(null),className:"p-1 hover:bg-gray-100 rounded-md",children:(0,s.jsx)(j.A,{className:"w-5 h-5 text-gray-500"})})]}),(0,s.jsxs)("div",{className:"p-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 flex-wrap",children:[(0,s.jsx)(Z,{status:ef.jobStatus}),(null===(e=ef.companySnapshot)||void 0===e?void 0:e.name)&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-sm text-gray-600",children:[(0,s.jsx)(E.A,{className:"w-4 h-4"})," ",ef.companySnapshot.name]}),(null===(t=ef.jobLocation)||void 0===t?void 0:t[0])&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-sm text-gray-600",children:[(0,s.jsx)(D.A,{className:"w-4 h-4"}
1)," ",ef.jobLocation.join(", ")]}),(0,s.jsxs)("span",{className:"flex items-center gap-1 text-sm text-gray-600",children:[(0,s.jsx)(T.A,{className:"w-4 h-4"})," ",$(ef.createdAt)]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,s.jsxs)("div",{className:"bg-gray-50 rounded-lg p-3",children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Employment Type"}),(0,s.jsx)("p",{className:"font-medium capitalize",children:ef.employmentType||"-"})]}),(0,s.jsxs)("div",{className:"bg-gray-50 rounded-lg p-3",children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Work Mode"}),(0,s.jsx)("p",{className:"font-medium",children:ef.workMode||"-"})]}),(0,s.jsxs)("div",{className:"bg-gray-50 rounded-lg p-3",children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Positions"}),(0,s.jsx)("p",{className:"font-medium",children:ef.numberOfPositions||"-"})]}),(0,s.jsxs)("div",{className:"bg-gray-50 rounded-lg p-3",children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Applicants"}),(0,s.jsx)("p",{className:"font-medium",children:ef.applicantCount||0})]})]}),ef.jobSkill&&ef.jobSkill.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Skills"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:ef.jobSkill.map((e,t)=>(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-full text-xs font-medium ".concat(e.isRequired?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600"),children:[e.title," ",e.isRequired?"(Required)":""]},t))})]}),ef.jobDescription&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Description"}),(0,s.jsx)("div",{className:"text-sm text-gray-600 bg-gray-50 rounded-lg p-3 max-h-40 overflow-y-auto",dangerouslySetInnerHTML:{__html:ef.jobDescription}})]}),ef.rejectionFeedback&&(0,s.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:[(0,s.jsx)("h4",{className:"text-sm font-medium text-red-700 mb-1",children:"Rejection Feedback"}),(0,s.jsx)("p",{className:"text-sm text-red-600",children:ef.rejectionFeedback}),ef.rejectedBy&&(0,s.jsxs)("p",{className:"text-xs text-red-400 mt-1",children:["By ",ef.rejectedBy," on ",$(ef.rejectedAt||"")]})]}),ef.createdBySnapshot&&(0,s.jsxs)("div",{className:"text-xs text-gray-400",children:["Posted by: ",ef.createdBySnapshot.firstName," ",ef.createdBySnapshot.lastName," (",ef.createdBySnapshot.email,")"]})]})]})}),eN&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md mx-4 p-6",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800 mb-1",children:"Reject Job"}),(0,s.jsxs)("p",{className:"text-sm text-gray-500 mb-4",children:["Rejecting: ",eN.jobTitle]}),(0,s.jsx)("textarea",{value:eS,onChange:e=>eA(e.target.value),placeholder:"Provide feedback for the rejection...",className:"w-full border rounded-lg px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500 resize-none",rows:4}),(0,s.jsxs)("div",{className:"flex justify-end gap-3 mt-4",children:[(0,s.jsx)("button",{onClick:()=>ew(null),className:"px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg",children:"Cancel"}),(0,s.jsxs)("button",{onClick:ts,disabled:eM||!eS.trim(),className:"flex items-center gap-2 bg-red-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-red-700 disabled:opacity-50",children:[eM?(0,s.jsx)(u.A,{className:"w-4 h-4 animate-spin"}):(0,s.jsx)(C.A,{className:"w-4 h-4"})," Reject"]})]})]})}),ek&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md mx-4 p-6",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800 mb-1",children:"Delete Job"}),(0,s.jsxs)("p",{className:"text-sm text-gray-500 mb-4",children:["Are you sure you want to permanently delete ",(0,s.jsx)("strong",{children:ek.jobTitle}),"? This action cannot be undone."]}),(0,s.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,s.jsx)("button",{onClick:()=>eC(null),className:"px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg",children:"Cancel"}),(0,s.jsxs)("button",{onClick:tn,disabled:eM,className:"flex items-center gap-2 bg-red-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-red-700 disabled:opacity-50",children:[eM?(0,s.jsx)(u.A,{className:"w-4 h-4 animate-spin"}):(0,s.jsx)(A.A,{className:"w-4 h-4"})," Delete"]})]})]})}),eE&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800",children:"Applicants"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:eE.jobTitle})]}),(0,s.jsx)("button",{onClick:()=>{eD(null),eR([])},className:"p-1 hover:bg-gray-100 rounded-md",children:(0,s.jsx)(j.A,{className:"w-5 h-5 text-gray-500"})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:eF?(0,s.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,s.jsx)(u.A,{className:"w-6 h-6 animate-spin text-blue-600"})}):0===eT.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)(v.A,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),(0,s.jsx)("p",{className:"text-gray-500",children:"No applicants yet"})]}):(0,s.jsx)("div",{className:"space-y-3",children:eT.map((e,t)=>{var a,l;let n=e.candidateSnapshots||{};return(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg border",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center shrink-0",children:(0,s.jsx)("span",{className:"text-sm font-bold text-blue-600",children:((null===(a=n.firstName)||void 0===a?void 0:a[0])||"?").toUpperCase()})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("p",{className:"font-medium text-gray-800 truncate",children:[n.firstName||""," ",n.lastName||""]}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 truncate",children:[n.email||"",n.designation?" | ".concat(n.designation):"",n.location?" | ".concat(n.location):""]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0 ml-3",children:[(null===(l=e.profileMatch)||void 0===l?void 0:l.matchPercentage)!=null&&(0,s.jsxs)("span",{className:"text-xs font-medium text-green-600 bg-green-50 px-2 py-1 rounded",children:[Math.round(e.profileMatch.matchPercentage),"% match"]}),(0,s.jsx)("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-medium capitalize ".concat({pending:"bg-yellow-100 text-yellow-700",approved:"bg-green-100 text-green-700",hired:"bg-blue-100 text-blue-700",rejected:"bg-red-100 text-red-700",autorejected:"bg-red-100 text-red-700",assigned:"bg-purple-100 text-purple-700",cancelled:"bg-gray-100 text-gray-600"}[e.status]||"bg-gray-100 text-gray-600"),children:e.status})]})]},e._id||t)})})})]})}),e_&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800",children:"Matched Candidates"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:e_.jobTitle}),ez.matchedAt&&(0,s.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5",children:["Matched on ",new Date(ez.matchedAt).toLocaleDateString()," â ",ez.totalEmailed," emailed, ",ez.totalNotified," notified"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[eJ.length>0&&(0,s.jsx)("button",{onClick:eG,disabled:eH||eJ.every(e=>e.emailed),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(eJ.every(e=>e.emailed)?"bg-green-50 text-green-600 cursor-default":eH?"bg-blue-50 text-blue-400 cursor-wait":"bg-blue-600 text-white hover:bg-blue-700"),
1children:eH?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.A,{className:"w-3.5 h-3.5 animate-spin"})," Sending..."]}):eJ.every(e=>e.emailed)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(k.A,{className:"w-3.5 h-3.5"})," All Emailed"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(R.A,{className:"w-3.5 h-3.5"})," Send Emails (",eJ.filter(e=>!e.emailed).length,")"]})}),(0,s.jsx)("button",{onClick:()=>{eB(null),eL([])},className:"p-1 hover:bg-gray-100 rounded-md",children:(0,s.jsx)(j.A,{className:"w-5 h-5 text-gray-500"})})]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:eq?(0,s.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,s.jsx)(u.A,{className:"w-6 h-6 animate-spin text-purple-600"})}):0===eJ.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)(p.A,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),(0,s.jsx)("p",{className:"text-gray-500",children:"No matched candidates yet"})]}):(0,s.jsx)("div",{className:"space-y-3",children:eJ.map((e,t)=>{var a;let l=e.score>=80?"bg-green-50 text-green-700":e.score>=60?"bg-blue-50 text-blue-700":"bg-gray-100 text-gray-600";return(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg border",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center shrink-0",children:(0,s.jsx)("span",{className:"text-sm font-bold text-purple-600",children:((null===(a=e.firstName)||void 0===a?void 0:a[0])||"?").toUpperCase()})}),(0,s.jsxs)("div",{className:"min-w-0",children:[e.userId?(0,s.jsxs)(_(),{href:"/admin/developers/".concat(e.userId),className:"font-medium text-gray-800 hover:text-purple-600 hover:underline truncate block",children:[e.firstName||""," ",e.lastName||""]}):(0,s.jsxs)("p",{className:"font-medium text-gray-800 truncate",children:[e.firstName||""," ",e.lastName||""]}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 truncate",children:[e.email||"",e.designation?" | ".concat(e.designation):"",e.city?" | ".concat(e.city):"",e.experience?" | ".concat(Math.round(e.experience),"y exp"):""]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-3",children:[(0,s.jsxs)("span",{className:"text-xs font-medium px-2 py-1 rounded ".concat(l),children:[e.score,"% match"]}),e.emailed&&(0,s.jsx)("span",{className:"text-xs text-green-600 bg-green-50 px-2 py-0.5 rounded",children:"Emailed"})]})]},e.email||t)})})})]})}),(0,s.jsx)(Q,{open:ex,initial:eo,categories:ep,onApply:e=>{em(e),eu(!1)},onClose:ti}),(0,s.jsx)(m.A,{title:"".concat((null==eZ?void 0:eZ.edit)?"Edit":"Create"," Job"),isOpen:null==eZ?void 0:eZ.modal,onClose:()=>{e3||eQ((0,c.L)({showJobForm:{modal:!1,jobId:null,draftId:null,edit:!1}}))},content:(0,s.jsx)(x.Ay,{isEdit:null==eZ?void 0:eZ.edit,ref:e2,currentStep:e5,setCurrentStep:e4,totalSteps:3}),maxWidth:"4xl",hasFooter:!1,customFooter:(0,s.jsxs)("div",{className:"flex justify-between items-center gap-4 px-6 py-4 border-t border-gray-200 bg-gray-50",children:[(0,s.jsxs)("button",{onClick:()=>e4(e=>Math.max(e-1,1)),disabled:1===e5||e3,className:"text-sm flex items-center px-4 py-2 rounded-md font-medium transition-colors ".concat(1===e5||e3?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-200 text-gray-700 hover:bg-gray-300"),children:[(0,s.jsx)(M.A,{className:"w-4 h-4 mr-2"})," BACK"]}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)("button",{onClick:()=>{e2.current&&e2.current.onSaveAsDraft()},disabled:e3,className:"text-sm px-4 py-2 border border-blue-600 text-blue-600 rounded-md hover:bg-blue-50 font-medium ".concat(e3?"opacity-50 cursor-not-allowed":""),children:"SAVE AS DRAFT"}),(0,s.jsx)("button",{onClick:e5<3?e7:()=>{e2.current&&e2.current.onSubmit()},disabled:e3,className:"text-sm flex items-center px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 font-medium ".concat(e3?"opacity-75 cursor-not-allowed":""),children:e3?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(F.A,{className:"w-4 h-4 mr-2 animate-spin"}),3===e5?"SUBMITTING...":"PROCESSING..."]}):e5<3?(0,s.jsxs)(s.Fragment,{children:["NEXT ",(0,s.jsx)(P.A,{className:"w-4 h-4 ml-2"})]}):"SUBMIT"})]})]})})]})};var et=a(51318);let ea=()=>(0,s.jsxs)(l.A,{hideSidebar:!1,children:[(0,s.jsx)(et.bV,{title:"Job Management",description:"Moderate and manage all job postings across the Olibr platform."}),(0,s.jsx)("div",{className:"flex-1 min-w-0 overflow-auto p-6",children:(0,s.jsx)(ee,{})})]})}},e=>{var t=t=>e(e.s=t);e.O(0,[6551,7717,5553,6410,8926,9588,5876,3980,4960,2024,3658,7956,3239,636,6593,8792],()=>t(28304)),_N_E=e.O()}]);
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.