mario-education 2.0.268-staging → 2.0.269-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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),fe=require("reactstrap"),c=require("mario-core"),ie=require("./constants-DfnEgLPg.cjs"),f=require("react"),ee=require("react-redux"),we=require("formik"),Te=require("yup"),b=require("@mui/material"),he=require("@mui/x-date-pickers"),Ce=require("moment"),x=require("./OutlinedInput-BjTQ2gUe.cjs"),Se=require("./constants-9UnXcqo8.cjs"),xe=require("./DoneCheckInIcon-7Q31KvHI.cjs"),ge=require("./userService-DsbgpY7L.cjs"),Ee=require("./styles.module-CHKJJ8Zm.cjs"),ke=require("./AdapterMoment-B-q0UCj0.cjs"),de=require("./Visibility-8udu2NF7.cjs"),ue=require("./IconButton-CqDyeB-N.cjs"),be=require("react-router-dom"),Re=require("date-fns");function Pe(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const l in t)if(l!=="default"){const v=Object.getOwnPropertyDescriptor(t,l);Object.defineProperty(a,l,v.get?v:{enumerable:!0,get:()=>t[l]})}}return a.default=t,Object.freeze(a)}const R=Pe(Te),De="_name_1koi9_205",Ae="_role_1koi9_217",Ue="_item_1koi9_230",Me="_gender_1koi9_323",Ie="_gender__item_1koi9_328",r={"profile-value":"_profile-value_1koi9_77","input-error":"_input-error_1koi9_94","user-profile-container-admin":"_user-profile-container-admin_1koi9_122","user-profile-container-admin__left":"_user-profile-container-admin__left_1koi9_135","user-profile-container-admin__left--information":"_user-profile-container-admin__left--information_1koi9_146","image-user-container":"_image-user-container_1koi9_154","image-user-container__image":"_image-user-container__image_1koi9_169","image-user-container__edit-btn":"_image-user-container__edit-btn_1koi9_176","image-user-container__delete-btn":"_image-user-container__delete-btn_1koi9_190","name-role-container":"_name-role-container_1koi9_205",name:De,role:Ae,"user-profile-container-admin__left--btn-control":"_user-profile-container-admin__left--btn-control_1koi9_224",item:Ue,"item-active":"_item-active_1koi9_246","user-profile-container-admin__right":"_user-profile-container-admin__right_1koi9_274","edit-profile-container":"_edit-profile-container_1koi9_285","edit-profile-container__title":"_edit-profile-container__title_1koi9_290","edit-profile-container__form":"_edit-profile-container__form_1koi9_297","edit-profile-container__form--row":"_edit-profile-container__form--row_1koi9_302","edit-profile-container__form--field":"_edit-profile-container__form--field_1koi9_307",gender:Me,gender__item:Ie,"edit-profile-container__form--width-50":"_edit-profile-container__form--width-50_1koi9_334","edit-profile-container__form--width-30":"_edit-profile-container__form--width-30_1koi9_337","edit-profile-container__form--width-70":"_edit-profile-container__form--width-70_1koi9_340","edit-profile-container__form--btn-group":"_edit-profile-container__form--btn-group_1koi9_343","btn-save":"_btn-save_1koi9_349","btn-cancel":"_btn-cancel_1koi9_371"};var J=(t=>(t.Info="info",t.ForgotPassword="forgotPassword",t.DownloadUserData="downloadUserData",t.ChangePassword="changePassword",t))(J||{});const oe=[{value:"info",label:"Personal Information",icon:"/images/user/User.svg",isControl:!0},{value:"changePassword",label:"Change Password",icon:"/images/user/Lock.svg",isControl:!1},{value:"forgotPassword",label:"Send Forgot Password Link",icon:"/images/user/Lock.svg",isControl:!1},{value:"downloadUserData",label:"Download User Data",icon:"/images/user/Log-out.svg",isControl:!1}],je=["Admin","Assistant","Teacher","Counselor","General ED teacher","SecondaryTeacher","Parent","Student"],$e=je,Le=je.filter(t=>t!=="SecondaryTeacher"),Fe=t=>t==="both"?["MS","ES"]:[t.toUpperCase()],Oe=t=>t==="both"?"ES, MS":t.toUpperCase(),pe=(t,a)=>{const l=(t||"").toUpperCase();if(l==="ES, MS")return"both";if(l==="ES")return"es";if(l==="MS")return"ms";const v=(a||[]).includes("MS");return(a||[]).includes("ES")&&!v?"es":"ms"},P={EDUTEACHER:"General ED teacher",STUDENT:"Student"},qe=[{value:!0,label:"Active"},{value:!1,label:"Inactive"}],me=["K","G","1","2","3","4","5","6","7","8","9","10","11","12",...ie.isMalvernCollege?["12/13"]:[],"13",...ie.isSaisSchool?["PCS"]:[]],ye=["K","G","1","2","3","4","5",...ie.isMalvernCollege?["6"]:[]],Ne=[...ie.isMalvernCollege?[]:["6"],"7","8","9","10","11","12","12/13","13","PCS"],_e=["Student"],Be=R.object({firstName:R.string().required("First name is required"),lastName:R.string().required("Last name is required"),email:R.string().email("Email is invalid").required("Email is required"),appTypes:R.array().of(R.string()).min(1,"School tier is required"),msRoles:R.array().of(R.string()).test("ms-role-required","MS role is required",(t,a)=>{const l=pe(a.parent.preferredAppType,a.parent.appTypes);return l!=="ms"&&l!=="both"?!0:!!t&&t.length>0}),esRoles:R.array().of(R.string()).test("es-role-required","ES role is required",(t,a)=>{const l=pe(a.parent.preferredAppType,a.parent.appTypes);return l!=="es"&&l!=="both"?!0:!!t&&t.length>0}),gradeLevel:R.string().nullable().test("grade-level-required","Grade level is required",(t,a)=>{const l=a.parent.msRoles||[],v=a.parent.esRoles||[];return l.includes("Student")||v.includes("Student")?!!t:!0})}),Ve={currentPage:1,pageSize:100},He=(t,a)=>{const[l,v]=f.useState([]),[h,u]=f.useState(!1),[C,w]=f.useState(Ve),[U,T]=f.useState(),m=ee.useDispatch(),F=f.useCallback(async()=>{u(!0);try{const o=(await ge.getRosterUsersApi(C)).data?.items||[];v(O(o))}catch{m(c.setAlert({type:"error",message:"Cannot get roster users"}))}u(!1)},[JSON.stringify(C)]),K=f.useCallback(async()=>{if(!a)return;const i=l.find(o=>o.value===a);if(i){T(i);return}u(!0);try{const L=(await ge.getRosterUserBySourcedIdApi(a)).data;T({label:q(L),value:L.sourcedId})}catch(o){console.log("err:",o)}u(!1)},[a]),O=i=>i.map(o=>({label:q(o),value:o.sourcedId})),q=i=>{const o=[],{givenName:L,middleName:j,familyName:y,email:D,role:E}=i,p=[];return L&&p.push(L),j&&p.push(j),y&&p.push(y),p.length&&o.push(p.join(" ")),D&&o.push(D),`${o.join(" - ")}${E?` (${E})`:""}`},z=i=>{w(o=>({...o,searchString:i}))},$=f.useCallback(i=>{w({...C,...i})},[JSON.stringify(C)]);return f.useEffect(()=>{C.roles?.length&&F()},[JSON.stringify(C)]),f.useEffect(()=>{$({roles:t})},[JSON.stringify(t)]),f.useEffect(()=>{K()},[a]),{users:l,isLoading:h,user:U,handleInputChange:z}},Ge=({value:t,roles:a,onChange:l})=>{const{users:v,isLoading:h,user:u,handleInputChange:C}=He(a,t);return e.jsx(b.Select,{label:"Select user",value:u?.value||"",onChange:w=>{l(w.target.value)},onOpen:()=>C(""),disabled:h,className:`${Ee.styles["profile-value"]}`,variant:"outlined",children:h?e.jsx(b.MenuItem,{disabled:!0,children:e.jsx(b.CircularProgress,{size:20})}):v.length>0?v.map(w=>e.jsx(b.MenuItem,{value:w.value,children:`${w.label}`},w.value)):e.jsx(b.MenuItem,{disabled:!0,children:"No users found"})})},ze=({userDetail:t,confirmData:a,goBack:l,teacherOptions:v,getDataTeachers:h,id:u,checkHasTeacher:C,setCheckHasTeacher:w,userHasData:U,currentRoles:T})=>{const{t:m}=c.useTranslation(),F=f.useRef(null),O=ee.useSelector($=>$.common.user)?.hasEsSchool!==!1,{getLabel:q,system:z}=c.useGradeLabel();return e.jsxs("div",{className:r["edit-profile-container"],children:[e.jsx("div",{className:r["edit-profile-container__title"],children:`${u?"Edit User Profile":"Create User"}`}),e.jsx(we.Formik,{initialValues:t,enableReinitialize:!0,onSubmit:$=>{a($)},validationSchema:Be,children:$=>{const{values:i,setFieldValue:o,handleSubmit:L,errors:j,touched:y}=$,D=Object.keys(j);D.length&&document.querySelector(`input[name=${D[0]}]`)?.scrollIntoView({behavior:"smooth",block:"center"});const E=i?.appTypes||[],p=E.includes("MS"),le=E.includes("ES"),Y=i?.msRoles||[],W=i?.esRoles||[],M=Y.includes(P.STUDENT)||W.includes(P.STUDENT),B=O?pe(i?.preferredAppType,E):"ms",se=B==="ms"||B==="both",Z=B==="es"||B==="both",re=M?B==="ms"?"MS":B==="es"?"ES":null:null,te=re==="MS"?me.filter(n=>Ne.includes(n)):re==="ES"?me.filter(n=>ye.includes(n)):me,ce=(n,_)=>{if(!_)return;const V=Fe(_),G=Oe(_);u?o("preferredAppType",G):(o("appTypes",V),o("preferredAppType",G),M&&(_==="es"&&o("msRoles",[]),_==="ms"&&o("esRoles",[]),h(_==="both"?"MS":_.toUpperCase())))},ae=n=>_=>{const V=_.target.value,G=n==="MS"?"msRoles":"esRoles",X=n==="MS"?"esRoles":"msRoles",S=F.current,A=U?.[n]??{};if(u&&(A.isHasTeacherData&&S==="Teacher"||A.isHasAssistantData&&S==="Assistant"||A.isHasCounselorData&&S==="Counselor"||A.isHasSecondaryTeacherData&&S==="SecondaryTeacher"||S==="Student"&&(A.isHasAssistantData||A.isHasCounselorData||A.isHasSecondaryTeacherData||A.isHasTeacherData))){alert("Please switch data before removing the role");return}const s=i?.[G]||[],g=V.some(H=>_e.includes(H))?S&&!s.includes(S)?[S]:[V.find(H=>_e.includes(H))].filter(Boolean):V,N=s.includes(P.STUDENT),I=g.includes(P.STUDENT);o(G,g),F.current=null,I?(o("preferredAppType",n),o(X,[]),u||(o("appTypes",[n]),h(n))):N&&!I&&o(X,[])},ne=n=>{const _=n==="MS"?"msRoles":"esRoles",V=n==="MS"?Y:W,G=n==="MS"?$e:Le,X=T?.[n]||[];return e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${se&&Z?r["edit-profile-container__form--width-50"]:""}`,children:[e.jsxs("p",{children:[O&&e.jsx("span",{style:{display:"inline-block",fontSize:11,fontWeight:700,color:"#3b4ba8",backgroundColor:"#e9ecfb",borderRadius:4,padding:"1px 6px",marginRight:6,verticalAlign:"middle"},children:n}),O?n==="MS"?"Middle school roles":"Elementary school roles":"Roles"," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.Select,{variant:"outlined",multiple:!0,name:_,value:V,renderValue:S=>S.map(A=>A==="SecondaryTeacher"?"Support Teacher":A).join(", "),onChange:ae(n),className:`${r["profile-value"]}`,children:G.map(S=>{const A=T?.MS?.includes(P.STUDENT)||T?.ES?.includes(P.STUDENT);return e.jsxs(b.MenuItem,{value:S,disabled:u?X.some(s=>["Student","Parent","General ED teacher"].includes(s))||["Parent"].includes(S)||!A&&S===P.STUDENT:["Parent"].includes(S)||M&&S!==P.STUDENT,onClick:()=>{F.current=S},children:[e.jsx(b.Checkbox,{checked:V.includes(S)}),e.jsx(b.ListItemText,{primary:S==="SecondaryTeacher"?"Support Teacher":S})]},S)})}),j[_]&&y[_]?e.jsx("div",{className:`${r["input-error"]}`,children:j[_]}):null]})};return e.jsxs("div",{className:r["edit-profile-container__form"],children:[e.jsxs("div",{className:r["edit-profile-container__form--row"],children:[e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsxs("p",{children:[m("first_name")," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.TextField,{name:"firstName",variant:"outlined",value:i?.firstName||"",onChange:n=>o("firstName",n.target.value)}),j.firstName&&y.firstName?e.jsx("div",{className:`${r["input-error"]}`,children:j.firstName}):null]}),e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsxs("p",{children:[m("last_name")," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.TextField,{name:"lastName",variant:"outlined",className:`${r["profile-value"]}`,value:i?.lastName||"",onChange:n=>o("lastName",n.target.value)}),j.lastName&&y.lastName?e.jsx("div",{className:`${r["input-error"]}`,children:j.lastName}):null]})]}),e.jsxs("div",{className:r["edit-profile-container__form--row"],children:[e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-30"]}`,children:[e.jsxs("p",{children:[" ",m("date_of_birth")]}),e.jsx(he.LocalizationProvider,{dateAdapter:ke.AdapterMoment,children:e.jsx(he.DatePicker,{format:"Do MMM YYYY",value:i?.dateOfBirth&&!Se.DATE_MIN_VALUE.includes(i?.dateOfBirth)?Ce(i?.dateOfBirth):null,onChange:n=>{if(n){const _=n.format("YYYY-MM-DD");o("dateOfBirth",_)}else o("dateOfBirth",null)},slotProps:{textField:{variant:"outlined",id:"time-picker",className:`${r["profile-value"]}`},openPickerButton:{"aria-label":"change date"}}})})]}),e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-70"]}`,children:[e.jsxs("p",{children:[m("email")," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.TextField,{name:"email",variant:"outlined",className:`${r["profile-value"]}`,value:i?.email||"",onChange:n=>o("email",n.target.value)}),j.email&&y.email?e.jsx("div",{className:`${r["input-error"]}`,children:j.email}):null]})]}),e.jsxs("div",{style:{border:"1px solid #e0e0e0",borderRadius:"12px",marginBottom:"24px",overflow:"hidden"},children:[O&&e.jsx("div",{style:{backgroundColor:"#f8f9fa",padding:"16px 24px",borderBottom:"1px solid #e0e0e0"},children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]}`,style:{marginBottom:0,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsxs("p",{style:{marginBottom:4,fontWeight:600,fontSize:16},children:["School tier ",e.jsx("sup",{children:"*"})]}),e.jsx("p",{style:{fontSize:13,color:"#6c757d",marginTop:0,marginBottom:0},children:"Pick a tier. Roles are assigned per tier."})]}),e.jsxs(b.ToggleButtonGroup,{exclusive:!0,value:B,onChange:ce,size:"small",sx:{border:"1px solid #e0e0e0",borderRadius:"30px",padding:"4px",backgroundColor:"#fff","& .MuiToggleButton-root":{border:"none",borderRadius:"30px !important",textTransform:"none",padding:"6px 20px",margin:"0",color:"#6c757d",fontWeight:500,fontSize:14,"&.Mui-selected":{backgroundColor:"#2b65d9",color:"#fff","&:hover":{backgroundColor:"#1d4ed8"}}}},children:[e.jsx(b.ToggleButton,{value:"ms",disabled:!!u&&!p&&M,children:"Middle school"}),e.jsx(b.ToggleButton,{value:"es",disabled:!!u&&!le&&M,children:"Elementary"}),!M&&e.jsx(b.ToggleButton,{value:"both",disabled:!1,children:"Both"})]})]}),j.appTypes&&y.appTypes?e.jsx("div",{className:`${r["input-error"]}`,children:j.appTypes}):null]})}),e.jsx("div",{style:{backgroundColor:"#fff",padding:"24px"},children:e.jsxs("div",{className:r["edit-profile-container__form--row"],style:{margin:0},children:[Z&&ne("ES"),se&&ne("MS")]})})]}),e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsx("p",{children:m("status")}),e.jsx("div",{className:`${r.gender}`,children:qe.map(n=>e.jsxs("div",{className:`${r.gender__item}`,children:[e.jsx(b.Radio,{color:"primary",value:n.value,checked:i?.isActive===n.value,onChange:()=>o("isActive",n.value),disabled:!!u&&!!i?.isImportedFromIntegration}),n.label]},n.label))})]})}),M&&!u&&!!v&&e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]}`,children:[e.jsxs("p",{children:["Assign Teacher ",e.jsx("sup",{children:"*"})]}),e.jsx(b.Select,{multiple:!0,variant:"outlined",name:"teacherUserId",value:i?.teacherUserId||[],renderValue:n=>v.filter(_=>n.includes(_.value)).map(_=>_.label).join(", "),onChange:n=>{const _=n.target.value;o("teacherUserId",_),w(!!_.length)},className:`${r["profile-value"]}`,children:v?.map(n=>e.jsx(b.MenuItem,{value:n.value,children:n.label},n.value))}),!C&&e.jsx("div",{className:`${r["input-error"]}`,children:"Teacher is required"})]})}),M&&e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsxs("p",{children:[" ",z==="UK"?"Year":m("grade_level")," ",e.jsx("sup",{children:"*"})]}),e.jsxs(b.Select,{variant:"outlined",value:i?.gradeLevel??"",renderValue:n=>q(n),onChange:n=>o("gradeLevel",n.target.value),className:`${r["profile-value"]}`,children:[i?.gradeLevel&&!te.includes(i.gradeLevel)&&e.jsx(b.MenuItem,{value:i.gradeLevel,sx:{display:"none"},children:q(i.gradeLevel)},"__current__"),te.map(n=>e.jsx(b.MenuItem,{value:n,children:q(n)},n))]}),j.gradeLevel&&y.gradeLevel?e.jsx("div",{className:`${r["input-error"]}`,children:j.gradeLevel}):null]})}),!M&&(!!Y.length||!!W.length)&&!!u&&e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsx("p",{children:m("Map from Roster")}),e.jsx(Ge,{roles:[...Y,...W],value:i.sourcedId,onChange:n=>o("sourcedId",n)})]})}),e.jsxs("div",{className:r["edit-profile-container__form--btn-group"],children:[e.jsx("button",{type:"button",className:r["btn-cancel"],onClick:()=>l(),children:m("cancel")}),e.jsxs("button",{type:"button",className:r["btn-save"],onClick:()=>L(),children:[e.jsx(xe.DoneCheckInIcon,{color:"#fff"}),m("save_changes")]})]})]})}})]})},k={"input-error":"_input-error_gmvmh_1","change-password-container":"_change-password-container_gmvmh_6","change-password-container__title":"_change-password-container__title_gmvmh_11","change-password-container__form":"_change-password-container__form_gmvmh_19","change-password-container__form--field":"_change-password-container__form--field_gmvmh_24","change-password-container__form--description":"_change-password-container__form--description_gmvmh_38","change-password-container__form--btn-group":"_change-password-container__form--btn-group_gmvmh_54","btn-save":"_btn-save_gmvmh_60","btn-cancel":"_btn-cancel_gmvmh_82"},Ye=R.object({oldPassword:R.string().required("Old password is required"),newPassword:R.string().required("New password is required"),confirmedNewPassword:R.string().oneOf([R.ref("newPassword"),void 0],"New password must match").required("Confirm your new password")}),Je=({confirmChangePassword:t,goBack:a})=>{const{t:l}=c.useTranslation();return e.jsxs("div",{className:k["change-password-container"],children:[e.jsx("div",{className:k["change-password-container__title"],children:l("change_password")}),e.jsx(we.Formik,{initialValues:{oldPassword:"",newPassword:"",confirmedNewPassword:"",showOldPassword:!1,showNewPassword:!1,showConfirmNewPassword:!1},enableReinitialize:!0,onSubmit:v=>{t(v)},validateOnChange:!1,validateOnBlur:!1,validationSchema:Ye,children:v=>{const{values:h,setFieldValue:u,handleSubmit:C,errors:w,touched:U}=v,T=Object.keys(w);return T.length&&document.querySelector(`input[name=${T[0]}]`)?.scrollIntoView({behavior:"smooth",block:"center"}),e.jsxs("div",{className:k["change-password-container__form"],children:[e.jsxs("div",{className:`${k["change-password-container__form--field"]}`,children:[e.jsx("p",{children:l("old_password")}),e.jsx(x.FormControl,{variant:"outlined",className:`${k["input-field"]}`,children:e.jsx(x.OutlinedInput,{type:h.showOldPassword?"text":"password",value:h?.oldPassword,onChange:m=>u("oldPassword",m.target.value.trim()),endAdornment:e.jsx(x.InputAdornment,{position:"end",children:e.jsx(ue.IconButton,{"aria-label":"toggle password visibility",onClick:()=>u("showOldPassword",!h.showOldPassword),onMouseDown:m=>m.preventDefault(),children:h.showOldPassword?e.jsx(de.Visibility,{color:"primary"}):e.jsx(x.VisibilityOff,{color:"primary"})})})})}),w.oldPassword&&U.oldPassword&&e.jsx("div",{className:`${k["input-error"]}`,children:w.oldPassword})]}),e.jsxs("div",{className:`${k["change-password-container__form--field"]}`,children:[e.jsx("p",{children:l("new_password")}),e.jsx(x.FormControl,{variant:"outlined",className:`${k["input-field"]}`,children:e.jsx(x.OutlinedInput,{type:h.showNewPassword?"text":"password",value:h?.newPassword,onChange:m=>u("newPassword",m.target.value.trim()),endAdornment:e.jsx(x.InputAdornment,{position:"end",children:e.jsx(ue.IconButton,{"aria-label":"toggle password visibility",onClick:()=>u("showNewPassword",!h.showNewPassword),onMouseDown:m=>m.preventDefault(),children:h.showNewPassword?e.jsx(de.Visibility,{color:"primary"}):e.jsx(x.VisibilityOff,{color:"primary"})})})})}),w.newPassword&&U.newPassword&&e.jsx("div",{className:`${k["input-error"]}`,children:w.newPassword}),e.jsxs("div",{className:`${k["change-password-container__form--description"]}`,children:["Password must contain at least: 1 uppercase letter, 1 lowercase letter,",e.jsx("br",{})," 1 number, and 1 special character"]})]}),e.jsxs("div",{className:`${k["change-password-container__form--field"]}`,children:[e.jsx("p",{children:l("confirm_new_password")}),e.jsx(x.FormControl,{variant:"outlined",className:`${k["input-field"]}`,children:e.jsx(x.OutlinedInput,{type:h.showConfirmNewPassword?"text":"password",value:h?.confirmedNewPassword,onChange:m=>u("confirmedNewPassword",m.target.value.trim()),endAdornment:e.jsx(x.InputAdornment,{position:"end",children:e.jsx(ue.IconButton,{"aria-label":"toggle password visibility",onClick:()=>u("showConfirmNewPassword",!h.showConfirmNewPassword),onMouseDown:m=>m.preventDefault(),children:h.showConfirmNewPassword?e.jsx(de.Visibility,{color:"primary"}):e.jsx(x.VisibilityOff,{color:"primary"})})})})}),w.confirmedNewPassword&&U.confirmedNewPassword&&e.jsx("div",{className:`${k["input-error"]}`,children:w.confirmedNewPassword})]}),e.jsxs("div",{className:k["change-password-container__form--btn-group"],children:[e.jsx("button",{type:"button",className:k["btn-cancel"],onClick:()=>{a()},children:l("cancel")}),e.jsxs("button",{type:"button",className:k["btn-save"],onClick:()=>C(),children:[e.jsx(xe.DoneCheckInIcon,{color:"#fff"}),l("save_new_password")]})]})]})}})]})},Ke={id:"",firstName:"",lastName:"",email:"",dateOfBirth:Se.DATE_MIN_VALUE,msRoles:[],esRoles:[],isActive:!0,profileImageFileName:"",teacherUserId:[],gradeLevel:"",currentGradeLevel:"",isImportedFromIntegration:!1,appTypes:["MS"],preferredAppType:"MS"},ve="/admin/users/user-list",We="User detail",Xe=12,Ze=20,Qe=t=>{const a=ee.useDispatch(),l=be.useNavigate(),v=ee.useSelector(s=>s.common.user),h=ee.useSelector(s=>s.common?.defaultFontSize),[u,C]=f.useState(Ke),[w,U]=f.useState(null),[T,m]=f.useState(!1),[F,K]=f.useState({MS:[],ES:[]}),[O,q]=f.useState([]),[z,$]=f.useState(!1),[i,o]=f.useState(J.Info),[L,j]=f.useState(!0),[y,D]=f.useState({}),E=async()=>{localStorage.setItem(window.location.href,"true"),m(!0)},p=()=>{$(!z)},le=f.useMemo(()=>h==Ze?"font-large":h==Xe?"font-small":"",[h]);f.useEffect(()=>{document.title=We,m(!1),localStorage.getItem(window.location.href)&&localStorage.removeItem(window.location.href)},[]),f.useEffect(()=>{t&&W(),!t&&ae()},[t]);const Y=(s=[])=>s.includes("EduTeacher")?[...s.filter(d=>d!=="EduTeacher"),P.EDUTEACHER]:s,W=f.useCallback(async()=>{a(c.setLoading(!0));try{const s=await x.getByIdUser(t),d=(s.data.appTypeRaw||s.data.appType||"MS").toUpperCase(),g=d.includes("MS"),N=d.includes("ES"),I=g&&N?["MS","ES"]:N?["ES"]:["MS"],H=s.data.preferredAppType||d;C({...s.data,dateOfBirth:Re.format(new Date(s.data.dateOfBirth),c.DATE_FORMAT),msRoles:Y(s.data.msRoles),esRoles:Y(s.data.esRoles),currentGradeLevel:s.data.gradeLevel,appTypes:I,preferredAppType:H}),K({MS:s.data.msRoles??[],ES:s.data.esRoles??[]}),document.title=s.data?.fullName,g&&M("MS"),N&&M("ES")}catch(s){a(c.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}a(c.setLoading(!1))},[t]),M=f.useCallback(async s=>{a(c.setLoading(!0));try{const d=await x.userRoleHasDataApi(t,s);D(g=>({...g,[s]:d.data}))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}a(c.setLoading(!1))},[t]),B=f.useCallback(s=>{l(s&&typeof s=="string"?ve+`?query=${s}`:ve)},[]),se=s=>["Student","Parent","EduTeacher"].includes(s),Z=(s=[])=>s.includes(P.EDUTEACHER)?[...s.filter(d=>d!==P.EDUTEACHER),"EduTeacher"]:s,re=f.useCallback(async s=>{const d=s.msRoles?.includes(P.STUDENT)||s.esRoles?.includes(P.STUDENT);if(d&&!t&&!s.teacherUserId){j(!1);return}if(d&&s.gradeLevel){const g=s.msRoles?.includes(P.STUDENT),N=s.esRoles?.includes(P.STUDENT),I=s.preferredAppType,H=g&&!N?"MS":N&&!g?"ES":I==="MS"||I==="ES"?I:null,Q=H==="MS"?Ne:H==="ES"?ye:null;if(Q&&!Q.includes(s.gradeLevel)){a(c.setAlert({type:"danger",message:`Grade "${s.gradeLevel}" is not valid for ${H} students. Please select a new grade level.`}));return}}a(c.setLoading(!0));try{v?.hasEsSchool===!1&&(s.appTypes=["MS"],s.preferredAppType="MS",s.esRoles=[]);const g=t?x.update:x.create;!t&&delete s.id,s.teacherUserId=d?s.teacherUserId:[],s.msRoles=Z(s.msRoles),s.esRoles=Z(s.esRoles),t||(s.profileImageFileName=w||"");const N=await g(s);N&&x.getByIdUser(N.data.id).then(I=>{B(I.data.fullName)}),t||alert("Password of "+N.data.email+` is "${N.data.password}"`),a(c.setAlert({type:"success",message:`${t?"Update":"Create"} user successfully`}))}catch(g){a(c.setAlert({type:"danger",message:g.response?.data?.title||g.message}))}a(c.setLoading(!1))},[t,w]),te=async s=>{a(c.setLoading(!0));try{await x.changePassword(s),a(c.setAlert({type:"success",message:"Change password successfully"}))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}a(c.setLoading(!1))},ce=f.useCallback(async s=>{a(c.setLoading(!0));try{await x.forgotChangePassword(s),a(c.setAlert({type:"success",message:"Send forgot password link successfully"}))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message||"Error occured"}))}a(c.setLoading(!1))},[]),ae=async s=>{try{const d=await x.getTeachers({sortBy:"Email"},s);d.data&&q((d.data.map?.(g=>({label:g.email,value:g.id}))||[]).sort((g,N)=>g.label.localeCompare(N.label)))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}},ne=20097152,[n,_]=f.useState(""),V=s=>{s.preventDefault();let d=new FileReader,g=s.target.files[0];if(g.size>ne){a(c.setAlert({type:"danger",message:"File can't be larger than 2MB"}));return}d.onloadend=async()=>{if(_(d.result),g){const N=new FormData,{name:I}=g;N.append("file",g,I);const Q=(await x.systemProfileUpload(N))?.data?.key;t?await x.updateAvatarByAdminApi(u.id||"",Q):U(Q)}},g&&d.readAsDataURL(g)},G=async()=>{await x.updateAvatarByAdminApi(u.id||"",""),_("")},X=n||c.getFileUrl(u?.profileImageFileName),S=u?.profileImageFileName||"";return{userDetail:u,getDataTeachers:ae,backToList:B,confirmData:re,file:w,setFile:U,edited:T,currentRoles:F,setEdited:m,setEditedTrue:E,confirmChangePassword:te,forgotPasswordRequest:ce,handleDisableRoles:se,classFontSize:le,teacherOptions:O,handleToggleModel:p,openModel:z,user:v,activeTab:i,setActiveTab:o,imageSrc:X,imageUse:S,handleImageChange:V,handleDeleteAvatar:G,getFile:()=>{var s=window.location.origin+"/api/ExportDataUser/"+t;window.open(s)},checkHasTeacher:L,setCheckHasTeacher:j,userHasData:y}},es="/images/image-default.png",ss=()=>{const{id:t}=be.useParams(),{userDetail:a,getDataTeachers:l,backToList:v,confirmData:h,confirmChangePassword:u,forgotPasswordRequest:C,teacherOptions:w,user:U,activeTab:T,setActiveTab:m,imageSrc:F,handleImageChange:K,handleDeleteAvatar:O,getFile:q,currentRoles:z,handleDisableRoles:$,checkHasTeacher:i,setCheckHasTeacher:o,userHasData:L}=Qe(t),j=[{value:J.Info,component:e.jsx(ze,{id:t,goBack:v,userDetail:a,confirmData:h,teacherOptions:w,getDataTeachers:l,currentRoles:z,handleDisableRoles:$,checkHasTeacher:i,setCheckHasTeacher:o,userHasData:L})},{value:J.ChangePassword,component:e.jsx(Je,{confirmChangePassword:u,goBack:v})}],y=oe.find(p=>p.value===J.ForgotPassword),D=oe.find(p=>p.value===J.DownloadUserData),E=oe.find(p=>p.value===J.ChangePassword);return e.jsxs("div",{className:r["user-profile-container-admin"],children:[e.jsxs("div",{className:r["user-profile-container-admin__left"],children:[e.jsxs("div",{className:r["user-profile-container-admin__left--information"],children:[e.jsxs("div",{className:r["image-user-container"],children:[e.jsx(fe.Input,{className:"d-none",type:"file",id:"uploadFile",onChange:K,accept:"image/*"}),e.jsx("img",{src:F||c.getStaticFileUrl(es),alt:"avatar",className:`${r["image-user-container__image"]}`}),e.jsx(fe.Label,{htmlFor:"uploadFile",role:"button",tabIndex:0,children:e.jsx("div",{className:r["image-user-container__edit-btn"],children:e.jsx("img",{src:c.getStaticFileUrl("/images/user/Edit.svg"),alt:"edit-avatar"})})}),t&&e.jsx("button",{type:"button",onClick:()=>O(),className:r["image-user-container__delete-btn"],children:e.jsx("img",{src:c.getStaticFileUrl("/images/user/DeleteAvatar.svg"),alt:"delete-avatar"})})]}),e.jsxs("div",{className:r["name-role-container"],children:[e.jsx("div",{className:r.name,children:`${a?.firstName||""} ${a?.lastName||""}`}),e.jsx("div",{className:r.role,children:Array.from(new Set([...a?.msRoles||[],...a?.esRoles||[]])).map(p=>p==="SecondaryTeacher"?"Support Teacher":p).join(", ")})]})]}),e.jsxs("div",{className:r["user-profile-container-admin__left--btn-control"],children:[oe.filter(p=>p.isControl).map(p=>e.jsxs("button",{type:"button",className:`${r.item} ${T===p.value?r["item-active"]:""}`,onClick:()=>m(p.value),children:[e.jsx("img",{src:c.getStaticFileUrl(p.icon),alt:p.icon}),p.label]},p.value)),!!t&&!!E&&U?.id===t&&e.jsxs("button",{type:"button",className:`${r.item} ${T===E.value?r["item-active"]:""}`,onClick:()=>m(E.value),children:[e.jsx("img",{src:c.getStaticFileUrl(E.icon),alt:E.icon}),E.label]},E.value),t&&y&&e.jsxs("button",{type:"button",className:`${r.item} ${T===y.value?r["item-active"]:""}`,onClick:()=>C({email:a?.email||""}),children:[e.jsx("img",{src:c.getStaticFileUrl(y.icon),alt:y.icon}),y.label]},y.value),t&&D&&e.jsxs("button",{type:"button",className:`${r.item} ${T===D.value?r["item-active"]:""}`,onClick:()=>q(),children:[e.jsx("img",{src:c.getStaticFileUrl(D.icon),alt:D.icon}),D.label]},D.value)]})]}),e.jsx("div",{className:r["user-profile-container-admin__right"],children:j.find(p=>p.value===T)?.component})]})};exports.default=ss;
|
|
@@ -5,7 +5,7 @@ import { i as Te, c as He } from "./constants-DH_6jWvS.js";
|
|
|
5
5
|
import { useState as U, useCallback as Y, useEffect as se, useRef as Ve, useMemo as Ge } from "react";
|
|
6
6
|
import { useDispatch as ke, useSelector as Ne } from "react-redux";
|
|
7
7
|
import { Formik as Ue } from "formik";
|
|
8
|
-
import * as
|
|
8
|
+
import * as R from "yup";
|
|
9
9
|
import { Select as de, MenuItem as X, CircularProgress as je, TextField as pe, ToggleButtonGroup as ze, ToggleButton as fe, Radio as Ye, Checkbox as Je, ListItemText as Ke } from "@mui/material";
|
|
10
10
|
import { LocalizationProvider as We, DatePicker as Xe } from "@mui/x-date-pickers";
|
|
11
11
|
import Ze from "moment";
|
|
@@ -83,7 +83,7 @@ const ce = [
|
|
|
83
83
|
if (u === "MS") return "ms";
|
|
84
84
|
const w = (n || []).includes("MS");
|
|
85
85
|
return (n || []).includes("ES") && !w ? "es" : "ms";
|
|
86
|
-
},
|
|
86
|
+
}, P = {
|
|
87
87
|
EDUTEACHER: "General ED teacher",
|
|
88
88
|
STUDENT: "Student"
|
|
89
89
|
}, Nr = [
|
|
@@ -113,12 +113,12 @@ const ce = [
|
|
|
113
113
|
...Te ? ["12/13"] : [],
|
|
114
114
|
"13",
|
|
115
115
|
...He ? ["PCS"] : []
|
|
116
|
-
], Ie = ["K", "G", "1", "2", "3", "4", "5", ...Te ? ["6"] : []], Le = [...Te ? [] : ["6"], "7", "8", "9", "10", "11", "12", "12/13", "13", "PCS"],
|
|
117
|
-
firstName:
|
|
118
|
-
lastName:
|
|
119
|
-
email:
|
|
120
|
-
appTypes:
|
|
121
|
-
msRoles:
|
|
116
|
+
], Ie = ["K", "G", "1", "2", "3", "4", "5", ...Te ? ["6"] : []], Le = [...Te ? [] : ["6"], "7", "8", "9", "10", "11", "12", "12/13", "13", "PCS"], Re = ["Student"], yr = R.object({
|
|
117
|
+
firstName: R.string().required("First name is required"),
|
|
118
|
+
lastName: R.string().required("Last name is required"),
|
|
119
|
+
email: R.string().email("Email is invalid").required("Email is required"),
|
|
120
|
+
appTypes: R.array().of(R.string()).min(1, "School tier is required"),
|
|
121
|
+
msRoles: R.array().of(R.string()).test(
|
|
122
122
|
"ms-role-required",
|
|
123
123
|
"MS role is required",
|
|
124
124
|
(s, n) => {
|
|
@@ -126,7 +126,7 @@ const ce = [
|
|
|
126
126
|
return u !== "ms" && u !== "both" ? !0 : !!s && s.length > 0;
|
|
127
127
|
}
|
|
128
128
|
),
|
|
129
|
-
esRoles:
|
|
129
|
+
esRoles: R.array().of(R.string()).test(
|
|
130
130
|
"es-role-required",
|
|
131
131
|
"ES role is required",
|
|
132
132
|
(s, n) => {
|
|
@@ -134,7 +134,7 @@ const ce = [
|
|
|
134
134
|
return u !== "es" && u !== "both" ? !0 : !!s && s.length > 0;
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
|
-
gradeLevel:
|
|
137
|
+
gradeLevel: R.string().nullable().test(
|
|
138
138
|
"grade-level-required",
|
|
139
139
|
"Grade level is required",
|
|
140
140
|
(s, n) => {
|
|
@@ -146,11 +146,11 @@ const ce = [
|
|
|
146
146
|
currentPage: 1,
|
|
147
147
|
pageSize: 100
|
|
148
148
|
}, Cr = (s, n) => {
|
|
149
|
-
const [u, w] = U([]), [f, d] = U(!1), [T,
|
|
149
|
+
const [u, w] = U([]), [f, d] = U(!1), [T, g] = U(Tr), [$, y] = U(), m = ke(), O = Y(async () => {
|
|
150
150
|
d(!0);
|
|
151
151
|
try {
|
|
152
|
-
const
|
|
153
|
-
w(x(
|
|
152
|
+
const i = (await or(T)).data?.items || [];
|
|
153
|
+
w(x(i));
|
|
154
154
|
} catch {
|
|
155
155
|
m(I({
|
|
156
156
|
type: "error",
|
|
@@ -160,9 +160,9 @@ const ce = [
|
|
|
160
160
|
d(!1);
|
|
161
161
|
}, [JSON.stringify(T)]), Z = Y(async () => {
|
|
162
162
|
if (!n) return;
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
y(
|
|
163
|
+
const l = u.find((i) => i.value === n);
|
|
164
|
+
if (l) {
|
|
165
|
+
y(l);
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
d(!0);
|
|
@@ -172,22 +172,22 @@ const ce = [
|
|
|
172
172
|
label: B(F),
|
|
173
173
|
value: F.sourcedId
|
|
174
174
|
});
|
|
175
|
-
} catch (
|
|
176
|
-
console.log("err:",
|
|
175
|
+
} catch (i) {
|
|
176
|
+
console.log("err:", i);
|
|
177
177
|
}
|
|
178
178
|
d(!1);
|
|
179
|
-
}, [n]), x = (
|
|
180
|
-
label: B(
|
|
181
|
-
value:
|
|
182
|
-
})), B = (
|
|
183
|
-
const
|
|
184
|
-
return F && p.push(F), S && p.push(S), b && p.push(b), p.length &&
|
|
185
|
-
}, z = (
|
|
186
|
-
|
|
187
|
-
}, L = Y((
|
|
188
|
-
|
|
179
|
+
}, [n]), x = (l) => l.map((i) => ({
|
|
180
|
+
label: B(i),
|
|
181
|
+
value: i.sourcedId
|
|
182
|
+
})), B = (l) => {
|
|
183
|
+
const i = [], { givenName: F, middleName: S, familyName: b, email: D, role: C } = l, p = [];
|
|
184
|
+
return F && p.push(F), S && p.push(S), b && p.push(b), p.length && i.push(p.join(" ")), D && i.push(D), `${i.join(" - ")}${C ? ` (${C})` : ""}`;
|
|
185
|
+
}, z = (l) => {
|
|
186
|
+
g((i) => ({ ...i, searchString: l }));
|
|
187
|
+
}, L = Y((l) => {
|
|
188
|
+
g({
|
|
189
189
|
...T,
|
|
190
|
-
...
|
|
190
|
+
...l
|
|
191
191
|
});
|
|
192
192
|
}, [JSON.stringify(T)]);
|
|
193
193
|
return se(() => {
|
|
@@ -216,17 +216,17 @@ const ce = [
|
|
|
216
216
|
{
|
|
217
217
|
label: "Select user",
|
|
218
218
|
value: d?.value || "",
|
|
219
|
-
onChange: (
|
|
220
|
-
u(
|
|
219
|
+
onChange: (g) => {
|
|
220
|
+
u(g.target.value);
|
|
221
221
|
},
|
|
222
222
|
onOpen: () => T(""),
|
|
223
223
|
disabled: f,
|
|
224
224
|
className: `${lr["profile-value"]}`,
|
|
225
225
|
variant: "outlined",
|
|
226
|
-
children: f ? /* @__PURE__ */ e(X, { disabled: !0, children: /* @__PURE__ */ e(je, { size: 20 }) }) : w.length > 0 ? w.map((
|
|
226
|
+
children: f ? /* @__PURE__ */ e(X, { disabled: !0, children: /* @__PURE__ */ e(je, { size: 20 }) }) : w.length > 0 ? w.map((g) => /* @__PURE__ */ e(X, { value: g.value, children: `${g.label}` }, g.value)) : /* @__PURE__ */ e(X, { disabled: !0, children: "No users found" })
|
|
227
227
|
}
|
|
228
228
|
);
|
|
229
|
-
},
|
|
229
|
+
}, Rr = ({
|
|
230
230
|
userDetail: s,
|
|
231
231
|
confirmData: n,
|
|
232
232
|
goBack: u,
|
|
@@ -234,7 +234,7 @@ const ce = [
|
|
|
234
234
|
getDataTeachers: f,
|
|
235
235
|
id: d,
|
|
236
236
|
checkHasTeacher: T,
|
|
237
|
-
setCheckHasTeacher:
|
|
237
|
+
setCheckHasTeacher: g,
|
|
238
238
|
userHasData: $,
|
|
239
239
|
currentRoles: y
|
|
240
240
|
}) => {
|
|
@@ -251,25 +251,25 @@ const ce = [
|
|
|
251
251
|
},
|
|
252
252
|
validationSchema: yr,
|
|
253
253
|
children: (L) => {
|
|
254
|
-
const { values:
|
|
254
|
+
const { values: l, setFieldValue: i, handleSubmit: F, errors: S, touched: b } = L, D = Object.keys(S);
|
|
255
255
|
D.length && document.querySelector(`input[name=${D[0]}]`)?.scrollIntoView({
|
|
256
256
|
behavior: "smooth",
|
|
257
257
|
block: "center"
|
|
258
258
|
});
|
|
259
|
-
const C =
|
|
260
|
-
if (!
|
|
261
|
-
const H = Sr(
|
|
262
|
-
d ?
|
|
263
|
-
}, ie = (t) => (
|
|
264
|
-
const H =
|
|
259
|
+
const C = l?.appTypes || [], p = C.includes("MS"), me = C.includes("ES"), J = l?.msRoles || [], Q = l?.esRoles || [], M = J.includes(P.STUDENT) || Q.includes(P.STUDENT), q = x ? ye(l?.preferredAppType, C) : "ms", te = q === "ms" || q === "both", re = q === "es" || q === "both", ne = M ? q === "ms" ? "MS" : q === "es" ? "ES" : null : null, oe = ne === "MS" ? be.filter((t) => Le.includes(t)) : ne === "ES" ? be.filter((t) => Ie.includes(t)) : be, ue = (t, _) => {
|
|
260
|
+
if (!_) return;
|
|
261
|
+
const H = Sr(_), j = br(_);
|
|
262
|
+
d ? i("preferredAppType", j) : (i("appTypes", H), i("preferredAppType", j), M && (_ === "es" && i("msRoles", []), _ === "ms" && i("esRoles", []), f(_ === "both" ? "MS" : _.toUpperCase())));
|
|
263
|
+
}, ie = (t) => (_) => {
|
|
264
|
+
const H = _.target.value, j = t === "MS" ? "msRoles" : "esRoles", ee = t === "MS" ? "esRoles" : "msRoles", v = O.current, k = $?.[t] ?? {};
|
|
265
265
|
if (d && (k.isHasTeacherData && v === "Teacher" || k.isHasAssistantData && v === "Assistant" || k.isHasCounselorData && v === "Counselor" || k.isHasSecondaryTeacherData && v === "SecondaryTeacher" || v === "Student" && (k.isHasAssistantData || k.isHasCounselorData || k.isHasSecondaryTeacherData || k.isHasTeacherData))) {
|
|
266
266
|
alert("Please switch data before removing the role");
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
-
const r =
|
|
270
|
-
|
|
269
|
+
const r = l?.[j] || [], h = H.some((V) => Re.includes(V)) ? v && !r.includes(v) ? [v] : [H.find((V) => Re.includes(V))].filter(Boolean) : H, N = r.includes(P.STUDENT), A = h.includes(P.STUDENT);
|
|
270
|
+
i(j, h), O.current = null, A ? (i("preferredAppType", t), i(ee, []), d || (i("appTypes", [t]), f(t))) : N && !A && i(ee, []);
|
|
271
271
|
}, le = (t) => {
|
|
272
|
-
const
|
|
272
|
+
const _ = t === "MS" ? "msRoles" : "esRoles", H = t === "MS" ? J : Q, j = t === "MS" ? vr : wr, ee = y?.[t] || [];
|
|
273
273
|
return /* @__PURE__ */ o("div", { className: `${a["edit-profile-container__form--field"]} ${te && re ? a["edit-profile-container__form--width-50"] : ""}`, children: [
|
|
274
274
|
/* @__PURE__ */ o("p", { children: [
|
|
275
275
|
x && /* @__PURE__ */ e("span", { style: {
|
|
@@ -292,18 +292,18 @@ const ce = [
|
|
|
292
292
|
{
|
|
293
293
|
variant: "outlined",
|
|
294
294
|
multiple: !0,
|
|
295
|
-
name:
|
|
295
|
+
name: _,
|
|
296
296
|
value: H,
|
|
297
297
|
renderValue: (v) => v.map((k) => k === "SecondaryTeacher" ? "Support Teacher" : k).join(", "),
|
|
298
298
|
onChange: ie(t),
|
|
299
299
|
className: `${a["profile-value"]}`,
|
|
300
300
|
children: j.map((v) => {
|
|
301
|
-
const k = y?.MS?.includes(
|
|
301
|
+
const k = y?.MS?.includes(P.STUDENT) || y?.ES?.includes(P.STUDENT);
|
|
302
302
|
return /* @__PURE__ */ o(
|
|
303
303
|
X,
|
|
304
304
|
{
|
|
305
305
|
value: v,
|
|
306
|
-
disabled: d ? ee.some((r) => ["Student", "Parent", "General ED teacher"].includes(r)) || ["Parent"].includes(v) || !k && v ===
|
|
306
|
+
disabled: d ? ee.some((r) => ["Student", "Parent", "General ED teacher"].includes(r)) || ["Parent"].includes(v) || !k && v === P.STUDENT : ["Parent"].includes(v) || M && v !== P.STUDENT,
|
|
307
307
|
onClick: () => {
|
|
308
308
|
O.current = v;
|
|
309
309
|
},
|
|
@@ -317,7 +317,7 @@ const ce = [
|
|
|
317
317
|
})
|
|
318
318
|
}
|
|
319
319
|
),
|
|
320
|
-
S[
|
|
320
|
+
S[_] && b[_] ? /* @__PURE__ */ e("div", { className: `${a["input-error"]}`, children: S[_] }) : null
|
|
321
321
|
] });
|
|
322
322
|
};
|
|
323
323
|
return /* @__PURE__ */ o("div", { className: a["edit-profile-container__form"], children: [
|
|
@@ -333,8 +333,8 @@ const ce = [
|
|
|
333
333
|
{
|
|
334
334
|
name: "firstName",
|
|
335
335
|
variant: "outlined",
|
|
336
|
-
value:
|
|
337
|
-
onChange: (t) =>
|
|
336
|
+
value: l?.firstName || "",
|
|
337
|
+
onChange: (t) => i("firstName", t.target.value)
|
|
338
338
|
}
|
|
339
339
|
),
|
|
340
340
|
S.firstName && b.firstName ? /* @__PURE__ */ e("div", { className: `${a["input-error"]}`, children: S.firstName }) : null
|
|
@@ -351,8 +351,8 @@ const ce = [
|
|
|
351
351
|
name: "lastName",
|
|
352
352
|
variant: "outlined",
|
|
353
353
|
className: `${a["profile-value"]}`,
|
|
354
|
-
value:
|
|
355
|
-
onChange: (t) =>
|
|
354
|
+
value: l?.lastName || "",
|
|
355
|
+
onChange: (t) => i("lastName", t.target.value)
|
|
356
356
|
}
|
|
357
357
|
),
|
|
358
358
|
S.lastName && b.lastName ? /* @__PURE__ */ e("div", { className: `${a["input-error"]}`, children: S.lastName }) : null
|
|
@@ -368,13 +368,13 @@ const ce = [
|
|
|
368
368
|
Xe,
|
|
369
369
|
{
|
|
370
370
|
format: "Do MMM YYYY",
|
|
371
|
-
value:
|
|
371
|
+
value: l?.dateOfBirth && !$e.includes(l?.dateOfBirth) ? Ze(l?.dateOfBirth) : null,
|
|
372
372
|
onChange: (t) => {
|
|
373
373
|
if (t) {
|
|
374
|
-
const
|
|
375
|
-
|
|
374
|
+
const _ = t.format("YYYY-MM-DD");
|
|
375
|
+
i("dateOfBirth", _);
|
|
376
376
|
} else
|
|
377
|
-
|
|
377
|
+
i("dateOfBirth", null);
|
|
378
378
|
},
|
|
379
379
|
slotProps: {
|
|
380
380
|
textField: {
|
|
@@ -401,8 +401,8 @@ const ce = [
|
|
|
401
401
|
name: "email",
|
|
402
402
|
variant: "outlined",
|
|
403
403
|
className: `${a["profile-value"]}`,
|
|
404
|
-
value:
|
|
405
|
-
onChange: (t) =>
|
|
404
|
+
value: l?.email || "",
|
|
405
|
+
onChange: (t) => i("email", t.target.value)
|
|
406
406
|
}
|
|
407
407
|
),
|
|
408
408
|
S.email && b.email ? /* @__PURE__ */ e("div", { className: `${a["input-error"]}`, children: S.email }) : null
|
|
@@ -471,9 +471,9 @@ const ce = [
|
|
|
471
471
|
{
|
|
472
472
|
color: "primary",
|
|
473
473
|
value: t.value,
|
|
474
|
-
checked:
|
|
475
|
-
onChange: () =>
|
|
476
|
-
disabled: !!d && !!
|
|
474
|
+
checked: l?.isActive === t.value,
|
|
475
|
+
onChange: () => i("isActive", t.value),
|
|
476
|
+
disabled: !!d && !!l?.isImportedFromIntegration
|
|
477
477
|
}
|
|
478
478
|
),
|
|
479
479
|
t.label
|
|
@@ -490,11 +490,11 @@ const ce = [
|
|
|
490
490
|
multiple: !0,
|
|
491
491
|
variant: "outlined",
|
|
492
492
|
name: "teacherUserId",
|
|
493
|
-
value:
|
|
494
|
-
renderValue: (t) => w.filter((
|
|
493
|
+
value: l?.teacherUserId || [],
|
|
494
|
+
renderValue: (t) => w.filter((_) => t.includes(_.value)).map((_) => _.label).join(", "),
|
|
495
495
|
onChange: (t) => {
|
|
496
|
-
const
|
|
497
|
-
|
|
496
|
+
const _ = t.target.value;
|
|
497
|
+
i("teacherUserId", _), g(!!_.length);
|
|
498
498
|
},
|
|
499
499
|
className: `${a["profile-value"]}`,
|
|
500
500
|
children: w?.map((t) => /* @__PURE__ */ e(X, { value: t.value, children: t.label }, t.value))
|
|
@@ -513,12 +513,12 @@ const ce = [
|
|
|
513
513
|
de,
|
|
514
514
|
{
|
|
515
515
|
variant: "outlined",
|
|
516
|
-
value:
|
|
516
|
+
value: l?.gradeLevel ?? "",
|
|
517
517
|
renderValue: (t) => B(t),
|
|
518
|
-
onChange: (t) =>
|
|
518
|
+
onChange: (t) => i("gradeLevel", t.target.value),
|
|
519
519
|
className: `${a["profile-value"]}`,
|
|
520
520
|
children: [
|
|
521
|
-
|
|
521
|
+
l?.gradeLevel && !oe.includes(l.gradeLevel) && /* @__PURE__ */ e(X, { value: l.gradeLevel, sx: { display: "none" }, children: B(l.gradeLevel) }, "__current__"),
|
|
522
522
|
oe.map((t) => /* @__PURE__ */ e(X, { value: t, children: B(t) }, t))
|
|
523
523
|
]
|
|
524
524
|
}
|
|
@@ -531,8 +531,8 @@ const ce = [
|
|
|
531
531
|
Er,
|
|
532
532
|
{
|
|
533
533
|
roles: [...J, ...Q],
|
|
534
|
-
value:
|
|
535
|
-
onChange: (t) =>
|
|
534
|
+
value: l.sourcedId,
|
|
535
|
+
onChange: (t) => i("sourcedId", t)
|
|
536
536
|
}
|
|
537
537
|
)
|
|
538
538
|
] }) }),
|
|
@@ -574,10 +574,10 @@ const ce = [
|
|
|
574
574
|
"change-password-container__form--btn-group": "_change-password-container__form--btn-group_gmvmh_54",
|
|
575
575
|
"btn-save": "_btn-save_gmvmh_60",
|
|
576
576
|
"btn-cancel": "_btn-cancel_gmvmh_82"
|
|
577
|
-
},
|
|
578
|
-
oldPassword:
|
|
579
|
-
newPassword:
|
|
580
|
-
confirmedNewPassword:
|
|
577
|
+
}, Pr = R.object({
|
|
578
|
+
oldPassword: R.string().required("Old password is required"),
|
|
579
|
+
newPassword: R.string().required("New password is required"),
|
|
580
|
+
confirmedNewPassword: R.string().oneOf([R.ref("newPassword"), void 0], "New password must match").required("Confirm your new password")
|
|
581
581
|
}), Dr = ({ confirmChangePassword: s, goBack: n }) => {
|
|
582
582
|
const { t: u } = De();
|
|
583
583
|
return /* @__PURE__ */ o("div", { className: E["change-password-container"], children: [
|
|
@@ -599,9 +599,9 @@ const ce = [
|
|
|
599
599
|
},
|
|
600
600
|
validateOnChange: !1,
|
|
601
601
|
validateOnBlur: !1,
|
|
602
|
-
validationSchema:
|
|
602
|
+
validationSchema: Pr,
|
|
603
603
|
children: (w) => {
|
|
604
|
-
const { values: f, setFieldValue: d, handleSubmit: T, errors:
|
|
604
|
+
const { values: f, setFieldValue: d, handleSubmit: T, errors: g, touched: $ } = w, y = Object.keys(g);
|
|
605
605
|
return y.length && document.querySelector(
|
|
606
606
|
`input[name=${y[0]}]`
|
|
607
607
|
)?.scrollIntoView({
|
|
@@ -640,7 +640,7 @@ const ce = [
|
|
|
640
640
|
)
|
|
641
641
|
}
|
|
642
642
|
),
|
|
643
|
-
|
|
643
|
+
g.oldPassword && $.oldPassword && /* @__PURE__ */ e("div", { className: `${E["input-error"]}`, children: g.oldPassword })
|
|
644
644
|
] }),
|
|
645
645
|
/* @__PURE__ */ o("div", { className: `${E["change-password-container__form--field"]}`, children: [
|
|
646
646
|
/* @__PURE__ */ e("p", { children: u("new_password") }),
|
|
@@ -674,7 +674,7 @@ const ce = [
|
|
|
674
674
|
)
|
|
675
675
|
}
|
|
676
676
|
),
|
|
677
|
-
|
|
677
|
+
g.newPassword && $.newPassword && /* @__PURE__ */ e("div", { className: `${E["input-error"]}`, children: g.newPassword }),
|
|
678
678
|
/* @__PURE__ */ o("div", { className: `${E["change-password-container__form--description"]}`, children: [
|
|
679
679
|
"Password must contain at least: 1 uppercase letter, 1 lowercase letter,",
|
|
680
680
|
/* @__PURE__ */ e("br", {}),
|
|
@@ -713,7 +713,7 @@ const ce = [
|
|
|
713
713
|
)
|
|
714
714
|
}
|
|
715
715
|
),
|
|
716
|
-
|
|
716
|
+
g.confirmedNewPassword && $.confirmedNewPassword && /* @__PURE__ */ e("div", { className: `${E["input-error"]}`, children: g.confirmedNewPassword })
|
|
717
717
|
] }),
|
|
718
718
|
/* @__PURE__ */ o("div", { className: E["change-password-container__form--btn-group"], children: [
|
|
719
719
|
/* @__PURE__ */ e(
|
|
@@ -762,8 +762,8 @@ const ce = [
|
|
|
762
762
|
// Man tao moi mac dinh MS; man edit se duoc getData ghi de bang appType tu API
|
|
763
763
|
appTypes: ["MS"],
|
|
764
764
|
preferredAppType: "MS"
|
|
765
|
-
},
|
|
766
|
-
const n = ke(), u = dr(), w = Ne((r) => r.common.user), f = Ne((r) => r.common?.defaultFontSize), [d, T] = U(kr), [
|
|
765
|
+
}, Pe = "/admin/users/user-list", Ur = "User detail", $r = 12, Mr = 20, Ar = (s) => {
|
|
766
|
+
const n = ke(), u = dr(), w = Ne((r) => r.common.user), f = Ne((r) => r.common?.defaultFontSize), [d, T] = U(kr), [g, $] = U(null), [y, m] = U(!1), [O, Z] = U({ MS: [], ES: [] }), [x, B] = U([]), [z, L] = U(!1), [l, i] = U(W.Info), [F, S] = U(!0), [b, D] = U({}), C = async () => {
|
|
767
767
|
localStorage.setItem(window.location.href, "true"), m(!0);
|
|
768
768
|
}, p = () => {
|
|
769
769
|
L(!z);
|
|
@@ -773,7 +773,7 @@ const ce = [
|
|
|
773
773
|
}, []), se(() => {
|
|
774
774
|
s && Q(), !s && ie();
|
|
775
775
|
}, [s]);
|
|
776
|
-
const J = (r = []) => r.includes("EduTeacher") ? [...r.filter((c) => c !== "EduTeacher"),
|
|
776
|
+
const J = (r = []) => r.includes("EduTeacher") ? [...r.filter((c) => c !== "EduTeacher"), P.EDUTEACHER] : r, Q = Y(async () => {
|
|
777
777
|
n(G(!0));
|
|
778
778
|
try {
|
|
779
779
|
const r = await Ce(s), c = (r.data.appTypeRaw || r.data.appType || "MS").toUpperCase(), h = c.includes("MS"), N = c.includes("ES"), A = h && N ? ["MS", "ES"] : N ? ["ES"] : ["MS"], V = r.data.preferredAppType || c;
|
|
@@ -810,16 +810,16 @@ const ce = [
|
|
|
810
810
|
}
|
|
811
811
|
n(G(!1));
|
|
812
812
|
}, [s]), q = Y((r) => {
|
|
813
|
-
u(r && typeof r == "string" ?
|
|
814
|
-
}, []), te = (r) => ["Student", "Parent", "EduTeacher"].includes(r), re = (r = []) => r.includes(
|
|
813
|
+
u(r && typeof r == "string" ? Pe + `?query=${r}` : Pe);
|
|
814
|
+
}, []), te = (r) => ["Student", "Parent", "EduTeacher"].includes(r), re = (r = []) => r.includes(P.EDUTEACHER) ? [...r.filter((c) => c !== P.EDUTEACHER), "EduTeacher"] : r, ne = Y(
|
|
815
815
|
async (r) => {
|
|
816
|
-
const c = r.msRoles?.includes(
|
|
816
|
+
const c = r.msRoles?.includes(P.STUDENT) || r.esRoles?.includes(P.STUDENT);
|
|
817
817
|
if (c && !s && !r.teacherUserId) {
|
|
818
818
|
S(!1);
|
|
819
819
|
return;
|
|
820
820
|
}
|
|
821
821
|
if (c && r.gradeLevel) {
|
|
822
|
-
const h = r.msRoles?.includes(
|
|
822
|
+
const h = r.msRoles?.includes(P.STUDENT), N = r.esRoles?.includes(P.STUDENT), A = r.preferredAppType, V = h && !N ? "MS" : N && !h ? "ES" : A === "MS" || A === "ES" ? A : null, ae = V === "MS" ? Le : V === "ES" ? Ie : null;
|
|
823
823
|
if (ae && !ae.includes(r.gradeLevel)) {
|
|
824
824
|
n(
|
|
825
825
|
I({
|
|
@@ -834,7 +834,7 @@ const ce = [
|
|
|
834
834
|
try {
|
|
835
835
|
w?.hasEsSchool === !1 && (r.appTypes = ["MS"], r.preferredAppType = "MS", r.esRoles = []);
|
|
836
836
|
const h = s ? er : rr;
|
|
837
|
-
!s && delete r.id, r.teacherUserId = c ? r.teacherUserId : [], r.msRoles = re(r.msRoles), r.esRoles = re(r.esRoles), s || (r.profileImageFileName =
|
|
837
|
+
!s && delete r.id, r.teacherUserId = c ? r.teacherUserId : [], r.msRoles = re(r.msRoles), r.esRoles = re(r.esRoles), s || (r.profileImageFileName = g || "");
|
|
838
838
|
const N = await h(r);
|
|
839
839
|
N && Ce(N.data.id).then((A) => {
|
|
840
840
|
q(A.data.fullName);
|
|
@@ -854,7 +854,7 @@ const ce = [
|
|
|
854
854
|
}
|
|
855
855
|
n(G(!1));
|
|
856
856
|
},
|
|
857
|
-
[s,
|
|
857
|
+
[s, g]
|
|
858
858
|
), oe = async (r) => {
|
|
859
859
|
n(G(!0));
|
|
860
860
|
try {
|
|
@@ -910,7 +910,7 @@ const ce = [
|
|
|
910
910
|
})
|
|
911
911
|
);
|
|
912
912
|
}
|
|
913
|
-
}, le = 20097152, [t,
|
|
913
|
+
}, le = 20097152, [t, _] = U(""), H = (r) => {
|
|
914
914
|
r.preventDefault();
|
|
915
915
|
let c = new FileReader(), h = r.target.files[0];
|
|
916
916
|
if (h.size > le) {
|
|
@@ -923,7 +923,7 @@ const ce = [
|
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
c.onloadend = async () => {
|
|
926
|
-
if (
|
|
926
|
+
if (_(c.result), h) {
|
|
927
927
|
const N = new FormData(), { name: A } = h;
|
|
928
928
|
N.append("file", h, A);
|
|
929
929
|
const ae = (await tr(N))?.data?.key;
|
|
@@ -931,14 +931,14 @@ const ce = [
|
|
|
931
931
|
}
|
|
932
932
|
}, h && c.readAsDataURL(h);
|
|
933
933
|
}, j = async () => {
|
|
934
|
-
await Ee(d.id || "", ""),
|
|
934
|
+
await Ee(d.id || "", ""), _("");
|
|
935
935
|
}, ee = t || qe(d?.profileImageFileName), v = d?.profileImageFileName || "";
|
|
936
936
|
return {
|
|
937
937
|
userDetail: d,
|
|
938
938
|
getDataTeachers: ie,
|
|
939
939
|
backToList: q,
|
|
940
940
|
confirmData: ne,
|
|
941
|
-
file:
|
|
941
|
+
file: g,
|
|
942
942
|
setFile: $,
|
|
943
943
|
edited: y,
|
|
944
944
|
currentRoles: O,
|
|
@@ -952,8 +952,8 @@ const ce = [
|
|
|
952
952
|
handleToggleModel: p,
|
|
953
953
|
openModel: z,
|
|
954
954
|
user: w,
|
|
955
|
-
activeTab:
|
|
956
|
-
setActiveTab:
|
|
955
|
+
activeTab: l,
|
|
956
|
+
setActiveTab: i,
|
|
957
957
|
imageSrc: ee,
|
|
958
958
|
imageUse: v,
|
|
959
959
|
handleImageChange: H,
|
|
@@ -974,7 +974,7 @@ const ce = [
|
|
|
974
974
|
confirmData: f,
|
|
975
975
|
confirmChangePassword: d,
|
|
976
976
|
forgotPasswordRequest: T,
|
|
977
|
-
teacherOptions:
|
|
977
|
+
teacherOptions: g,
|
|
978
978
|
user: $,
|
|
979
979
|
activeTab: y,
|
|
980
980
|
setActiveTab: m,
|
|
@@ -984,25 +984,25 @@ const ce = [
|
|
|
984
984
|
getFile: B,
|
|
985
985
|
currentRoles: z,
|
|
986
986
|
handleDisableRoles: L,
|
|
987
|
-
checkHasTeacher:
|
|
988
|
-
setCheckHasTeacher:
|
|
987
|
+
checkHasTeacher: l,
|
|
988
|
+
setCheckHasTeacher: i,
|
|
989
989
|
userHasData: F
|
|
990
990
|
} = Ar(s), S = [
|
|
991
991
|
{
|
|
992
992
|
value: W.Info,
|
|
993
993
|
component: /* @__PURE__ */ e(
|
|
994
|
-
|
|
994
|
+
Rr,
|
|
995
995
|
{
|
|
996
996
|
id: s,
|
|
997
997
|
goBack: w,
|
|
998
998
|
userDetail: n,
|
|
999
999
|
confirmData: f,
|
|
1000
|
-
teacherOptions:
|
|
1000
|
+
teacherOptions: g,
|
|
1001
1001
|
getDataTeachers: u,
|
|
1002
1002
|
currentRoles: z,
|
|
1003
1003
|
handleDisableRoles: L,
|
|
1004
|
-
checkHasTeacher:
|
|
1005
|
-
setCheckHasTeacher:
|
|
1004
|
+
checkHasTeacher: l,
|
|
1005
|
+
setCheckHasTeacher: i,
|
|
1006
1006
|
userHasData: F
|
|
1007
1007
|
}
|
|
1008
1008
|
)
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("mario-core"),n=require("@ag-grid-enterprise/core"),e=require("react"),t=e.lazy(()=>Promise.resolve().then(()=>require("./ConferenceRubricList-CASLPVnE.cjs"))),s=e.lazy(()=>Promise.resolve().then(()=>require("./ConferenceRubricDetail-OS4gA4Sr.cjs"))),i=e.lazy(()=>Promise.resolve().then(()=>require("./LearningStrategyList-c9ut_ZBs.cjs"))),a=e.lazy(()=>Promise.resolve().then(()=>require("./SetupContainer-Dlgw2pUp.cjs"))),l=e.lazy(()=>Promise.resolve().then(()=>require("./QuestionBankList-CrB0n_-u.cjs"))),u=e.lazy(()=>Promise.resolve().then(()=>require("./ReflectionContainer-T8k3ipxn.cjs"))),m=e.lazy(()=>Promise.resolve().then(()=>require("./QuestionDetail-C1huYVsZ.cjs"))),y=e.lazy(()=>Promise.resolve().then(()=>require("./SubjectList-DBvEGKQs.cjs"))),c=e.lazy(()=>Promise.resolve().then(()=>require("./LearningSupportCategoryList-BpCRx0CF.cjs"))),v=e.lazy(()=>Promise.resolve().then(()=>require("./BadgeList-DHs-Rsvu.cjs"))),h=e.lazy(()=>Promise.resolve().then(()=>require("./GoalExampleList-DdkEu4hA.cjs"))),P=e.lazy(()=>Promise.resolve().then(()=>require("./TutorialScreenContainer-Cc7pBhl5.cjs"))),q=e.lazy(()=>Promise.resolve().then(()=>require("./QuestionBankContainer-Bjh5LiB1.cjs"))),z=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyQuestionContainer-lvaQ6LER.cjs"))),S=e.lazy(()=>Promise.resolve().then(()=>require("./SessionTemplateDetail-B9-wcCpc.cjs"))),d=e.lazy(()=>Promise.resolve().then(()=>require("./CustomAlertList-DyMS-_v3.cjs"))),C=e.lazy(()=>Promise.resolve().then(()=>require("./AssetLog-Bexcnjvn.cjs"))),g=e.lazy(()=>Promise.resolve().then(()=>require("./Dashboard-C_bWclkh.cjs"))),p=e.lazy(()=>Promise.resolve().then(()=>require("./AdminTraining-CFhKwWEu.cjs"))),A=e.lazy(()=>Promise.resolve().then(()=>require("./TemplateContainer-wVMb1knJ.cjs"))),L=e.lazy(()=>Promise.resolve().then(()=>require("./OneRosterContainer-BHDMzC1V.cjs"))),D=e.lazy(()=>Promise.resolve().then(()=>require("./SandboxContainer-2xT8qr0Z.cjs"))),b=e.lazy(()=>Promise.resolve().then(()=>require("./TemplateBuilderPage-RtTtRDYv.cjs"))),Q=e.lazy(()=>Promise.resolve().then(()=>require("./TemplateStartBuild-L-GJIKx5.cjs"))),T=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyDashboardContainer-BUEboxID.cjs"))),W=e.lazy(()=>Promise.resolve().then(()=>require("./RevertUser-BQszWVGK.cjs"))),f=e.lazy(()=>Promise.resolve().then(()=>require("./CustomQuestionAlert-BbN6ShBA.cjs"))),R=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyDetailAdmin-Btnac5NT.cjs"))),k=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyStudentFlagListAdmin-DSGCH2PN.cjs"))),B=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyResultAdmin-CzirC-Qm.cjs"))),F=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyIndexAdmin-CgU2eWIM.cjs"))),I=e.lazy(()=>Promise.resolve().then(()=>require("./CreateSurveyAdminV2-BlYltowD.cjs"))),M=e.lazy(()=>Promise.resolve().then(()=>require("./PreviewSurveyAdmin-B3v7Zjyd.cjs"))),E=e.lazy(()=>Promise.resolve().then(()=>require("./ExternalApi-C9QAZfYm.cjs"))),x=e.lazy(()=>Promise.resolve().then(()=>require("./WeeklyQuest-B_Vw_BP5.cjs"))),O=e.lazy(()=>Promise.resolve().then(()=>require("./SettingWeeklyQuest-CDi1sio0.cjs"))),w=e.lazy(()=>Promise.resolve().then(()=>require("./HomePage-yRsfaYmw.cjs"))),G=e.lazy(()=>Promise.resolve().then(()=>require("./MainLayoutAdmin--2z3EG_v.cjs"))),V=e.lazy(()=>Promise.resolve().then(()=>require("./SyncData-C2Shc7Al.cjs"))),H=e.lazy(()=>Promise.resolve().then(()=>require("./SummarizeQuestion-DlZVirqY.cjs"))),U=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyQuestion-C4P3HZol.cjs"))),j=e.lazy(()=>Promise.resolve().then(()=>require("./MarioAi-BbsGO3rP.cjs"))),K=e.lazy(()=>Promise.resolve().then(()=>require("./AIMario-DP2HBmgn.cjs"))),N=e.lazy(()=>Promise.resolve().then(()=>require("./ChatWithAI-DtF5_ldy.cjs"))),_=e.lazy(()=>Promise.resolve().then(()=>require("./ViewHistoryPrompt-B4hPzqM-.cjs"))),$=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyPortal-plPFzllO.cjs"))),J=e.lazy(()=>Promise.resolve().then(()=>require("./ConversationGoal-DpXDZc4j.cjs"))),X=e.lazy(()=>Promise.resolve().then(()=>require("./FrequencyAndSetup-CUIllgRW.cjs"))),Y=e.lazy(()=>Promise.resolve().then(()=>require("./FrequencyAndSetupV2-Bh8ZTZV0.cjs"))),Z=e.lazy(()=>Promise.resolve().then(()=>require("./DesignatedStaff-CDI3_ImT.cjs"))),ee=e.lazy(()=>Promise.resolve().then(()=>require("./WellBeingDashboard-L35Tvoj1.cjs"))),re=e.lazy(()=>Promise.resolve().then(()=>require("./OpenFieldWellbeingQuestion-BmzycV1N.cjs"))),oe=e.lazy(()=>Promise.resolve().then(()=>require("./MyProfile-2gO2puMv.cjs"))),ne=e.lazy(()=>Promise.resolve().then(()=>require("./UserProfileManagement-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("mario-core"),n=require("@ag-grid-enterprise/core"),e=require("react"),t=e.lazy(()=>Promise.resolve().then(()=>require("./ConferenceRubricList-CASLPVnE.cjs"))),s=e.lazy(()=>Promise.resolve().then(()=>require("./ConferenceRubricDetail-OS4gA4Sr.cjs"))),i=e.lazy(()=>Promise.resolve().then(()=>require("./LearningStrategyList-c9ut_ZBs.cjs"))),a=e.lazy(()=>Promise.resolve().then(()=>require("./SetupContainer-Dlgw2pUp.cjs"))),l=e.lazy(()=>Promise.resolve().then(()=>require("./QuestionBankList-CrB0n_-u.cjs"))),u=e.lazy(()=>Promise.resolve().then(()=>require("./ReflectionContainer-T8k3ipxn.cjs"))),m=e.lazy(()=>Promise.resolve().then(()=>require("./QuestionDetail-C1huYVsZ.cjs"))),y=e.lazy(()=>Promise.resolve().then(()=>require("./SubjectList-DBvEGKQs.cjs"))),c=e.lazy(()=>Promise.resolve().then(()=>require("./LearningSupportCategoryList-BpCRx0CF.cjs"))),v=e.lazy(()=>Promise.resolve().then(()=>require("./BadgeList-DHs-Rsvu.cjs"))),h=e.lazy(()=>Promise.resolve().then(()=>require("./GoalExampleList-DdkEu4hA.cjs"))),P=e.lazy(()=>Promise.resolve().then(()=>require("./TutorialScreenContainer-Cc7pBhl5.cjs"))),q=e.lazy(()=>Promise.resolve().then(()=>require("./QuestionBankContainer-Bjh5LiB1.cjs"))),z=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyQuestionContainer-lvaQ6LER.cjs"))),S=e.lazy(()=>Promise.resolve().then(()=>require("./SessionTemplateDetail-B9-wcCpc.cjs"))),d=e.lazy(()=>Promise.resolve().then(()=>require("./CustomAlertList-DyMS-_v3.cjs"))),C=e.lazy(()=>Promise.resolve().then(()=>require("./AssetLog-Bexcnjvn.cjs"))),g=e.lazy(()=>Promise.resolve().then(()=>require("./Dashboard-C_bWclkh.cjs"))),p=e.lazy(()=>Promise.resolve().then(()=>require("./AdminTraining-CFhKwWEu.cjs"))),A=e.lazy(()=>Promise.resolve().then(()=>require("./TemplateContainer-wVMb1knJ.cjs"))),L=e.lazy(()=>Promise.resolve().then(()=>require("./OneRosterContainer-BHDMzC1V.cjs"))),D=e.lazy(()=>Promise.resolve().then(()=>require("./SandboxContainer-2xT8qr0Z.cjs"))),b=e.lazy(()=>Promise.resolve().then(()=>require("./TemplateBuilderPage-RtTtRDYv.cjs"))),Q=e.lazy(()=>Promise.resolve().then(()=>require("./TemplateStartBuild-L-GJIKx5.cjs"))),T=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyDashboardContainer-BUEboxID.cjs"))),W=e.lazy(()=>Promise.resolve().then(()=>require("./RevertUser-BQszWVGK.cjs"))),f=e.lazy(()=>Promise.resolve().then(()=>require("./CustomQuestionAlert-BbN6ShBA.cjs"))),R=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyDetailAdmin-Btnac5NT.cjs"))),k=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyStudentFlagListAdmin-DSGCH2PN.cjs"))),B=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyResultAdmin-CzirC-Qm.cjs"))),F=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyIndexAdmin-CgU2eWIM.cjs"))),I=e.lazy(()=>Promise.resolve().then(()=>require("./CreateSurveyAdminV2-BlYltowD.cjs"))),M=e.lazy(()=>Promise.resolve().then(()=>require("./PreviewSurveyAdmin-B3v7Zjyd.cjs"))),E=e.lazy(()=>Promise.resolve().then(()=>require("./ExternalApi-C9QAZfYm.cjs"))),x=e.lazy(()=>Promise.resolve().then(()=>require("./WeeklyQuest-B_Vw_BP5.cjs"))),O=e.lazy(()=>Promise.resolve().then(()=>require("./SettingWeeklyQuest-CDi1sio0.cjs"))),w=e.lazy(()=>Promise.resolve().then(()=>require("./HomePage-yRsfaYmw.cjs"))),G=e.lazy(()=>Promise.resolve().then(()=>require("./MainLayoutAdmin--2z3EG_v.cjs"))),V=e.lazy(()=>Promise.resolve().then(()=>require("./SyncData-C2Shc7Al.cjs"))),H=e.lazy(()=>Promise.resolve().then(()=>require("./SummarizeQuestion-DlZVirqY.cjs"))),U=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyQuestion-C4P3HZol.cjs"))),j=e.lazy(()=>Promise.resolve().then(()=>require("./MarioAi-BbsGO3rP.cjs"))),K=e.lazy(()=>Promise.resolve().then(()=>require("./AIMario-DP2HBmgn.cjs"))),N=e.lazy(()=>Promise.resolve().then(()=>require("./ChatWithAI-DtF5_ldy.cjs"))),_=e.lazy(()=>Promise.resolve().then(()=>require("./ViewHistoryPrompt-B4hPzqM-.cjs"))),$=e.lazy(()=>Promise.resolve().then(()=>require("./SurveyPortal-plPFzllO.cjs"))),J=e.lazy(()=>Promise.resolve().then(()=>require("./ConversationGoal-DpXDZc4j.cjs"))),X=e.lazy(()=>Promise.resolve().then(()=>require("./FrequencyAndSetup-CUIllgRW.cjs"))),Y=e.lazy(()=>Promise.resolve().then(()=>require("./FrequencyAndSetupV2-Bh8ZTZV0.cjs"))),Z=e.lazy(()=>Promise.resolve().then(()=>require("./DesignatedStaff-CDI3_ImT.cjs"))),ee=e.lazy(()=>Promise.resolve().then(()=>require("./WellBeingDashboard-L35Tvoj1.cjs"))),re=e.lazy(()=>Promise.resolve().then(()=>require("./OpenFieldWellbeingQuestion-BmzycV1N.cjs"))),oe=e.lazy(()=>Promise.resolve().then(()=>require("./MyProfile-2gO2puMv.cjs"))),ne=e.lazy(()=>Promise.resolve().then(()=>require("./UserProfileManagement-BAiMhCFW.cjs"))),te=e.lazy(()=>Promise.resolve().then(()=>require("./EditFlagCard-rD3j6Ni2.cjs"))),se=e.lazy(()=>Promise.resolve().then(()=>require("./ConversationTarget-Mq_yWdg5.cjs"))),ie=e.lazy(()=>Promise.resolve().then(()=>require("./TeacherConversations-ViMew8lQ.cjs")).then(r=>r.TeacherConversations$1)),ae=e.lazy(()=>Promise.resolve().then(()=>require("./index-BInIBoT7.cjs"))),le=e.lazy(()=>Promise.resolve().then(()=>require("./index-PdnV-xwV.cjs"))),ue=e.lazy(()=>Promise.resolve().then(()=>require("./DashboardWrapper-BqcF82EB.cjs"))),me=e.lazy(()=>Promise.resolve().then(()=>require("./FlagAlertWrapper-D1doALtZ.cjs"))),ye=e.lazy(()=>Promise.resolve().then(()=>require("./PersonalLearningPlansWrapper-PHtgR0pM.cjs"))),ce=e.lazy(()=>Promise.resolve().then(()=>require("./SentEmailLogs-BBGOSb-p.cjs"))),ve=e.lazy(()=>Promise.resolve().then(()=>require("./CheckInChangeLogs-4A0wuITI.cjs")));n.LicenseManager.setLicenseKey(o.LICENSE_AGGRID);exports.AIMario=K;exports.AdminTraining=p;exports.AssetLog=C;exports.BadgeList=v;exports.ChatWithAI=N;exports.CheckInChangeLogs=ve;exports.CheckInSetup=ae;exports.ConferenceRubricDetail=s;exports.ConferenceRubricList=t;exports.ConversationGoal=J;exports.ConversationTarget=se;exports.CreateSurveyAdminV2=I;exports.CustomAlertList=d;exports.CustomQuestionAlert=f;exports.Dashboard=g;exports.DashboardWrapper=ue;exports.DesignatedStaff=Z;exports.EditFlagCard=te;exports.ExternalApi=E;exports.FlagAlertWrapper=me;exports.FrequencyAndSetup=X;exports.FrequencyAndSetupV2=Y;exports.GoalExampleList=h;exports.HomePage=w;exports.LearningStrategyList=i;exports.LearningSupportCategoryList=c;exports.MainLayoutAdmin=G;exports.MarioAi=j;exports.MyProfile=oe;exports.OneRosterContainer=L;exports.OpenFieldWellbeingQuestion=re;exports.Overview=le;exports.PersonalLearningPlansWrapper=ye;exports.PreviewSurveyAdmin=M;exports.QuestionBankContainer=q;exports.QuestionBankList=l;exports.QuestionDetail=m;exports.ReflectionContainer=u;exports.RevertUser=W;exports.SandboxContainer=D;exports.SentEmailLogs=ce;exports.SessionTemplateDetail=S;exports.SettingWeeklyQuest=O;exports.SetupContainer=a;exports.SubjectList=y;exports.SummarizeQuestion=H;exports.SurveyDashboardContainer=T;exports.SurveyDetailAdmin=R;exports.SurveyIndexAdmin=F;exports.SurveyPortal=$;exports.SurveyQuestion=U;exports.SurveyQuestionContainer=z;exports.SurveyResultAdmin=B;exports.SurveyStudentFlagListAdmin=k;exports.SyncData=V;exports.TeacherConversations=ie;exports.TemplateBuilderPage=b;exports.TemplateContainer=A;exports.TemplateStartBuild=Q;exports.TutorialScreenContainer=P;exports.UserProfileManagement=ne;exports.ViewHistoryPrompt=_;exports.WeeklyQuest=x;exports.WellBeingDashboard=ee;
|
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LICENSE_AGGRID as n } from "mario-core";
|
|
2
2
|
import { LicenseManager as r } from "@ag-grid-enterprise/core";
|
|
3
3
|
import { lazy as t } from "react";
|
|
4
|
-
const m = t(() => import("./ConferenceRubricList-BMS__Zhg.js")), p = t(() => import("./ConferenceRubricDetail-MyH6jFQI.js")), c = t(() => import("./LearningStrategyList-CXDUExaq.js")), a = t(() => import("./SetupContainer-CyG0WZ46.js")), u = t(() => import("./QuestionBankList-DJifni6K.js")), l = t(() => import("./ReflectionContainer-DYumB3DG.js")), S = t(() => import("./QuestionDetail-Qz55g64f.js")), d = t(() => import("./SubjectList-ewa6hXBk.js")), C = t(() => import("./LearningSupportCategoryList-BmFj6dul.js")), g = t(() => import("./BadgeList-DUEUMpRP.js")), y = t(() => import("./GoalExampleList-DwoJ0Zn_.js")), A = t(() => import("./TutorialScreenContainer-BIhGp5Xb.js")), L = t(() => import("./QuestionBankContainer-CKs40aJ0.js")), v = t(() => import("./SurveyQuestionContainer-CR9012Ys.js")), h = t(() => import("./SessionTemplateDetail-Y0ShCfW-.js")), D = t(() => import("./CustomAlertList-CYJe8i2n.js")), b = t(() => import("./AssetLog-9i4_srMc.js")), f = t(() => import("./Dashboard-DGKxw9FZ.js")), Q = t(() => import("./AdminTraining-BS64lsyg.js")), P = t(() => import("./TemplateContainer-CPK7IVP1.js")), T = t(() => import("./OneRosterContainer-DeHIE93G.js")), W = t(() => import("./SandboxContainer-DmPlQa8l.js")), I = t(() => import("./TemplateBuilderPage-DzJLw-Su.js")), R = t(() => import("./TemplateStartBuild-naD1Xn49.js")), k = t(() => import("./SurveyDashboardContainer-FLqSP6wY.js")), B = t(() => import("./RevertUser-bHci1c1Z.js")), E = t(() => import("./CustomQuestionAlert-DUSI_Zbg.js")), F = t(() => import("./SurveyDetailAdmin-Dl_9mCaR.js")), M = t(() => import("./SurveyStudentFlagListAdmin-DO29YV8P.js")), x = t(() => import("./SurveyResultAdmin-Bc2G7dsf.js")), G = t(() => import("./SurveyIndexAdmin-BDFnlGk-.js")), w = t(() => import("./CreateSurveyAdminV2-X7yQ1GAa.js")), O = t(() => import("./PreviewSurveyAdmin-w0miZTli.js")), V = t(() => import("./ExternalApi-CFsQM9Kw.js")), q = t(() => import("./WeeklyQuest-D8B5Fw-0.js")), z = t(() => import("./SettingWeeklyQuest-D61948jR.js")), H = t(() => import("./HomePage-C5wbVAdx.js")), U = t(() => import("./MainLayoutAdmin-Dqmx6m4X.js")), j = t(() => import("./SyncData-BTSEX_ZA.js")), K = t(() => import("./SummarizeQuestion-DYFtUnI_.js")), N = t(() => import("./SurveyQuestion-CeCF5uB3.js")), _ = t(() => import("./MarioAi-ChMlmmc2.js")), J = t(() => import("./AIMario-Bk_MPYou.js")), X = t(() => import("./ChatWithAI-CQE0lUHi.js")), Y = t(() => import("./ViewHistoryPrompt-C9GP8vwn.js")), Z = t(() => import("./SurveyPortal-B8XniK_9.js")), $ = t(() => import("./ConversationGoal-CPtGyH13.js")), tt = t(() => import("./FrequencyAndSetup-Codhil9J.js")), ot = t(() => import("./FrequencyAndSetupV2-vgfDY55i.js")), nt = t(() => import("./DesignatedStaff-tuZkULQ_.js")), rt = t(() => import("./WellBeingDashboard-0Dmuv4-I.js")), it = t(() => import("./OpenFieldWellbeingQuestion-D1GEWxta.js")), et = t(() => import("./MyProfile-CXOYxjGH.js")), st = t(() => import("./UserProfileManagement-
|
|
4
|
+
const m = t(() => import("./ConferenceRubricList-BMS__Zhg.js")), p = t(() => import("./ConferenceRubricDetail-MyH6jFQI.js")), c = t(() => import("./LearningStrategyList-CXDUExaq.js")), a = t(() => import("./SetupContainer-CyG0WZ46.js")), u = t(() => import("./QuestionBankList-DJifni6K.js")), l = t(() => import("./ReflectionContainer-DYumB3DG.js")), S = t(() => import("./QuestionDetail-Qz55g64f.js")), d = t(() => import("./SubjectList-ewa6hXBk.js")), C = t(() => import("./LearningSupportCategoryList-BmFj6dul.js")), g = t(() => import("./BadgeList-DUEUMpRP.js")), y = t(() => import("./GoalExampleList-DwoJ0Zn_.js")), A = t(() => import("./TutorialScreenContainer-BIhGp5Xb.js")), L = t(() => import("./QuestionBankContainer-CKs40aJ0.js")), v = t(() => import("./SurveyQuestionContainer-CR9012Ys.js")), h = t(() => import("./SessionTemplateDetail-Y0ShCfW-.js")), D = t(() => import("./CustomAlertList-CYJe8i2n.js")), b = t(() => import("./AssetLog-9i4_srMc.js")), f = t(() => import("./Dashboard-DGKxw9FZ.js")), Q = t(() => import("./AdminTraining-BS64lsyg.js")), P = t(() => import("./TemplateContainer-CPK7IVP1.js")), T = t(() => import("./OneRosterContainer-DeHIE93G.js")), W = t(() => import("./SandboxContainer-DmPlQa8l.js")), I = t(() => import("./TemplateBuilderPage-DzJLw-Su.js")), R = t(() => import("./TemplateStartBuild-naD1Xn49.js")), k = t(() => import("./SurveyDashboardContainer-FLqSP6wY.js")), B = t(() => import("./RevertUser-bHci1c1Z.js")), E = t(() => import("./CustomQuestionAlert-DUSI_Zbg.js")), F = t(() => import("./SurveyDetailAdmin-Dl_9mCaR.js")), M = t(() => import("./SurveyStudentFlagListAdmin-DO29YV8P.js")), x = t(() => import("./SurveyResultAdmin-Bc2G7dsf.js")), G = t(() => import("./SurveyIndexAdmin-BDFnlGk-.js")), w = t(() => import("./CreateSurveyAdminV2-X7yQ1GAa.js")), O = t(() => import("./PreviewSurveyAdmin-w0miZTli.js")), V = t(() => import("./ExternalApi-CFsQM9Kw.js")), q = t(() => import("./WeeklyQuest-D8B5Fw-0.js")), z = t(() => import("./SettingWeeklyQuest-D61948jR.js")), H = t(() => import("./HomePage-C5wbVAdx.js")), U = t(() => import("./MainLayoutAdmin-Dqmx6m4X.js")), j = t(() => import("./SyncData-BTSEX_ZA.js")), K = t(() => import("./SummarizeQuestion-DYFtUnI_.js")), N = t(() => import("./SurveyQuestion-CeCF5uB3.js")), _ = t(() => import("./MarioAi-ChMlmmc2.js")), J = t(() => import("./AIMario-Bk_MPYou.js")), X = t(() => import("./ChatWithAI-CQE0lUHi.js")), Y = t(() => import("./ViewHistoryPrompt-C9GP8vwn.js")), Z = t(() => import("./SurveyPortal-B8XniK_9.js")), $ = t(() => import("./ConversationGoal-CPtGyH13.js")), tt = t(() => import("./FrequencyAndSetup-Codhil9J.js")), ot = t(() => import("./FrequencyAndSetupV2-vgfDY55i.js")), nt = t(() => import("./DesignatedStaff-tuZkULQ_.js")), rt = t(() => import("./WellBeingDashboard-0Dmuv4-I.js")), it = t(() => import("./OpenFieldWellbeingQuestion-D1GEWxta.js")), et = t(() => import("./MyProfile-CXOYxjGH.js")), st = t(() => import("./UserProfileManagement-EnPmJt_-.js")), mt = t(() => import("./EditFlagCard-BLYcaAv6.js")), pt = t(() => import("./ConversationTarget-BlgNqH-d.js")), ct = t(() => import("./TeacherConversations-CcicZLxW.js").then((o) => o.b)), at = t(() => import("./index-DYSiXaEC.js")), ut = t(() => import("./index-MU7h3m42.js")), lt = t(() => import("./DashboardWrapper-CxXistlm.js")), St = t(() => import("./FlagAlertWrapper-BuheeP2f.js")), dt = t(() => import("./PersonalLearningPlansWrapper-Dl0A1m8C.js")), Ct = t(() => import("./SentEmailLogs-nlpEbxgt.js")), gt = t(() => import("./CheckInChangeLogs-BjAVIu0t.js"));
|
|
5
5
|
r.setLicenseKey(n);
|
|
6
6
|
export {
|
|
7
7
|
J as AIMario,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mario-education",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.269-staging",
|
|
4
4
|
"description": "Contains education components && functions for BRSS Mario project",
|
|
5
5
|
"author": "brss",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"formik": "^2.4.9",
|
|
66
66
|
"html2canvas": "^1.4.1",
|
|
67
67
|
"jspdf": "^3.0.4",
|
|
68
|
-
"mario-core": "2.0.
|
|
68
|
+
"mario-core": "2.0.197-staging",
|
|
69
69
|
"moment": "^2.29.4",
|
|
70
70
|
"papaparse": "^5.5.2",
|
|
71
71
|
"pusher-js": "^7.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),fe=require("reactstrap"),c=require("mario-core"),ie=require("./constants-DfnEgLPg.cjs"),f=require("react"),ee=require("react-redux"),we=require("formik"),Te=require("yup"),b=require("@mui/material"),he=require("@mui/x-date-pickers"),Ce=require("moment"),x=require("./OutlinedInput-BjTQ2gUe.cjs"),Se=require("./constants-9UnXcqo8.cjs"),xe=require("./DoneCheckInIcon-7Q31KvHI.cjs"),ge=require("./userService-DsbgpY7L.cjs"),Ee=require("./styles.module-CHKJJ8Zm.cjs"),ke=require("./AdapterMoment-B-q0UCj0.cjs"),de=require("./Visibility-8udu2NF7.cjs"),ue=require("./IconButton-CqDyeB-N.cjs"),be=require("react-router-dom"),Pe=require("date-fns");function De(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const l in t)if(l!=="default"){const _=Object.getOwnPropertyDescriptor(t,l);Object.defineProperty(a,l,_.get?_:{enumerable:!0,get:()=>t[l]})}}return a.default=t,Object.freeze(a)}const P=De(Te),Re="_name_1koi9_205",Ue="_role_1koi9_217",Ae="_item_1koi9_230",Me="_gender_1koi9_323",Ie="_gender__item_1koi9_328",r={"profile-value":"_profile-value_1koi9_77","input-error":"_input-error_1koi9_94","user-profile-container-admin":"_user-profile-container-admin_1koi9_122","user-profile-container-admin__left":"_user-profile-container-admin__left_1koi9_135","user-profile-container-admin__left--information":"_user-profile-container-admin__left--information_1koi9_146","image-user-container":"_image-user-container_1koi9_154","image-user-container__image":"_image-user-container__image_1koi9_169","image-user-container__edit-btn":"_image-user-container__edit-btn_1koi9_176","image-user-container__delete-btn":"_image-user-container__delete-btn_1koi9_190","name-role-container":"_name-role-container_1koi9_205",name:Re,role:Ue,"user-profile-container-admin__left--btn-control":"_user-profile-container-admin__left--btn-control_1koi9_224",item:Ae,"item-active":"_item-active_1koi9_246","user-profile-container-admin__right":"_user-profile-container-admin__right_1koi9_274","edit-profile-container":"_edit-profile-container_1koi9_285","edit-profile-container__title":"_edit-profile-container__title_1koi9_290","edit-profile-container__form":"_edit-profile-container__form_1koi9_297","edit-profile-container__form--row":"_edit-profile-container__form--row_1koi9_302","edit-profile-container__form--field":"_edit-profile-container__form--field_1koi9_307",gender:Me,gender__item:Ie,"edit-profile-container__form--width-50":"_edit-profile-container__form--width-50_1koi9_334","edit-profile-container__form--width-30":"_edit-profile-container__form--width-30_1koi9_337","edit-profile-container__form--width-70":"_edit-profile-container__form--width-70_1koi9_340","edit-profile-container__form--btn-group":"_edit-profile-container__form--btn-group_1koi9_343","btn-save":"_btn-save_1koi9_349","btn-cancel":"_btn-cancel_1koi9_371"};var J=(t=>(t.Info="info",t.ForgotPassword="forgotPassword",t.DownloadUserData="downloadUserData",t.ChangePassword="changePassword",t))(J||{});const oe=[{value:"info",label:"Personal Information",icon:"/images/user/User.svg",isControl:!0},{value:"changePassword",label:"Change Password",icon:"/images/user/Lock.svg",isControl:!1},{value:"forgotPassword",label:"Send Forgot Password Link",icon:"/images/user/Lock.svg",isControl:!1},{value:"downloadUserData",label:"Download User Data",icon:"/images/user/Log-out.svg",isControl:!1}],je=["Admin","Assistant","Teacher","Counselor","General ED teacher","SecondaryTeacher","Parent","Student"],$e=je,Le=je.filter(t=>t!=="SecondaryTeacher"),Fe=t=>t==="both"?["MS","ES"]:[t.toUpperCase()],Oe=t=>t==="both"?"ES, MS":t.toUpperCase(),pe=(t,a)=>{const l=(t||"").toUpperCase();if(l==="ES, MS")return"both";if(l==="ES")return"es";if(l==="MS")return"ms";const _=(a||[]).includes("MS");return(a||[]).includes("ES")&&!_?"es":"ms"},D={EDUTEACHER:"General ED teacher",STUDENT:"Student"},qe=[{value:!0,label:"Active"},{value:!1,label:"Inactive"}],me=["K","G","1","2","3","4","5","6","7","8","9","10","11","12",...ie.isMalvernCollege?["12/13"]:[],"13",...ie.isSaisSchool?["PCS"]:[]],ye=["K","G","1","2","3","4","5",...ie.isMalvernCollege?["6"]:[]],Ne=[...ie.isMalvernCollege?[]:["6"],"7","8","9","10","11","12","12/13","13","PCS"],_e=["Student"],Be=P.object({firstName:P.string().required("First name is required"),lastName:P.string().required("Last name is required"),email:P.string().email("Email is invalid").required("Email is required"),appTypes:P.array().of(P.string()).min(1,"School tier is required"),msRoles:P.array().of(P.string()).test("ms-role-required","MS role is required",(t,a)=>{const l=pe(a.parent.preferredAppType,a.parent.appTypes);return l!=="ms"&&l!=="both"?!0:!!t&&t.length>0}),esRoles:P.array().of(P.string()).test("es-role-required","ES role is required",(t,a)=>{const l=pe(a.parent.preferredAppType,a.parent.appTypes);return l!=="es"&&l!=="both"?!0:!!t&&t.length>0}),gradeLevel:P.string().nullable().test("grade-level-required","Grade level is required",(t,a)=>{const l=a.parent.msRoles||[],_=a.parent.esRoles||[];return l.includes("Student")||_.includes("Student")?!!t:!0})}),Ve={currentPage:1,pageSize:100},He=(t,a)=>{const[l,_]=f.useState([]),[h,u]=f.useState(!1),[C,v]=f.useState(Ve),[A,T]=f.useState(),m=ee.useDispatch(),F=f.useCallback(async()=>{u(!0);try{const i=(await ge.getRosterUsersApi(C)).data?.items||[];_(O(i))}catch{m(c.setAlert({type:"error",message:"Cannot get roster users"}))}u(!1)},[JSON.stringify(C)]),K=f.useCallback(async()=>{if(!a)return;const o=l.find(i=>i.value===a);if(o){T(o);return}u(!0);try{const L=(await ge.getRosterUserBySourcedIdApi(a)).data;T({label:q(L),value:L.sourcedId})}catch(i){console.log("err:",i)}u(!1)},[a]),O=o=>o.map(i=>({label:q(i),value:i.sourcedId})),q=o=>{const i=[],{givenName:L,middleName:j,familyName:y,email:R,role:E}=o,p=[];return L&&p.push(L),j&&p.push(j),y&&p.push(y),p.length&&i.push(p.join(" ")),R&&i.push(R),`${i.join(" - ")}${E?` (${E})`:""}`},z=o=>{v(i=>({...i,searchString:o}))},$=f.useCallback(o=>{v({...C,...o})},[JSON.stringify(C)]);return f.useEffect(()=>{C.roles?.length&&F()},[JSON.stringify(C)]),f.useEffect(()=>{$({roles:t})},[JSON.stringify(t)]),f.useEffect(()=>{K()},[a]),{users:l,isLoading:h,user:A,handleInputChange:z}},Ge=({value:t,roles:a,onChange:l})=>{const{users:_,isLoading:h,user:u,handleInputChange:C}=He(a,t);return e.jsx(b.Select,{label:"Select user",value:u?.value||"",onChange:v=>{l(v.target.value)},onOpen:()=>C(""),disabled:h,className:`${Ee.styles["profile-value"]}`,variant:"outlined",children:h?e.jsx(b.MenuItem,{disabled:!0,children:e.jsx(b.CircularProgress,{size:20})}):_.length>0?_.map(v=>e.jsx(b.MenuItem,{value:v.value,children:`${v.label}`},v.value)):e.jsx(b.MenuItem,{disabled:!0,children:"No users found"})})},ze=({userDetail:t,confirmData:a,goBack:l,teacherOptions:_,getDataTeachers:h,id:u,checkHasTeacher:C,setCheckHasTeacher:v,userHasData:A,currentRoles:T})=>{const{t:m}=c.useTranslation(),F=f.useRef(null),O=ee.useSelector($=>$.common.user)?.hasEsSchool!==!1,{getLabel:q,system:z}=c.useGradeLabel();return e.jsxs("div",{className:r["edit-profile-container"],children:[e.jsx("div",{className:r["edit-profile-container__title"],children:`${u?"Edit User Profile":"Create User"}`}),e.jsx(we.Formik,{initialValues:t,enableReinitialize:!0,onSubmit:$=>{a($)},validationSchema:Be,children:$=>{const{values:o,setFieldValue:i,handleSubmit:L,errors:j,touched:y}=$,R=Object.keys(j);R.length&&document.querySelector(`input[name=${R[0]}]`)?.scrollIntoView({behavior:"smooth",block:"center"});const E=o?.appTypes||[],p=E.includes("MS"),le=E.includes("ES"),Y=o?.msRoles||[],W=o?.esRoles||[],M=Y.includes(D.STUDENT)||W.includes(D.STUDENT),B=O?pe(o?.preferredAppType,E):"ms",se=B==="ms"||B==="both",Z=B==="es"||B==="both",re=M?B==="ms"?"MS":B==="es"?"ES":null:null,te=re==="MS"?me.filter(n=>Ne.includes(n)):re==="ES"?me.filter(n=>ye.includes(n)):me,ce=(n,w)=>{if(!w)return;const V=Fe(w),G=Oe(w);u?i("preferredAppType",G):(i("appTypes",V),i("preferredAppType",G),M&&h(w==="both"?"MS":w.toUpperCase()))},ae=n=>w=>{const V=w.target.value,G=n==="MS"?"msRoles":"esRoles",X=n==="MS"?"esRoles":"msRoles",S=F.current,U=A?.[n]??{};if(u&&(U.isHasTeacherData&&S==="Teacher"||U.isHasAssistantData&&S==="Assistant"||U.isHasCounselorData&&S==="Counselor"||U.isHasSecondaryTeacherData&&S==="SecondaryTeacher"||S==="Student"&&(U.isHasAssistantData||U.isHasCounselorData||U.isHasSecondaryTeacherData||U.isHasTeacherData))){alert("Please switch data before removing the role");return}const s=o?.[G]||[],g=V.some(H=>_e.includes(H))?S&&!s.includes(S)?[S]:[V.find(H=>_e.includes(H))].filter(Boolean):V,N=s.includes(D.STUDENT),I=g.includes(D.STUDENT);i(G,g),F.current=null,I?(i("preferredAppType",n),i(X,[D.STUDENT]),u||(i("appTypes",[n]),h(n))):N&&!I&&i(X,[])},ne=n=>{const w=n==="MS"?"msRoles":"esRoles",V=n==="MS"?Y:W,G=n==="MS"?$e:Le,X=T?.[n]||[];return e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${se&&Z?r["edit-profile-container__form--width-50"]:""}`,children:[e.jsxs("p",{children:[O&&e.jsx("span",{style:{display:"inline-block",fontSize:11,fontWeight:700,color:"#3b4ba8",backgroundColor:"#e9ecfb",borderRadius:4,padding:"1px 6px",marginRight:6,verticalAlign:"middle"},children:n}),O?n==="MS"?"Middle school roles":"Elementary school roles":"Roles"," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.Select,{variant:"outlined",multiple:!0,name:w,value:V,renderValue:S=>S.map(U=>U==="SecondaryTeacher"?"Support Teacher":U).join(", "),onChange:ae(n),className:`${r["profile-value"]}`,children:G.map(S=>{const U=T?.MS?.includes(D.STUDENT)||T?.ES?.includes(D.STUDENT);return e.jsxs(b.MenuItem,{value:S,disabled:u?X.some(s=>["Student","Parent","General ED teacher"].includes(s))||["Parent"].includes(S)||!U&&S===D.STUDENT:["Parent"].includes(S)||M&&S!==D.STUDENT,onClick:()=>{F.current=S},children:[e.jsx(b.Checkbox,{checked:V.includes(S)}),e.jsx(b.ListItemText,{primary:S==="SecondaryTeacher"?"Support Teacher":S})]},S)})}),j[w]&&y[w]?e.jsx("div",{className:`${r["input-error"]}`,children:j[w]}):null]})};return e.jsxs("div",{className:r["edit-profile-container__form"],children:[e.jsxs("div",{className:r["edit-profile-container__form--row"],children:[e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsxs("p",{children:[m("first_name")," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.TextField,{name:"firstName",variant:"outlined",value:o?.firstName||"",onChange:n=>i("firstName",n.target.value)}),j.firstName&&y.firstName?e.jsx("div",{className:`${r["input-error"]}`,children:j.firstName}):null]}),e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsxs("p",{children:[m("last_name")," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.TextField,{name:"lastName",variant:"outlined",className:`${r["profile-value"]}`,value:o?.lastName||"",onChange:n=>i("lastName",n.target.value)}),j.lastName&&y.lastName?e.jsx("div",{className:`${r["input-error"]}`,children:j.lastName}):null]})]}),e.jsxs("div",{className:r["edit-profile-container__form--row"],children:[e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-30"]}`,children:[e.jsxs("p",{children:[" ",m("date_of_birth")]}),e.jsx(he.LocalizationProvider,{dateAdapter:ke.AdapterMoment,children:e.jsx(he.DatePicker,{format:"Do MMM YYYY",value:o?.dateOfBirth&&!Se.DATE_MIN_VALUE.includes(o?.dateOfBirth)?Ce(o?.dateOfBirth):null,onChange:n=>{if(n){const w=n.format("YYYY-MM-DD");i("dateOfBirth",w)}else i("dateOfBirth",null)},slotProps:{textField:{variant:"outlined",id:"time-picker",className:`${r["profile-value"]}`},openPickerButton:{"aria-label":"change date"}}})})]}),e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-70"]}`,children:[e.jsxs("p",{children:[m("email")," ",e.jsx("sup",{children:"*"})]}),e.jsx(b.TextField,{name:"email",variant:"outlined",className:`${r["profile-value"]}`,value:o?.email||"",onChange:n=>i("email",n.target.value)}),j.email&&y.email?e.jsx("div",{className:`${r["input-error"]}`,children:j.email}):null]})]}),e.jsxs("div",{style:{border:"1px solid #e0e0e0",borderRadius:"12px",marginBottom:"24px",overflow:"hidden"},children:[O&&e.jsx("div",{style:{backgroundColor:"#f8f9fa",padding:"16px 24px",borderBottom:"1px solid #e0e0e0"},children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]}`,style:{marginBottom:0,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsxs("p",{style:{marginBottom:4,fontWeight:600,fontSize:16},children:["School tier ",e.jsx("sup",{children:"*"})]}),e.jsx("p",{style:{fontSize:13,color:"#6c757d",marginTop:0,marginBottom:0},children:"Pick a tier. Roles are assigned per tier."})]}),e.jsxs(b.ToggleButtonGroup,{exclusive:!0,value:B,onChange:ce,size:"small",sx:{border:"1px solid #e0e0e0",borderRadius:"30px",padding:"4px",backgroundColor:"#fff","& .MuiToggleButton-root":{border:"none",borderRadius:"30px !important",textTransform:"none",padding:"6px 20px",margin:"0",color:"#6c757d",fontWeight:500,fontSize:14,"&.Mui-selected":{backgroundColor:"#2b65d9",color:"#fff","&:hover":{backgroundColor:"#1d4ed8"}}}},children:[e.jsx(b.ToggleButton,{value:"ms",disabled:!!u&&!p&&M,children:"Middle school"}),e.jsx(b.ToggleButton,{value:"es",disabled:!!u&&!le&&M,children:"Elementary"}),!M&&e.jsx(b.ToggleButton,{value:"both",disabled:!1,children:"Both"})]})]}),j.appTypes&&y.appTypes?e.jsx("div",{className:`${r["input-error"]}`,children:j.appTypes}):null]})}),e.jsx("div",{style:{backgroundColor:"#fff",padding:"24px"},children:e.jsxs("div",{className:r["edit-profile-container__form--row"],style:{margin:0},children:[Z&&ne("ES"),se&&ne("MS")]})})]}),e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsx("p",{children:m("status")}),e.jsx("div",{className:`${r.gender}`,children:qe.map(n=>e.jsxs("div",{className:`${r.gender__item}`,children:[e.jsx(b.Radio,{color:"primary",value:n.value,checked:o?.isActive===n.value,onChange:()=>i("isActive",n.value),disabled:!!u&&!!o?.isImportedFromIntegration}),n.label]},n.label))})]})}),M&&!u&&!!_&&e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]}`,children:[e.jsxs("p",{children:["Assign Teacher ",e.jsx("sup",{children:"*"})]}),e.jsx(b.Select,{multiple:!0,variant:"outlined",name:"teacherUserId",value:o?.teacherUserId||[],renderValue:n=>_.filter(w=>n.includes(w.value)).map(w=>w.label).join(", "),onChange:n=>{const w=n.target.value;i("teacherUserId",w),v(!!w.length)},className:`${r["profile-value"]}`,children:_?.map(n=>e.jsx(b.MenuItem,{value:n.value,children:n.label},n.value))}),!C&&e.jsx("div",{className:`${r["input-error"]}`,children:"Teacher is required"})]})}),M&&e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsxs("p",{children:[" ",z==="UK"?"Year":m("grade_level")," ",e.jsx("sup",{children:"*"})]}),e.jsxs(b.Select,{variant:"outlined",value:o?.gradeLevel??"",renderValue:n=>q(n),onChange:n=>i("gradeLevel",n.target.value),className:`${r["profile-value"]}`,children:[o?.gradeLevel&&!te.includes(o.gradeLevel)&&e.jsx(b.MenuItem,{value:o.gradeLevel,sx:{display:"none"},children:q(o.gradeLevel)},"__current__"),te.map(n=>e.jsx(b.MenuItem,{value:n,children:q(n)},n))]}),j.gradeLevel&&y.gradeLevel?e.jsx("div",{className:`${r["input-error"]}`,children:j.gradeLevel}):null]})}),!M&&(!!Y.length||!!W.length)&&!!u&&e.jsx("div",{className:r["edit-profile-container__form--row"],children:e.jsxs("div",{className:`${r["edit-profile-container__form--field"]} ${r["edit-profile-container__form--width-50"]}`,children:[e.jsx("p",{children:m("Map from Roster")}),e.jsx(Ge,{roles:[...Y,...W],value:o.sourcedId,onChange:n=>i("sourcedId",n)})]})}),e.jsxs("div",{className:r["edit-profile-container__form--btn-group"],children:[e.jsx("button",{type:"button",className:r["btn-cancel"],onClick:()=>l(),children:m("cancel")}),e.jsxs("button",{type:"button",className:r["btn-save"],onClick:()=>L(),children:[e.jsx(xe.DoneCheckInIcon,{color:"#fff"}),m("save_changes")]})]})]})}})]})},k={"input-error":"_input-error_gmvmh_1","change-password-container":"_change-password-container_gmvmh_6","change-password-container__title":"_change-password-container__title_gmvmh_11","change-password-container__form":"_change-password-container__form_gmvmh_19","change-password-container__form--field":"_change-password-container__form--field_gmvmh_24","change-password-container__form--description":"_change-password-container__form--description_gmvmh_38","change-password-container__form--btn-group":"_change-password-container__form--btn-group_gmvmh_54","btn-save":"_btn-save_gmvmh_60","btn-cancel":"_btn-cancel_gmvmh_82"},Ye=P.object({oldPassword:P.string().required("Old password is required"),newPassword:P.string().required("New password is required"),confirmedNewPassword:P.string().oneOf([P.ref("newPassword"),void 0],"New password must match").required("Confirm your new password")}),Je=({confirmChangePassword:t,goBack:a})=>{const{t:l}=c.useTranslation();return e.jsxs("div",{className:k["change-password-container"],children:[e.jsx("div",{className:k["change-password-container__title"],children:l("change_password")}),e.jsx(we.Formik,{initialValues:{oldPassword:"",newPassword:"",confirmedNewPassword:"",showOldPassword:!1,showNewPassword:!1,showConfirmNewPassword:!1},enableReinitialize:!0,onSubmit:_=>{t(_)},validateOnChange:!1,validateOnBlur:!1,validationSchema:Ye,children:_=>{const{values:h,setFieldValue:u,handleSubmit:C,errors:v,touched:A}=_,T=Object.keys(v);return T.length&&document.querySelector(`input[name=${T[0]}]`)?.scrollIntoView({behavior:"smooth",block:"center"}),e.jsxs("div",{className:k["change-password-container__form"],children:[e.jsxs("div",{className:`${k["change-password-container__form--field"]}`,children:[e.jsx("p",{children:l("old_password")}),e.jsx(x.FormControl,{variant:"outlined",className:`${k["input-field"]}`,children:e.jsx(x.OutlinedInput,{type:h.showOldPassword?"text":"password",value:h?.oldPassword,onChange:m=>u("oldPassword",m.target.value.trim()),endAdornment:e.jsx(x.InputAdornment,{position:"end",children:e.jsx(ue.IconButton,{"aria-label":"toggle password visibility",onClick:()=>u("showOldPassword",!h.showOldPassword),onMouseDown:m=>m.preventDefault(),children:h.showOldPassword?e.jsx(de.Visibility,{color:"primary"}):e.jsx(x.VisibilityOff,{color:"primary"})})})})}),v.oldPassword&&A.oldPassword&&e.jsx("div",{className:`${k["input-error"]}`,children:v.oldPassword})]}),e.jsxs("div",{className:`${k["change-password-container__form--field"]}`,children:[e.jsx("p",{children:l("new_password")}),e.jsx(x.FormControl,{variant:"outlined",className:`${k["input-field"]}`,children:e.jsx(x.OutlinedInput,{type:h.showNewPassword?"text":"password",value:h?.newPassword,onChange:m=>u("newPassword",m.target.value.trim()),endAdornment:e.jsx(x.InputAdornment,{position:"end",children:e.jsx(ue.IconButton,{"aria-label":"toggle password visibility",onClick:()=>u("showNewPassword",!h.showNewPassword),onMouseDown:m=>m.preventDefault(),children:h.showNewPassword?e.jsx(de.Visibility,{color:"primary"}):e.jsx(x.VisibilityOff,{color:"primary"})})})})}),v.newPassword&&A.newPassword&&e.jsx("div",{className:`${k["input-error"]}`,children:v.newPassword}),e.jsxs("div",{className:`${k["change-password-container__form--description"]}`,children:["Password must contain at least: 1 uppercase letter, 1 lowercase letter,",e.jsx("br",{})," 1 number, and 1 special character"]})]}),e.jsxs("div",{className:`${k["change-password-container__form--field"]}`,children:[e.jsx("p",{children:l("confirm_new_password")}),e.jsx(x.FormControl,{variant:"outlined",className:`${k["input-field"]}`,children:e.jsx(x.OutlinedInput,{type:h.showConfirmNewPassword?"text":"password",value:h?.confirmedNewPassword,onChange:m=>u("confirmedNewPassword",m.target.value.trim()),endAdornment:e.jsx(x.InputAdornment,{position:"end",children:e.jsx(ue.IconButton,{"aria-label":"toggle password visibility",onClick:()=>u("showConfirmNewPassword",!h.showConfirmNewPassword),onMouseDown:m=>m.preventDefault(),children:h.showConfirmNewPassword?e.jsx(de.Visibility,{color:"primary"}):e.jsx(x.VisibilityOff,{color:"primary"})})})})}),v.confirmedNewPassword&&A.confirmedNewPassword&&e.jsx("div",{className:`${k["input-error"]}`,children:v.confirmedNewPassword})]}),e.jsxs("div",{className:k["change-password-container__form--btn-group"],children:[e.jsx("button",{type:"button",className:k["btn-cancel"],onClick:()=>{a()},children:l("cancel")}),e.jsxs("button",{type:"button",className:k["btn-save"],onClick:()=>C(),children:[e.jsx(xe.DoneCheckInIcon,{color:"#fff"}),l("save_new_password")]})]})]})}})]})},Ke={id:"",firstName:"",lastName:"",email:"",dateOfBirth:Se.DATE_MIN_VALUE,msRoles:[],esRoles:[],isActive:!0,profileImageFileName:"",teacherUserId:[],gradeLevel:"",currentGradeLevel:"",isImportedFromIntegration:!1,appTypes:["MS"],preferredAppType:"MS"},ve="/admin/users/user-list",We="User detail",Xe=12,Ze=20,Qe=t=>{const a=ee.useDispatch(),l=be.useNavigate(),_=ee.useSelector(s=>s.common.user),h=ee.useSelector(s=>s.common?.defaultFontSize),[u,C]=f.useState(Ke),[v,A]=f.useState(null),[T,m]=f.useState(!1),[F,K]=f.useState({MS:[],ES:[]}),[O,q]=f.useState([]),[z,$]=f.useState(!1),[o,i]=f.useState(J.Info),[L,j]=f.useState(!0),[y,R]=f.useState({}),E=async()=>{localStorage.setItem(window.location.href,"true"),m(!0)},p=()=>{$(!z)},le=f.useMemo(()=>h==Ze?"font-large":h==Xe?"font-small":"",[h]);f.useEffect(()=>{document.title=We,m(!1),localStorage.getItem(window.location.href)&&localStorage.removeItem(window.location.href)},[]),f.useEffect(()=>{t&&W(),!t&&ae()},[t]);const Y=(s=[])=>s.includes("EduTeacher")?[...s.filter(d=>d!=="EduTeacher"),D.EDUTEACHER]:s,W=f.useCallback(async()=>{a(c.setLoading(!0));try{const s=await x.getByIdUser(t),d=(s.data.appTypeRaw||s.data.appType||"MS").toUpperCase(),g=d.includes("MS"),N=d.includes("ES"),I=g&&N?["MS","ES"]:N?["ES"]:["MS"],H=s.data.preferredAppType||d;C({...s.data,dateOfBirth:Pe.format(new Date(s.data.dateOfBirth),c.DATE_FORMAT),msRoles:Y(s.data.msRoles),esRoles:Y(s.data.esRoles),currentGradeLevel:s.data.gradeLevel,appTypes:I,preferredAppType:H}),K({MS:s.data.msRoles??[],ES:s.data.esRoles??[]}),document.title=s.data?.fullName,g&&M("MS"),N&&M("ES")}catch(s){a(c.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}a(c.setLoading(!1))},[t]),M=f.useCallback(async s=>{a(c.setLoading(!0));try{const d=await x.userRoleHasDataApi(t,s);R(g=>({...g,[s]:d.data}))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}a(c.setLoading(!1))},[t]),B=f.useCallback(s=>{l(s&&typeof s=="string"?ve+`?query=${s}`:ve)},[]),se=s=>["Student","Parent","EduTeacher"].includes(s),Z=(s=[])=>s.includes(D.EDUTEACHER)?[...s.filter(d=>d!==D.EDUTEACHER),"EduTeacher"]:s,re=f.useCallback(async s=>{const d=s.msRoles?.includes(D.STUDENT)||s.esRoles?.includes(D.STUDENT);if(d&&!t&&!s.teacherUserId){j(!1);return}if(d&&s.gradeLevel){const g=s.msRoles?.includes(D.STUDENT),N=s.esRoles?.includes(D.STUDENT),I=s.preferredAppType,H=g&&!N?"MS":N&&!g?"ES":I==="MS"||I==="ES"?I:null,Q=H==="MS"?Ne:H==="ES"?ye:null;if(Q&&!Q.includes(s.gradeLevel)){a(c.setAlert({type:"danger",message:`Grade "${s.gradeLevel}" is not valid for ${H} students. Please select a new grade level.`}));return}}a(c.setLoading(!0));try{_?.hasEsSchool===!1&&(s.appTypes=["MS"],s.preferredAppType="MS",s.esRoles=[]);const g=t?x.update:x.create;!t&&delete s.id,s.teacherUserId=d?s.teacherUserId:[],s.msRoles=Z(s.msRoles),s.esRoles=Z(s.esRoles),t||(s.profileImageFileName=v||"");const N=await g(s);N&&x.getByIdUser(N.data.id).then(I=>{B(I.data.fullName)}),t||alert("Password of "+N.data.email+` is "${N.data.password}"`),a(c.setAlert({type:"success",message:`${t?"Update":"Create"} user successfully`}))}catch(g){a(c.setAlert({type:"danger",message:g.response?.data?.title||g.message}))}a(c.setLoading(!1))},[t,v]),te=async s=>{a(c.setLoading(!0));try{await x.changePassword(s),a(c.setAlert({type:"success",message:"Change password successfully"}))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}a(c.setLoading(!1))},ce=f.useCallback(async s=>{a(c.setLoading(!0));try{await x.forgotChangePassword(s),a(c.setAlert({type:"success",message:"Send forgot password link successfully"}))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message||"Error occured"}))}a(c.setLoading(!1))},[]),ae=async s=>{try{const d=await x.getTeachers({sortBy:"Email"},s);d.data&&q((d.data.map?.(g=>({label:g.email,value:g.id}))||[]).sort((g,N)=>g.label.localeCompare(N.label)))}catch(d){a(c.setAlert({type:"danger",message:d.response?.data?.title||d.message}))}},ne=20097152,[n,w]=f.useState(""),V=s=>{s.preventDefault();let d=new FileReader,g=s.target.files[0];if(g.size>ne){a(c.setAlert({type:"danger",message:"File can't be larger than 2MB"}));return}d.onloadend=async()=>{if(w(d.result),g){const N=new FormData,{name:I}=g;N.append("file",g,I);const Q=(await x.systemProfileUpload(N))?.data?.key;t?await x.updateAvatarByAdminApi(u.id||"",Q):A(Q)}},g&&d.readAsDataURL(g)},G=async()=>{await x.updateAvatarByAdminApi(u.id||"",""),w("")},X=n||c.getFileUrl(u?.profileImageFileName),S=u?.profileImageFileName||"";return{userDetail:u,getDataTeachers:ae,backToList:B,confirmData:re,file:v,setFile:A,edited:T,currentRoles:F,setEdited:m,setEditedTrue:E,confirmChangePassword:te,forgotPasswordRequest:ce,handleDisableRoles:se,classFontSize:le,teacherOptions:O,handleToggleModel:p,openModel:z,user:_,activeTab:o,setActiveTab:i,imageSrc:X,imageUse:S,handleImageChange:V,handleDeleteAvatar:G,getFile:()=>{var s=window.location.origin+"/api/ExportDataUser/"+t;window.open(s)},checkHasTeacher:L,setCheckHasTeacher:j,userHasData:y}},es="/images/image-default.png",ss=()=>{const{id:t}=be.useParams(),{userDetail:a,getDataTeachers:l,backToList:_,confirmData:h,confirmChangePassword:u,forgotPasswordRequest:C,teacherOptions:v,user:A,activeTab:T,setActiveTab:m,imageSrc:F,handleImageChange:K,handleDeleteAvatar:O,getFile:q,currentRoles:z,handleDisableRoles:$,checkHasTeacher:o,setCheckHasTeacher:i,userHasData:L}=Qe(t),j=[{value:J.Info,component:e.jsx(ze,{id:t,goBack:_,userDetail:a,confirmData:h,teacherOptions:v,getDataTeachers:l,currentRoles:z,handleDisableRoles:$,checkHasTeacher:o,setCheckHasTeacher:i,userHasData:L})},{value:J.ChangePassword,component:e.jsx(Je,{confirmChangePassword:u,goBack:_})}],y=oe.find(p=>p.value===J.ForgotPassword),R=oe.find(p=>p.value===J.DownloadUserData),E=oe.find(p=>p.value===J.ChangePassword);return e.jsxs("div",{className:r["user-profile-container-admin"],children:[e.jsxs("div",{className:r["user-profile-container-admin__left"],children:[e.jsxs("div",{className:r["user-profile-container-admin__left--information"],children:[e.jsxs("div",{className:r["image-user-container"],children:[e.jsx(fe.Input,{className:"d-none",type:"file",id:"uploadFile",onChange:K,accept:"image/*"}),e.jsx("img",{src:F||c.getStaticFileUrl(es),alt:"avatar",className:`${r["image-user-container__image"]}`}),e.jsx(fe.Label,{htmlFor:"uploadFile",role:"button",tabIndex:0,children:e.jsx("div",{className:r["image-user-container__edit-btn"],children:e.jsx("img",{src:c.getStaticFileUrl("/images/user/Edit.svg"),alt:"edit-avatar"})})}),t&&e.jsx("button",{type:"button",onClick:()=>O(),className:r["image-user-container__delete-btn"],children:e.jsx("img",{src:c.getStaticFileUrl("/images/user/DeleteAvatar.svg"),alt:"delete-avatar"})})]}),e.jsxs("div",{className:r["name-role-container"],children:[e.jsx("div",{className:r.name,children:`${a?.firstName||""} ${a?.lastName||""}`}),e.jsx("div",{className:r.role,children:Array.from(new Set([...a?.msRoles||[],...a?.esRoles||[]])).map(p=>p==="SecondaryTeacher"?"Support Teacher":p).join(", ")})]})]}),e.jsxs("div",{className:r["user-profile-container-admin__left--btn-control"],children:[oe.filter(p=>p.isControl).map(p=>e.jsxs("button",{type:"button",className:`${r.item} ${T===p.value?r["item-active"]:""}`,onClick:()=>m(p.value),children:[e.jsx("img",{src:c.getStaticFileUrl(p.icon),alt:p.icon}),p.label]},p.value)),!!t&&!!E&&A?.id===t&&e.jsxs("button",{type:"button",className:`${r.item} ${T===E.value?r["item-active"]:""}`,onClick:()=>m(E.value),children:[e.jsx("img",{src:c.getStaticFileUrl(E.icon),alt:E.icon}),E.label]},E.value),t&&y&&e.jsxs("button",{type:"button",className:`${r.item} ${T===y.value?r["item-active"]:""}`,onClick:()=>C({email:a?.email||""}),children:[e.jsx("img",{src:c.getStaticFileUrl(y.icon),alt:y.icon}),y.label]},y.value),t&&R&&e.jsxs("button",{type:"button",className:`${r.item} ${T===R.value?r["item-active"]:""}`,onClick:()=>q(),children:[e.jsx("img",{src:c.getStaticFileUrl(R.icon),alt:R.icon}),R.label]},R.value)]})]}),e.jsx("div",{className:r["user-profile-container-admin__right"],children:j.find(p=>p.value===T)?.component})]})};exports.default=ss;
|