PageSourceSearch

https://hack2skill.com/assets/index-8e3b4710.js

js hack2skill.com collected 2026-09-24 11:21:58 UTC 72,515 bytes, 8 lines download raw bytes

1import{i as e,D as b,M as Y,j as c,F as m,aL as Ue,cD as M,bA as Ge,cM as He,aE as jt,a6 as ze,a7 as Be,a8 as qe,a3 as me,ds as Ie,dt as he,d4 as ht,d5 as Oe,bu as Vt,bs as zt,W as Bt,bt as qt,a4 as dt,a5 as ut,aC as Gt,aD as Ht,d7 as Xt,bI as Kt,k as Pe,cq as Xe,z as Re,dw as $t,$ as Ae,B as F,I as ue,V as Ce,C as Fe,S as Ke,dx as ke,cu as $e,du as Qe,cv as We,cc as Ye,cz as Ze,dn as oe,dp as ce,dq as de,ce as Qt,aK as Wt,E as Yt,aO as Zt,cH as Jt}from"./index-afaf2031.js";import{r as u}from"./vendor-4adab861.js";import{L as ea,b as Me,u as ta,c as aa}from"./router-805badc2.js";import{u as Je}from"./redux-7a585bcd.js";import{A as et}from"./index-9d16e945.js";import{d as je}from"./Edit-9922b5cd.js";import{D as ft,f as xt}from"./eventRegistration.data-63630c40.js";import{c as sa}from"./index-c9be8257.js";import{g as ra}from"./getYearPicklist-ef7e528c.js";import{m as la,n as na,o as ia,p as oa,q as ca,r as da,s as ua,t as pa,v as ma,w as ha,x as fa,y as xa}from"./index-0ffed05f.js";import{u as Ne,w as pt}from"./xlsx-0bff4e18.js";import{F as ga}from"./index-eb14c7f8.js";import{H as ba}from"./index-e3430fa8.js";import"./ui-86749c30.js";const Ea=({handleUploadFile:t})=>[{name:"file",title:"Select XLSX file",type:b.FILE,required:!0,helperText:"Upload a valid offline data of the users",accept:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],Wrapper:Y,uploadFileOnServer:!1,note:'<span class="text-h2sBrand-900 text-subtitle2v1"><strong>*Note</strong>: The uploaded XLSX file should contain <em>Email</em>, <em>Instruction</em> and <em>QR</em> fields',customUpload:t}],Sa=({fileHandler:t})=>[{name:"file",title:"Select XLSX file",type:b.FILE,accept:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],Wrapper:Y,uploadFileOnServer:!1,customUpload:t,required:!0,note:`<span class="text-h2sBrand-900 text-body3v1"><strong>*Note</strong>: Upload a .xlsx file containing the innovator registration details.
2You can download the sample file above to see the required format.`},{name:"sheet",title:"Google Sheet Slug",type:b.TEXT,required:!0,placeholder:"Enter Google Sheet Slug",helperText:`From this Google Sheet URL:
3        https://docs.google.com/spreadsheets/d/
4        1aBcD3FgHIjkLmNopQRstuVwXyZ1234
5        567890/edit, Copy only this part as the Google Sheet Slug: '1aBcD3FgHIjkLmNopQRstuVwXyZ1234
6        567890'.`,note:`<span class="text-h2sBrand-900 text-body3v1"><strong>*Note</strong>: Please provide the Google Sheet ID (slug): This is the unique part of the URL that appears after '/d/' and before '/edit'. Ensure the sheet is accessible to everyone with editor access.`},{name:"subsheet",title:"Subsheet Name",type:b.TEXT,required:!0,placeholder:"Enter Subsheet Name",note:'<span class="text-h2sBrand-900 text-body3v1"><strong>*Note</strong>: Please enter the name of an existing sub sheet or a new one to create.'}],ya=({data:t})=>{const r=l=>{try{return new Date(l).toLocaleDateString()}catch{return l}},a=l=>{try{return e("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:l})}catch{return l}},n=l=>Object.entries(l).map(([p,i])=>p==="occupation"?null:i&&typeof i=="object"?e("div",{className:"text-xs text-h2sSlate-600",children:Object.entries(i).map(([s,d])=>c("div",{className:"mb-1",children:[s.charAt(0).toUpperCase()+s.slice(1),": ",d]},`${p}-${s}`))},p):c("div",{className:"text-xs text-h2sSlate-600",children:[p.charAt(0).toUpperCase()+p.slice(1),": ",i]},p));return e("div",{className:"w-full",children:(()=>{if(!t?.response)return e("div",{className:"text-sm text-h2sSlate-500 truncate",children:"-"});switch(t.defaultTag){case"GENDER":return e("div",{className:"text-sm text-h2sSlate-500 truncate",children:t.response.gender?t.response.gender:t.response});case"OCCUPATION":return c("div",{className:"space-y-1",children:[e("div",{className:"text-sm text-h2sSlate-500 truncate",children:t.response.occupation?.split("_").join(" ")}),n(t.response)]});default:switch(t?.type){case"URL":return e("div",{className:"text-sm text-h2sBrand-900",children:a(t.response)});case"DATE":return e("div",{className:"text-sm text-h2sSlate-500 truncate",children:r(t.response)});case"PHONE":return e("div",{className:"text-sm text-h2sSlate-500 truncate",children:"+"+t.response})}return e("div",{className:"text-sm text-h2sSlate-500 truncate",children:t.response?.value?t.response?.value:t.response})}})()})},va=[{label:"10",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"75",value:"75"},{label:"100",value:"100"}],Na=t=>{const{columndata:r}=t,a=r?.map(l=>({label:l?.label,_id:l?._id,columnClass:"min-w-[8rem] text-nowrap",type:l?.type??"",render:p=>e(m,{children:e("div",{className:"flex items-center justify-start text-grey2 w-full gap-2",children:e("span",{className:"ellipsis-two-lines",title:p?.label,children:p?.label})})})}));let n=a?.findIndex(l=>l?.label==="Status");if(n!==-1&&n>-1){let l=a.splice(n,1)[0];a.splice(1,0,l)}return[{label:"",type:"ACTION",_id:r?.some(l=>l.type==="USER")?r.find(l=>l.type==="USER")?._id:"",columnClass:"text-center !min-w-[0px] !max-w-[0px]",email:r?.some(l=>l.type==="EMAIL")?r.find(l=>l.type==="EMAIL")?._id:"",render:()=>e(m,{})},...a]};function Ca({user:t,status:r,email:a},n=()=>{},o=()=>{},l=[],p){const i={...t,email:a},d=({REVOKED:[{label:"Verify",className:"text-h2sSuccess-600",value:"VERIFIED",icon:"icon-park-outline:check-one"}],VERIFIED:[{label:"Revoke",value:"REVOKED",className:"text-h2sError-600",icon:"mi:circle-error"}],CREATED:[{label:"Verify",className:"text-h2sSuccess-600",value:"VERIFIED",icon:"icon-park-outline:check-one"},{label:"Revoke",value:"REVOKED",className:"text-h2sError-600",icon:"mi:circle-error"}]}[r]||[]).map(h=>({label:h.label,icon:h.icon,customClass:h.className,onClick:()=>{n({user:t,status:h.value})}}));return[...Ie(l,he(p,l)?.STAFF.MANAGE_USERS.INITIATIVE.INNOVATOR)?[{label:"Edit Details",icon:"mdi:user",customClass:"text-h2sSlate-500",onClick:()=>{o(i)}},...d]:[]]}const Ta=t=>{const{rowData:r,newColumndata:a,handleConfirmation:n,handleUserEditDetails:o,userRoles:l,eventId:p}=t;if(r?.length>0&&a?.length>0)return r?.map(s=>{const d=[];return a?.map(h=>{switch(h?.type){case"ACTION":d?.push({label:"ACTION",render:L=>e(m,{children:e("div",{className:"relative flex !justify-center",children:e(et,{handleMenuClick:()=>{},customClass:"text-h2sSlate-600 cursor-pointer",customIcon:e(je,{className:"text-h2sSlate-500"}),menuButtonsData:Ca({user:s[h?._id],status:s.status,email:s[h?.email]},n,o,l,p),rowIndex:1,rowData:L?._id})})})});break;case M?.USER:d?.push({label:s[h?._id]?.name,render:()=>e(m,{children:e(He,{className:"!gap-2 mr-10 !max-w-60 ",data:{image:s[h?._id]?.picture?s[h?._id]?.picture:"https://h2svision.github.io/publicAssets/vision/defaultUser.png",title:s[h?._id]?.name}})})});break;case M?.PHONE:d?.push({label:s[h?._id]?.name,render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !max-w-60 text-sm",children:"+"+s[h?._id]})})});break;case M?.DATE:d?.push({label:s[h?._id]?.name,render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 text-sm",children:s[h?._id]?Ge
6(s[h?._id],h?._id==="timestamp"):""})})});break;case M?.URL:d?.push({label:s[h?._id]?.name,render:()=>e(m,{children:e(ea,{target:"_blank",to:s[h?._id],className:"underline text-h2sSlate-400 !block font-mulish ellipsis-two-lines text-[var(--grey1)] dark:text-[var(--darkTheme2)] font-bold text-sm ",children:s[h?._id]})})});break;case M?.EMAIL:d?.push({label:s[h?._id],render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !block ellipsis-two-lines  text-sm",children:s[h?._id]})})});break;default:d?.push({label:s[h?._id],render:()=>e(m,{children:h?._id==="status"?e("div",{className:`w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs ${s[h?._id]==="REVOKED"?"bg-h2sError-50 text-h2sError-600":s[h?._id]==="VERIFIED"?"bg-h2sSuccess-50 text-h2sSuccess-600":s[h?._id]==="CREATED"?"bg-h2sWarning-50 text-h2sWarning-600":""}  `,children:e("p",{children:s[h?._id]})}):e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !block ellipsis-two-lines  text-sm",children:typeof s[h?._id]=="string"&&s[h?._id]?.toLowerCase().includes("https")?s[h?._id]:Ue(s[h?._id])??""})})})});break}}),d})},gt=t=>({ALL:[{label:"Male",value:"MALE"},{label:"Female",value:"FEMALE"},{label:"Transgender",value:"TRANS"},{label:"Other",value:"OTHER"},{label:"Prefer not to say",value:"UNDISCLOSED"}],WOMEN:[{label:"Female",value:"FEMALE"},{label:"Prefer not to say",value:"UNDISCLOSED"}],TRANS_OTHERS:[{label:"Transgender",value:"TRANS"},{label:"Other",value:"OTHER"},{label:"Prefer not to say",value:"UNDISCLOSED"}],WOMEN_TRANS_OTHERS:[{label:"Female",value:"FEMALE"},{label:"Transgender",value:"TRANS"},{label:"Other",value:"OTHER"},{label:"Prefer not to say",value:"UNDISCLOSED"}]})[t];function wa(t){const r=[{occupation:"PROFESSIONAL"},{occupation:"COLLEGE_STUDENT"},{occupation:"STARTUP"},{occupation:"SCHOOL_STUDENT"},{occupation:"FREELANCE"}],a=["PROFESSIONAL","COLLEGE_STUDENT","STARTUP","SCHOOL_STUDENT","FREELANCE"],n=[];return t?.forEach(o=>{const l=a.indexOf(o.occupation);l!==-1?r[l]={...r[l],...o}:n.push(o)}),[...r,...n]}const Ra=[{title:"School Student",value:"SCHOOL_STUDENT",icon:"ep:school"},{title:"College Student",value:"COLLEGE_STUDENT",icon:"mdi:college-outline"},{title:"Startup",value:"STARTUP",icon:"streamline:startup"},{title:"Freelancer",value:"FREELANCE",icon:"tdesign:user-business"}],De={image:"image/*",audio:"audio/*",video:"video/*",pdf:"application/pdf",zip:"application/zip",md:"text/markdown"},Ia=[{field:"SCHOOL_STUDENT",value:"SCHOOL_STUDENT",type:"visible"},{field:"COLLEGE_STUDENT",value:"COLLEGE_STUDENT",type:"visible"},{field:"PROFESSIONAL",value:"PROFESSIONAL",type:"visible"},{field:"STARTUP",value:"STARTUP",type:"visible"},{field:"FREELANCE",value:"FREELANCE",type:"visible"}];function La(t,r){let a={...t};if(t?.defaultTag==="GENDER"){const n=gt(r?.gender);a={...a,type:"SELECT",pickList:n}}else if(t?.defaultTag==="OCCUPATION"){const n=wa(r?.occupations)?.filter(o=>o?.isHidden==!1)?.map(o=>{const l=Ra?.find(p=>p.value==o?.occupation)||{value:o?.occupation,icon:"material-symbols:dashboard-customize-outline"};return{title:o?.occupation?.toLowerCase()==="freelance"?"Freelancer":Ue(o?.occupation),value:l?.value,icon:l?.icon,_id:o?._id}});a={...a,type:"RADIO_CARD",pickList:n,className:"mb-4 OccupationFieldCommon"}}else if(t?.defaultTag==="DATE_OF_BIRTH"){const n=ht(r?.age?.min||xt,r?.age?.max||ft),o=Oe(n?.maxDate),l=Oe(n?.minDate);a={...a,...n,note:`<b>Eligibility:</b>You need to be between age group ${o} to ${l} to be a part of this initiative.
7`}}else if(t?.type==="FILE_UPLOAD"){const n=[];Object.keys(t?.accept)?.forEach(o=>{t?.accept?.[o]===!0&&n.push(De[o])}),a={...a,accept:n}}else t?.label==="Linkedin URL"?a.label="Linkedin Profile":t?.label==="Github URL"&&(a.label="Github Profile");return a}const _a=({profileData:t,currentYear:r})=>[{name:"SCHOOL_STUDENT",type:b?.FORM,className:"mb-4 occupation-custom-parent !w-full flex flex-col gap-4 ",...t&&t?.school&&{value:t?.school},fields:[{name:"class",title:"Class",placeholder:"Class",type:b?.SELECT,pickList:Vt},{name:"name",title:"School Name",placeholder:"Write here...",type:b?.TEXT}
7,{name:"country",title:"School Country",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,apiUrl:!0,getApiFunction:ze,dependentFields:[{field:"state",value:"country",type:"value"},{field:"city",value:"country",type:"value"},{field:"state",value:1,type:"countryDependencies"}],required:!0,className:"mb-4 !w-full",value:{value:"India",label:"India"}},{name:"state",title:"School State",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,dependentValues:{country:{value:"India"}},getApiFunction:Be,required:!0,dependentFields:[{field:"city",value:"",type:"disabled"},{field:"city",value:"state",type:"value"}],className:"mb-4 !w-full"},{name:"city",title:"School City",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,dependentValues:{country:{value:"India"}},isMulti:!1,isCreatable:!1,isSearchable:!0,getApiFunction:qe,required:!0,className:"mb-4 !w-full"}]},{name:"COLLEGE_STUDENT",type:b.FORM,className:"mb-4 occupation-custom-parent !w-full flex flex-col gap-4",...t&&t?.college&&{value:t?.college}
7,fields:[{name:"_id",title:"College/University Name",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,validation:me.CREATABLE_PICKLIST,isCreatable:!0,isSearchable:!0,isMulti:!1,apiUrl:!0,postApiFunction:zt,getApiFunction:Bt,required:!0},{name:"country",title:"College Country",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,apiUrl:!0,dependentValues:{country:{value:"India"}},getApiFunction:ze,dependentFields:[{field:"state",value:"country",type:"value"},{field:"city",value:"country",type:"value"},{field:"state",value:1,type:"countryDependencies"}],required:!0,className:"mb-4 !w-full",value:{value:"India",label:"India"}},{name:"state",title:"College State",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,apiUrl:!0,dependentValues:{country:{value:"India"}},getApiFunction:Be,dependentFields:[{field:"city",value:"",type:"disabled"},{field:"city",value:"state",type:"value"}],required:!0,className:"mb-4 !w-full"},{name:"city",title:"College City",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,dependentValues:{country:{value:"India"}},apiUrl:!0,getApiFunction:qe,required:!0,className:"mb-4 !w-full"},{name:"degree",title:"Degree",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isSearchable:!0,isCreatable:!1,apiUrl:!0,getApiFunction:qt,required:!0,dependentFields:[{field:"otherDegree",value:"Other",type:"visible"}]},{name:"otherDegree",title:"Specify Degree",placeholder:"specify your degree here...",type:b?.TEXT,required:!0},{name:"specialization",title:"Major/Stream/Specialization",placeholder:"Write here...",type:b.TEXT,required:!0},{name:"passoutYear",title:"Passout Year",placeholder:"Passout Year",type:b?.SELECT,pickList:ra(r),required:!0}]},{name:"PROFESSIONAL",type:b.FORM,className:"mb-4 occupation-custom-parent !w-full flex flex-col gap-4",...t&&t?.professional&&{value:t?.professional},fields:[{name:"organization",title:"Company Name",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,validation:me.CREATABLE_PICKLIST,isMulti:!1,isCreatable:!0,isSearchable:!0,apiUrl:!0,postApiFunction:dt,getApiFunction:ut,required:!0},{name:"designation",title:"Designation",placeholder:"Designation",type:b?.TEXT,validation:me?.HUNDRED_WORDS,min:2,max:100,required:!0},{name:"yearsOfExperience",title:"Year(s) of Experience",placeholder:"Year(s) of Experience",type:b?.NUMBER,validation:me.NUMBER,required:!0}]},{name:"STARTUP",type:b.FORM,className:"mb-4 occupation-custom-parent !w-full flex flex-col gap-4",...t&&t?.startup&&{value:t?.startup},fields:[{name:"organization",title:"Startup Name",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,validation:me.CREATABLE_PICKLIST,isMulti:!1,apiUrl:!0,required:!0,isSearchable:!0,isCreatable:!0,postApiFunction:dt,getApiFunction:ut},{name:"foundedIn",title:"Founded In",placeholder:"Founded In",type:b?.DATE,validation:me?.DATE,min:Gt,max:Ht,saveAs:"ISOString",required:!0},{name:"size",title:"Startup Size",placeholder:"Startup Size",type:b?.NUMBER,required:!0},{name:"industry",title:"Industry/Domain",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,required:!0,helperText:"Choose your domain of expertise",pickList:Xt},{name:"designation",title:"Designation",placeholder:"Designation..",type:b?.TEXT,validation:me.SHORT_TEXT,required:!0}]},{name:"FREELANCE",type:b.FORM,className:"mb-4 occupation-custom-parent !w-full flex flex-col gap-4",...t&&t?.freelance&&{value:t?.freelance},fields:[{name:"portfolio",title:"Portfolio Link",placeholder:"Portfolio Link",type:b.URL,validation:me?.URL,required:!0},{name:"domain",title:"Industry/Domain",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,required:!0,isCreatable:!1,apiUrl:!0,helperText:"Choose your domain of expertise",getApiFunction:Kt}]}];function Aa(t,r,a){const n=t.toLowerCase();let o=a?.[n]?a[n]:null;return typeof o!="object"&&!Array.isArray(o)&&r?.type==="multiSelect"&&(o=[{label:o,value:o}],(r?.type=="select"||r?.isMulti===!1)&&(o=o?.[0])),{...r,value:o}}function Da(t){if(!t)return t;let r={...t};if(r?.occupation==="SCHOOL_STUDENT")return r;if(r?.occupation==="COLLEGE_STUDENT"){const a=r?.COLLEGE_STUDENT,n=new Date(a?.endDate).getFullYear().toString();r.college={...a,_id:{...a?._id,label:a?._id?.name},degree:{value:a?.degree,label:a?.degree},passoutYear:n}}else if(r?.occupation==="PROFESSIONAL"){const a=r?.PROFESSIONAL;r.professional={...a,organization:{value:a?.organization?._id,label:a?.organization?.name}}}else if(r?.occupation==="STARTUP"){const a=r?.STARTUP;r.startup={...a,organization:{value:a?.organization?._id,label:a?.organization?.name}}}else if(r?.occupation==="FREELANCE"){const a=r?.FREELANCE;r.freelance={...a,domain:{value:a?.domain,label:a?.domain}}}return r}const Oa=t=>{const r=[];switch(t?.type){case"PHONE":return[{...t,name:t?.defaultTag??"",id:t?._id??"",_id:t?._id??"",type:b?.PHONE,title:t?.label??"",required:t?.isRequired??"",value:t?.response??""}];case"URL":return[{...t,name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",type:b?.URL,title:t?.label??"",value:t?.response??"",required:t?.isRequired??""}];case"LINEAR_SCALE":return[{...t,name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",title:t?.label??"",value:t?.response??"",required:t?.isRequired??"",showTooltip:!0,min:t?.min??"",max:t?.max??"",type:b?.LINEAR_SLIDER}];case"DROPDOWN":return[{type:b?.MULTIPLE_SELECT,isMulti:t?.isMulti??!1,isSearchable:!0,isCreatable:!1,showMenu:!0,placeholder:t?.placeholder||"Search here...",name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",title:t?.label??"",required:t?.isRequired??"",pickList:t?.options??[],value:{label:t?.response?.label?t?.response?.label:t?.response,value:t?.response?.value?t?.response?.value:t?.response}}];case"NON_SEARCHABLE_DROPDOWN":return[{type:b?.MULTIPLE_SELECT,placeholder:t?.placeholder||"Search here...",name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",title:t?.label??"",required:t?.isRequired??"",pickList:t?.options??[],value:{label:t?.response?.label?t?.response?.label:t?.response,value:t?.response?.value?t?.response?.value:t?.response}}];case"FILE_UPLOAD":return Object.keys(t?.accept)?.forEach(a=>{t?.accept?.[a]===!0&&(Array.isArray(De[a])?r.push(...De[a]):r.push(De[a]))}),[{...t,name:t?.defaultTag?t?.defaultTag:t?.label??"",type:b?.FILE,accept:r,customUpload:jt,value:t?.response??""}];case"MULTIPLE_CHOICE":return[{...t,name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",type:b.RADIO,pickList:t?.options,value:t?.response??""}];case"CHECKBOX":return[{...t,name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",type:b.MULTIPLE_CHECKBOX,pickList:t?.options,value:t?.response??""}];default:return[{...t,name:t?.defaultTag?t?.defaultTag:t?.label??"",id:t?._id??"",_id:t?._id??"",title:t?.label??"",value:t?.response??"",required:t?.isRequired??"",type:t?.type}]}},Fa=(t,r,a)=>{const n=new Date()?.getFullYear();let o=[];return t?.forEach(l=>{if(l?.defaultTag==="OCCUPATION"){const p=La(l,t);let i=sa(p);i=Aa(l?.defaultTag,i,r);let s=null;if(i.dependentFields=Ia,s=_a({profileData:r,currentYear:n}),a?.length>0){const d=i?.value,h=d&&a?.some(L=>L?.occupation===d&&!L?.isHidden);i.value=h?d:i.required?a[0]?.occupation:null}else i.required=!1,i.className="!hidden",i.isHidden=!0;o=[...o,i,...Array.isArray(s)?s:s?[s]:[]]}}),o},ka=()=>
7[{name:"country",title:"Country",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,apiUrl:!0,getApiFunction:ze,className:"mb-4 !w-full",required:!0,dependentFields:[{field:"state",value:void 0,type:"disabled"},{field:"city",value:void 0,type:"disabled"},{field:"state",value:"country",type:"value"},{field:"city",value:"country",type:"value"}]},{name:"state",title:"State",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,apiUrl:!0,required:!0,getApiFunction:Be,className:"mb-4 !w-full",dependentFields:[{field:"city",value:void 0,type:"disabled"},{field:"city",value:"state",type:"value"}]},{name:"city",title:"City",placeholder:"start typing...",type:b?.MULTIPLE_SELECT,isMulti:!1,isCreatable:!1,isSearchable:!0,required:!0,apiUrl:!0,className:"mb-4 !w-full",getApiFunction:qe}],Ua=({genderType:t,isOtherGender:r})=>[{name:"gender",title:"Gender",type:b?.SELECT,required:!0,className:"mb-4",pickList:gt(t??""),dependentFields:[{field:"otherGender",value:"OTHER",type:"visible"}]},{name:"otherGender",title:"Please Specify Your Gender",placeholder:"Specify your gender here...",type:b?.TEXT,required:!0,isHidden:!r,validation:me.SHORT_TEXT}],Pa=()=>{async function t(p="",i={}){try{return await la(p,i)}catch(s){console.log("Error: ",s)}}async function r({eventId:p="",innovatorId:i="",status:s=""}){try{return await na({eventId:p,innovatorId:i,status:s})}catch(d){console.log("Error: ",d)}}async function a(p,i){try{return await ia(p,i)}catch(s){console.log("Error: ",s)}return null}async function n(p,i,s){try{return await oa(p,i,s)}catch(d){console.log("Error: ",d)}return null}async function o(p,i){try{return console.log({eventId:p,data:i}),await ca(p,i)}catch(s){console.log("Error: ",s)}return null}async function l(p){try{return await da(p)}catch(i){console.log("Error: ",i)}return null}return{getInnovatorListStaffApi:t,updateInnovatorStatusStaffApi:r,getInnovatorProfileListStaff:a,updateUserDetailsFields:n,injectInnovatoDataHandler:o,getInjectInnovatorDataSampleFileHeadersHandler:l}},Ma=t=>t&&t.trim().replace(/^;+|;+$/g,"").replace(/;{2,}/g,";").split(";").filter(Boolean).join(";"),ja=()=>{const t=Pe(),{eventId:r}=Me(),a=Je(g=>g?.user?.roles)||[],[n,o]=u.useState(""),l=Xe(n,800),{getInnovatorListStaffApi:p,updateInnovatorStatusStaffApi:i,getInnovatorProfileListStaff:s,updateUserDetailsFields:d,injectInnovatoDataHandler:h,getInjectInnovatorDataSampleFileHeadersHandler:L}=Pa(),[U,E]=u.useState(!1),[w,ae]=u.useState(!1),[O,j]=u.useState(1),[q,C]=u.useState(1),[se,P]=u.useState(null),[_,G]=u.useState("10"),[Z,A]=u.useState([]),[V,J]=u.useState([]),[H,ee]=u.useState(""),[R,z]=u.useState({}),[$,X]=u.useState(!1),[te,Q]=u.useState(!1),[pe,re]=u.useState({}),[fe,le]=u.useState(!1),[ne,ie]=u.useState(!1),[v,T]=u.useState(!1),[W,Te]=u.useState([]),[Ee,xe]=u.useState({}),ye=u.useRef(null),[N,k]=u.useState(!1),K=u.useRef(null),[ge,Se]=u.useState(Ea({handleUploadFile:St})||[]),[we,tt]=u.useState(null),[bt,bs]=u.useState(!1),[Et,Le]=u.useState(!1);function St(g){if(g)return tt(g),new Promise(x=>{x({success:!0,URL:"",data:g})})}async function yt(){if(!we){Re.error("No file selected for upload.");return}try{Le(!0);const g=await $t({file:we,eventUrl:r});g?.status===200?(Re.success("File downloaded successfully!"),k(!1),Le(""),tt(null)):(Le("Failed to upload file. Please try again with a valid file."),Re.error(g?.message||"Failed to upload file. Please try again."))}catch(g){console.error("Error uploading file:",g)}finally{Le(!1)}}function vt(){const g=["Email","Instruction","QR"],x=["[email protected]","Sample instruction","sample-qr-payload"],S=Ne.aoa_to_sheet([g,x]);S["!cols"]=g.map(ve=>({wch:Math.max(String(ve??"").length,20)}));const f=Ne.book_new();Ne.book_append_sheet(f,S,"OfflineData");const I=pt(f,{bookType:"xlsx",type:"array"}),y=new Blob([I],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),D=URL.createObjectURL(y),B=document.createElement("a");B.href=D,B.download="OfflineData_Sample.xlsx",document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(D)}
7const[Nt,at]=u.useState(!1),[Ct,Es]=u.useState(Sa({fileHandler:wt})||[]),[st,Ve]=u.useState(null),[Tt,rt]=u.useState(!1),lt=u.useRef(null),nt=u.useRef(null);function it(){Ve(null),at(!1)}async function wt(g){if(g)return Ve(g),new Promise(x=>{x({success:!0,URL:"",data:g})})}async function Rt(){try{rt(!0);let g={};const[x,S]=await Promise.allSettled([lt?.current?.getValues(),nt?.current?.getValues()]),f=x.status!=="fulfilled",I=S.status!=="fulfilled";if(I||(g=S.value),f||I){const B=f?x.reason?.message:null,ve=I?S.reason?.message:null,be=[B,ve].filter(Boolean).join(" | ");throw console.error("Validation Errors:",be),new Error(be||"Validation failed")}const y=new FormData;y.append("file",st),y.append("sheet",g?.sheet),y.append("subsheet",g?.subsheet??"Sheet1");const D=await h(r,y);if(D?.status===200){const B={search:l||"",page:O||1,records:_??"10"};Ve(null),_e(r,B),it(),Re.success(D?.data?.message)}else Re.error("Something went wrong!")}catch(g){console.log(g)}finally{rt(!1)}}async function It(){try{const g=await L(r);if(!g)return;const x=g?.[0]?.data,S=x?.[0]||[],f=x?.[1]||[],I=Ne.aoa_to_sheet([S,f]);I["!cols"]=S.map(Mt=>({wch:Math.max(String(Mt??"").length,16)}));const y=Ne.book_new();Ne.book_append_sheet(y,I,"Sheet1");const D=pt(y,{bookType:"xlsx",type:"array"}),B=new Blob([D],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),ve=URL.createObjectURL(B),be=document.createElement("a");be.href=ve,be.download="Inject_Innovator_Data_Staff_Sample.xlsx",document.body.appendChild(be),be.click(),document.body.removeChild(be),URL.revokeObjectURL(ve)}catch(g){console.log(g)}}const ot=()=>Na({columndata:V}),Lt=()=>Ta({newColumndata:ot(),rowData:Z,handleConfirmation:kt,handleUserEditDetails:_t,userRoles:a,eventId:r});function _t(g){g?._id&&(z(g),Q(!0))}function At(){Q(!1),z({}),re({}),T([]),ie(!1)}async function Dt(g,x){const S=["country","state","city"];if(S.includes(x?.defaultTag?.toLowerCase())){const f=g.filter(D=>S.includes(D?.defaultTag?.toLowerCase())),y=(await ka()).map((D,B)=>S.includes(D?.name)?{...D,_id:f?.[B]?._id,value:{label:f?.[B]?.response??"",value:f?.[B]?.response??""}}:D);T(y||[])}else if(x?.defaultTag==="OCCUPATION"){const f=Da(x?.response),I=await Fa(g,f,W);await T(I||[])}else if(x?.defaultTag==="DATE_OF_BIRTH"){const f=[],I=ht(Ee?.age?.min||xt,Ee?.age?.max||ft),y=Oe(I?.maxDate),D=Oe(I?.minDate);f.push({...x,defaultTag:x?.defaultTag,name:"DATE_OF_BIRTH",title:"Date of Birth",...I,value:Ae(x?.response).format("yyyy-MM-DD")??"",note:`<b>Eligibility:</b>You need to be between age group ${y} to ${D} to be a part of this initiative.
8      `}),await T(f||[])}else if(x?.defaultTag==="GENDER"){const f=g.find(y=>y?.defaultTag==="GENDER")?._id,I=Ua({genderType:Ee?.gender});I?.map(y=>{y?.type=="select"&&y?.name!=="otherGender"?(y.value=x?.response?.gender?x?.response?.gender:x?.response??"",y._id=f):y?.name==="otherGender"&&x?.response?.other?.length>0&&(y.value=x?.response?.other,y._id=f)}),T(I||[])}else if(x?.type==="DATE"){const f=[];f.push({...x,name:x?.label,saveAs:"ISOString",defaultTag:x?.defaultTag,value:Ae(x?.response).format("yyyy-MM-DD")??""}),await T(f||[])}else await T(Oa(x)||[]);await ie(!0)}async function Ot(){le(!0);const g=["country","state","city"],x=await ye?.current?.getValues();if(!x||!v?.length)return;let S={};v.forEach(f=>{if(!f?._id||!f?.name)return;const I=f.name.toLowerCase();if(f?.type==="file"&&(S[f._id]=x[f.name]),f.name==="gender"){const{gender:y,otherGender:D}=x;S[f._id]=y==="OTHER"?{gender:y,...D?.length>0?{other:D}:{}}:y;return}if(f.defaultTag==="DATE_OF_BIRTH"){S[f._id]=Ae(x[f.name]).toISOString();return}if(f.type==="DATE"){S[f._id]=Ae(x[f.name]).toISOString();return}if(g.includes(I)){S[f._id]=x[f.name]?.value;return}if(f.name!=="otherGender"&&(S[f._id]=x[f.name]?x[f.name]:x[f.name]?.value),f?.type==="multiSelect"){const y=x[f.name];Array.isArray(y)?S[f._id]=y?.map(D=>D?.value)?.join(","):S[f._id]=y?.value||y||[]}if(f?.type==="multipleCheckbox"||f?.type==="checkbox"){const y=Ma(x[f.name]);S[f._id]=y}});try{(await d(S,r,R?._id))?.success&&(le(!1),await ct(r,R?._id),await _e(r,{search:l||"",page:O||1,records:_??"10"}),ie(!1))}catch(f){le(!1),console.log(f)}finally{le(!1)}}async function Ft(){try{const g={eventId:r,innovatorId:R?.user?._id??"",status:R?.status??""};(await i(g))?.success&&(ee(""),z({}),_e(r,{page:O||"1",records:_,search:l}))}catch(g){console.log("Error: ",g)}}async function kt({user:g,status:x}){switch(x){case"REVOKED":ee("REVOKED"),z({user:g,status:x});break;case"VERIFIED":ee("VERIFIED"),z({user:g,status:x});break}}function Ut(){ee(""),z({})}function Pt(g){n!=1&&j(1),o(g)}async function ct(g,x){X(!0);let S=null;try{S=await s(g,x),xe(S?.data);const f=S?.data?.response;re(f),Te(S?.data?.occupations),X(!1)}catch(f){console.log("Error: ",f),X(!1)}}async function _e(g,x){E(!0);try{const S=await p(g,{page:x?.page||"1",records:x?.records?.toString(),search:x?.search});S&&(E(!1),J(S?.data?.columns||[]),A(S?.data?.rows||[]),P(S?.count),C(S?.pages))}catch(S){E(!1),console.log("Error: ",S)}finally{E(!1)}}return u.useEffect(()=>{_e(r,{search:l||"",page:O||1,records:_??"10"})},[_,l,O]),u.useEffect(()=>{j(1)},[_]),u.useEffect(()=>{R?._id&&ct(r,R?._id)}
8,[R?._id]),{t,showUploadError:Et,uploadOfflineState:ge,uploadOfflineDataRef:K,showQRUpload:N,handleDownloadXlxsFile:vt,setShowQRUpload:k,isLoading:U,totalPages:q,currentPage:O,rowPerPageCount:va,totalDataCount:se,setRowsPerPage:G,rowsPerPage:_,setCurrentPage:j,debouncedSearchRecord:l,handleSearch:Pt,setIsRowList:ae,isRowList:w,generateColumnData:ot,generateRowData:Lt,handleCloseModal:Ut,currentModal:H,handleRevokeConfirmation:Ft,editUserModal:te,setEditUserModal:Q,userCurrent:R,userDataAPI:pe,isUserDataloading:$,handleCloseModalUser:At,handleEditUserFields:Dt,currentFieldDisplay:ne,setCurrentFieldDisplay:ie,currentFieldForm:v,currentFieldFormRef:ye,handleSubmitUpdateFieldUser:Ot,isSubmitLoading:fe,QRDataSubmitLoader:bt,QRDataFile:we,handleUploadQRData:yt,injectDataLoader:Tt,isInjectDataModalOpen:Nt,onCloseInjectDataModal:it,injectDataFormFields:Ct,injectDataInputRef:lt,injectDataOutputRef:nt,registrationDataFile:st,handleInjectInnovatorData:Rt,downloadSampleXlsxFileHandler:It,setIsInjectDataModalOpen:at,userRoles:a,eventId:r}},Va=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n=()=>{}})=>e(m,{children:r?e(Y,{isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e("h5",{className:"",children:"Are you sure you want to revoke access for this user?"}),c("div",{className:"flex justify-center gap-5 my-5",children:[e("button",{onClick:()=>{a()},className:"bg-grey5 py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("No")}),e("button",{onClick:n,className:"bg-[#e21e1e] py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("Yes")})]})]})}):e(m,{})}),za=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n})=>e(m,{children:r?e(Y,{isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e("h5",{className:"",children:"Are you sure you want to verify this user?"}),c("div",{className:"flex justify-center gap-5 my-5",children:[e("button",{onClick:()=>{a()},className:"bg-grey5 py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("No")}),e("button",{onClick:n,className:"bg-success py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("Yes")})]})]})}):e(m,{})}),Ba=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,userDetails:n,currentFieldDisplay:o,setCurrentFieldDisplay:l,handleSubmitUpdateFieldUser:p,children:i,isSubmitLoading:s})=>e(m,{children:r?c(Y,{modalTitle:`Edit ${n?.name??"--"} Details`,isOpen:r,onClose:()=>a(),customClass:"modal-border !max-w-2xl ",children:[e("div",{className:"mt-6 text-center max-h-[60vh] min-h-auto  pr-2  ",children:i}),o?c("div",{className:"mt-4 mb-4 flex justify-end gap-4 ",children:[e(F,{variant:"outlined",customClass:"!w-fit",onClick:()=>l(!1),children:t("cGoBack")}),e(F,{isLoading:s,customClass:"!w-fit",onClick:p,children:t("cUpdate")})]}):e("div",{className:"mt-4 mb-4 flex justify-end gap-4",children:e(F,{variant:"outlined",customClass:"!w-fit",onClick:a,children:t("cClose")})})]}):e(m,{})}),mt=({t,isModalOpen:r,onClose:a,uploadQRDataFormRef:n,uploadQRDataFormFields:o,downloadUploadQRDataSampleFile:l,submitHandler:p,submitLoader:i,data:s})=>e(m,{children:r?c(Y,{customWidth:"max-w-4xl",modalTitle:t("cUploadQRCodeData"),isOpen:r,onClose:a,children:[e("hr",{}),c("div",{className:"mt-6 flex flex-col gap-6 px-4",children:[e(F,{variant:"outlined",color:"primary",customClass:"!w-fit",icon:e(ue,{fontSize:18,icon:"tabler:download"}),onClick:l,children:"Download Sample XLSX"}),e(Ce,{fields:o,ref:n}),c("div",{className:"flex justify-end gap-4",children:[e(F,{variant:"outlined",color:"disabledv1",customClass:"!w-fit",onClick:a,children:t("cCancelButton")}),e(F,{disabled:!s,customClass:"!w-fit",isLoading:i,onClick:p,children:t("cUploadText")})]})]})]}):e(m,{})}),qa=({t,isModalOpen:r,onClose:a,injectDataInputRef:n,injectDataOutputRef:o,injectInnovatorFormFields:l,downloadInjectDataSampleFile:p,submitHandler:i,submitLoader:s,data:d})=>e(m,{children:r?e(Y,{customHeight:"max-h-[95vh]",customWidth:"max-w-[95vw] w-[85%] md:w-[65%] lg:w-[50%]",customClass:"!pb-0",isOpen:r,children:c("div",{className:"",children:[c("div",{className:"flex flex-col gap-2 pt-4 z-50 sticky bg-white  top-0 left-0 right-0  mb-3",children:[c("div",{className:"flex justify-between",children:[e("h3",{"aria-label":"Modal Title",className:"text-lg font-semibold text-h2sSlate-900 truncate ",children:t("cInjectInnovatorDataText")}),e("div",{onClick:a,className:"cursor-pointer bg-h2sGrey-600 text-h2sGrey-900 mt-3 hover:text-h2sSlate-800 rounded-full",children:e(ue,{icon:"charm:cross",className:"text-h2sGrey-100",fontSize:25})})]}),e("hr",{})]}),c("div",{className:"mt-6 flex flex-col gap-6 px-4",children:[e(F,{variant:"outlined",color:"primary",customClass:"!w-fit",icon:e(ue,{fontSize:18,icon:"tabler:download"}),onClick:p,children:"Download Sample XLSX"}),Array.isArray(l)&&l.length>=3&&c("div",{className:"flex  flex-col gap-4",children:[e("div",{className:"flex flex-col gap-2",children:e(Ce,{fields:[l[0]],ref:n})}),e("hr",{}),c("div",{className:"flex flex-col gap-4",children:[e("p",{className:"text-body2v1 text-left text-h2sSlate-500",children:"Provide the Google Sheet slug and Subsheet name where the status of each uploaded record will be stored"}),e(Ce,{fields:l.slice(1,3),ref:o})]})]}),c("div",{className:"py-3 border-t sticky bottom-0 left-0 flex justify-end gap-4 bg-white ",children:[e(F,{variant:"outlined",color:"disabledv1",customClass:"!w-fit",onClick:a,children:t("cCancelButton")}),e(F,{disabled:!d,customClass:"!w-fit",isLoading:s,onClick:i,children:t("cInjectDataText")})]})]})]})}):e(m,{})}),Ga=({eventData:t})=>{const{eventName:r}=t,{t:a,isLoading:n,totalPages:o,currentPage:l,rowPerPageCount:p,totalDataCount:i,setRowsPerPage:s,rowsPerPage:d,setCurrentPage:h,debouncedSearchRecord:L,handleSearch:U,setIsRowList:E,isRowList:w,generateColumnData:ae,generateRowData:O,handleCloseModal:j,currentModal:q,handleRevokeConfirmation:C,editUserModal:se,userCurrent:P,userDataAPI:_,isUserDataloading:G,handleEditUserFields:Z,currentFieldForm:A,currentFieldFormRef:V,handleSubmitUpdateFieldUser:J,currentFieldDisplay:H,setCurrentFieldDisplay:ee,handleCloseModalUser:R,isSubmitLoading:z,showQRUpload:$,setShowQRUpload:X,uploadOfflineState:te,uploadOfflineDataRef:Q,handleDownloadXlxsFile:pe,QRDataSubmitLoader:re,QRDataFile:fe,handleUploadQRData:le,showUploadError:ne,injectDataLoader:ie,isInjectDataModalOpen:v,onCloseInjectDataModal:T,injectDataFormFields:W,injectDataInputRef:Te,injectDataOutputRef:Ee,registrationDataFile:xe,handleInjectInnovatorData:ye,downloadSampleXlsxFileHandler:N,setIsInjectDataModalOpen:k,userRoles:K,eventId:ge}=ja();return c(m,{children:[e(mt,{isModalOpen:$,onClose:()=>{X(!1)},t:a,data:fe,submitHandler:le,submitLoader:re,uploadQRDataFormFields:te,uploadQRDataFormRef:Q,downloadUploadQRDataSampleFile:pe}),e(qa,{t:a,submitLoader:ie,injectInnovatorFormFields:W,injectDataInputRef:Te,injectDataOutputRef:Ee,isModalOpen:v,onClose:T,downloadInjectDataSampleFile:N,data:xe,submitHandler:ye}),e(mt,{isModalOpen:$,onClose:()=>{X(!1)},t:a,data:fe,submitHandler:le,submitLoader:re,uploadQRDataFormFields:te,uploadQRDataFormRef:Q,downloadUploadQRDataSampleFile:pe}),e(Ba,{t:a,isSubmitLoading:z,handleSubmitUpdateFieldUser:J,setCurrentFieldDisplay:ee,userDetails:P,currentFieldDisplay:H,confirmationModalOpen:se,setConfirmationModalOpen:R,children:H&&A?c("div",{className:`${A?.length>0&&A?.[0]?.title==="Occupation"?"max-h-[60vh] overflow-y-auto pr-4":""} `,children:[e(Ce,{fields:A,ref:V}),ne?.length>0?e("div",{className:"text-subtitle3v1 text-h2sError-600",children:ne}):e(m,{})]}):e(Fe,{isLoading:G,children:e("div",{className:"grid grid-cols-2 max-sm:grid-cols-1 gap-6 overflow-y-auto max-h-[60vh]",children:_?.length>0?_?.map((Se,we)=>c("div",{className:"flex justify-between text-left max-w-[90%]",children:[c("div",{className:"flex flex-col gap-2 max-w-[90%]",children:[e("div",{className:"font-bold text-sm  text-h2sSlate-700",children:Se?.label??"-"}),e(ya,{data:Se})]}),Se?.defaultTag==="OCCUPATION"?e(m,{}):e(je,{onClick:()=>Z(_,Se),fontSize:"10",className:"text-h2sSlate-500 cursor-pointer"})]},we)):null})})}),e(Va,{t:a,handleConfirmModal:C,confirmationModalOpen:q==="REVOKED",setConfirmationModalOpen:j}),e(za,{t:a,handleConfirmModal:C,confirmationModalOpen:q==="VERIFIED",setConfirmationModalOpen:j}),e("div",{children:c("div",{className:"rounded-2xl bg-white shadow-soft-xl mt-[24px] pb-[12px] ",children:[c("div",{className:"flex-col  justify-between max-[640px]:flex-wrap max-[640px]:gap-3  gap-4 max-xl:flex-col p-5",children:[e("div",{className:"gap-4 max-xl:flex-col mb-5",children:e("h1",{className:"text-h6  text-h2sSlate-700 ",children:r??" "})}),c("div",{className:"flex gap-4 justify-between max-sm:flex-col max-sm:gap-4",children:[e("div",{className:"flex max-[640px]:flex-wrap max-[640px]:gap-0  gap-2 ",children:e("div",{className:"max-[640px]:w-full max-[640px]:mb-3 w-64",children:e(Ke,{value:L||"",onChange:Se=>U(Se),placeholder:"Search here...",customClass:"!px-[8px] !py-[3px]"})})}),c("div",{className:"flex justify-end gap-4",children:[e(ke,{userRoles:K,requiredRoles:he(ge,K)?.STAFF.MANAGE_USERS.INITIATIVE.INNOVATOR,children:e(F,{onClick:()=>X(!0),variant:"outlined",customClass:"!w-fit text-nowrap",icon:e(ue,{icon:"material-symbols:qr-code",fontSize:16}),children:"Upload QR Data"})}),e(ke,{userRoles:K,requiredRoles:he(ge,K)?.STAFF.MANAGE_USERS.INITIATIVE.INNOVATOR,children:e(F,{customClass:"!w-fit text-nowrap",onClick:()=>k(!0),variant:"outlined",icon:e(ue,{icon:"fluent-mdl2:bulk-upload",fontSize:16}),children:a("cInjectInnovatorDataText")})})]})]})]}),c("div",{className:"flex gap-4 px-5 justify-between items-center max-[640px]:flex-wrap max-[640px]:gap-3 border-y md:sticky bg-white z-10  top-[3.9rem]",children:[e("div",{children:e($e,{isRowList:w,setIsRowList:E,rowsPerPage:d,setRowsPerPage:s,rowPerPageCount:p})}),c("div",{className:"flex items-center max-[640px]:flex-wrap max-[640px]:gap-3 gap-4",children:[e(Qe,{rowsPerPage:d,totalDataCount:i,currentPage:l}),e(We,{t:a,isLoading:n,totalPages:o||1,currentPage:l,setCurrentPage:h})]})]}),e("div",{className:"",children:e(Fe,{isLoading:n,children:O()?.length===0?c("div",{className:"!flex !flex-col mx-auto w-fit my-[1rem] font-openSans text-center",children:[e(Ye,{className:"w-[10rem] !h-[10rem] mx-auto"}),e("h5",{className:"text-h6 text-h2sSlate-600  mb-3",children:a("cRecordNotFound")}),e("p",{className:"text-sm text-h2sSlate-400 ",children:a("cTableNoRecordDescription")})]}
8):e(Ze,{columns:ae()||[],rows:O()||[]})})})]})})]})},Ha=()=>{async function t(n="",o={}){try{return await ua(n,o)}catch(l){console.log("Error: ",l)}}async function r({eventId:n="",innovatorId:o="",status:l=""}){try{return await pa({eventId:n,innovatorId:o,status:l})}catch(p){console.log("Error: ",p)}}async function a({eventId:n="",data:o={}}){try{return await ma({eventId:n,data:o})}catch(l){console.log("Error: ",l)}}return{getOrganizerListDataStaff:t,updateOrganizerStatusStaffApi:r,addOrganizerUserStaff:a}},Xa=[{label:"10",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"75",value:"75"},{label:"100",value:"100"}],Ka=[{_id:"L3",label:"L3"},{_id:"L4",label:"L4"},{_id:"L5",label:"L5"},{_id:"L6",label:"L6"},{_id:"L3A",label:"Custom Profile"}];function $a({user:t,status:r},a=()=>{},n=[],o){const l=r==="REVOKED"?{label:"Verify",className:"text-h2sSuccess-600",value:"VERIFIED",icon:"icon-park-outline:check-one"}:{label:"Revoke",value:"REVOKED",className:"text-h2sError-600",icon:"mi:circle-error"};return[...Ie(n,he(o,n)?.STAFF.MANAGE_USERS.INITIATIVE.ORGANIZER)?[{label:l?.label??"",icon:l?.icon??"",customClass:l?.className??"",onClick:()=>{a({user:t,status:r==="REVOKED"?"VERIFIED":"REVOKED"})}}]:[]]}const Qa=({columndata:t,setSortColumn:r,sortColumn:a,userRoles:n=[],eventId:o})=>{const l=s=>{r(d=>d.name===s?{name:s,order:d.order==="asc"?"desc":"asc"}:{name:s,order:"asc"})},p=[{label:"Created At",_id:"createdAt",type:M?.DATE,render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Status",_id:"status",type:"STATUS",render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Name",_id:"name",type:M?.USER,render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Email",_id:"email",type:M?.EMAIL,render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Role",_id:"role",type:"ROLE",render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})}];return[...Ie(n,he(o,n)?.STAFF.MANAGE_USERS.INITIATIVE.ORGANIZER)?[{label:"",type:"ACTION",_id:t?.some(s=>s.type==="USER")?t.find(s=>
8s.type==="USER")?._id:"",columnClass:"text-center !min-w-[0px] !max-w-[0px]",render:()=>e(m,{})}]:[],...p]},Wa=t=>{const{rowData:r,newColumndata:a,handleConfirmation:n,userRoles:o,eventId:l}=t;if(r?.length>0&&a?.length>0)return r?.map(i=>{const s=[];return a?.map(d=>{switch(d?.type){case"ACTION":s?.push({label:"ACTION",render:h=>e(m,{children:e("div",{className:"relative flex !justify-center",children:e(et,{handleMenuClick:()=>{},customClass:"text-h2sSlate-600 cursor-pointer",customIcon:e(je,{className:"text-h2sSlate-500"}),menuButtonsData:$a({user:i,status:i?.status},n,o,l),rowIndex:1,rowData:h?._id})})})});break;case M?.USER:s?.push({label:i?.name,render:()=>e(m,{children:e(He,{className:"!gap-2 mr-10 !max-w-60 ",data:{image:i?.picture?i?.picture:"https://h2svision.github.io/publicAssets/vision/defaultUser.png",title:i?.name}})})});break;case M?.DATE:s?.push({label:i?.createdAt,render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 text-sm",children:i?.createdAt?Ge(i?.createdAt,d?._id==="createdAt"):""})})});break;case M?.EMAIL:s?.push({label:i?.email,render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !block ellipsis-two-lines  text-sm",children:i?.email})})});break;case"STATUS":s?.push({label:i?.email,render:()=>e(m,{children:e("div",{className:`w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs ${i?.status==="REVOKED"?"bg-h2sError-50 text-h2sError-600":i?.status==="VERIFIED"?"bg-h2sSuccess-50 text-h2sSuccess-600":i?.status==="CREATED"?"bg-h2sWarning-50 text-h2sWarning-600":""}  `,children:e("p",{children:i?.status})})})});break;case"ROLE":s?.push({label:i?.role,render:()=>e(m,{children:e("div",{className:"w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs  text-h2sSlate-400",children:e("p",{children:i?.role})})})});break;default:s?.push({label:i[d?._id],render:()=>e(m,{children:d?._id==="status"?e("div",{className:`w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs ${i[d?._id]==="REVOKED"?"bg-h2sError-50 text-h2sError-600":i[d?._id]==="VERIFIED"?"bg-h2sSuccess-50 text-h2sSuccess-600":i[d?._id]==="CREATED"?"bg-h2sWarning-50 text-h2sWarning-600":""}  `,children:e("p",{children:i[d?._id]})}):e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !block ellipsis-two-lines  text-sm",children:typeof i[d?._id]=="string"&&i[d?._id]?.toLowerCase().includes("https")?e("a",{href:"",className:"underline text-h2sBrand-900",target:"_blank",children:i[d?._id]}):Ue(i[d?._id])??""})})})});break}}),s})},Ya=[{name:"name",title:"Full Name",type:"text",required:!0,validation:"LONG_TEXT",helperText:"Enter your legal full name"},{name:"email",title:"Email",type:"email",required:!0,validation:"EMAIL",helperText:"Enter a valid email address to Sign Up for your H2S account"},{name:"role",title:"Role",placeholder:"Select the role of the user",type:b?.SELECT,pickList:[{label:"L3",value:"L3"},{label:"L4",value:"L4"},{label:"L5",value:"L5"},{label:"L6",value:"L6"}],isMulti:!1,isCreatable:!1,isSearchable:!1,required:!0,className:"mb-4 mt-4 roleCheckBox"}],Za=()=>{const t=Pe(),{eventId:r}=Me(),a=Je(N=>N?.user?.roles)||[],[n,o]=u.useState(""),l=Xe(n,800),{getOrganizerListDataStaff:p,updateOrganizerStatusStaffApi:i,addOrganizerUserStaff:s}=Ha(),[d,h]=u.useState(!1),[L,U]=u.useState(!1),[E,w]=u.useState(1),[ae,O]=u.useState(1),[j,q]=u.useState(null),[C,se]=u.useState("10"),[P,_]=u.useState(!1),[G,Z]=u.useState([]),[A,V]=u.useState({name:"createdAt",order:"desc"}),[J,H]=u.useState([]),[ee,R]=u.useState(""),[z,$]=u.useState({}),[X,te]=u.useState(!1),[Q]=u.useState(Ya||[]),pe=u.useRef(),re=u.useRef();function fe(){te(!0)}async function le(){try{const N=await pe?.current?.getValues(),k={email:N?.email,role:N?.role?.split(/[;:]+/).map(ge=>ge.trim().toUpperCase()).filter(ge=>ge.startsWith("L")).sort().join(";"),name:N?.name};if((await s({eventId:r,data:k}))?.success)te(!1),xe(r,{page:E||"1",records:C,search:l});else throw new Error("Error in adding evaluator")}catch(N){console.log("Error: ",N)}finally{}}function ne(){xe(r,{page:"1",records:C,search:l,role:G||[]}),re.current=!0,w(1),_(!1)}async function ie(){Z([])}const v=()=>Qa({columndata:[],setSortColumn:V,sortColumn:A,userRoles:a,eventId:r}),T=()=>Wa({newColumndata:v(),rowData:J,handleConfirmation:Te,userRoles:a,eventId:r});async function W(){try{const N={eventId:r,innovatorId:z?.user?._id??"",status:z?.status??""};(await i(N))?.success&&(R(""),$({}),xe(r,{page:E||"1",records:C,search:l,role:G||[]}))}catch(N){console.log("Error: ",N)}}async function Te({user:N,status:k}){switch(k){case"REVOKED":R("REVOKED"),$({user:N,status:k});break;case"VERIFIED":R("VERIFIED"),$({user:N,status:k});break}}function Ee(){R("")}async function xe(N,k){h(!0);try{const K=await p(N,{page:k?.page||"1",records:k?.records?.toString(),search:k?.search,sortColumn:k?.sortColumn,sortOrder:k?.sortOrder,role:k?.role?.join(";")});K&&(h(!1),H(K?.data||[]),q(K?.count),O(K?.pages))}catch(K){h(!1),console.log("Error: ",K)}finally{h(!1)}}function ye(N){n!=1&&w(1),o(N)}return u.useEffect(()=>{if(re.current===!0){re.current=!1;return}const N={search:l||"",page:E||1,records:C??"10",role:G||[],...A?.name?{sortColumn:A?.name}:{},...A?.order?{sortOrder:A?.order}:{}};xe(r,N)},[C,l,E,A?.name,A?.order]),u.useEffect(()=>{w(1)},[C]),{t,isLoading:d,totalPages:ae,currentPage:E,rowPerPageCount:Xa,totalDataCount:j,setRowsPerPage:se,rowsPerPage:C,setCurrentPage:w,debouncedSearchRecord:l,handleSearch:ye,setIsRowList:U,isRowList:L,generateColumnData:v,generateRowData:T,handleCloseModal:Ee,currentModal:ee,handleRevokeConfirmation:W,showFilter:P,setShowFilter:_,handleClearFilters:ie,handleApplyColumn:ne,selectedColumns:G,setSelectedColumns:Z,tableStaticColumns:Ka,handleAddOrganizerModal:fe,addOrganizerForm:Q,addOrganizerRef:pe,handleAddOrganizerFormData:le,addModalData:X,setAddModalData:te,userRoles:a,eventId:r}},Ja=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n})=>e(m,{children:r?e(Y,{isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e("h5",{className:"",children:"Are you sure you want to verify this user?"}),c("div",{className:"flex justify-center gap-5 my-5",children:[e("button",{onClick:()=>{a()},className:"bg-grey5 py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("No")}),e("button",{onClick:n,className:"bg-success py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("Yes")})]})]})}):e(m,{})}),es=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n=()=>{}})=>e(m,{children:r?e(Y,{isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e("h5",{className:"",children:"Are you sure you want to revoke access for this user?"}),c("div",{className:"flex justify-center gap-5 my-5",children:[e("button",{onClick:()=>{a()},className:"bg-grey5 py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("No")}),e("button",{onClick:n,className:"bg-[#e21e1e] py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("Yes")})]})]})}):e(m,{})}),ts=({tableStaticColumns:t=[],t:r,selectedColumns:a,setSelectedColumns:n=()=>{},handleApplyColumn:o=()=>{},showFilter:l,setShowFilter:p=()=>{},handleResetFilter:i=()=>{}})=>{const s=u.useRef();Qt(s,()=>{p(!1)}),u.useEffect(()=>{t&&t.length>0?n(t.map(E=>E._id)):n([])},[t]);function d(E){a.includes(E)?n(a.filter(w=>w!==E)):n([...a,E])}function h(){n([])}function L(){p(!1),o()}function U(){a.length===t.length?n([]):n(t.map(E=>E._id))}return e(m,{children:e(ga,{setShowFilter:p,showFilter:l,isReload:!1,handleResetFilter:i,customPosition:"top-12 right-[-9rem] max-md:right-[-8rem] max-sm:right-[0rem]",customIcon:e(ue,{fontSize:22,icon:"ri:filter-2-fill",className:"mx-4"}),children:e("div",{className:"filterCard-custom bg-[var(--theme-color)] rounded-lg px-5 pt-4 pb-4",ref:s,children:c(m,{children:[c("div",{className:"flex flex-col  items-center w-full h-46 overflow-y-scroll",children:[e("div",{className:"flex text-[0.8rem] items-center  w-full p-2 pl-0",children:c("div",{className:"flex gap-4 items-center justify-start cursor-pointer filterCheckbox",onClick:()=>{},children:[e("input",{checked:a.length===t.length,onChange:U,className:"cursor-pointer ",type:"checkbox",name:r("cSelectAll"),id:r("cSelectAll")}),c("label",{className:"cursor-pointer font-openSans text-h2sSlate-800 font-semibold ellipsis-two-lines",htmlFor:r("cSelectAll"),title:r("cSelectAll"),children:[" ",r("
8cSelectAll")]})]})}),t?.length>0&&t?.map((E,w)=>e("div",{className:"flex text-[0.8rem] items-center  w-full p-2 pl-0",children:c("div",{className:"flex gap-4 items-center justify-center cursor-pointer filterCheckbox",onClick:()=>{},children:[e("input",{checked:a.includes(E?._id),onChange:()=>d(E?._id),className:"cursor-pointer ",type:"checkbox",name:r(E?.label),id:r(E?.label)}),c("label",{className:"cursor-pointer font-openSans text-h2sSlate-800 font-semibold ellipsis-two-lines",htmlFor:r(E?.label),title:r(E?.label),children:[" ",r(E?.label)]})]})},w))]}),c("div",{className:"flex justify-end gap-3 pt-5",children:[e(F,{onClick:h,variant:"outlined",color:"primary",customClass:"!w-fit ",children:r("cClear")}),e(F,{onClick:()=>L(),variant:"filled",color:"primary",customClass:"!w-fit ",children:r("cApplyButton")})]})]})})})})};const as=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n=()=>{},addOrganizerForm:o=[],addOrganizerRef:l=""})=>e(m,{children:r?e(Y,{modalTitle:t("cAddOrganizer"),isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e(Ce,{fields:o,ref:l}),c("div",{className:"mt-4 mb-4 flex justify-end gap-4",children:[e(F,{variant:"outlined",customClass:"!w-fit",onClick:()=>a(),children:t("cCancelButton")}),e(F,{customClass:"!w-fit",onClick:n,children:t("cSubmitButton")})]})]})}):e(m,{})}),ss=({eventData:t})=>{const{eventName:r}=t,{t:a,isLoading:n,totalPages:o,currentPage:l,rowPerPageCount:p,totalDataCount:i,setRowsPerPage:s,rowsPerPage:d,setCurrentPage:h,debouncedSearchRecord:L,handleSearch:U,setIsRowList:E,isRowList:w,generateColumnData:ae,generateRowData:O,handleCloseModal:j,currentModal:q,handleRevokeConfirmation:C,showFilter:se,setShowFilter:P,handleClearFilters:_,handleApplyColumn:G,selectedColumns:Z,setSelectedColumns:A,tableStaticColumns:V,handleAddOrganizerModal:J,addOrganizerForm:H,addOrganizerRef:ee,handleAddOrganizerFormData:R,setAddModalData:z,addModalData:$,userRoles:X,eventId:te}=Za();return c(m,{children:[e(as,{t:a,handleConfirmModal:R,addOrganizerForm:H,addOrganizerRef:ee,confirmationModalOpen:$,setConfirmationModalOpen:z}),e(es,{t:a,handleConfirmModal:C,confirmationModalOpen:q==="REVOKED",setConfirmationModalOpen:j}),e(Ja,{t:a,handleConfirmModal:C,confirmationModalOpen:q==="VERIFIED",setConfirmationModalOpen:j}),e("div",{children:c("div",{className:"rounded-2xl bg-white shadow-soft-xl mt-[24px] pb-[12px] ",children:[c("div",{className:"flex-col  justify-between max-[640px]:flex-wrap max-[640px]:gap-3  gap-4 max-xl:flex-col p-5",children:[e("div",{className:"gap-4 max-xl:flex-col mb-5",children:e("h1",{className:"text-h6  text-h2sSlate-700 ",children:r??" "})}),c("div",{className:"flex justify-between gap-4",children:[c("div",{className:" flex gap-4",children:[e("div",{className:"flex max-[640px]:flex-wrap max-[640px]:gap-0  gap-2 ",children:e("div",{className:"max-[640px]:w-full max-[640px]:mb-3 w-64",children:e(Ke,{value:L||"",onChange:Q=>U(Q),placeholder:"Search here...",customClass:"!px-[8px] !py-[3px]"})})}),e("div",{className:"flex gap-2",children:e(ts,{handleResetFilter:_,showFilter:se,setShowFilter:P,handleApplyColumn:G,selectedColumns:Z,setSelectedColumns:A,tableStaticColumns:V||[],t:a})})]}),e(ke,{userRoles:X,requiredRoles:he(te,X)?.STAFF.MANAGE_USERS.INITIATIVE.ORGANIZER,children:e("div",{children:c(F,{customClass:"h-full",onClick:J,variant:"outlined",children:[e(ue,{icon:"ic:baseline-plus"}),a("cAddOrganizer")]})})})]})]}),c("div",{className:"flex gap-4 px-5 justify-between items-center max-[640px]:flex-wrap max-[640px]:gap-3 border-y md:sticky bg-white z-10  top-[3.9rem]",children:[e("div",{children:e($e,{isRowList:w,setIsRowList:E,rowsPerPage:d,setRowsPerPage:s,rowPerPageCount:p})}),c("div",{className:"flex items-center max-[640px]:flex-wrap max-[640px]:gap-3 gap-4",children:[e(Qe,{rowsPerPage:d,totalDataCount:i,currentPage:l}),e(We,{t:a,isLoading:n,totalPages:o||1,currentPage:l,setCurrentPage:h})]})]}),e("div",{className:"",children:e(Fe,{isLoading:n,children:O()?.length===0?c("div",{className:"!flex !flex-col mx-auto w-fit my-[1rem] font-openSans text-center",children:[e(Ye,{className:"w-[10rem] !h-[10rem] mx-auto"}),e("h5",{className:"text-h6 text-h2sSlate-600  mb-3",children:a("cRecordNotFound")}),e("p",{className:"text-sm text-h2sSlate-400 ",children:a("cTableNoRecordDescription")})]}
8):e(Ze,{columns:ae()||[],rows:O()||[]})})})]})})]})},rs=()=>{async function t(n="",o={}){try{return await ha(n,o)}catch(l){console.log("Error: ",l)}}async function r({eventId:n="",innovatorId:o="",status:l=""}){try{return await fa({eventId:n,innovatorId:o,status:l})}catch(p){console.log("Error: ",p)}}async function a({eventId:n="",data:o={}}){try{return await xa({eventId:n,data:o})}catch(l){console.log("Error: ",l)}}return{getEvaluatorListDataStaff:t,updateEvaluatorStatusStaffApi:r,addEvaluatorUserStaff:a}},ls=[{label:"10",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"75",value:"75"},{label:"100",value:"100"}];function ns({user:t,status:r},a=()=>{},n=[],o){const l=r==="REVOKED"?{label:"Verify",className:"text-h2sSuccess-600",value:"VERIFIED",icon:"icon-park-outline:check-one"}:{label:"Revoke",value:"REVOKED",className:"text-h2sError-600",icon:"mi:circle-error"};return[...Ie(n,he(o,n)?.STAFF.MANAGE_USERS.INITIATIVE.EVALUATOR)?[{label:l?.label??"",icon:l?.icon??"",customClass:l?.className??"",onClick:()=>{a({user:t,status:r==="REVOKED"?"VERIFIED":"REVOKED"})}}]:[]]}const is=({columndata:t,setSortColumn:r,sortColumn:a,userRoles:n=[],eventId:o})=>{const l=s=>{r(d=>d.name===s?{name:s,order:d.order==="asc"?"desc":"asc"}:{name:s,order:"asc"})},p=[{label:"Created At",_id:"createdAt",type:M?.DATE,render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Status",_id:"status",type:"STATUS",render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Name",_id:"name",type:M?.USER,render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Email",_id:"email",type:M?.EMAIL,render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})},{label:"Role",_id:"role",type:"ROLE",render:s=>e(m,{children:c("div",{className:"flex items-center justify-between text-grey2 w-full gap-1",children:[e("span",{className:"ellipsis-two-lines flex-grow",title:s?.label,children:s?.label}),a?.name===s?._id?a.order==="asc"?e(oe,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(ce,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sBrand-900",sx:{fontSize:19}}):e(de,{onClick:()=>l(s?._id),className:"cursor-pointer text-h2sGrey-500",sx:{fontSize:25}})]})})}];return[...Ie(n,he(o,n)?.STAFF.MANAGE_USERS.INITIATIVE.EVALUATOR)?[{label:"",type:"ACTION",_id:t?.some(s=>s.type==="USER")?t.find(s=>
8s.type==="USER")?._id:"",columnClass:"text-center !min-w-[0px] !max-w-[0px]",render:()=>e(m,{})}]:[],...p]},os=t=>{const{rowData:r,newColumndata:a,handleConfirmation:n,userRoles:o,eventId:l}=t;if(r?.length>0&&a?.length>0)return r?.map(i=>{const s=[];return a?.map(d=>{switch(d?.type){case"ACTION":s?.push({label:"ACTION",render:h=>e(m,{children:e("div",{className:"relative flex !justify-center",children:e(et,{handleMenuClick:()=>{},customClass:"text-h2sSlate-600 cursor-pointer",customIcon:e(je,{className:"text-h2sSlate-500"}),menuButtonsData:ns({user:i,status:i?.status},n,o,l),rowIndex:1,rowData:h?._id})})})});break;case M?.USER:s?.push({label:i?.name,render:()=>e(m,{children:e(He,{className:"!gap-2 mr-10 !max-w-60 ",data:{image:i?.picture?i?.picture:"https://h2svision.github.io/publicAssets/vision/defaultUser.png",title:i?.name}})})});break;case M?.DATE:s?.push({label:i?.createdAt,render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 text-sm",children:i?.createdAt?Ge(i?.createdAt,d?._id==="createdAt"):""})})});break;case M?.EMAIL:s?.push({label:i?.email,render:()=>e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !block ellipsis-two-lines  text-sm",children:i?.email})})});break;case"STATUS":s?.push({label:i?.email,render:()=>e(m,{children:e("div",{className:`w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs ${i?.status==="REVOKED"?"bg-h2sError-50 text-h2sError-600":i?.status==="VERIFIED"?"bg-h2sSuccess-50 text-h2sSuccess-600":i?.status==="CREATED"?"bg-h2sWarning-50 text-h2sWarning-600":""}  `,children:e("p",{children:i?.status})})})});break;case"ROLE":s?.push({label:i?.role,render:()=>e(m,{children:e("div",{className:"w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs  text-h2sSlate-400",children:e("p",{children:i?.role})})})});break;default:s?.push({label:i[d?._id],render:()=>e(m,{children:d?._id==="status"?e("div",{className:`w-fit h-fit px-4 py-2 rounded-lg uppercase text-xs ${i[d?._id]==="REVOKED"?"bg-h2sError-50 text-h2sError-600":i[d?._id]==="VERIFIED"?"bg-h2sSuccess-50 text-h2sSuccess-600":i[d?._id]==="CREATED"?"bg-h2sWarning-50 text-h2sWarning-600":""}  `,children:e("p",{children:i[d?._id]})}):e(m,{children:e("p",{className:"text-wrap text-h2sSlate-400 !block ellipsis-two-lines  text-sm",children:typeof i[d?._id]=="string"&&i[d?._id]?.toLowerCase().includes("https")?i[d?._id]:Ue(i[d?._id])??""})})})});break}}),s})},cs=[{name:"name",title:"Full Name",type:"text",required:!0,validation:"LONG_TEXT",helperText:"Enter your legal full name"},{name:"email",title:"Email",type:"email",required:!0,validation:"EMAIL",helperText:"Enter a valid email address to Sign Up for your H2S account"}],ds=()=>{const t=Pe(),{eventId:r}=Me(),a=Je(v=>v?.user?.roles)||[],[n,o]=u.useState(""),l=Xe(n,800),{getEvaluatorListDataStaff:p,updateEvaluatorStatusStaffApi:i,addEvaluatorUserStaff:s}=rs(),[d,h]=u.useState(!1),[L,U]=u.useState(!1),[E,w]=u.useState(1),[ae,O]=u.useState(1),[j,q]=u.useState(null),[C,se]=u.useState("10"),[P,_]=u.useState({name:"createdAt",order:"desc"}),[G,Z]=u.useState([]),[A,V]=u.useState(""),[J,H]=u.useState({}),[ee,R]=u.useState(!1),[z]=u.useState(cs||[]),$=u.useRef();function X(){R(!0)}async function te(){try{const v=await $?.current?.getValues(),T={email:v?.email,role:v?.name};if((await s({eventId:r,data:T}))?.success)R(!1),ne(r,{page:E||"1",records:C,search:l});else throw new Error("Error in adding evaluator")}catch(v){console.log("Error: ",v)}finally{R(!1)}}const Q=()=>is({columndata:[],setSortColumn:_,sortColumn:P,userRoles:a,eventId:r}),pe=()=>os({newColumndata:Q(),rowData:G,handleConfirmation:fe,userRoles:a,eventId:r});async function re(){try{const v={eventId:r,innovatorId:J?.user?._id??"",status:J?.status??""};(await i(v))?.success&&(V(""),H({}),ne(r,{page:E||"1",records:C,search:l}))}catch(v){console.log("Error: ",v)}}async function fe({user:v,status:T}){switch(T){case"REVOKED":V("REVOKED"),H({user:v,status:T});break;case"VERIFIED":V("VERIFIED"),H({user:v,status:T});break}}function le(){V("")}async function ne(v,T){h(!0);try{const W=await p(v,{page:T?.page||"1",records:T?.records?.toString(),search:T?.search,sortColumn:T?.sortColumn,sortOrder:T?.sortOrder,role:T?.role?.join(";")});W&&(h(!1),Z(W?.data||[]),q(W?.count),O(W?.pages))}catch(W){h(!1),console.log("Error: ",W)}finally{h(!1)}}function ie(v){n!=1&&w(1),o(v)}return u.useEffect(()=>{const v={search:l||"",page:E||1,records:C??"10",...P?.name?{sortColumn:P?.name}:{},...P?.order?{sortOrder:P?.order}:{}};ne(r,v)},[C,l,E,P?.name,P?.order]),u.useEffect(()=>{w(1)},[C]),{t,isLoading:d,totalPages:ae,currentPage:E,rowPerPageCount:ls,totalDataCount:j,setRowsPerPage:se,rowsPerPage:C,setCurrentPage:w,debouncedSearchRecord:l,handleSearch:ie,setIsRowList:U,isRowList:L,generateColumnData:Q,generateRowData:pe,handleCloseModal:le,currentModal:A,addModalData:ee,setAddModalData:R,handleRevokeConfirmation:re,handleAddEvaluatorModal:X,addEvaluatorForm:z,handleAddEvaluatorFormData:te,addEvaluatorRef:$,userRoles:a,eventId:r}},us=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n=()=>{}})=>e(m,{children:r?e(Y,{isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e("h5",{className:"",children:"Are you sure you want to revoke access for this user?"}),c("div",{className:"flex justify-center gap-5 my-5",children:[e("button",{onClick:()=>{a()},className:"bg-grey5 py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("No")}),e("button",{onClick:n,className:"bg-[#e21e1e] py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("Yes")})]})]})}):e(m,{})}),ps=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n})=>e(m,{children:r?e(Y,{isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e("h5",{className:"",children:"Are you sure you want to verify this user?"}),c("div",{className:"flex justify-center gap-5 my-5",children:[e("button",{onClick:()=>{a()},className:"bg-grey5 py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("No")}),e("button",{onClick:n,className:"bg-success py-2 rounded-lg text-nowrap px-6 text-white uppercase text-xs",children:t("Yes")})]})]})}):e(m,{})}),ms=({t,confirmationModalOpen:r,setConfirmationModalOpen:a,handleConfirmModal:n=()=>{},addEvaluatorForm:o=[],addEvaluatorRef:l=""})=>
8e(m,{children:r?e(Y,{modalTitle:t("cAddEvaluator"),isOpen:r,onClose:()=>{a()},customClass:"modal-border",children:c("div",{className:"mt-6 text-center",children:[e(Ce,{fields:o,ref:l}),c("div",{className:"mt-4 mb-4 flex justify-end gap-4",children:[e(F,{variant:"outlined",customClass:"!w-fit",onClick:()=>a(!1),children:t("cCancelButton")}),e(F,{customClass:"!w-fit",onClick:n,children:t("cSubmitButton")})]})]})}):e(m,{})}),hs=({eventData:t})=>{const{eventName:r}=t,{t:a,isLoading:n,totalPages:o,currentPage:l,rowPerPageCount:p,totalDataCount:i,setRowsPerPage:s,rowsPerPage:d,setCurrentPage:h,debouncedSearchRecord:L,handleSearch:U,setIsRowList:E,isRowList:w,generateColumnData:ae,generateRowData:O,handleCloseModal:j,currentModal:q,handleRevokeConfirmation:C,addModalData:se,setAddModalData:P,handleAddEvaluatorModal:_,addEvaluatorForm:G,addEvaluatorRef:Z,handleAddEvaluatorFormData:A,userRoles:V,eventId:J}=ds();return c(m,{children:[e(ms,{t:a,handleConfirmModal:A,addEvaluatorForm:G,addEvaluatorRef:Z,confirmationModalOpen:se,setConfirmationModalOpen:P}),e(us,{t:a,handleConfirmModal:C,confirmationModalOpen:q==="REVOKED",setConfirmationModalOpen:j}),e(ps,{t:a,handleConfirmModal:C,confirmationModalOpen:q==="VERIFIED",setConfirmationModalOpen:j}),e("div",{children:c("div",{className:"rounded-2xl bg-white shadow-soft-xl mt-[24px] pb-[12px] ",children:[c("div",{className:"flex-col  justify-between max-[640px]:flex-wrap max-[640px]:gap-3  gap-4 max-xl:flex-col p-5",children:[e("div",{className:"gap-4 max-xl:flex-col mb-5",children:e("h1",{className:"text-h6  text-h2sSlate-700 ",children:r??" "})}),c("div",{className:"flex gap-4 justify-between",children:[e("div",{className:"flex max-[640px]:flex-wrap max-[640px]:gap-0  gap-2 ",children:e("div",{className:"max-[640px]:w-full max-[640px]:mb-3 w-64",children:e(Ke,{value:L||"",onChange:H=>U(H),placeholder:"Search here...",customClass:"!px-[8px] !py-[3px]"})})}),e(ke,{userRoles:V,requiredRoles:he(J,V)?.STAFF.MANAGE_USERS.INITIATIVE.EVALUATOR,children:e("div",{children:c(F,{onClick:_,variant:"outlined",children:[e(ue,{icon:"ic:baseline-plus"}),"Add Evaluator"]})})})]})]}),c("div",{className:"flex gap-4 px-5 justify-between items-center max-[640px]:flex-wrap max-[640px]:gap-3 border-y md:sticky bg-white z-10  top-[3.9rem]",children:[e("div",{children:e($e,{isRowList:w,setIsRowList:E,rowsPerPage:d,setRowsPerPage:s,rowPerPageCount:p})}),c("div",{className:"flex items-center max-[640px]:flex-wrap max-[640px]:gap-3 gap-4",children:[e(Qe,{rowsPerPage:d,totalDataCount:i,currentPage:l}),e(We,{t:a,isLoading:n,totalPages:o||1,currentPage:l,setCurrentPage:h})]})]}),e("div",{className:"",children:e(Fe,{isLoading:n,children:O()?.length===0?c("div",{className:"!flex !flex-col mx-auto w-fit my-[1rem] font-openSans text-center",children:[e(Ye,{className:"w-[10rem] !h-[10rem] mx-auto"}),e("h5",{className:"text-h6 text-h2sSlate-600  mb-3",children:a("cRecordNotFound")}),e("p",{className:"text-sm text-h2sSlate-400 ",children:a("cTableNoRecordDescription")})]}):e(Ze,{columns:ae()||[],rows:O()||[]})})})]})})]})},fs=({eventId:t,eventName:r=""})=>Wt([{to:"/staff/manage-users/initiative",icon:e(ue,{className:"text-slate-700 opacity-45",fontSize:17,icon:"heroicons:home-solid"})},{to:`/staff/manage-users/initiative/${t}`,title:r??""}]),xs=({t,eventId:r,eventName:a})=>[{label:t("cOrganizer"),component:e(ss,{eventData:{eventId:r,eventName:a}})},{label:t("cEvaluator"),component:e(hs,{eventData:{eventId:r,eventName:a}})},{label:t("cInnovator"),component:e(Ga,{eventData:{eventId:r,eventName:a}})}],gs=()=>{const t=Pe(),r=ta(),{eventId:a}=Me(),[n,o]=aa(),l=n.get("eventName"),p=fs({eventId:a,eventName:l}),i=xs({t,eventId:a,eventName:l}),[s,d]=u.useState(0),h=(U,E)=>{const w=Object.fromEntries(n.entries());o({...w,tabIndex:String(E)}),d(E)};function L(){const U=n.get("tabIndex"),E=parseInt(U,10);if(!U||isNaN(E)){const w=Object.fromEntries(n.entries());o({...w,tabIndex:"0"}),d(0)}else d(E)}return u.useEffect(()=>{L()},[n]),u.useEffect(()=>{a||r("/staff/manage-users/initiative")},[a]),{t,activeTabIndex:s,tabChangeHandler:h,breadCrumDataToSend:p,navigate:r,manageUserInitiativeTabs:i}},Fs=()=>{const{t,activeTabIndex:r,tabChangeHandler:a,breadCrumDataToSend:n,navigate:o,manageUserInitiativeTabs:l}=gs();return e("div",{children:c("div",{className:"font-sans",children:[e(Yt,{metaData:{title:t("cManageUsers")}}),c("div",{className:"w-full px-[24px] pb-20",children:[e("div",{className:"pt-8 pb-2 w-full md:sticky top-0 bg-h2sGrey-50 z-20",children:e(Zt,{breadCrumData:n,className:""})}),e(ba,{title:t("cManageUsersInitiativeText1"),description:t("cManageUsersInitiativeDescrpition1")}),c("div",{className:"flex text-h2sEventPage-900 gap-2 py-4 items-center cursor-pointer text-title2v1 ",onClick:()=>o("/staff/manage-users/initiative"),children:[e(ue,{icon:"ep:back"})," ",t("Go back")]}),e(Jt,{activeTab:r,clickHandler:a,tabsData:l})]})]})})};export{Fs 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.