1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6233],{97534:function(e,t,a){Promise.resolve().then(a.bind(a,33734))},33734:function(e,t,a){"use strict";a.d(t,{default:function(){return p}});var n=a(57437),l=a(2265),r=a(57913),i=a(74958),o=a(24485),c=e=>{let{onChange:t,placeholder:a}=e,[r,c]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{c((await (0,o.XQ)()).map(e=>({value:e.skill,label:e.skill,_id:e._id})))})()},[]),(0,n.jsx)(i.Z,{className:"grid p-2 grid-cols-1 bg-white rounded-md gap-8 flex-col items-start w-full md:w-[100%] lg:w-[100%] mx-auto",isClearable:!0,options:r,onChange:t,placeholder:a})},s=a(7222),d=e=>{let{item:t,setFormInput:a}=e,i=t.fields?t.fields.reduce((e,t)=>(e[t.name]="",e),{}):{},[o,d]=(0,l.useState)(i),[u,m]=(0,l.useState)(0),[p,f]=(0,l.useState)(0),h=e=>{let n=t.value.filter((t,a)=>a!==e);a(t.name,n)},v=e=>{let t=Math.min(Math.max("string"==typeof e?parseInt(e,10):e,1),5),a=[];for(let e=0;e<t;e++)a.push((0,n.jsx)("span",{children:"â"},e));return a};return(0,n.jsx)("div",{children:"complex"===t.type&&(0,n.jsxs)("div",{children:[t.fields&&t.fields.map((e,a)=>(0,n.jsx)("div",{className:"flex items-center mt-1",children:"skills"===t.name&&"proficiency"===e.name?(0,n.jsx)("div",{className:"bg-white flex p-2 rounded-md w-full md:w-[100%] lg:w-[100%]",children:(0,n.jsx)(r.Z,{initialValue:u,onClick:e=>m(e)})}):"reviews"===t.name&&"rating"===e.name?(0,n.jsx)("div",{className:"bg-white flex p-2 rounded-md w-full md:w-[100%] lg:w-[100%] ",children:(0,n.jsx)(r.Z,{initialValue:p,onClick:e=>f(e)})}):(null==e?void 0:e.name)==="skill"?(0,n.jsx)(c,{onChange:e=>{d({...o,skillId:e?e._id:null,skill:e?e.value:null})},placeholder:"select ".concat(e.label)}):(0,n.jsx)("input",{type:"text",id:e.name,name:e.name,className:"form-input flex-1 rounded-md",placeholder:e.label,value:o[e.name],onChange:t=>d({...o,[e.name]:t.target.value})})},a)),(0,n.jsx)("div",{className:"flex",children:(0,n.jsx)("button",{type:"button",className:"mt-2 px-4 py-2 bg-blue-500 text-white rounded-md",onClick:()=>{let e=Array.isArray(t.value)?t.value:[];a(t.name,[...e,{...o,proficiency:u,rating:p}]),d(i)},children:"Add"})}),t.value&&t.value.map((e,a)=>(0,n.jsxs)("div",{className:"flex flex-row bg-white rounded-md mt-5 p-4 pt-1 relative justify-between",children:[(0,n.jsx)("div",{className:"flex-row items-center ",children:t.fields&&t.fields.map(t=>(0,n.jsx)("div",{className:"flex-1 mt-3",children:"proficiency"===t.name?(0,n.jsx)("div",{children:v(e[t.name])}):"rating"===t.name?(0,n.jsx)("div",{children:v(e[t.name])}):(0,n.jsx)("div",{className:"text-black ml-2",children:e[t.name]})},t.name))},a),(0,n.jsx)("div",{children:(0,n.jsx)("button",{type:"button",className:"ml-2 mt-3 px-2 py-1 bg-red-500 text-white rounded-md ",onClick:()=>h(a),children:(0,n.jsx)(s.Ybf,{size:16})})})]},a))]})})};let u=[{label:"Name",name:"fullName",type:"normal",value:""},{label:"Email",name:"email",type:"normal",value:""},{label:"Phone",name:"phone",type:"normal",value:""},{label:"City",name:"city",type:"normal",value:""},{label:"Education",name:"education",type:"normal",value:""},{label:"Experience",name:"experience",type:"normal",value:""},{label:"Description",name:"description",type:"normal",value:""},{label:"Experience Details",name:"experienceData",type:"complex",fields:[{label:"Role",name:"role"},{label:"Company",name:"company"},{label:"Project Description",name:"projectDescription"},{label:"Duration",name:"duration"}],value:[]},{label:"Personal Project",name:"personalProjects",type:"complex",fields:[{label:"Project Name",name:"projectName"},{label:"Description",name:"description"},{label:"Duration",name:"duration"}],value:[]},{label:"Reviews",name:"reviews",type:"complex",fields:[{label:"Description",name:"description"},{label:"Rating",name:"rating"},{label:"Review By",name:"reviewBy"}],value:[]},{label:"Achievements",name:"achivement",type:"complex",fields:[{label:"Acheivement",name:"acheivement"},{label:"Given By",name:"givenBy"},{label:"Date",name:"date"}],value:[]},{label:"Skills",name:"skills",type:"complex",fields:[{label:"Skill",name:"skill"},{label:"Experience",name:"experience"},{label:"Proficiency",name:"proficiency"}],value:[]}];var m=a(95956),p=()=>{let[e,t]=(0,l.useState)(0),[a,r]=(0,l.useState)(u);console.log(u,"form input data");let i=(e,t)=>{r(a=>{let n=a.map(a=>{if(a.name===e)return{...a,value:t};if("complex"===a.type){let n=Array.isArray(a.value)?a.value.map(a=>a.name===e?{...a,value:t}:a):a.value;return{...a,value:n}}return a});return console.log("Updated Form Input:",n),n})},c=async e=>{var n,l,i,c,s,d,p,f,h,v,y,x;e.preventDefault();let g={fullName:(null===(n=a.find(e=>"fullName"===e.name))||void 0===n?void 0:n.value)||"",city:(null===(l=a.find(e=>"city"===e.name))||void 0===l?void 0:l.value)||"",phone:(null===(i=a.find(e=>"phone"===e.name))||void 0===i?void 0:i.value)||"",email:(null===(c=a.find(e=>"email"===e.name))||void 0===c?void 0:c.value)||"",education:(null===(s=a.find(e=>"education"===e.name))||void 0===s?void 0:s.value)||"",experience:(null===(d=a.find(e=>"experience"===e.name))||void 0===d?void 0:d.value)||"",description:(null===(p=a.find(e=>"description"===e.name))||void 0===p?void 0:p.value)||"",skills:((null===(f=a.find(e=>"skills"===e.name))||void 0===f?void 0:f.value)||[]).map(e=>({skillId:e.skillId,skill:e.skill,experience:e.experience,proficiency:e.proficiency})),experienceData:((null===(h=a.find(e=>"experienceData"===e.name))||void 0===h?void 0:h.value)||[]).map(e=>({role:e.role,company:e.company,projectDescription:e.projectDescription,duration:e.duration})),personalProjects:((null===(v=a.find(e=>"personalProjects"===e.name))||void 0===v?void 0:v.value)||[]).map(e=>({projectName:e.projectName,company:e.company,projectDescription:e.projectDescription,duration:e.duration})),reviews:((null===(y=a.find(e=>"reviews"===e.name))||void 0===y?void 0:y.value)||[]).map(e=>({description:e.description,reviewBy:e.reviewBy,rating:e.rating})),achivement:((null===(x=a.find(e=>"achivement"===e.name))||void 0===x?void 0:x.value)||[]).map(e=>({acheivement:e.acheivement,givenBy:e.givenBy,date:e.date}))};console.log(g,"final data");try{let e=await (0,o.Q_)(g);console.log("API Response:",e);let a=e.username;if(console.log("NewUsername:",a),window.location.replace("/".concat(a)),r(u),t(0),m.Am.success("Candidate added successfully",{position:"top-center",autoClose:3e3}),e.status>=200&&e.status<300){let t=e.data;console.log("Candidate added successfully:",t)}}catch(e){console.error("Error adding candidate:",e),m.Am.error("Something went wrong please try again",{position:"top-center",autoClose:3e3})}};return(0,n.jsxs)("div",{className:"px-2 min-h-screen pt-8 bg-gray-200",children:[(0,n.jsx)("h1",{className:"text-3xl font-bold text-center",children:"Add Candidate"}),(0,n.jsx)("div",{children:(0,n.jsx)("form",{onSubmit:e=>c(e),children:(0,n.jsxs)("div",{className:"grid p-2 gap-6 items-start w-full md:w-[50%] lg:w-[50%] mx-auto",children:[a.map((a,l)=>(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-lg font-bold text-gray-700",children:a.label}),"normal"===a.type?(0,n.jsx)("div",{className:"flex items-center",children:"description"===a.name?(0,n.jsx)("textarea",{id:a.name,name:a.name,className:"form-input flex-1 rounded-md h-20",placeholder:a.label,value:a.value,onChange:e=>i(a.name,e.target.value),rows:2}):(0,n.jsx)("input",{type:"text",id:a.name,name:a.name,className:"form-input flex-1 rounded-md",placeholder:a.label,value:a.value,onChange:e=>i(a.name,e.target.value)})}):(0,n.jsx)(d,{item:a,setFormInput:i,proficiency:e,setProficiency:t})]},l)),(0,n.jsx)("button",{type:"submit",className:"px-4 py-2 bg-blue-500 text-white rounded-md mb-5",children:"Add Candidate"})]})})})]})}},57913:function(e,t,a){"use strict";var n=a(57437),l=a(2265);t.Z=e=>{let{initialValue:t,onClick:a}=e,[r,i]=(0,l.useState)(t),o=Array.from({length:5},(e,t)=>t+1),c=e=>{let t=r===e?e-1:e;i(t),a(t)};return(0,n.jsx)("div",{children:o.map(e=>(0,n.jsx)("span",{onClick:()=>c(e),style:{cursor:"pointer",color:e<=r?"gold":"gray",fontSize:"1.5em",padding:3},children:"â
"},e))})}},58357:function(e,t,a){"use strict";a.d(t,{CT:function(){return n},bz:function(){return r},nL:function(){return l}});let n=(a(20357).env.NEXT_PUBLIC_CLOUD_API_URL||"https://excelrs-cloud-new-1069037816864.asia-south1.run.app").replace(/\/+$/,""),l="https://powr-api.lawazia.tech";function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=String(e||"").replace(/^\/+/,"");return t?"".concat(l,"/").concat(t):l}},28388:function(e,t,a){"use strict";a.d(t,{oD:function(){return l}});var n=a(20357);let l=120;n.env.STATIC_PROFILE_PARAM_LIMIT},24485:function(e,t,a){"use strict";a.d(t,{Q_:function(){return x},Ax:function(){return b},p8:function(){return p},XQ:function(){return y},RF:function(){return m},qm:function(){return v},Fe:function(){return g},qr:function(){return h}});
1var n=a(65399),l=a(2265),r=a(58357),i=(a(28388),a(38472));let o=()=>{try{let{useAuthStore:e}=a(96450);return e.getState().token}catch(t){var e;return console.warn("Store not available, falling back to localStorage"),null===(e=localStorage)||void 0===e?void 0:e.getItem("accessToken")}return""},c=i.Z.create({baseURL:"/api"});async function s(e){let t="".concat(r.CT,"/profiles/by-username/").concat(encodeURIComponent(e)),a=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(404===a.status)return null;if(!a.ok){let e=await a.text();throw Error("Error fetching candidate: ".concat(a.statusText," - ").concat(e))}return a.json()}async function d(e,t){let a="".concat(r.CT,"/profiles/by-username/").concat(encodeURIComponent(e)),n=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}});if(404===n.status)return null;if(!n.ok){let e=await n.text();throw Error("Error fetching candidate: ".concat(n.statusText," - ").concat(e))}return n.json()}c.interceptors.request.use(e=>{let t=o();return t&&(e.headers.Authorization="Bearer ".concat(t)),e}),i.Z.create({baseURL:"/api"}).interceptors.request.use(e=>{let t=o();return t&&(e.headers.Authorization="Bearer ".concat(t)),e}),(0,l.cache)(s);let u=(0,l.cache)(d),m=async(e,t)=>{let a=null!=t?t:"";if(!a){let t=await s(e);if(null===t)throw Error("Error fetching candidate: Not Found");return t}let n=await u(e,a);if(null===n)throw Error("Error fetching candidate: Not Found");return n},p=async e=>{try{let t=new URLSearchParams;e.skills&&t.set("skills",JSON.stringify(e.skills)),e.pageNo&&t.set("pageNo",e.pageNo.toString()),e.pageSize&&t.set("pageSize",e.pageSize.toString());let a="/candidate/getAll?".concat(t.toString()),{data:n}=await c.get(a);return console.log("Fetched data:",n),n}catch(e){throw e}},f=e=>{var t;let a=null===(t=e.response)||void 0===t?void 0:t.data;throw Error((null==a?void 0:a.message)||"An unexpected error occurred")},h=async e=>{try{return(await c.post("/api/candidate/feedback",e)).data}catch(e){f(e)}},v=async e=>{let t=await fetch("/api/candidate/".concat(e));if(!t.ok)throw Error("Error fetching candidate feedback: ".concat(t.statusText));return t.json()},y=async()=>{let e=await fetch("/api/candidate/skills");if(!e.ok)throw Error("Error fetching candidate skills: ".concat(e.statusText));return e.json()},x=async e=>{try{return(await c.post("/api/candidate",e)).data}catch(e){f(e)}},g=async()=>{try{return(await c.get("/api/filter/".concat(n.h))).data}catch(e){f(e)}},b=async(e,t)=>{try{let a=await fetch("".concat(r.CT,"/users/admins"),{method:"GET",headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"}});if(a.ok){let t=await a.json();return(Array.isArray(t.admins)?t.admins:[]).some(t=>t._id===e)}return!1}catch(e){return!1}}},96450:function(e,t,a){"use strict";a.r(t),a.d(t,{useAuthStore:function(){return s}});var n=a(10903),l=a(89291),r=a(44785),i=a(34080),o=a(76934);let c=a(20357).env.NEXT_PUBLIC_PROJECT_ID||"678db178f70e70f6056b2c3d",s=(0,n.U)()((0,l.tJ)((e,t)=>({user:null,token:null,refreshToken:null,isHydrated:!1,setAuthData:function(t,a){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e({user:t,token:a,refreshToken:n,isHydrated:!0}),r.Z.set("auth-token",a,{expires:7,secure:!0,sameSite:"lax"}),localStorage.setItem("auth-token",a),localStorage.setItem("accessToken",a),localStorage.setItem("token",a),localStorage.setItem("user",JSON.stringify(t)),n?localStorage.setItem("refreshToken",n):localStorage.removeItem("refreshToken")},clearAuthData:()=>{(0,o.notifyImpersonationExit)({projectId:c}).catch(()=>{}),(0,i.P4)();let a=t();if(null!==a.user||null!==a.token||null!==a.refreshToken){e({user:null,token:null,refreshToken:null,isHydrated:!0});try{localStorage.removeItem("auth-store")}catch(e){console.warn("Failed to clear localStorage:",e)}}}}),{name:"auth-store",storage:(0,l.FL)(()=>localStorage),skipHydration:!0,onRehydrateStorage:()=>e=>{e&&(e.isHydrated=!0)}}));try{s.persist.rehydrate()}catch(e){console.warn("Failed to rehydrate auth store:",e)}}},function(e){e.O(0,[9715,7971,7279,2502,251,5171,9465,8472,5956,9617,2702,8509,5490,2971,7023,1744],function(){return e(e.s=97534)}
1),_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.