1import{b as e,ab as L,u as M,v as H,w as $,a0 as G,a2 as J,r as u,a1 as g,ac as Y}from"./vendor-CNlRBQKV.js";import{s as O,F as W}from"./index-BLUlY5na.js";import{HeroSection as Z}from"./About-BUtDk5S4.js";import"./vendor-lodash-B3EhnKIF.js";/* empty css */import"./ImageWithText-DTIdaL76.js";const z="/assets/loading-data-DexGxxZ_.gif",K=t=>e.jsxs("div",{className:"card ml-5 mt-5",children:[e.jsx("div",{className:"container text-center",children:e.jsx("h1",{children:"Your response summary"})}),e.jsx("ul",{className:"list-group",children:t.summary.map((a,d)=>e.jsxs("li",{className:"list-group-item",children:[e.jsx("h5",{children:t.allQuestins[d].question}),t.allQuestins[d].answers.map((o,c)=>a.answer_id===o._id?e.jsxs("h4",{className:"ul.list-group .list-group-item",children:[" ",o.answer," "]},c):t.allQuestins[c].type===2?e.jsx("h4",{className:"ul.list-group .list-group-item",children:a.answer_id},c):t.allQuestins[c].type===1?e.jsxs("h4",{className:"ul.list-group .list-group-item",children:[" ",a.answer_id," "]},c):null)]},d))})]}),U=t=>{const{question:a,answerSelected:d,currentSliderValue:o,setCurrentSliderValue:c,parentOption:p,setParentOption:j,showSubQue:C,setShowSubQue:q,currentSubSliderValue:v,setCurrentSubSliderValue:f}=t;let h={answerType:null,text:"",selectedOption:null,selectedRange:0};const w=(s,i)=>{j(s),q(i)},r=s=>{d({selectedOption:s,question:{answerType:null,text:"",selectedOption:null,selectedRange:0}})};let x=(s,i)=>{h.answerType=i,i==="text"?h.text=s:i==="range"?h.selectedRange=s:i==="option"&&(h.selectedOption=s),d({selectedOption:p,question:h})},y=[];a.type==="option"?y=e.jsx("ul",{className:"answer-list",children:a.options.map((s,i)=>e.jsxs("li",{children:[e.jsx("input",{type:"radio",id:s._id,name:"selector",value:s.text,onChange:n=>{s.question.text?w(n.target.value,i):r(n.target.value)}}),e.jsx("label",{htmlFor:s._id,children:s.text}),e.jsx("div",{className:"check"}),C===i&&s.question.text&&e.jsx("div",{children:s.question.questionType==="text"?e.jsx(e.Fragment,{children:e.jsx("div",{children:e.jsx("div",{className:"box-questions text-black!",children:e.jsxs("div",{className:"questions-answer",children:[e.jsx("h4",{children:s.question.text}),e.jsx("textarea",{className:"px-6 py-3",id:"answers",name:"answers",rows:"5",cols:"50",onChange:n=>x(n.target.value,"text")},s.question._id)]})})})}):s.question.questionType==="range"?e.jsx("div",{children:e.jsx("div",{className:"box-questions",children:e.jsxs("div",{className:"questions-answer",children:[e.jsx("h4",{children:s.question.text}),e.jsxs("div",{className:"slidecontainer",children:[e.jsx("input",{type:"range",className:"slider",id:"myRange",min:s.question.startRange,max:s.question.endRange,onChange:n=>{x(n.target.value,"range"),f(n.target.value)}}),e.jsx("span",{className:"min float-left",children:s.question.startRange}),e.jsx("span",{className:"max float-right",children:s.question.endRange}),e.jsx("div",{className:"text-center",children:e.jsxs("span",{className:"value",children:["Value: ",v]})}),e.jsx("div",{className:"text-center",children:e.jsx("span",{className:"value",children:e.jsxs("div",{style:{margin:"20px 0 5px",padding:"0"},children:[" ",e.jsx("div",{dangerouslySetInnerHTML:{__html:s.question.summary&&s.question.summary[v-1]}})]})})})]})]})})}):e.jsx("div",{children:e.jsx("div",{className:"box-questions",children:e.jsxs("div",{className:"questions-answer",children:[e.jsx("h4",{children:s.question.text}),e.jsx("div",{style:{textAlign:"left"},dangerouslySetInnerHTML:{__html:s.question.description}}),e.jsx("ul",{className:"answer-list",children:s.question.options.map(n=>e.jsxs("li",{children:[e.jsx("input",{type:"radio",id:n._id,name:"selector",value:n.text,onChange:S=>x(S.target.value,"option")}),e.jsx("label",{htmlFor:n._id,children:n.text}),e.jsx("div",{className:"check"})]},n._id))})]})})})})]},s._id))}):a.type==="range"?y=e.jsx(e.Fragment,{children:e.jsxs("div",{className:"slidecontainer",children:[e.jsx(L,{"aria-label":"Small steps",defaultValue:o,value:o,step:1,marks:!0,min:a.startRange,max:a.endRange,valueLabelDisplay:"auto",sx:{color:"#0b6767",height:"6px"},onChange:s=>{d(s.target.value),c(s.target.value)}}),e.jsx("span",{className:"min float-left",children:"Low"}),e.jsx("span",{className:"max float-right",children:"High"}),e.jsx("div",{className:"text-center",children:e.jsxs("span",{className:"value",children:["Value: ",o]})}),e.jsxs("div",{style:{margin:"20px 0 5px",padding:"0"},children:[" ",e.jsx("div",{dangerouslySetInnerHTML:{__html:a.summary&&a.summary[o-1]}})]})]})}):y=e.jsx(e.Fragment,{children:e.jsx("textarea",{id:"answers",className:"px-6 py-3 text-black!",name:"answers",rows:"5",cols:"50",onChange:s=>d(s.target.value)},a._id)});let N=[];return N=e.jsx("div",{children:e.jsx("div",{className:"box-questions",children:e.jsxs("div",{className:"questions-answer",children:[e.jsx("h4",{children:a.text}),e.jsx("div",{style:{textAlign:"left"},dangerouslySetInnerHTML:{__html:a.description}}),y]})})}),e.jsx(e.Fragment,{children:e.jsx("div",{children:N})})},X=t=>{var B,k,E;console.log("PrelegateQuestions Rendered");
1var{userAnswer:a}=t,{service:d,subCategoryId:o}=G();const{user:c}=J(l=>l.auth),[p,j]=u.useState(1),[C,q]=u.useState(),[v,f]=u.useState(""),[h,w]=u.useState();let[r,x]=u.useState(0),[y,N]=u.useState(!0),[s,i]=u.useState();const[n,S]=u.useState(),[_,ae]=u.useState([]),[b,Q]=u.useState([]);let A="Need to give answer to move further";u.useEffect(()=>{F()},[]),u.useEffect(()=>{t.questions.queryResult.data.length&&i(t.questions.queryResult.data[r])},[t]);const F=async()=>{try{localStorage.getItem("idToken")?await O.questions.find({query:{category:o,service:d,$sort:{createdAt:1},$limit:1e3,$skip:0}}):(g.error("Session expired. Please login again.",{hideProgressBar:!0,autoClose:2e3}),t.history.push({pathname:"/login",state:window.location.pathname}))}catch{}},T=async l=>{if(r<0)return null;if(!n)g.error(A,{hideProgressBar:!0,autoClose:2e3});else if(s.regex){const m=s.regex;new RegExp(m).test(n)?(await R(),x(r+1),i(t.questions.queryResult.data[r+1]),P()):g.error(s.regexErrorMessage,{hideProgressBar:!0,autoClose:2e3})}else await R(),x(r+1),i(t.questions.queryResult.data[r+1]),P()},P=()=>{j(1),q(""),f(""),w("")},V=l=>{if(r<=0)return r=0;{x(--r),i(t.questions.queryResult.data[r]);let m=JSON.parse(JSON.stringify(b));m.pop(),Q(m)}},R=async()=>{let l={answertype:s.type,text:"",options:{selectedOption:"",question:{answerType:null,text:"",selectedOption:"",selectedRange:""}},selectedRange:0};s.type==="text"?l.text=n:s.type==="range"?l.selectedOption=n:s.type==="option"&&(l.options=n);let m={questionId:s._id,userId:c._id,answer:l,categoryId:`${o}`};Q([...b,m]),S("")},D=l=>{S(l)},I=async()=>{if(!n)g.error(A,{hideProgressBar:!0,autoClose:2e3});else if(s.regex){const l=s.regex;new RegExp(l).test(n)?await R():g.error(s.regexErrorMessage,{hideProgressBar:!0,autoClose:2e3})}else await R();N(!1)};return u.useEffect(()=>{r===t.questions.queryResult.data.length-1&&O["user-answers"].create(b)},[b]),u.useEffect(()=>{a.isError&&g.error(a.isError,{hideProgressBar:!0,autoClose:2e3}),a.isFinished&&(x(++r),i(""),g.success("Answer submitted",{hideProgressBar:!0,autoClose:2e3}))},[a]),e.jsx(e.Fragment,{children:y&&t.questions.isLoading?e.jsx("div",{className:"noRecord_found loadingFull",children:e.jsx("img",{src:z,alt:"No Data Found",className:"img-fluid"})}):!t.questions.isError&&t.questions.queryResult.data.length>0?e.jsx("div",{className:"container",children:e.jsxs("div",{className:"questioner_area",children:[r<((E=(k=(B=t==null?void 0:t.questions)==null?void 0:B.queryResult)==null?void 0:k.data)==null?void 0:E.length)&&e.jsxs("div",{className:"questionNumber",children:[e.jsx("span",{className:"currentQuestionNumber",children:(r+1).toString().padStart(2,"0")}),e.jsxs("span",{className:"totalQuestions",children:["/",t.questions.queryResult.data.length.toString().padStart(2,"0")]})]}),s?e.jsx(U,{question:s,answerSelected:D,currentSliderValue:p,setCurrentSliderValue:j,parentOption:C,setParentOption:q,showSubQue:v,setShowSubQue:f,currentSubSliderValue:h,setCurrentSubSliderValue:w}):e.jsx("div",{className:"thankyou-section",children:"Thank you for answering the question. Please check your registered email for the recommendations."}),r===t.questions.queryResult.data.length&&t.questions.queryResult.data.length>0&&_.length===t.questions.queryResult.data.length&&e.jsx(K,{summary:_,allQuestins:t.questions.queryResult.data}),e.jsxs("div",{className:"bottom-btn",children:[r<=t.questions.queryResult.data.length-1&&e.jsxs("a",{onClick:l=>V(),style:{color:"black"},className:"bg-[#f2f2f2] px-4 py-3 rounded-md font-Montserrat font-[500]",children:[e.jsx(Y,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),"Previous"]}),r<t.questions.queryResult.data.length-1?e.jsxs("a",{onClick:l=>T(),style:{color:"white",backgroundColor:"#0B6767"},className:"bg-ThemeSecondary text-white rounded-md px-4 py-3 font-Montserrat font-[500]",children:["Next",e.jsx(ChevronsRight,{className:"w-4 h-4 ml-2","aria-hidden":"true"})]}):r===t.questions.queryResult.data.length-1?e.jsxs("a",{onClick:l=>I(),style:{color:"white",backgroundColor:"#0B6767"},className:"getStarted",children:["Submit",e.jsx(ChevronsRight,{className:"w-4 h-4 ml-2","aria-hidden":"true"})]}):e.jsx("div",{className:"gotoDashboard",children:e.jsx(te,{variantVal:"primary",to:"/",label:"Go to Home"})})]})]})}):e.jsx("div",{className:"noRecord_found",children:e.jsx("h6",{children:"No Questions Added Any Yet"})})})},ee=t=>({user:t.auth&&t.auth.user||{},questions:t.questions,userAnswer:t["user-answers"]}),se=M($,H(ee,{}))(X),te=({variantVal:t,disabled:a,handleClick:d,to:o,label:c})=>{const p=()=>
1{switch(t){default:case"primary":return"hover:bg-[#E3B576] bg-[#006766]";case"secondary":return"hover:bg-[#006766] bg-[#E3B576]";case"secondary-not-hovered":return"bg-[#E3B576]"}},j=!o||o===""?{}:{href:o};return e.jsx("div",{style:{opacity:a?".4":"",pointerEvents:a?"none":""},className:"flex justify-center md:justify-start cursor-pointer font-Montserrat",children:e.jsx("div",{onClick:d,className:` ${p()} px-[20px] py-[9px] 3xl:py-6 3xl:px-10 flex rounded-md 3xl:rounded-lg font-Montserrat `,children:e.jsx("a",{...j,className:"flex no-underline! items-center ",children:e.jsx("div",{className:"my-auto text-white uppercase tracking-[0.28px] font-[80px] 3xl:text-[30px] text-[14px]",children:c})})})})},ce=()=>e.jsxs(e.Fragment,{children:[e.jsx(Z,{heading:"Questionaire",bgImg:"/recommendateHero.png"}),e.jsx("div",{className:"questioneer-main",children:e.jsx(se,{})}),e.jsx(W,{})]});export{ce 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.