mario-education 2.0.140-staging → 2.0.142-staging

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/CreateSurveyAdmin-DAlojafJ.cjs +3 -0
  2. package/dist/CreateSurveyAdmin-n-Sng_5S.js +3239 -0
  3. package/dist/DesignatedStaff-BYnitMg-.cjs +1 -0
  4. package/dist/DesignatedStaff-C_ZIGrCB.js +432 -0
  5. package/dist/FrequencyAndSetup-BaO9uG_z.cjs +9 -0
  6. package/dist/FrequencyAndSetup-CD3mLTEm.js +1008 -0
  7. package/dist/FrequencyAndSetupV2-CtQP6Ayt.cjs +1 -0
  8. package/dist/FrequencyAndSetupV2-DVENqSJh.js +2003 -0
  9. package/dist/OpenFieldWellbeingQuestion-BGGcQzFO.js +145 -0
  10. package/dist/OpenFieldWellbeingQuestion-kRyQBkP-.cjs +1 -0
  11. package/dist/QuestionDetail-CESf9ZOG.js +718 -0
  12. package/dist/QuestionDetail-CYwTKh2p.cjs +1 -0
  13. package/dist/SummarizeQuestion-D8sD8_Qq.js +1097 -0
  14. package/dist/SummarizeQuestion-aPTLqTAy.cjs +1 -0
  15. package/dist/SurveyDashboardContainer-CUIOJoi9.cjs +10 -0
  16. package/dist/SurveyDashboardContainer-CW3maIo_.js +2318 -0
  17. package/dist/WellBeingDashboard-BIz823dm.js +2265 -0
  18. package/dist/WellBeingDashboard-DB5WpXPA.cjs +1 -0
  19. package/dist/containers/FrequencyAndSetupV2/components/ComprehensiveTabContent.d.ts +11 -0
  20. package/dist/containers/FrequencyAndSetupV2/components/DeleteQuestionModal.d.ts +8 -0
  21. package/dist/containers/FrequencyAndSetupV2/components/LaunchModal.d.ts +7 -0
  22. package/dist/containers/FrequencyAndSetupV2/components/ModeTabs.d.ts +7 -0
  23. package/dist/containers/FrequencyAndSetupV2/components/OneOffTabContent.d.ts +11 -0
  24. package/dist/containers/FrequencyAndSetupV2/components/QuestionRow.d.ts +12 -0
  25. package/dist/containers/FrequencyAndSetupV2/components/QuestionSectionCard.d.ts +15 -0
  26. package/dist/containers/FrequencyAndSetupV2/components/ReviewQuestionsV2.d.ts +11 -0
  27. package/dist/containers/FrequencyAndSetupV2/components/RoutineTabContent.d.ts +11 -0
  28. package/dist/containers/FrequencyAndSetupV2/components/SavedView.d.ts +8 -0
  29. package/dist/containers/FrequencyAndSetupV2/constants.d.ts +28 -0
  30. package/dist/containers/FrequencyAndSetupV2/hooks/useFrequencyAndSetupV2.d.ts +24 -0
  31. package/dist/containers/FrequencyAndSetupV2/index.d.ts +4 -0
  32. package/dist/containers/FrequencyAndSetupV2/types.d.ts +63 -0
  33. package/dist/containers/FrequencyAndSetupV2/views/FrequencyAndSetupV2.d.ts +3 -0
  34. package/dist/containers/Overview/api/index.d.ts +1 -0
  35. package/dist/containers/Overview/components/StaffWellBeing.d.ts +10 -0
  36. package/dist/containers/Overview/config/type.d.ts +2 -0
  37. package/dist/index-5D_qVz5G.js +2438 -0
  38. package/dist/index-BVyTLfxz.js +75 -0
  39. package/dist/index-BXZur0H1.cjs +1 -0
  40. package/dist/index-CdM_YkEV.cjs +1 -0
  41. package/dist/index-DZalvWz7.js +35 -0
  42. package/dist/index-xxh_RC7A.cjs +1 -0
  43. package/dist/index.js +1 -1
  44. package/dist/index.modern.js +1 -1
  45. package/dist/mario-education.css +1 -1
  46. package/dist/wellbeingService-08Ik-Wlp.js +22 -0
  47. package/dist/wellbeingService-Dfc5P6vF.cjs +1 -0
  48. package/package.json +2 -2
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@mui/material"),k=require("./constants-COyuhuqA.cjs"),Bs=require("./ArrowForward-D4TtLiX5.cjs"),t=require("./dashboard.module-CMRJ-dMz.cjs"),zs=require("./CustomHeaderComponent-cv1SEmBK.cjs"),u=require("react"),F=require("react-redux"),j=require("mario-core"),H=require("./surveyService-DHeZqbW5.cjs"),hs=require("react-router-dom"),gs=require("./ExpandLess-CoNRrIEg.cjs"),ds=require("./Search-CZp6DUOA.cjs"),xs=require("@mui/x-data-grid"),Y=require("./styles.module-CHKJJ8Zm.cjs"),me=require("./AddCircle-BZ4OwAPA.cjs"),be=require("./Send-CcZzWQnU.cjs"),ms=require("@mui/x-date-pickers"),fs=require("moment"),Hs=require("./Close-BqvQ2Wpz.cjs"),ye=require("./createSvgIcon-CRp0VXvr.cjs"),Vs=require("./ArrowBack-C4WIF8bZ.cjs"),Ys=require("./ExpandMore-CF3178RV.cjs"),ys=require("./TableCells-D-3RzIrO.cjs"),Z=require("./useFontStyles-B5YQSPG6.cjs"),Fs=require("./useDebounce-Bp3c1B3v.cjs"),bs=require("./Edit-Dm4rcAd5.cjs"),Ws=require("./AdapterMoment-B-q0UCj0.cjs"),Us=(n,l)=>({root:{width:"100%"},instructions:{marginTop:n.spacing(1),marginBottom:n.spacing(1)},completed:{color:"#5A7F05 !important"},label:{fontSize:l,fontWeight:400}}),Js=n=>l=>Us(l,n?.fontSize),Zs={root:{borderBottom:"none",borderLeft:"none","& .MuiDataGrid-columnHeader":{"& .MuiDataGrid-columnHeaderTitle":{fontWeight:700,fontSize:14,textTransform:"uppercase"},"& .MuiDataGrid-columnSeparator":{display:"none"},"& .MuiDataGrid-sortIcon":{fontSize:20}},"& .MuiDataGrid-withBorder:first-child":{borderRight:"none !important"}}},js=()=>Zs,Ks=({surveyId:n})=>{const l=F.useDispatch(),a=hs.useNavigate(),[i,h]=u.useState(!1),[c,x]=u.useState([]),[f,y]=u.useState(""),[$,w]=u.useState([]),[p,q]=u.useState(""),[m,T]=u.useState(!1),[v,_]=u.useState(0),L=()=>{i&&a("/admin/survey-dashboard/list-survey"),h(!i)},g=()=>{m&&a("/admin/survey-dashboard/list-survey"),T(!m)},N=(r,S)=>{const G=c.findIndex(V=>V.generalEducationTeacherId===r),M=[...c];G!==-1&&(M[G].isSelected=S,x([...M]))},d=r=>{var S=/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/;return!!r.match(S)},b=u.useCallback(()=>{const r=$;!f.trim()||!d(f)||(r.push(f.trim()),w([...r]),y(""))},[$,f]),A=r=>{y(r.target.value)},C=r=>{q(r.target.value)},o=r=>{const S=$,G=$.findIndex(M=>M===r);G!==-1&&(S.splice(G,1),w([...S]))},I=u.useCallback(async()=>{l(j.setLoading(!0));try{const r=await H.getAllEduTeacher();x(r.data)}catch(r){l(j.setAlert({type:"danger",message:r.message}))}l(j.setLoading(!1))},[]),B=u.useCallback(async()=>{l(j.setLoading(!0));try{const r=c.filter(S=>S.isSelected).map(S=>S.email);await H.shareSurvey({emails:$.concat(r),emailContent:p,surveyId:n,studentShareId:v,isAdmin:!0}),a("/admin/survey-dashboard/list-survey"),l(j.setAlert({type:"success",message:"Share survey successfully"}))}catch(r){l(j.setAlert({type:"danger",message:r.response?.data?.title||r.message}))}l(j.setLoading(!1))},[n,$,c,v,p]),P=async r=>{if(r){l(j.setLoading(!0));try{const S=new FormData;S.append("file",r,r.name);const G=await H.importCsv(S),M=$.concat(G.data);w(M)}catch(S){l(j.setAlert({type:"danger",message:S.response?.data?.title||S.message}))}finally{l(j.setLoading(!1))}}},z=async()=>{l(j.setLoading(!0));try{const G=await H.downloadTemplateFile();var r=new Blob([G.data.content],{type:"text/csv"});const M=window.URL.createObjectURL(r);var S=document.createElement("a");S.href=M,S.setAttribute("download",G.data.nameFile),S.click(),l(j.setAlert({type:"success",message:"Download successfully"}))}catch(G){l(j.setAlert({type:"danger",message:G.message}))}l(j.setLoading(!1))};return u.useEffect(()=>{i&&I()},[i]),{openModelShare:i,handleToggleModelShare:L,listEduTeacher:c,handleToggleSuggestedTeacher:N,handleChangeInputSender:A,textValueSender:f,handleEnterAddSender:b,senderList:$,handleChangeEmailContent:C,emailContent:p,handleShareSurvey:B,handleDeleteEmail:o,handleToggleModelConfirmShare:g,openModelConfirmShare:m,studentShareId:v,setStudentShareId:_,importEmailCsv:P,downloadTemplate:z}},Xs=({dataFormCreateSurvey:n,templateSurvey:l,setDataFormCreateSurvey:a,contentModelQuestion:i,setContentModelQuestion:h,setOpenModelSelectTemplate:c,handleCloseModelEdit:x,openModelSelectTemplate:f})=>{const y=(d,b)=>{const A=n.templateQuestions.find(I=>I.id===d.id)?.questionTemplates,C=n?.templateQuestions?.find(I=>I.id===d.id)?.questionTemplates;return!!(A?.find(I=>I.questionId===b.questionId)||C?.find(I=>I.questionId===b.questionId))},$=(d,b)=>(l.find(o=>o.id===d.id)?.questionTemplates?.filter(o=>o.type===b)||[]).length,w=(d,b)=>{const A=n.templateQuestions,C=A.findIndex(P=>P.id===d.id),I=A.find(P=>P.id===d.id)?.questionTemplates?.findIndex(P=>P.questionId===b.questionId);I===-1?(A[C].questionTemplates.push(b),a({...n,templateQuestions:[...A]})):(I&&I>0||I===0)&&(A[C].questionTemplates.splice(I,1),a({...n,templateQuestions:[...A]}));const B=A.flatMap(P=>P.questionTemplates.filter(z=>z.type==="Summarize"));a({...n,summarizeQuestions:B})},p=(d,b)=>!n.templateQuestions.find(C=>C.id===d?.id)&&b===0,q=u.useCallback(d=>{const b=i.selectQuestion||[],A=b.findIndex(C=>C.questionId===d.questionId);h(A===-1?{...i,selectQuestion:b.concat([d])}:{...i,selectQuestion:b.filter(C=>C.questionId!==d.questionId)})},[i]),m=d=>{const A=l.find(o=>o.id===d.id)?.questionTemplates?.map(o=>o.type)||[];return Array.from(new Set(A))},T=d=>!!n?.templateQuestions?.find(A=>A.id===d.id),v=u.useCallback(()=>{a({...n,templateQuestions:n.templateQuestions}),c(!1)},[n.templateQuestions]),_=u.useCallback(d=>{let b=n.templateQuestions;const A=n?.templateQuestions?.findIndex(o=>o.id===d.id);A===-1&&d.questionTemplates.length>0?b=b.concat([d]):d.questionTemplates.length===0&&A>=0?b=b.filter(o=>o.id!==d.id):A>=0&&d.questionTemplates.length>0&&(b=b.filter(o=>o.id!==d.id),b=b.concat([d]));const C=b.flatMap(o=>o.questionTemplates.filter(I=>I.type==="Summarize"));a({...n,templateQuestions:[...b],summarizeQuestions:C}),x()},[n]),L=u.useCallback((d,b)=>{h({...i,selectQuestion:b?[]:[...d]});const A=i.template;A&&_({...A,questionTemplates:b?[]:[...d]})},[i]),g=u.useCallback(d=>{h({open:!0,template:d,selectQuestion:n.templateQuestions.find(b=>b.id===d.id)?.questionTemplates||[]})},[n]);return{handleCheckSelectQuestion:y,handleCheckCountQuestionByType:$,handleSelectQuestionCollapse:w,handleCheckInsertQuestion:p,handleSelectQuestion:q,handleCheckTypeQuestion:m,handleCheckSelectTemplate:T,handleInsertQuestion:v,handleSelectTemplate:_,handleChangeModelQuestion:g,handleToggleModel:()=>{a(f?{...n,templateQuestions:[]}:{...n,templateQuestions:n.templateQuestions}),c(!f)},handleInsertAllQuestion:L}},et=({changeFilters:n,inputSearch:l,students:a,dataFormCreateSurvey:i,setDataFormCreateSurvey:h,setValueinputSearch:c,inputSearchTeacher:x,setValueInputSearchTeacher:f})=>{const y=F.useSelector(T=>T.common?.menuBar),$=T=>{n({gradeLevels:T})},w=T=>((window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)-(y?280:0))/100*T-50,p=T=>{const v=T.target.value;c(v),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{n({search:v,currentPage:1})},800)},q=T=>{const v=T.target.value;f(v),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{n({searchTeacher:v,currentPage:1})},800)},m=u.useCallback(T=>{const v=a?.items.map(N=>N.id)||[],_=i.studentIds?.filter(N=>!v.includes(N)),L=T.concat(_),g=L.filter((N,d)=>L.indexOf(N)==d);h({...i,studentIds:g})},[a,i]);return{resizeWidthTable:w,handleChangeGrade:$,handleChangeInputSearch:p,handleSelectStudent:m,handleChangeInputSearchTeacher:q}},st=({dataFormCreateSurvey:n,setDataFormCreateSurvey:l})=>({handleToggleButtonHeader:u.useCallback(()=>n?.studentIds?.length>=0&&n.activeStep===0||n.activeStep===2&&n.title.trim()?!1:!(n.activeStep===3||n.activeStep===1),[n]),handleChangeFavorite:()=>{l({...n,isFavorite:!n.isFavorite})},onChangeValueForm:y=>{l({...n,[y.target.name]:y.target.value})},handleChangeDate:y=>{l({...n,deadline:y?.valueOf()})},handleNextStep:y=>{l({...n,activeStep:y||y===0?y:n.activeStep+1})},onRecordChangeTitle:y=>{l({...n,title:y})}}),tt=({setDataFormCreateSurvey:n,handleresetFilterStudent:l,handleresetFilterStaff:a,students:i,favoriteId:h})=>{const c=F.useDispatch(),[x,f]=u.useState(),[y,$]=u.useState(!1),[w,p]=u.useState({isAdmin:!0,currentPage:1,pageSize:10,isFavorite:!0,isMyFavorite:!0}),q=F.useSelector(N=>N.common.language),m=N=>p({...w,...N}),T=N=>{m({sortOrder:w.sortOrder==="DESC"?"ASC":"DESC",sortBy:N})},v=N=>{m({currentPage:N+1})},_=N=>{m({pageSize:parseInt(N.target.value),currentPage:1})},L=async N=>{c(j.setLoading(!0));try{const d=await H.getSurveyDetail(N,q),b=i?.items?.map(o=>o.studentId)||[],C=d.data.studentIds.filter(o=>b.includes(o));$(!0),d.data&&(n({...d.data,activeStep:0,staffIds:d.data?.sharedStaff?d.data.sharedStaff.split(";"):[],studentIds:C,isDraft:!1,additionalQuestions:d.data.additionalQuestions?.map(o=>({...o,id:o.questionId?.toString()})),deadline:d.data?.isDraft?d.data?.deadline:null,id:h||0}),l?.(),a?.())}catch(d){c(j.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}c(j.setLoading(!1))},g=u.useCallback(async()=>{c(j.setLoading(!0));try{const N=await H.getAllSurvey({...w,excludeSurveyId:h});f(N.data)}catch(N){c(j.setAlert({type:"danger",message:N.response?.data?.title||N.message}))}c(j.setLoading(!1))},[w,h]);return u.useEffect(()=>{g()},[w,h]),u.useEffect(()=>{h&&h!==0&&i?.items?.length&&!y&&L(h)},[h,i,y]),{filterFavorite:w,favoriteItem:x,handleChangeRowsPerPageFavorite:_,handleChangePageFavorite:v,handleDuplicateSurvey:L,handleSortTableFavorite:T}},nt=({setAdditionalQuestionForm:n,dataFormCreateSurvey:l,setDataFormCreateSurvey:a,additionalQuestionForm:i,openModelAdditional:h,setOpenModelAdditional:c})=>{const[x,f]=u.useState([]),[y,$]=u.useState([]),[w,p]=u.useState([]),q=F.useDispatch(),m=r=>{const S={...k.initialAdditionalQuestion,type:r.type,questionText:r.questionText,id:Date.now().toString(),answers:[]};switch(r.type){case k.QuestionType.Rating:S.fromLabel=r.fromLabel,S.toLabel=r.toLabel;break;case k.QuestionType.SingleChoice:S.answers=r.answers;break}return S},T=u.useCallback(()=>{const r=l.additionalQuestions;r.push(m(i)),a({...l,additionalQuestions:[...r]}),b()},[i]),v=r=>{n({...i,[r.target.name]:r.target.value})},_=r=>{var S=w.find(M=>M.text==r&&i.answers&&JSON.stringify(i.answers)===JSON.stringify(M.answerText)),G={questionText:r};if(S!=null){let M={fromLabel:S!=null?S.fromText:"",toLabel:S!=null?S.toText:"",answers:S.answerText.map(V=>({text:V}))};Object.assign(G,M)}n({...i,...G})},L=r=>{n({...i,type:r})},g=r=>{const S=l.additionalQuestions,G=S.findIndex(M=>M.id===r);G!==-1&&S.splice(G,1),a({...l,additionalQuestions:[...S]}),b()},N=r=>{const G=l.additionalQuestions.find(M=>M.id===r);n({...G}),b()},d=r=>{const S=l.additionalQuestions,G=S.findIndex(M=>M.id==r.id);S[G]=m(r),a({...l,additionalQuestions:[...S]}),b()},b=()=>{h&&n({...k.initialAdditionalQuestion,answers:[]}),c(!h)},A=u.useCallback(()=>{const r=i.answers?.concat([{text:i?.textAnswer?.trim()}]);n({...i,answers:r,textAnswer:""})},[i]),C=u.useCallback((r,S)=>{const G=S.answers.filter(M=>M!==r);n({...S,answers:G})},[i]),o=r=>r.type&&r?.questionText?.trim()?r.type===k.QuestionType.SingleChoice&&r.answers.length===0:!0,I=r=>{switch(r.target.value){case k.optionSingleChoice.TrueFalse.toString():n({...i,answers:k.initialAnswerTrueFalse});break;case k.optionSingleChoice.YesNo.toString():n({...i,answers:k.initialAnswerYesNo});break;case k.optionSingleChoice.Other.toString():n({...i,answers:[]})}},B=u.useMemo(()=>{switch(JSON.stringify(i.answers)){case JSON.stringify(k.initialAnswerTrueFalse):return k.optionSingleChoice.TrueFalse;case JSON.stringify(k.initialAnswerYesNo):return k.optionSingleChoice.YesNo;default:return k.optionSingleChoice.Other}},[i]),P=(r,S)=>{r.includes("fromLabel")?n({...i,fromLabel:S}):n({...i,toLabel:S})},z=async()=>{q(j.setLoading(!0));try{const r=await H.getRatingLabelSurvey(!0);f(r.data.fromText),$(r.data.toText),p(r.data.questionAdditionalSurvey)}catch(r){q(j.setAlert({type:"danger",message:r.message}))}q(j.setLoading(!1))};return u.useEffect(()=>{z()},[]),{handleAddAdditionalQuestion:T,handleChangeAdditionalQuestion:v,handleRemoveAdditionalQuestion:g,handleEditAdditionalQuestion:d,handleFindAdditionalQuestion:N,handleToggleModelAdditional:b,handleChangeAdditionalType:L,handleCheckFormConfirm:o,handleAddAnswerQuestion:A,handleRemoveAnswer:C,handleSelectOptionSingleChoice:I,handleCheckSelectOptionSingleChoice:B,handleRecordChangeQuestionText:_,formTextList:x,toTextList:y,handleChangeAdditionalRatingQuestion:P,questionAdditionalType:w}},lt=({dataFormCreateSurvey:n,setDataFormCreateSurvey:l})=>{const a=F.useDispatch(),[i,h]=u.useState(k.initialFilters),[c,x]=u.useState(),f=u.useRef(null),[y,$]=u.useState(""),w=v=>h({...i,...v}),p=()=>{f.current=null,$(""),h({...i,search:""})},q=u.useCallback(async()=>{a(j.setLoading(!0));try{const v=await H.getAllStaff({...i,isAdmin:!0});x(v.data)}catch(v){a(j.setAlert({type:"danger",message:v.message}))}a(j.setLoading(!1))},[i]),m=v=>{const _=v.target.value;$(_),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{w({search:_,currentPage:1})},800)},T=u.useCallback(v=>{const _=c?.items.map(d=>d.id)||[],L=n.staffIds?.filter(d=>!_.includes(d)),g=v.concat(L),N=g.filter((d,b)=>g.indexOf(d)==b);l({...n,staffIds:N,activeStep:1})},[c,n]);return u.useEffect(()=>{q()},[i]),{handleChangeInputStaff:m,handleSelectStaff:T,staffs:c,inputStaff:y,inputSearchStaff:f,handleresetFilterStaff:p}},at=()=>{const n=F.useDispatch(),l=hs.useNavigate(),a=location.search,i=new URLSearchParams(a),h=i.get("createContinue"),c=i.get("favoriteId")||"0",x=JSON.parse(localStorage.getItem("dataFormSurvey")||"null"),[f,y]=u.useState(0),[$,w]=u.useState(),[p,q]=u.useState(0),[m,T]=u.useState(x&&h?x:gs.cloneDeep(k.initialValues)),v=F.useSelector(D=>D.common.language),[_,L]=u.useState(k.initialAdditionalQuestion),[g,N]=u.useState(!1),[d,b]=u.useState(k.initialFilters),[A,C]=u.useState(""),[o,I]=u.useState(""),[B,P]=u.useState([]),[z,r]=u.useState(!1),[S,G]=u.useState(k.initialModelQuestion),[M,V]=u.useState(!1),te=F.useSelector(D=>D?.common?.user?.roles),W=u.useRef(null),K=u.useRef(null),X=D=>b({...d,...D}),ne=()=>{W.current=null,C(""),I(""),b({...d,search:""})},U=()=>{G({open:!1})},ee=()=>{V(!M)},le=()=>{l("/admin/preview-survey")},{openModelShare:ae,handleToggleModelShare:ie,listEduTeacher:oe,handleToggleSuggestedTeacher:re,handleChangeInputSender:ce,textValueSender:de,handleEnterAddSender:O,senderList:ue,handleChangeEmailContent:E,emailContent:R,handleShareSurvey:he,handleDeleteEmail:je,handleToggleModelConfirmShare:ge,openModelConfirmShare:Se,studentShareId:Te,setStudentShareId:Ce,importEmailCsv:ve,downloadTemplate:Ne}=Ks({surveyId:f}),{handleCheckSelectQuestion:$e,handleCheckCountQuestionByType:_e,handleSelectQuestionCollapse:Ie,handleCheckInsertQuestion:we,handleSelectQuestion:Ae,handleCheckTypeQuestion:ke,handleCheckSelectTemplate:qe,handleInsertQuestion:Ge,handleSelectTemplate:Le,handleChangeModelQuestion:Me,handleToggleModel:De,handleInsertAllQuestion:Ee}=Xs({dataFormCreateSurvey:m,templateSurvey:B,setDataFormCreateSurvey:T,contentModelQuestion:S,setContentModelQuestion:G,setOpenModelSelectTemplate:r,handleCloseModelEdit:U,openModelSelectTemplate:z}),{resizeWidthTable:Pe,handleChangeGrade:Re,handleChangeInputSearch:Qe,handleSelectStudent:Oe,handleChangeInputSearchTeacher:Be}=et({changeFilters:X,inputSearch:W,students:$,dataFormCreateSurvey:m,setDataFormCreateSurvey:T,setValueinputSearch:C,inputSearchTeacher:K,setValueInputSearchTeacher:I}),{staffs:ze,handleSelectStaff:He,inputStaff:Ve,inputSearchStaff:Ye,handleChangeInputStaff:Fe,handleresetFilterStaff:We}=lt({dataFormCreateSurvey:m,setDataFormCreateSurvey:T}),{handleToggleButtonHeader:Ue,handleChangeFavorite:Je,onChangeValueForm:Ze,handleChangeDate:Ke,handleNextStep:Xe,onRecordChangeTitle:es}=st({dataFormCreateSurvey:m,setDataFormCreateSurvey:T}),{handleAddAdditionalQuestion:ss,handleChangeAdditionalQuestion:ts,handleRecordChangeQuestionText:ns,handleRemoveAdditionalQuestion:ls,handleEditAdditionalQuestion:as,handleFindAdditionalQuestion:is,handleToggleModelAdditional:os,handleChangeAdditionalType:rs,handleCheckFormConfirm:cs,handleAddAnswerQuestion:xe,handleRemoveAnswer:Ts,handleSelectOptionSingleChoice:Cs,handleCheckSelectOptionSingleChoice:vs,formTextList:Ns,toTextList:$s,handleChangeAdditionalRatingQuestion:_s,questionAdditionalType:Is}=nt({dataFormCreateSurvey:m,setDataFormCreateSurvey:T,additionalQuestionForm:_,setAdditionalQuestionForm:L,openModelAdditional:g,setOpenModelAdditional:N}),{favoriteItem:ws,handleDuplicateSurvey:As,filterFavorite:ks,handleSortTableFavorite:qs,handleChangeRowsPerPageFavorite:Gs,handleChangePageFavorite:Ls}=tt({setDataFormCreateSurvey:T,handleresetFilterStudent:ne,handleresetFilterStaff:We,students:$,favoriteId:c?Number(c):void 0}),Ms=u.useCallback(async()=>{n(j.setLoading(!0));try{const D=await H.getStudentList({...d,isAdmin:!0});w(D.data)}catch(D){n(j.setAlert({type:"danger",message:D.message}))}n(j.setLoading(!1))},[d]),Ds=u.useMemo(()=>{const D=m.studentIds;return $?.items?.filter((Q=>D.includes(Q.id))).map(Q=>({id:Q?.id,fullName:`${Q?.fullName}(${Q?.email})`,email:Q?.email}))||[]},[JSON.stringify(m),$]),Es=async D=>{n(j.setLoading(!0));try{await H.deleteSurvey(D)}catch(Q){n(j.setAlert({type:"danger",message:Q.response?.data?.title||Q.message}))}n(j.setLoading(!1))},Ps=u.useCallback(async D=>{n(j.setLoading(!0));try{m.id&&await Es(m.id);const Q=await H.createSurvey({...m,templateQuestions:m.templateQuestions.filter(se=>se.questionTemplates.length>0),isAdmin:!0,isDraft:D||!1,role:te.toString()});localStorage.removeItem("dataFormSurvey"),D?(l("/admin/survey-dashboard/list-survey"),n(j.setAlert({type:"success",message:"Draft survey success"}))):(y(Q.data.id),ge(),n(j.setAlert({type:"success",message:"Publish survey success"})))}catch(Q){n(j.setAlert({type:"danger",message:Q.response?.data?.title||"Something went wrong"}))}n(j.setLoading(!1))},[m]),Rs=u.useCallback(async()=>{n(j.setLoading(!0));try{const D=await H.getTemplateSurvey(v);P(D.data);const Q=m.templateQuestions.map(se=>{const fe=D.data.find(ps=>ps.id===se.id);return fe&&{...fe,questionTemplates:fe.questionTemplates.filter(Qs=>se.questionTemplates.some(Os=>Os.questionId===Qs.questionId))}});T(se=>({...se,templateQuestions:Q})),localStorage.setItem("dataFormSurvey",JSON.stringify({...m,templateQuestions:Q}))}catch(D){n(j.setAlert({type:"danger",message:D.message}))}n(j.setLoading(!1))},[v]);return u.useEffect(()=>{localStorage.setItem("dataFormSurvey",JSON.stringify({...m,templateQuestions:m.templateQuestions.filter(D=>D.questionTemplates.length>0)}))},[m]),u.useEffect(()=>{Ms()},[d]),u.useEffect(()=>{Rs(),document.title="Create Survey"},[v]),{filters:d,students:$,inputSearch:W,valueInputSearch:A,templateSurvey:B,openCollapseId:p,contentModelQuestion:S,dataFormCreateSurvey:m,openModelSelectTemplate:z,changeFilters:X,handleSelectStudent:Oe,setDataFormCreateSurvey:T,onChangeValueForm:Ze,onRecordChangeTitle:es,handleChangeDate:Ke,handleChangeInputSearch:Qe,handleChangeFavorite:Je,handleChangeGrade:Re,handleSelectTemplate:Le,setOpenCollapseId:q,setOpenModelSelectTemplate:r,handleInsertQuestion:Ge,handleToggleButtonHeader:Ue,handleCreateSurvey:Ps,handleCloseModelEdit:U,setContentModelQuestion:G,handleSelectQuestion:Ae,handleCheckSelectQuestion:$e,handleChangeModelQuestion:Me,handleSelectQuestionCollapse:Ie,handleCheckTypeQuestion:ke,handleCheckCountQuestionByType:_e,handleChangePagePreview:le,handleNextStep:Xe,handleCheckInsertQuestion:we,handleCheckSelectTemplate:qe,handleToggleModel:De,resizeWidthTable:Pe,handleToggleModelConfirm:ee,openModelConfirmPublish:M,openModelShare:ae,handleToggleModelShare:ie,listEduTeacher:oe,handleToggleSuggestedTeacher:re,handleChangeInputSender:ce,textValueSender:de,handleEnterAddSender:O,senderList:ue,handleChangeEmailContent:E,emailContent:R,handleShareSurvey:he,handleDeleteEmail:je,handleToggleModelConfirmShare:ge,openModelConfirmShare:Se,handleInsertAllQuestion:Ee,favoriteItem:ws,handleDuplicateSurvey:As,handleAddAdditionalQuestion:ss,handleChangeAdditionalQuestion:ts,handleRecordChangeQuestionText:ns,handleRemoveAdditionalQuestion:ls,handleEditAdditionalQuestion:as,handleFindAdditionalQuestion:is,handleToggleModelAdditional:os,openModelAdditional:g,additionalQuestionForm:_,handleChangeAdditionalType:rs,handleCheckFormConfirm:cs,handleAddAnswerQuestion:xe,handleRemoveAnswer:Ts,filterFavorite:ks,handleSortTableFavorite:qs,handleChangeRowsPerPageFavorite:Gs,handleChangePageFavorite:Ls,handleSelectOptionSingleChoice:Cs,handleCheckSelectOptionSingleChoice:vs,listChooseStudents:Ds,studentShareId:Te,setStudentShareId:Ce,staffs:ze,handleSelectStaff:He,inputStaff:Ve,inputSearchStaff:Ye,handleChangeInputStaff:Fe,importEmailCsv:ve,downloadTemplate:Ne,formTextList:Ns,toTextList:$s,handleChangeAdditionalRatingQuestion:_s,questionAdditionalType:Is,handleGoToSurveyDashboard:()=>{l("/admin/survey-dashboard/overview")},inputSearchTeacher:K,handleChangeInputSearchTeacher:Be,valueInputSearchTeacher:o}},it=({filters:n,handleChangeGrade:l,students:a})=>{const[i,h]=u.useState(n.gradeLevels),[c,x]=u.useState(!1),f=u.useRef(!1),y=a?.grades??[];return{selected:i,open:c,gradeList:y,handleOpen:()=>{f.current=!1,x(!0)},handleClose:()=>{x(!1),f.current||h([])},handleToggle:m=>{h(T=>T.includes(m)?T.filter(v=>v!==m):[...T,m])},handleApplyFilterGrade:()=>{f.current=!0,x(!1),l(i)}}},pe={menuPaper:{maxHeight:300,width:180,display:"flex",flexDirection:"column",position:"relative"},menuList:{flex:1,overflowY:"auto"},applyButtonContainer:{position:"sticky",bottom:0,background:"#fff",borderTop:"1px solid #ddd",textAlign:"center",padding:"8px",display:"flex",justifyContent:"flex-end",alignItems:"center",zIndex:1},applyButton:{display:"flex",justifyContent:"center",alignItems:"center",padding:"8px 12px",borderRadius:8,background:"#316CD9",color:"#fff",cursor:"pointer"},selectOutlined:{height:48,display:"flex",alignItems:"center","& .MuiSelect-select:focus":{backgroundColor:"transparent"}}},ot=({filters:n,handleChangeGrade:l,handleChangeInputSearch:a,inputSearch:i,dataFormCreateSurvey:h,students:c,resizeWidthTable:x,handleSelectStudent:f,valueInputSearch:y,classFontSize:$,inputSearchTeacher:w,handleChangeInputSearchTeacher:p,valueInputSearchTeacher:q})=>{const{t:m}=j.useTranslation(),T=js(),v=[{headerName:m("student_name"),field:"fullName",width:x(30),disableColumnMenu:!0,renderCell:C=>e.jsxs("div",{className:`${t.styles.row_name}`,children:[e.jsx("img",{src:C.row.avatar?j.getFileUrl(C.row.avatar):k.DEFAULT_USER_AVATAR,alt:"",className:`${t.styles.avatar_user}`}),C.row.fullName]})},{headerName:m("grade"),field:"gradeLevel",width:x(20),disableColumnMenu:!0,renderCell:C=>e.jsx("div",{className:`${t.styles["data-grid-content"]}`,children:C.row.gradeLevel})},{headerName:m("email"),field:"email",width:x(35),disableColumnMenu:!0,renderCell:C=>e.jsx("div",{className:`${t.styles["data-grid-content"]}`,children:C.row.email})}],{selected:_,open:L,gradeList:g,handleOpen:N,handleClose:d,handleToggle:b,handleApplyFilterGrade:A}=it({filters:n,handleChangeGrade:l,students:c});return e.jsxs(s.Grid,{className:`${t.styles[$]}`,children:[e.jsxs(s.Grid,{className:`${t.styles["block-filter"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-filter"]}`,children:m("select_student")}),e.jsx(s.Grid,{className:`${t.styles["block-filter-right"]}`,style:{width:"auto"},children:e.jsxs(s.Grid,{className:`${t.styles["box-filter-right"]}`,children:[e.jsx(s.Grid,{className:`${t.styles["search-input-icon"]}`,children:e.jsx(ds.SearchIcon,{})}),e.jsx(s.InputBase,{placeholder:m("search_teacher"),inputProps:{"aria-label":"search"},className:`${t.styles.inputInput}`,onChange:C=>p(C),ref:w,value:q})]})}),e.jsxs(s.Grid,{className:`${t.styles["block-filter-right"]}`,children:[e.jsx(s.Grid,{className:`${t.styles["filter-item"]}`,children:e.jsxs(s.FormControl,{variant:"outlined",fullWidth:!0,children:[e.jsx(s.InputLabel,{style:{background:"#fff"},htmlFor:"filter_grade_dashboard_label",children:m("grade")}),e.jsxs(s.Select,{open:L,onOpen:N,onClose:d,labelId:"filter_grade_dashboard_label",id:"filter_grade_dashboard",multiple:!0,value:_,MenuProps:{PaperProps:{sx:pe.menuPaper},anchorOrigin:{vertical:"bottom",horizontal:"center"}},renderValue:C=>C.join(", "),sx:pe.selectOutlined,style:{minWidth:"180px"},children:[e.jsx("div",{style:pe.menuList,children:g.map(C=>e.jsxs(s.MenuItem,{value:C,onClick:()=>b(C),children:[e.jsx(s.Checkbox,{checked:_.includes(C),color:"primary"}),e.jsx(s.ListItemText,{primary:C})]},C))}),e.jsx("div",{style:pe.applyButtonContainer,children:e.jsx("button",{style:pe.applyButton,type:"button",onClick:()=>A(),children:"Apply"})})]})]})}),e.jsxs(s.Grid,{className:`${t.styles["box-filter-right"]}`,children:[e.jsx(s.Grid,{className:`${t.styles["search-input-icon"]}`,children:e.jsx(ds.SearchIcon,{})}),e.jsx(s.InputBase,{placeholder:m("search_student"),inputProps:{"aria-label":"search"},className:`${t.styles.inputInput}`,onChange:C=>a(C),ref:i,value:y})]})]})]}),e.jsx("div",{className:`${t.styles["table-desktop"]}`,style:{height:"600px",width:"100%"},children:c&&c?.items?.length>0?e.jsx(xs.DataGrid,{rows:c?c?.items:[],columns:v,initialState:{pagination:{paginationModel:{pageSize:10,page:0}}},pageSizeOptions:[10],checkboxSelection:!0,disableRowSelectionOnClick:!0,sx:{...T.root,borderLeft:"1px solid #e0e0e0 !important"},showColumnVerticalBorder:!0,showCellVerticalBorder:!0,rowHeight:80,rowSelectionModel:h.studentIds,hideFooterSelectedRowCount:!0,onRowSelectionModelChange:C=>{f(C)}}):e.jsx(s.Box,{p:2,children:e.jsx(s.Typography,{variant:"h5",className:t.styles["no-data"],children:m("no_data")})})})]})},rt=({valueText:n,onChange:l,name:a,label:i,isAddIcon:h,handleAddItem:c,placeholder:x,onBlur:f,customId:y,isSending:$,handleSending:w,canSubmit:p,disabled:q,onChangeEvent:m})=>e.jsx("div",{className:Y.styles["talk-conduct"],children:e.jsx("div",{className:Y.styles["box-radio"],children:e.jsx("div",{style:{width:"100%"},children:e.jsx(s.Box,{children:e.jsx(s.TextField,{placeholder:x,multiline:!0,onBlur:f,fullWidth:!0,disabled:q,value:n,label:i||a,name:a,variant:"outlined",onChange:T=>{l?.(T.target.value),m?.(T)},id:y??`outlined-${a}-basic`,InputProps:{endAdornment:e.jsx(s.InputAdornment,{position:"end",children:$&&e.jsx("div",{style:{marginLeft:"26px"},children:e.jsx(be.SendIcon,{className:Y.styles["icon-btn"],onClick:()=>{n.trim()&&w&&!q&&w()},color:n.trim()&&p?"primary":"disabled"})})}),startAdornment:e.jsx(s.InputAdornment,{position:"start",children:h&&e.jsx(me.AddCircleIcon,{className:Y.styles["icon-btn"],onClick:()=>{c&&n?.trim()!==""&&!q&&c()},color:n?.trim()?"primary":"disabled"})})}})})})})}),us=ye.createSvgIcon(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddCircleOutlined"),ct=ye.createSvgIcon(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11H7v-2h10z"}),"RemoveCircle"),dt=({open:n,handleClose:l,template:a,selectQuestion:i,handleSelectTemplate:h,handleSelectQuestion:c,handleCheckInsertQuestion:x,handleInsertAllQuestion:f})=>{const{t:y}=j.useTranslation(),$=a?.questionTemplates?.length===i?.length;return e.jsxs(s.Dialog,{open:n,onClose:()=>l(),"aria-labelledby":"simple-dialog-question",disableEnforceFocus:!0,disableRestoreFocus:!0,sx:{zIndex:1401},children:[e.jsx(s.DialogTitle,{id:"simple-dialog-question",children:e.jsxs(s.Grid,{className:`${t.styles["box-header-select"]}`,children:[e.jsx(Vs.ArrowBackIcon,{className:`${t.styles["header-select-icon"]}`,onClick:()=>l()}),e.jsxs(s.Grid,{children:[e.jsx(s.Typography,{className:`${t.styles["header-select-name"]}`,children:a?.name}),e.jsx(s.Typography,{className:`${t.styles["header-select-detail"]}`,children:`${y("slider")} • ${a?.questionTemplates?.length} ${y("questions")} • ${a?.name}`})]})]})}),e.jsxs(s.DialogContent,{id:"simple-dialog-question",className:`${t.styles["dialog-select-template"]}`,children:[e.jsx(s.Grid,{className:`${t.styles["list-question-select"]}`,children:a?.questionTemplates?.map(w=>e.jsxs(s.Grid,{className:`${t.styles["box-collapse-content-item"]}`,children:[e.jsx(s.Checkbox,{checked:i?.map(p=>p.questionId).includes(w.questionId),color:"primary",inputProps:{"aria-label":"secondary checkbox"},onChange:()=>c(w)}),e.jsx("div",{className:`${t.styles.innerHtml}`,dangerouslySetInnerHTML:{__html:w.questionText.replace(/<br\s*\/?>/gi,`
2
+ `)}})]},w.questionId))}),e.jsx(s.Grid,{className:`${t.styles["box-function"]}`,children:e.jsxs(s.Grid,{className:`${t.styles["box-function-flex"]}`,children:[e.jsx("button",{className:`${t.styles.cancel_btn}`,onClick:()=>l(),children:y("cancel")}),e.jsxs("button",{hidden:$,className:`${t.styles.confirm_btn} ${t.styles.mid_btn}`,onClick:()=>f(a?.questionTemplates),children:[e.jsx(s.Typography,{className:`${t.styles.confirm_btn_title}`,children:`${y("insert_all_question")} [${a?.questionTemplates?.length}]`}),e.jsx(us,{className:`${t.styles.confirm_btn_icon}`})]}),e.jsxs("button",{hidden:!$,className:`${t.styles.remove_btn} ${t.styles.mid_btn}`,onClick:()=>f(a?.questionTemplates,!0),children:[e.jsx(s.Typography,{className:`${t.styles.remove_btn_title}`,children:`${y("remove_all_question")} [${a?.questionTemplates?.length}]`}),e.jsx(ct,{className:`${t.styles.remove_btn_icon}`})]}),e.jsxs("button",{className:`${t.styles.confirm_btn}`,disabled:x(a,i?.length),onClick:()=>h({...a,questionTemplates:i}),children:[e.jsx(s.Typography,{className:`${t.styles.confirm_btn_title}`,children:`${y("insert_question")} [${i?.length}]`}),e.jsx(us,{className:`${t.styles.confirm_btn_icon}`})]})]})})]})]},a?.id)},ut=({open:n,handleClose:l,listTemplate:a,handleInsertQuestion:i,handleSelectTemplate:h,contentModelQuestion:c,handleCloseModelEdit:x,handleChangeModelQuestion:f,handleSelectQuestion:y,handleCheckCountQuestionByType:$,handleCheckTypeQuestion:w,dataFormCreateSurvey:p,handleCheckInsertQuestion:q,handleCheckSelectTemplate:m,handleInsertAllQuestion:T})=>{const{t:v}=j.useTranslation();return e.jsxs(s.Dialog,{onClose:()=>l(),"aria-labelledby":"simple-dialog-title",open:n,disableEnforceFocus:!0,disableRestoreFocus:!0,sx:{zIndex:1401},children:[e.jsx(s.DialogTitle,{id:"simple-dialog-title",children:e.jsxs(s.Grid,{className:`${t.styles["title-box-model"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-btn"]}`,children:v("survey_templates")}),e.jsx(Hs.CloseIcon,{className:`${t.styles["icon-btn"]}`,onClick:()=>l()})]})}),e.jsxs(s.DialogContent,{className:`${t.styles["dialog-select-template"]}`,children:[e.jsxs(s.Grid,{children:[a.map(_=>e.jsxs(s.Grid,{className:`${t.styles["box-content-select"]}`,children:[e.jsx(s.Checkbox,{checked:m(_),color:"primary",inputProps:{"aria-label":"secondary checkbox"},className:`${t.styles["check-box-btn"]}`,onChange:()=>f(_)}),e.jsxs(s.Grid,{children:[e.jsx(s.Typography,{className:`${t.styles["title-content-select"]}`,children:_.name}),w(_).map(L=>e.jsx(s.Typography,{className:`${t.styles["description-content-select"]}`,children:`${L} • ${$(_,L)} ${v("questions")} • ${_.name}`},L))]})]},_.id)),e.jsx(dt,{open:c.open,template:c.template,handleClose:x,selectQuestion:c.selectQuestion,handleSelectTemplate:h,handleSelectQuestion:y,handleCheckInsertQuestion:q,handleInsertAllQuestion:T})]}),e.jsx(s.Grid,{className:`${t.styles["box-function"]}`,children:e.jsxs(s.Grid,{className:`${t.styles["box-function-flex"]}`,children:[e.jsx("button",{className:`${t.styles.cancel_btn}`,onClick:()=>l(),children:v("cancel")}),e.jsxs("button",{className:`${t.styles.confirm_btn}`,onClick:()=>i(),children:[e.jsx(s.Typography,{className:`${t.styles.confirm_btn_title}`,children:`${v("insert_template")} [${p?.templateQuestions?.length}]`}),e.jsx(us,{className:`${t.styles.confirm_btn_icon}`})]})]})})]})]})},ht=({favoriteItem:n,filterFavorite:l,onDuplicateSurvey:a,onSortTable:i,handleChangeRowsPerPageFavorite:h,handleChangePageFavorite:c})=>{const{t:x}=j.useTranslation();return e.jsxs(s.Grid,{className:`${t.styles["list-favorite"]}`,children:[e.jsx(s.Typography,{className:`${t.styles.title}`,children:x("favorite_survey")}),n&&n?.items?.length>0?e.jsx(s.Grid,{className:`${t.styles["box-favorite"]}`,children:e.jsx(s.TableContainer,{children:e.jsxs(s.Table,{"aria-label":"simple table",className:`${t.styles["table-border"]}`,children:[e.jsx(s.TableHead,{children:e.jsx(ys.TableCells,{listTableCell:ys.tableFavoriteSurvey,filters:l,handleSort:i})}),e.jsx(s.TableBody,{children:n?.items?.map(f=>e.jsxs(s.TableRow,{className:`${t.styles["table-row"]}`,children:[e.jsx(s.TableCell,{align:"left",className:`${t.styles.row_name}`,children:f?.title}),e.jsx(s.TableCell,{align:"center",component:"th",scope:"row",height:80,className:`${t.styles["table-class-type"]}`,children:e.jsx(s.Tooltip,{title:"Duplicate survey",placement:"top",children:e.jsx(s.Button,{onClick:()=>a(f.id),children:e.jsx("img",{src:"./images/duplicate.svg"})})})})]},f.id))})]})})}):e.jsx("div",{children:x("no_data")}),!!n&&n?.items?.length>0&&e.jsx(s.TablePagination,{rowsPerPageOptions:[5,10,25],component:"div",count:n.totalItems,rowsPerPage:n.pageSize,page:n.currentPage-1,onPageChange:(f,y)=>c(y),onRowsPerPageChange:f=>h(f)})]})},Ss=ye.createSvgIcon(e.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z"}),"Cancel"),pt=({open:n,onClose:l,additionalQuestionForm:a,onChangeAdditionalQuestion:i,onAddAdditionalQuestion:h,onRemoveAdditionalQuestion:c,onEditAdditionalQuestion:x,onChangeAdditionalType:f,onCheckFormConfirm:y,onAddAnswerQuestion:$,onRemoveAnswer:w,onSelectOptionSingleChoice:p,onCheckSelectOptionSingleChoice:q,onRecordChangeQuestionText:m,questionAdditionalType:T,formTextList:v,toTextList:_,onChangeAdditionalRatingQuestion:L})=>{const{t:g}=j.useTranslation(),{classFontSize:N}=Z.useFontStyles(),[d,b]=u.useState(""),A=Fs.useDebounce(d,300);u.useEffect(()=>{A&&m(A)},[A]);const C=u.useMemo(()=>a.type==k.QuestionType.SingleChoice?T.filter(o=>o.type==1):a.type==k.QuestionType.Rating?T.filter(o=>o.type==10):T.filter(o=>o.type==3),[a.type,T]);return e.jsxs(s.Dialog,{open:n,onClose:()=>l(),className:`${t.styles[N]}`,disableEnforceFocus:!0,disableRestoreFocus:!0,children:[e.jsx(s.DialogTitle,{className:`${t.styles["box-additional-title"]}`,children:a.id?g("edit_question"):g("create_question")}),e.jsxs(s.DialogContent,{children:[e.jsxs(s.Grid,{className:`${t.styles["box-input"]}`,children:[e.jsxs(s.Typography,{className:`${t.styles["input-title"]}`,children:[g("question_type"),e.jsx("sup",{className:`${t.styles["sup-require"]}`,children:"*"})]}),e.jsx(s.Autocomplete,{id:"combo-box-demo",fullWidth:!0,options:k.questionTypeAdditional,getOptionLabel:o=>o.label,value:k.questionTypeAdditional?.find((o=>o.value==a.type))||null,onChange:(o,I)=>f(I?.value),className:`${t.styles["select-type"]}`,renderInput:o=>e.jsx(s.TextField,{...o,label:"Combo box",variant:"outlined"})})]}),e.jsxs(s.Grid,{className:`${t.styles["box-input"]}`,children:[e.jsxs(s.Typography,{className:`${t.styles["input-title"]}`,children:[g("text"),e.jsx("sup",{className:`${t.styles["sup-require"]}`,children:"*"})]}),e.jsx(s.Autocomplete,{id:"outlined-number",style:{width:"100%"},options:C.map(o=>o.text)||[],freeSolo:!0,autoHighlight:!0,getOptionLabel:o=>o||"",renderOption:(o,I)=>e.jsx("li",{...o,children:I}),value:a.questionText,onInputChange:(o,I)=>{b(I)},onChange:(o,I)=>{typeof I=="string"&&(m(I),b(I))},inputValue:d,renderInput:o=>e.jsx(s.TextField,{...o,label:g("text"),name:"questionText",variant:"outlined",inputProps:{...o.inputProps}})})]}),a.type==k.QuestionType.Rating&&e.jsxs(s.Grid,{className:`${t.styles["box-input"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["input-title"]}`,children:g("scale")}),e.jsxs(s.Grid,{className:"d-flex",children:[e.jsx(s.Autocomplete,{id:"outlined-number",style:{width:"48%",margin:"15px 10px 0px 0px"},options:v||[],freeSolo:!0,autoHighlight:!0,getOptionLabel:o=>o||"",renderOption:(o,I)=>e.jsx("li",{...o,children:I}),value:a.fromLabel||"",onInputChange:(o,I)=>{L?.("fromLabel",I)},renderInput:o=>e.jsx(s.TextField,{...o,label:g("from"),name:"fromLabel",variant:"outlined",inputProps:{...o.inputProps}})}),e.jsx(s.Autocomplete,{id:"outlined-number",style:{width:"48%",margin:"15px 10px 0px 0px"},options:_||[],freeSolo:!0,autoHighlight:!0,getOptionLabel:o=>o||"",renderOption:(o,I)=>e.jsx("li",{...o,children:I}),value:a.toLabel||"",onInputChange:(o,I)=>{L?.("toLabel",I)},renderInput:o=>e.jsx(s.TextField,{...o,label:g("to"),name:"toLabel",variant:"outlined",inputProps:{...o.inputProps}})})]})]}),a.type==k.QuestionType.SingleChoice&&e.jsxs(s.Grid,{className:`${t.styles["box-input"]}`,children:[e.jsx(s.FormControl,{component:"fieldset",children:e.jsxs(s.RadioGroup,{row:!0,value:q,onChange:o=>p(o),children:[e.jsx(s.FormControlLabel,{value:k.optionSingleChoice.TrueFalse,control:e.jsx(s.Radio,{color:"primary"}),label:"True - False",className:`${t.styles["option-select"]}`}),e.jsx(s.FormControlLabel,{value:k.optionSingleChoice.YesNo,control:e.jsx(s.Radio,{color:"primary"}),label:"Yes - No",className:`${t.styles["option-select"]}`}),e.jsx(s.FormControlLabel,{value:k.optionSingleChoice.Other,control:e.jsx(s.Radio,{color:"primary"}),label:"Other",className:`${t.styles["option-select"]}`})]})}),e.jsxs(s.Typography,{className:`${t.styles["input-title"]}`,children:[g("answer"),e.jsx("sup",{className:`${t.styles["sup-require"]}`,children:"*"})]}),a.answers!==k.initialAnswerTrueFalse&&a.answers!==k.initialAnswerYesNo&&e.jsx(s.TextField,{fullWidth:!0,variant:"outlined",label:"Add new answer",name:"textAnswer",value:a.textAnswer,onChange:o=>i(o),InputProps:{endAdornment:e.jsx(s.InputAdornment,{position:"end",children:a?.textAnswer?.trim()?e.jsx(me.AddCircleIcon,{color:"primary",onClick:()=>$(),className:t.styles["icon-btn"]}):e.jsx(me.AddCircleIcon,{color:"disabled",className:t.styles["icon-btn"]})})}}),a.answers.map((o,I)=>e.jsxs(s.Grid,{className:`${t.styles["flex-between"]} ${t.styles["item-answer"]}`,children:[e.jsx(s.Typography,{children:o.text}),e.jsx(Ss,{className:`${t.styles.pointer} ${t.styles["sup-require"]}`,onClick:()=>w(o,a)})]},I))]})]}),e.jsxs(s.DialogActions,{className:`${t.styles["model-confirm-publish"]}`,children:[e.jsx(s.Button,{className:`${t.styles["btn-cancel"]}`,onClick:()=>l(),children:g("cancel")}),a.id?e.jsxs("div",{children:[e.jsx(s.Button,{className:`${t.styles["btn-cancel"]}`,onClick:()=>c(a.id),children:g("delete")}),e.jsx(s.Button,{disabled:y(a),className:`${t.styles["btn-send-survey"]} ${t.styles["ml-10"]}`,onClick:()=>x(a),children:g("save_question")})]}):e.jsx(s.Button,{className:`${t.styles["btn-send-survey"]}`,onClick:()=>h(),disabled:y(a),children:g("add_question")})]})]})},mt=({dataFormCreateSurvey:n,onChangeValueForm:l,onRecordChangeTitle:a,handleChangeDate:i,handleChangeFavorite:h,templateSurvey:c,handleToggleModel:x,openModelSelectTemplate:f,handleSelectTemplate:y,openCollapseId:$,setOpenCollapseId:w,handleInsertQuestion:p,contentModelQuestion:q,handleCloseModelEdit:m,handleChangeModelQuestion:T,handleSelectQuestion:v,handleCheckSelectQuestion:_,handleSelectQuestionCollapse:L,handleCheckTypeQuestion:g,handleCheckCountQuestionByType:N,handleCheckInsertQuestion:d,handleCheckSelectTemplate:b,handleInsertAllQuestion:A,favoriteItem:C,handleDuplicateSurvey:o,handleAddAdditionalQuestion:I,handleChangeAdditionalQuestion:B,handleRecordChangeQuestionText:P,handleRemoveAdditionalQuestion:z,handleEditAdditionalQuestion:r,handleFindAdditionalQuestion:S,handleToggleModelAdditional:G,openModelAdditional:M,additionalQuestionForm:V,handleChangeAdditionalType:te,handleCheckFormConfirm:W,handleAddAnswerQuestion:K,handleRemoveAnswer:X,filterFavorite:ne,handleSortTableFavorite:U,handleChangeRowsPerPageFavorite:ee,handleChangePageFavorite:le,handleSelectOptionSingleChoice:ae,handleCheckSelectOptionSingleChoice:ie,formTextList:oe,toTextList:re,handleChangeAdditionalRatingQuestion:ce,questionAdditionalType:de})=>{const{t:O}=j.useTranslation(),{classFontSize:ue}=Z.useFontStyles();return e.jsxs(s.Grid,{container:!0,spacing:2,className:`${t.styles["create-survey-container"]} ${t.styles[ue]}`,children:[e.jsxs(s.Grid,{item:!0,md:8,xs:12,className:`${t.styles["box-create-survey"]}`,children:[e.jsxs(s.Grid,{className:`${t.styles["box-form-input"]}`,children:[e.jsxs(s.Typography,{className:`${t.styles["form-input-title"]}`,children:[O("survey_title"),e.jsx("sup",{className:`${t.styles["sup-require"]}`,children:"*"})]}),e.jsx(rt,{valueText:n.title,label:O("title"),name:"title",onChangeEvent:l,onChange:a})]}),e.jsxs(s.Grid,{className:`${t.styles["box-form-input"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["form-input-title"]}`,children:O("survey_questions")}),e.jsx(s.TextField,{disabled:!0,fullWidth:!0,variant:"outlined",label:O("add_survey_question"),InputProps:{endAdornment:e.jsx(s.InputAdornment,{position:"end",children:e.jsx(me.AddCircleIcon,{className:t.styles["icon-btn"],onClick:()=>x()})})}}),e.jsx(ut,{handleClose:x,open:f,listTemplate:c,dataFormCreateSurvey:n,handleSelectTemplate:y,handleInsertQuestion:p,contentModelQuestion:q,handleCloseModelEdit:m,handleChangeModelQuestion:T,handleSelectQuestion:v,handleCheckTypeQuestion:g,handleCheckCountQuestionByType:N,handleCheckInsertQuestion:d,handleCheckSelectTemplate:b,handleInsertAllQuestion:A}),n.templateQuestions?.map(E=>e.jsxs(s.Grid,{className:`${t.styles["box-collapse"]}`,children:[e.jsxs(s.Grid,{children:[e.jsxs(s.Grid,{className:`${t.styles["box-collapse-top"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["collapse-left-title"]}`,children:E.name}),e.jsxs(s.Grid,{className:`${t.styles["box-collapse-right"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["collapse-chip"]}`,children:`${E.questionTemplates?.length} Selected`}),E.id!==$?e.jsx(gs.ExpandLessIcon,{className:`${t.styles["icon-btn"]}`,onClick:()=>w(E.id)}):e.jsx(Ys.ExpandMoreIcon,{className:`${t.styles["icon-btn"]}`,onClick:()=>w(0)})]})]}),g(E).map(R=>e.jsx(s.Typography,{className:`${t.styles["description-template-left"]}`,children:`${R} • ${N(E,R)} questions`},R))]}),e.jsx(s.Collapse,{in:$===E.id,children:c.find(R=>R.id===E.id)?.questionTemplates.map(R=>e.jsxs(s.Grid,{className:`${t.styles["box-collapse-content-item"]}`,children:[e.jsx(s.Checkbox,{checked:_(E,R),color:"primary",inputProps:{"aria-label":"secondary checkbox"},onChange:()=>L(E,R)}),e.jsx("div",{className:`${t.styles.innerHtml}`,dangerouslySetInnerHTML:{__html:R.questionText.replace(/<br\s*\/?>/gi,`
3
+ `)}})]},R.questionId))})]},E.id))]}),e.jsxs(s.Grid,{className:`${t.styles["box-form-input"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["form-input-title"]}`,children:O("additional_question")}),e.jsxs("button",{onClick:()=>G(),className:`${t.styles.confirm_btn}`,children:[e.jsx(s.Typography,{className:`${t.styles.confirm_btn_title}`,children:O("add_additional_question")}),e.jsx(me.AddCircleIcon,{className:`${t.styles.confirm_btn_icon}`})]}),e.jsx(pt,{open:M,onClose:G,additionalQuestionForm:V,onChangeAdditionalQuestion:B,onRecordChangeQuestionText:P,onAddAdditionalQuestion:I,onRemoveAdditionalQuestion:z,onEditAdditionalQuestion:r,onChangeAdditionalType:te,onCheckFormConfirm:W,onAddAnswerQuestion:K,onRemoveAnswer:X,onSelectOptionSingleChoice:ae,onCheckSelectOptionSingleChoice:ie,formTextList:oe,toTextList:re,onChangeAdditionalRatingQuestion:ce,questionAdditionalType:de}),n.additionalQuestions.map((E,R)=>e.jsxs(s.Grid,{className:`${t.styles["additional-box"]}`,children:[e.jsxs(s.Grid,{className:`${t.styles["header-item"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["header-title"]}`,children:E.questionText}),e.jsx(bs.EditIcon,{color:"primary",className:`${t.styles.pointer}`,onClick:()=>S(E.id)})]}),e.jsx(s.Typography,{children:k.questionTypeAdditional?.find(he=>he.value==E.type)?.label})]},R))]}),e.jsxs(s.Grid,{className:`${t.styles["box-form-input"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["form-input-title"]}`,children:O("deadline")}),e.jsx(ms.LocalizationProvider,{dateAdapter:Ws.AdapterMoment,children:e.jsx(ms.DateTimePicker,{disablePast:!0,format:"YYYY/MM/DD hh:mm A",label:O("select_deadline"),className:`${t.styles["filter-item"]}`,value:n.deadline?fs(n.deadline):null,onChange:E=>i(E),slotProps:{textField:{fullWidth:!0,variant:"outlined",name:"deadline",id:"time-picker"}}})})]}),e.jsxs(s.Grid,{className:`${t.styles["box-form-input"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["form-input-title"]}`,children:O("save_favorite")}),e.jsx(s.FormControlLabel,{control:e.jsx(s.Checkbox,{checked:!!n.isFavorite,onChange:()=>h(),name:"isFavorite",color:"primary"}),label:O("save_as_favorite")})]})]}),e.jsx(s.Grid,{item:!0,md:4,xs:12,className:`${t.styles["box-list-favorite"]}`,children:e.jsx(ht,{favoriteItem:C,onDuplicateSurvey:o,filterFavorite:ne,onSortTable:U,handleChangeRowsPerPageFavorite:ee,handleChangePageFavorite:le})})]})},J=({title:n,handleEdit:l,classFontSize:a})=>{const{t:i}=j.useTranslation();return e.jsxs(s.Grid,{className:`${Y.styles["block-card-name"]} ${Y.styles[a]}`,children:[e.jsx(s.Typography,{className:`${Y.styles["block-card-title"]}`,children:i(n)}),e.jsxs(s.Button,{className:`${Y.styles["block-card-btn"]}`,onClick:()=>l?.(),children:[e.jsx(s.Typography,{className:`${Y.styles["block-card-btn-title"]}`,children:i("edit")}),e.jsx(bs.EditIcon,{className:`${Y.styles["block-card-btn-icon"]}`})]})]},n)},yt=({dataFormCreateSurvey:n,handleNextStep:l,handleCheckTypeQuestion:a,handleCheckCountQuestionByType:i})=>{const{t:h}=j.useTranslation(),{classFontSize:c}=Z.useFontStyles();return e.jsxs(s.Container,{className:`${t.styles["block-review-detail"]} ${t.styles[c]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-block"]}`,children:h("review_survey_detail")}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:"students",handleEdit:()=>l(0),classFontSize:c}),e.jsxs(s.Grid,{className:`${t.styles["box-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:h("a_number_of_student")}),e.jsx(s.Typography,{className:`${t.styles.content}`,children:n?.studentIds?.length??0})]})]}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:h("staff"),handleEdit:()=>l(1),classFontSize:c}),e.jsxs(s.Grid,{className:`${t.styles["box-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:h("a_number_of_staff")}),e.jsx(s.Typography,{className:`${t.styles.content}`,children:n?.staffIds?.length??0})]})]}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:h("survey_title"),handleEdit:()=>l(2),classFontSize:c}),e.jsxs(s.Grid,{className:`${t.styles["box-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:h("survey_name")}),e.jsx(s.Typography,{className:`${t.styles.content}`,children:n.title})]})]}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:"survey_templates",handleEdit:()=>l(2),classFontSize:c}),e.jsx(s.Grid,{className:`${t.styles["box-content"]}`,children:e.jsx(s.Grid,{children:n?.templateQuestions?.map(x=>e.jsxs(s.Grid,{className:`${t.styles["block-template-review"]}`,children:[e.jsxs(s.Grid,{className:`${t.styles["block-template-left"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["name-template-left"]}`,children:x.name}),a(x)?.map(f=>e.jsx(s.Typography,{className:`${t.styles["description-template-left"]}`,children:`${f} • ${i(x,f)} ${h("questions")}`},f))]}),e.jsx(s.Typography,{className:`${t.styles["select-right"]}`,children:`${x.questionTemplates?.length} Selected`})]},x.id))})})]}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:"additional_question",handleEdit:()=>l(2),classFontSize:c}),e.jsx(s.Grid,{className:`${t.styles["box-content"]}`,children:e.jsx(s.Grid,{children:n?.additionalQuestions.map(x=>e.jsx(s.Grid,{className:`${t.styles["block-template-review"]}`,children:e.jsx(s.Grid,{className:`${t.styles["block-template-left"]}`,children:e.jsx(s.Typography,{className:`${t.styles["name-template-left"]}`,children:x.questionText})})},x.id))})})]}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:"deadline",handleEdit:()=>l(2),classFontSize:c}),e.jsxs(s.Grid,{className:`${t.styles["box-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:h("date_and_time")}),e.jsx(s.Typography,{children:fs(n.deadline).format("DD/MM/YYYY hh:mm A")})]})]}),e.jsxs(s.Grid,{className:`${t.styles["block-content-review"]}`,children:[e.jsx(J,{title:"save_favorite",handleEdit:()=>l(2),classFontSize:c}),e.jsxs(s.Grid,{className:`${t.styles["box-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:h("save_as_favorite")}),e.jsx(s.FormControlLabel,{control:e.jsx(s.Checkbox,{checked:!!n.isFavorite,name:"isFavorite",color:"primary"}),label:h("save_as_favorite")})]})]})]})},gt=ye.createSvgIcon(e.jsx("path",{d:"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"}),"GetApp"),xt=ye.createSvgIcon(e.jsx("path",{d:"M5 4v2h14V4zm0 10h4v6h6v-6h4l-7-7z"}),"Publish"),ft=({open:n,handleClose:l,handlePublishSurvey:a,handleDeleteEmail:i,listEduTeacher:h,handleChangeInputSender:c,textValueSender:x,handleEnterAddSender:f,senderList:y,handleChangeEmailContent:$,emailContent:w,listChooseStudents:p,studentShareId:q,setStudentShareId:m,importEmailCsv:T,downloadTemplate:v})=>{const{t:_}=j.useTranslation(),{classFontSize:L}=Z.useFontStyles();return e.jsxs(s.Dialog,{open:n,onClose:()=>l(),className:`${t.styles["model-confirm-publish"]} ${t.styles[L]}`,disableEnforceFocus:!0,disableRestoreFocus:!0,children:[e.jsx(s.DialogTitle,{children:e.jsx(s.Typography,{className:`${t.styles["dialog-title"]}`,children:_("share_survey_to_teacher")})}),e.jsxs(s.DialogContent,{children:[e.jsxs(s.Grid,{className:`${t.styles["box-email-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:_("external_email")}),e.jsx(s.Autocomplete,{multiple:!0,freeSolo:!0,id:"tags-filled",options:[],value:y,renderTags:()=>(y||[]).map(g=>e.jsx(s.Chip,{className:`${t.styles["box-chip-email"]}`,id:g,color:"primary",label:g,deleteIcon:e.jsx(Ss,{}),onDelete:()=>i?.(g)})),renderInput:g=>e.jsx(s.TextField,{...g,variant:"outlined",value:x,placeholder:"Enter external email",onKeyUp:N=>{N.key==="Enter"&&f?.()},onChange:N=>c?.(N)})}),e.jsxs(s.Grid,{className:`${t.styles["flex-item"]} ${t.styles["mt-20"]}`,children:[e.jsx(s.Button,{color:"primary",endIcon:e.jsx(gt,{}),onClick:()=>v?.(),className:`${t.styles["btn-send-survey"]} ${t.styles["mr-10"]}`,children:_("download_template")}),e.jsx("input",{className:"d-none",type:"file",id:"uploadFile",accept:"text/csv",onChange:g=>T?.(g.target.files[0]),onClick:g=>{g.target.value=null}}),e.jsx(s.Grid,{children:e.jsx("label",{htmlFor:"uploadFile",role:"button",className:`${t.styles["box-input-csv"]}`,children:e.jsxs(s.Grid,{className:`${t.styles["btn-send-survey"]}`,children:[e.jsx(s.Typography,{className:`${t.styles.title}`,children:_("import_emails_by_csv")}),e.jsx(xt,{className:`${t.styles.icon}`})]})})})]})]}),e.jsxs(s.Grid,{className:`${t.styles["box-email-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:_("student")}),e.jsx(s.Autocomplete,{id:"fixed-tags-demo",value:p?.find(g=>g?.id==q)||null,onChange:(g,N)=>{m?.(N?.id)},options:p,getOptionLabel:g=>g?.fullName!=null?g?.fullName:"",renderInput:g=>e.jsx(s.TextField,{...g,variant:"outlined",placeholder:_("select_student"),onChange:N=>{N.target.value===""&&m?.(-1)}})})]}),e.jsxs(s.Grid,{className:`${t.styles["box-email-content"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-content"]}`,children:_("email_contents")}),e.jsx(s.TextField,{fullWidth:!0,multiline:!0,minRows:4,variant:"outlined",value:w,placeholder:_("write_something_optional"),onChange:g=>$?.(g),className:`${t.styles["input-mail-content"]}`})]})]}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{className:`${t.styles["btn-cancel"]}`,onClick:()=>l(),children:_("cancel")}),e.jsx(s.Button,{disabled:!q&&p.length>0||!h?.filter(g=>g.isSelected)?.length&&!y?.length,color:"primary",endIcon:e.jsx(be.SendIcon,{}),onClick:()=>a?.(),className:`${t.styles["btn-send-survey"]}`,children:_("send_survey")})]})]})},bt=({open:n,handleClose:l,handlePublishSurvey:a})=>{const{t:i}=j.useTranslation(),{classFontSize:h}=Z.useFontStyles();return e.jsxs(s.Dialog,{open:n,onClose:()=>l(),className:`${t.styles["model-confirm-publish"]} ${t.styles[h]}`,disableEnforceFocus:!0,disableRestoreFocus:!0,children:[e.jsx(s.DialogTitle,{children:e.jsx(s.Typography,{className:`${t.styles["dialog-title"]}`,children:i("complete_survey")})}),e.jsx(s.DialogContent,{children:e.jsx(s.Typography,{className:`${t.styles["content-confirm-model"]}`,children:i("you_will_not_be_able_to_edit_this_survey_once_published_._are_you_sure_you_want_to_continue_?")})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{className:`${t.styles["btn-cancel"]}`,onClick:()=>l(),children:i("cancel")}),e.jsx(s.Button,{color:"primary",endIcon:e.jsx(be.SendIcon,{}),onClick:()=>a?.(),className:`${t.styles["btn-send-survey"]}`,children:i("publish_survey")})]})]})},jt=({open:n,handleClose:l,onOpenModelExternal:a,numberStaff:i,numberStudent:h})=>{const{t:c}=j.useTranslation(),{classFontSize:x}=Z.useFontStyles();return e.jsxs(s.Dialog,{open:n,onClose:()=>l(),className:`${t.styles["model-confirm-publish"]} ${t.styles[x]}`,disableEnforceFocus:!0,disableRestoreFocus:!0,children:[e.jsx(s.DialogContent,{children:e.jsx(s.Typography,{className:`${t.styles["content-confirm-model"]} ${t.styles["content-confirm-share-model"]}`,children:c("your_survey_was_sent_to_x_students_and_y_staff_members_you_can_keep_track_of_the_results_on_our_survey_dashboard",{numberStudent:h,numberStaff:i})})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{className:`${t.styles["btn-cancel"]}`,onClick:()=>l(),children:c("leave")}),e.jsx(s.Button,{color:"primary",endIcon:e.jsx(be.SendIcon,{}),onClick:()=>a?.(),className:`${t.styles["btn-send-survey"]}`,children:c("go_to_the_survey_dashboard")})]})]})},St=({classFontSize:n,staffs:l,resizeWidthTable:a,inputSearch:i,valueInputSearch:h,handleChangeInputSearch:c,dataFormCreateSurvey:x,onSelectStaff:f})=>{const{t:y}=j.useTranslation(),$=js(),w=[{headerName:y("staff_name"),field:"fullName",width:a(30),disableColumnMenu:!0,renderCell:p=>e.jsxs("div",{className:`${t.styles.row_name}`,children:[e.jsx("img",{src:p.row.avatar?j.getFileUrl(p.row.avatar):k.DEFAULT_USER_AVATAR,alt:"",className:`${t.styles.avatar_user}`}),p.row.fullName]})},{headerName:y("email"),field:"email",width:a(30),disableColumnMenu:!0,renderCell:p=>e.jsx("div",{className:`${t.styles["data-grid-content"]}`,children:p.row.email})},{headerName:y("roles"),field:"roles",width:a(30),disableColumnMenu:!0,renderCell:p=>e.jsx("div",{className:`${t.styles["data-grid-content"]}`,children:p.row.roles.toString().replace(/,/g,", ")})}];return e.jsxs(s.Grid,{className:`${t.styles[n]}`,children:[e.jsxs(s.Grid,{className:`${t.styles["block-filter"]}`,children:[e.jsx(s.Typography,{className:`${t.styles["title-filter"]}`,children:y("select_staff")}),e.jsx(s.Grid,{className:`${t.styles["block-filter-right"]}`,children:e.jsxs(s.Grid,{className:`${t.styles["box-filter-right"]}`,children:[e.jsx(s.Grid,{className:`${t.styles["search-input-icon"]}`,children:e.jsx(ds.SearchIcon,{})}),e.jsx(s.InputBase,{placeholder:y("search_staff"),inputProps:{"aria-label":"search"},className:`${t.styles.inputInput}`,onChange:p=>c(p),ref:i,value:h})]})})]}),e.jsx("div",{className:`${t.styles["table-desktop"]}`,style:{height:"600px",width:"100%"},children:l&&l?.items?.length>0?e.jsx(xs.DataGrid,{rows:l?l?.items:[],columns:w,initialState:{pagination:{paginationModel:{pageSize:10,page:0}}},pageSizeOptions:[10],checkboxSelection:!0,disableRowSelectionOnClick:!0,sx:{...$.root,borderLeft:"1px solid #e0e0e0 !important"},rowHeight:80,rowSelectionModel:x.staffIds,hideFooterSelectedRowCount:!0,onRowSelectionModelChange:p=>{f(p)}}):e.jsx(s.Box,{p:2,children:e.jsx(s.Typography,{variant:"h5",className:t.styles["no-data"],children:y("no_data")})})})]})},Tt=()=>{const n=hs.useNavigate(),{t:l}=j.useTranslation(),{classFontSize:a,defaultFont:i}=Z.useFontStyles(),h=s.useTheme(),c=Js({fontSize:i||14})(h),{filters:x,students:f,inputSearch:y,templateSurvey:$,openCollapseId:w,dataFormCreateSurvey:p,setDataFormCreateSurvey:q,contentModelQuestion:m,openModelSelectTemplate:T,openModelConfirmPublish:v,handleSelectStudent:_,onChangeValueForm:L,handleChangeDate:g,handleChangeInputSearch:N,handleChangeFavorite:d,handleChangeGrade:b,handleSelectTemplate:A,setOpenCollapseId:C,handleInsertQuestion:o,handleToggleButtonHeader:I,handleCreateSurvey:B,handleCloseModelEdit:P,handleChangeModelQuestion:z,handleSelectQuestion:r,handleCheckSelectQuestion:S,handleSelectQuestionCollapse:G,handleCheckTypeQuestion:M,handleCheckCountQuestionByType:V,handleChangePagePreview:te,handleNextStep:W,handleCheckInsertQuestion:K,handleCheckSelectTemplate:X,handleToggleModel:ne,resizeWidthTable:U,handleToggleModelConfirm:ee,openModelShare:le,handleToggleModelShare:ae,listEduTeacher:ie,handleToggleSuggestedTeacher:oe,handleChangeInputSender:re,textValueSender:ce,handleEnterAddSender:de,senderList:O,handleChangeEmailContent:ue,emailContent:E,handleShareSurvey:R,importEmailCsv:he,downloadTemplate:je,handleDeleteEmail:ge,handleToggleModelConfirmShare:Se,openModelConfirmShare:Te,handleInsertAllQuestion:Ce,favoriteItem:ve,handleDuplicateSurvey:Ne,handleAddAdditionalQuestion:$e,handleChangeAdditionalQuestion:_e,handleRecordChangeQuestionText:Ie,handleRemoveAdditionalQuestion:we,handleEditAdditionalQuestion:Ae,handleFindAdditionalQuestion:ke,handleToggleModelAdditional:qe,openModelAdditional:Ge,additionalQuestionForm:Le,handleChangeAdditionalType:Me,handleCheckFormConfirm:De,handleAddAnswerQuestion:Ee,handleRemoveAnswer:Pe,filterFavorite:Re,handleSortTableFavorite:Qe,handleChangeRowsPerPageFavorite:Oe,handleChangePageFavorite:Be,valueInputSearch:ze,handleSelectOptionSingleChoice:He,handleCheckSelectOptionSingleChoice:Ve,listChooseStudents:Ye,studentShareId:Fe,setStudentShareId:We,staffs:Ue,handleSelectStaff:Je,inputStaff:Ze,inputSearchStaff:Ke,handleChangeInputStaff:Xe,onRecordChangeTitle:es,formTextList:ss,toTextList:ts,handleChangeAdditionalRatingQuestion:ns,questionAdditionalType:ls,handleGoToSurveyDashboard:as,inputSearchTeacher:is,handleChangeInputSearchTeacher:os,valueInputSearchTeacher:rs}=at(),cs=()=>{if(p.activeStep>0){q({...p,activeStep:p.activeStep-1});return}n("/admin/survey-dashboard/list-survey")};return e.jsxs(s.Grid,{sx:c.root,children:[e.jsx(zs.CustomHeaderComponent,{classFontSize:a,title:"create_survey",contentButton:k.lableStep(p.activeStep),isGoback:!0,handleChangePage:p.activeStep!==3?W:ee,isDisableButton:I(),iconButton:e.jsx(Bs.ArrowForwardIcon,{className:`${t.styles["icon-add-header"]}`}),onDraft:p.activeStep!==3?null:B,isPreviewSurvey:p.activeStep===3,handlePreview:te,onHandleGoBack:cs}),e.jsx(s.Grid,{className:`${t.styles.stepper}`,style:{padding:"24px 0"},children:e.jsx(s.Stepper,{activeStep:p.activeStep,alternativeLabel:!0,children:k.STEP_MODEL.map(xe=>e.jsx(s.Step,{children:e.jsx(s.StepLabel,{StepIconProps:{sx:{"&.Mui-completed":c.completed,"&.Mui-active":{color:"#316CD9 !important"}}},sx:{"& .MuiStepLabel-label":c.label},children:l(xe)})},xe))})}),e.jsxs(s.Grid,{className:`${t.styles["block-content"]}`,children:[e.jsx(s.Grid,{hidden:p.activeStep!==0,children:e.jsx(ot,{filters:x,students:f,classFontSize:a,valueInputSearch:ze,inputSearch:y,handleChangeGrade:b,handleSelectStudent:_,handleChangeInputSearch:N,dataFormCreateSurvey:p,resizeWidthTable:U,valueInputSearchTeacher:rs,inputSearchTeacher:is,handleChangeInputSearchTeacher:os})}),e.jsx(s.Grid,{hidden:p.activeStep!==1,children:e.jsx(St,{staffs:Ue,inputSearch:Ke,classFontSize:a,onSelectStaff:Je,valueInputSearch:Ze,dataFormCreateSurvey:p,resizeWidthTable:U,handleChangeInputSearch:Xe})}),e.jsx(s.Grid,{hidden:p.activeStep!==2,children:e.jsx(mt,{dataFormCreateSurvey:p,onChangeValueForm:L,onRecordChangeTitle:es,handleChangeDate:g,handleChangeFavorite:d,templateSurvey:$,handleToggleModel:ne,openModelSelectTemplate:T,handleSelectTemplate:A,openCollapseId:w,setOpenCollapseId:C,handleInsertQuestion:o,contentModelQuestion:m,handleCloseModelEdit:P,handleChangeModelQuestion:z,handleSelectQuestion:r,handleCheckSelectQuestion:S,handleChangeAdditionalRatingQuestion:ns,questionAdditionalType:ls,handleSelectQuestionCollapse:G,handleCheckTypeQuestion:M,handleCheckCountQuestionByType:V,handleCheckInsertQuestion:K,handleCheckSelectTemplate:X,handleInsertAllQuestion:Ce,favoriteItem:ve,handleDuplicateSurvey:Ne,handleAddAdditionalQuestion:$e,handleChangeAdditionalQuestion:_e,handleRecordChangeQuestionText:Ie,handleRemoveAdditionalQuestion:we,handleEditAdditionalQuestion:Ae,handleFindAdditionalQuestion:ke,handleToggleModelAdditional:qe,handleChangeAdditionalType:Me,openModelAdditional:Ge,additionalQuestionForm:Le,handleCheckFormConfirm:De,handleAddAnswerQuestion:Ee,handleRemoveAnswer:Pe,filterFavorite:Re,handleSortTableFavorite:Qe,handleChangeRowsPerPageFavorite:Oe,handleChangePageFavorite:Be,handleSelectOptionSingleChoice:He,handleCheckSelectOptionSingleChoice:Ve,formTextList:ss,toTextList:ts})}),e.jsx(s.Grid,{hidden:p.activeStep!==3,children:e.jsx(yt,{dataFormCreateSurvey:p,handleNextStep:W,handleCheckTypeQuestion:M,handleCheckCountQuestionByType:V})})]}),e.jsx(bt,{open:v,handleClose:ee,handlePublishSurvey:B}),e.jsx(jt,{open:Te,handleClose:Se,onOpenModelExternal:as,numberStaff:p?.staffIds?.length||0,numberStudent:p?.studentIds?.length||0}),e.jsx(ft,{handleClose:ae,open:le,handlePublishSurvey:R,importEmailCsv:he,listEduTeacher:ie,handleToggleSuggestedTeacher:oe,handleChangeInputSender:re,textValueSender:ce,handleEnterAddSender:de,senderList:O,handleChangeEmailContent:ue,emailContent:E,handleDeleteEmail:ge,listChooseStudents:Ye,studentShareId:Fe,setStudentShareId:We,downloadTemplate:je})]})};exports.default=Tt;