PageSourceSearch

https://xyrus.ai/_next/static/chunks/1971.852dcaedc3450107.js

js xyrus.ai collected 2026-10-05 15:09:08 UTC 12,479 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1971],{48346:(e,s,t)=>{t.d(s,{default:()=>r});var a=t(95155),n=t(12115),d=t(25016),l=t(28990);let r=e=>{let{label:s,loading:t,items:r,selectedItems:i,onSelectionChange:o,renderItem:c,className:u,showRecommendedSection:m=!1,title:x="All Candidates",onLoadMore:h,hasMore:v,isLoadingMore:f,searchQuery:g,onSearchChange:p,isSearching:b=!1}=e,[j,y]=(0,n.useState)(""),[N,C]=(0,n.useState)(!1),_=(0,n.useRef)(null),A=(0,n.useRef)(null),w=(0,n.useRef)(null),S=void 0!==g?g:j,I=p||y,K=void 0!==g?r:r.filter(e=>""===S||e.name.toLowerCase().includes(S.toLowerCase())),L=K.filter(e=>(e.cdoRstScore||0)>30).sort((e,s)=>(s.cdoRstScore||0)-(e.cdoRstScore||0)).slice(0,5),k=e=>{i.find(s=>s.id===e.id)?o(i.filter(s=>s.id!==e.id)):o([...i,e]),void 0===g&&I("")},E=e=>{o(i.filter(s=>s.id!==e))};(0,n.useEffect)(()=>{let e=e=>{_.current&&!_.current.contains(e.target)&&C(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,n.useEffect)(()=>{if(!N)return;let e=A.current,s=w.current;if(!e||!s||!h)return;let t=new IntersectionObserver(e=>{let s=e[0];s&&s.isIntersecting&&!1!==v&&!f&&h()},{root:e,rootMargin:"200px 0px 0px 0px",threshold:0});return t.observe(s),()=>t.disconnect()},[N,h,v,f]);let R=(e,s)=>(0,a.jsxs)("div",{className:(0,d.cn)("flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-gray-50"),children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)("input",{type:"checkbox",checked:s,onChange:t=>{t.stopPropagation(),s?E(e.id):k(e)},className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"})}),(0,a.jsx)("div",{className:"w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"text-gray-700 font-semibold text-xs",children:e.name.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2)})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-gray-900 truncate",children:e.name}),e.role&&(0,a.jsx)("div",{className:"text-sm text-gray-600",children:e.role})]})]});return(0,a.jsxs)("div",{className:(0,d.cn)("space-y-3 p-0.5",u),children:[s&&(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 ",children:s}),(0,a.jsxs)("div",{className:"relative mt-2",ref:_,children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",disabled:t,value:S,onChange:e=>{I(e.target.value),C(!0)},onFocus:()=>C(!0),placeholder:t?"Loading...":N?"Search":"Select",className:"w-full px-3 py-2 pr-10 border border-gray-200 rounded-lg focus:outline-none focus:ring-1  focus:border-transparent"}),(0,a.jsx)("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none",children:(0,a.jsx)(l.A,{icon:"/images/icons/chevron-down.svg",width:16,height:16})})]}),i.length>0&&(0,a.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:i.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 bg-gray-100 rounded-full px-3 py-1 text-sm",children:[(0,a.jsx)("span",{className:"text-gray-700",children:e.name}),(0,a.jsx)("button",{onClick:()=>E(e.id),className:"text-gray-500 hover:text-gray-700",children:"\xd7"})]},e.id))}),N&&(0,a.jsx)("div",{ref:A,className:"absolute top-full left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-10 h-[70vh] overflow-y-auto",children:(0,a.jsx)("div",{className:"p-2",children:b?(0,a.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Searching candidates..."})]})}):(0,a.jsxs)(a.Fragment,{children:[m&&L.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 border-b border-gray-100 mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:L.length>0&&L.every(e=>i.find(s=>s.id===e.id)),onChange:()=>{if(L.every(e=>i.find(s=>s.id===e.id)))o(i.filter(e=>!L.find(s=>s.id===e.id)));else{let e=[...i];
1L.forEach(s=>{e.find(e=>e.id===s.id)||e.push(s)}),o(e)}},className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"}),(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-700",children:"Recommended Candidates"})]})}),(0,a.jsx)("div",{className:"mb-4",children:null==L?void 0:L.map(e=>{let s=i.find(s=>s.id===e.id);return(0,a.jsx)("div",{onClick:()=>k(e),children:c?c(e,!!s):R(e,!!s)},e.id)})})]}),(()=>{let e=m?K.filter(e=>!L.find(s=>s.id===e.id)):K;return e.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 border-b border-gray-100 mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:e.length>0&&e.every(e=>i.find(s=>s.id===e.id)),onChange:()=>{if(e.every(e=>i.find(s=>s.id===e.id)))o(i.filter(s=>!e.find(e=>e.id===s.id)));else{let s=[...i];e.forEach(e=>{s.find(s=>s.id===e.id)||s.push(e)}),o(s)}},className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"}),(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-700",children:x})]})}),(0,a.jsx)("div",{children:e.map(e=>{let s=i.find(s=>s.id===e.id);return(0,a.jsx)("div",{onClick:()=>k(e),children:c?c(e,!!s):R(e,!!s)},e.id)})})]}):null})(),0===K.length?(0,a.jsx)("div",{className:"text-center py-4 text-gray-500",children:"No items found"}):null,(0,a.jsx)("div",{ref:w,className:"h-1"}),f?(0,a.jsx)("div",{className:"text-center py-3 text-gray-500 text-sm",children:"Loading…"}):null,!1===v?(0,a.jsx)("div",{className:"text-center py-2 text-gray-400 text-xs",children:"No more results"}):null]})})})]})]})}},81971:(e,s,t)=>{t.r(s),t.d(s,{default:()=>g});var a=t(95155),n=t(12115),d=t(97003),l=t(90235),r=t(67001),i=t(50060),o=t(97582),c=t(22544),u=t
1(33602),m=t(98734),x=t(44193),h=t(48346);let v=m.Ik({status:m.fc(o.Ks),candidate_id:m.YO(m.Yj()).optional(),lost_reason:m.Yj().optional()}).superRefine((e,s)=>{e.status!==o.Ks.ClosedWon||Array.isArray(e.candidate_id)&&0!==e.candidate_id.length||s.addIssue({code:x.eq.custom,path:["candidate_id"],message:"Please select a candidate"}),e.status!==o.Ks.ClosedLost&&e.status!==o.Ks.Abandon||(e.lost_reason||"").trim()||s.addIssue({code:x.eq.custom,path:["lost_reason"],message:"Please provide a reason"})}),f=e=>{var s;let{project:t,projectCandidateData:m=[],onSubmit:x,onCancel:f,error:g=null,initialCandidateId:p,initialCandidateIds:b,initialLostReason:j}=e,[y,N]=n.useState(!1),{register:C,handleSubmit:_,formState:{errors:A,isSubmitting:w},setValue:S,watch:I}=(0,c.mN)({resolver:(0,u.u)(v),defaultValues:{status:(0,o._Y)((null==t?void 0:t.status)||o.Ks.Active),candidate_id:b&&b.length>0?b:p?[p]:[],lost_reason:j||""}}),K=async e=>{N(!0);try{await x({status:e.status,...Array.isArray(e.candidate_id)&&e.candidate_id.length>0?{candidate_id:e.candidate_id}:{},...e.lost_reason&&{lost_reason:e.lost_reason}});return}catch(e){console.error("Form submission error:",e),N(!1)}},L=[{value:o.Ks.Active,label:"Active"},{value:o.Ks.ClosedWon,label:"Closed won"},{value:o.Ks.ClosedLost,label:"Closed lost"},{value:o.Ks.Abandon,label:o.eb[o.Ks.Abandon]}],k=I("status"),E=I("candidate_id"),R=!Array.isArray(E)||0===E.length,O=n.useMemo(()=>m.map(e=>({id:e.id,name:e.name})),[m]),W=n.useMemo(()=>E||[],[E]),T=n.useMemo(()=>O.filter(e=>W.includes(e.id)),[O,W]),D=I("lost_reason"),F=k===o.Ks.ClosedWon,M=k===o.Ks.ClosedLost||k===o.Ks.Abandon,V=k===o.Ks.Abandon,Y=w||y||F&&R||M&&!(D||"").trim(),P=n.useMemo(()=>{let e=(0,o._Y)((null==t?void 0:t.status)||"");return e===o.Ks.ClosedWon||e===o.Ks.ClosedLost||e===o.Ks.Abandon},[null==t?void 0:t.status]);return(0,a.jsx)("div",{className:"flex flex-col h-[400px]",children:(0,a.jsxs)("form",{onSubmit:_(K),className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto",children:[g&&(0,a.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-md",children:(0,a.jsx)("p",{className:"text-sm text-red-600",children:g})}),(0,a.jsx)(i.SingleSelect,{label:"Choose Status",required:!0,placeholder:"Select Status",options:L,value:
1I("status"),onChange:e=>S("status",e),disabled:P,error:null==(s=A.status)?void 0:s.message}),k===o.Ks.ClosedWon&&(0,a.jsx)(h.default,{label:"Select Candidates",items:O,selectedItems:T,onSelectionChange:e=>S("candidate_id",e.map(e=>e.id),{shouldDirty:!0,shouldValidate:!0}),showRecommendedSection:!0,title:"All Candidates"}),k===o.Ks.ClosedWon&&A.candidate_id&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:A.candidate_id.message}),(k===o.Ks.ClosedLost||k===o.Ks.Abandon)&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(l.Label,{htmlFor:"lost_reason",children:[V?"Reason":"Lost Reason"," ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(r.T,{id:"lost_reason",...C("lost_reason"),placeholder:V?"Enter reason":"Enter lost reason",rows:4,className:"bg-white"+(A.lost_reason?" border-red-500":""),"data-testid":"status-reason-input"}),A.lost_reason&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:A.lost_reason.message})]})]}),(0,a.jsxs)("div",{className:"flex gap-3 justify-start bg-gray-50 p-4",children:[(0,a.jsx)(d.Button,{type:"submit",disabled:Y,className:"min-w-[100px]",children:w||y?"Saving...":"Save"}),(0,a.jsx)(d.Button,{type:"button",variant:"outline",onClick:f,disabled:w||y,className:"min-w-[100px]",children:"Cancel"})]})]})})},g=e=>{let{data:s}=e,t="function"!=typeof(null==s?void 0:s.onSubmit)||"function"!=typeof(null==s?void 0:s.onCancel),d=n.useMemo(()=>{var e,t;let a=null==s?void 0:s.project;if(null==a?void 0:a.selected_candidate_id)return[a.selected_candidate_id];let n=null==s||null==(t=s.recommendationsData)||null==(e=t.data)?void 0:e.filter(e=>{var s;return(null==(s=e.client_candidate_status||e.status)?void 0:s.toLowerCase())==="selected"});return null==n?void 0:n.map(e=>e.id)},[null==s?void 0:s.project,null==s?void 0:s.recommendationsData]),l=n.useMemo(()=>{let e=null==s?void 0:s.project;return(null==e?void 0:e.closed_reason)||(null==e?void 0:e.reason)||(null==e?void 0:e.lost_reason)||(null==e?void 0:e.abandon_reason)||""},[null==s?void 0:s.project]),r={project:null==s?void 0:s.project,projectCandidateData:(e=>(null==e?void 0:e.data)&&Array.isArray(e.data)?e.data.map(e=>({id:e.id,name:e.name,role:e.current_role||"Role not specified",avatar:e.name.charAt(0).toUpperCase(),cdoRstScore:e.ai_score||0,ccmScore:e.ccm_score||0,status:e.status||"In Progress",added:!1})):[])(null==s?void 0:s.recommendationsData),...d&&d.length>0?{initialCandidateIds:d}:{},initialLostReason:l,onSubmit:e=>{"function"==typeof(null==s?void 0:s.onSubmit)&&s.onSubmit(e)},onCancel:()=>{"function"==typeof(null==s?void 0:s.onCancel)&&s.onCancel()},loading:!!(null==s?void 0:s.loading)};return t?(0,a.jsx)("div",{children:"Invalid modal data"}):(0,a.jsx)(f,{...r})}},97582:(e,s,t)=>{t.d(s,{$V:()=>i,Kk:()=>x,Ks:()=>n,N1:()=>d,_Y:()=>l,eX:()=>u,eb:()=>o,kF:()=>m,md:()=>r});var a=t(30590),n=function(e){return e.Active="Active",e.ClosedWon="Close WON",e.ClosedLost="Closed LOST",e.Abandon="Inactive",e}({});function d(e){let s=e.toLowerCase();return s===a.gc.INACTIVE||s.includes("abandon")}function l(e){return d(e)?"Inactive":Object.values(n).includes(e)?e:"Active"}function r(e){return d(e)?o.Inactive:o[e]||e}function i(e){let s=(e.lost_reason||"").trim();return"Inactive"===e.status?{status:"Inactive",lost_reason:s}:{status:e.status,...Array.isArray(e.candidate_id)&&e.candidate_id.length>0?{candidate_id:e.candidate_id}:{},lost_reason:s}}let o={Active:"Active","Close WON":"Closed won","Closed LOST":"Closed lost",Inactive:"Inactive"},c={CLOSED:"closed",INACTIVE:a.gc.INACTIVE};function u(e){return e&&"All"!==e?e===c.CLOSED?"Closed":e===c.INACTIVE?"Inactive":o[e]||e:"All"}let m={Active:"bg-success-bg text-success-solid","Close WON":"bg-brand-4th/10 text-brand-4th","Closed LOST":"bg-error-bg text-error-solid",Inactive:"bg-gray-100 text-gray-600"};var x=function(e){return e.Accepted="accepted",e.OfferExtended="offer_extended",e.InProgress="in_progress",e.Rejected="rejected",e.RejectedByClient="rejected_by_client",e.RejectedByCandidate="rejected_by_candidate",e.Abandoned="abandoned",e}({})}}]);

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.