mario-core 2.0.127-release → 2.0.128-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/Dashboard-Dn1Xl7SC.js +1 -0
  2. package/dist/Dashboard-DxrE_UdE.mjs +206 -0
  3. package/dist/EmailTemplateDetail-BxDmv_IB.mjs +443 -0
  4. package/dist/EmailTemplateDetail-c2h1KwyT.js +1 -0
  5. package/dist/EmailTemplateList-C6KbuCHO.mjs +170 -0
  6. package/dist/EmailTemplateList-Dk7gCfdy.js +1 -0
  7. package/dist/GalleryList-CG-GA7Go.mjs +329 -0
  8. package/dist/GalleryList-p6WP3Krc.js +1 -0
  9. package/dist/Login-BMRuV2H4.js +1 -0
  10. package/dist/Login-Ch1dKH9m.mjs +1700 -0
  11. package/dist/NotificationList-51yt2V-v.js +1 -0
  12. package/dist/NotificationList-bZsuTSkC.mjs +419 -0
  13. package/dist/SkillList-BQM2FIla.mjs +386 -0
  14. package/dist/SkillList-BxqOHumi.js +1 -0
  15. package/dist/TeacherSelector-CrH5Ji_R.mjs +30 -0
  16. package/dist/TeacherSelector-DYwwL8rL.js +1 -0
  17. package/dist/TheContent-B_P8fq4J.mjs +38 -0
  18. package/dist/TheContent-C5I2GeSi.js +1 -0
  19. package/dist/UserContainer-JB0zF0Be.js +5 -0
  20. package/dist/UserContainer-QmPiHlko.mjs +2698 -0
  21. package/dist/UserDetail-BuhWeZrj.mjs +913 -0
  22. package/dist/UserDetail-ClL8qEKG.js +1 -0
  23. package/dist/UserList-Crz4aLRP.mjs +1514 -0
  24. package/dist/UserList-DoZZeZzW.js +7 -0
  25. package/dist/constants-DF79sw6a.mjs +241 -0
  26. package/dist/constants-DSNqVx4Y.js +1 -0
  27. package/dist/index-CD8bO3wO.js +15 -0
  28. package/dist/index-CfBp3NrB.mjs +22670 -0
  29. package/dist/mailCategoryService-C9FSK6lv.js +1 -0
  30. package/dist/mailCategoryService-CRdM3FRx.mjs +11 -0
  31. package/dist/shared/gradeYear/ukYearCsv.d.ts +4 -0
  32. package/dist/userService-CDfW2VnH.js +1 -0
  33. package/dist/userService-CjQDQKT0.mjs +47 -0
  34. package/package.json +113 -113
@@ -0,0 +1,7 @@
1
+ "use strict";const n=require("react/jsx-runtime"),d=require("react"),E=require("reactstrap"),ee=require("react-i18next"),Y=require("react-redux"),pe=require("react-router-dom"),t=require("./index-CD8bO3wO.js"),K=require("./userService-CDfW2VnH.js"),B=require("./constants-DSNqVx4Y.js"),je=require("./types-CTFcZUFS.js"),ie=require("date-fns"),de=require("papaparse"),_e=()=>{const[e,a]=d.useState(B.DEFAULT_FILTER);return{filters:e,setFilters:a,changeFilters:o=>{const u={...e,...o};u.searchString&&o.searchString&&o.searchString!=e.searchString&&(u.currentPage=1),a(u)}}},Ae="/admin/user",Le="/admin/create-user",Ne="User list",te="/home",Ie="/home",Oe="/admin/home",we="/parent",Be="/admin/schools",ke="/list-student",Me=()=>{const e=pe.useNavigate(),r=new URLSearchParams(location.search).get("query"),o=Y.useSelector(s=>s.users.userList),u=Y.useSelector(s=>s.users.totalItems),{filters:l,changeFilters:c}=_e(),f=r||"",[g,R]=d.useState([]),h=window.location.host.includes("-district"),m=Y.useDispatch(),{t:v}=ee.useTranslation(),y=s=>{const i=g.find(_=>_==s);R(i?g.filter(_=>_!=s):g.concat([s]))},S=d.useMemo(()=>(o||[]).length>0&&(o||[]).every(s=>g.includes(s.id)),[o,g]),w=d.useCallback(()=>{if(S){const i=new Set((o||[]).map(_=>_.id));R(_=>_.filter(C=>!i.has(C)));return}const s=(o||[]).map(i=>i.id).filter(i=>!g.includes(i));R(i=>[...i,...s])},[o,S,g]),j=d.useCallback(async()=>{if(l.searchBy!==void 0&&l.searchByStrings!==void 0&&l.searchByStrings.length===0){m(t.setUserList({userList:[],totalItems:0}));return}m(t.setLoading(!0));try{const s=t.isCombineMsHs(),i=await K.getRosterUser(s&&l.Tiers?.length?{...l,Tiers:t.expandCombinedTierFilter(l.Tiers)}:l),{totalItems:_}=i.data,C=s?i.data.items.map(t.mergeHsIntoMs):i.data.items;for(const b of C)b.roles=b.roles.map(A=>A!=t.ROLES.EDUTEACHER?A:"EduTeacher"),b.msRoles&&(b.msRoles=b.msRoles.map(A=>A!=t.ROLES.EDUTEACHER?A:"EduTeacher")),b.esRoles&&(b.esRoles=b.esRoles.map(A=>A!=t.ROLES.EDUTEACHER?A:"EduTeacher")),b.hsRoles&&(b.hsRoles=b.hsRoles.map(A=>A!=t.ROLES.EDUTEACHER?A:"EduTeacher"));m(t.setUserList({userList:C,totalItems:_}))}catch(s){m(t.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}m(t.setLoading(!1))},[m,l]),G=async()=>{m(t.setLoading(!0));try{const i=(await K.triggerAllRosterSyncApi()).data?.message||v("sync_roster_running_in_background","Roster synchronization is currently running in the background. Please wait a few moments before refreshing the page.");m(t.setModal({isOpen:!0,type:"success",message:i}))}catch(s){m(t.setModal({isOpen:!0,type:"danger",message:s.response?.data?.message||s.response?.data?.title||s.message}))}m(t.setLoading(!1))},x=s=>{if(!s)return"";const i=[],{sourcedId:_,rosterUser:C}=s;if(_&&C&&i.push(_),C){const{givenName:b,middleName:A,familyName:U,email:I}=C,P=[];U&&P.push(U),A&&P.push(A),b&&P.push(b),i.push(P.join(" ")||""),i.push(I||"")}return i.join(" / ")};d.useEffect(()=>{document.title=Ne},[]),d.useEffect(()=>{c({...l,searchString:f})},[f]),d.useEffect(()=>{j()},[JSON.stringify(l)]);const[N,F]=d.useState({isOpen:!1,userId:""}),z=d.useCallback(()=>{F({isOpen:!1,userId:""})},[]),p=d.useCallback(async(s,i)=>{const _=N.userId;if(_){m(t.setLoading(!0));try{if((await K.remove(_,{msTransferTeacherId:s,esTransferTeacherId:i}))?.data?.requireTransfer){m(t.setAlert({type:"danger",message:"Please select a teacher to transfer data to."}));return}z(),m(t.setAlert({type:"success",message:"Remove user successfully"})),l.currentPage!==1?c({currentPage:1}):j()}catch(C){m(t.setAlert({type:"danger",message:C.response?.data?.title||C.message}))}finally{m(t.setLoading(!1))}}},[N.userId,z,l,c,j]),k=d.useCallback(s=>{m(t.setModal({isOpen:!0,type:"warning",message:v("do_you_want_to_remove_this_user"),onConfirm:async()=>{m(t.setLoading(!0));try{const i=await K.remove(s);i?.data?.requireTransfer?F({isOpen:!0,userId:s,msTeachers:i.data.ms?.teachers||[],esTeachers:i.data.es?.teachers||[]}):(m(t.setAlert({type:"success",message:"Remove user successfully"})),l.currentPage!==1?c({currentPage:1}):j())}catch(i){m(t.setAlert({type:"danger",message:i.response?.data?.title||i.message}))}finally{m(t.setLoading(!1))}}}))},[JSON.stringify(l)]),O=[{role:"Admin",path:Oe},{role:"Teacher",path:te},{role:"Assistant",path:te},{role:"Counselor",path:te},{role:"SecondaryTeacher",path:te},{role:"EduTeacher",path:ke},{role:"Student",path:Ie},{role:"Parent",path:we}],q=s=>{const i=sessionStorage.getItem(t.IS_USER_SESSION_BROWSER),_=s.data?.token;let C=s.data.msRoles||[],b=s.data.esRoles||[];const A=s.data.roles||s.data.userRoles||[],U=(s.data.appType||"").toUpperCase();C.length===0&&b.length===0&&A.length>0&&(U.includes("ES")&&!U.includes("MS")?b=A:U.includes("MS")&&!U.includes("ES")?C=A:(C=A,b=A));const I=s.data?.id||s.data?.userId,$=((I?localStorage.getItem(`PREFERRED_ROLE_${I}`):null)||"").split(",").map(X=>X.trim()).filter(Boolean),D=$[0];let L="MS",M="/home",W=!1;if(!(C.includes("Admin")||b.includes("Admin"))&&D&&(C.includes(D)||b.includes(D))){L=C.includes(D)?"MS":"ES";const Q=O.find(Z=>Z.role===D);Q&&(M=Q.path,W=!0)}if(!W)for(const{role:X,path:Q}of O){const Z=C.includes(X),Re=b.includes(X);if(!(!Z&&!Re)){L=Z?"MS":"ES",M=Q,W=!0;break}}W||(L=C.length>0?"MS":b.length>0?"ES":"MS");const J=L==="ES"?b:C;i?sessionStorage.setItem(t.ACCESS_TOKEN,_):localStorage.setItem(t.ACCESS_TOKEN,_);let V="";J.includes("Admin")?V="Admin":$.length>0&&$.every(Q=>J.includes(Q))?$.length>1?V=$.every(Z=>Z==="Teacher"||Z==="Assistant")?"Teacher,Assistant":$[0]:V=$[0]:J.includes("Teacher")?V=J.includes("Assistant")?"Teacher,Assistant":"Teacher":J.includes("Assistant")?V="Assistant":J.includes("Counselor")?V="Counselor":J.includes("SecondaryTeacher")?V="SecondaryTeacher":J.includes("EduTeacher")?V="EduTeacher":J.includes("Student")?V="Student":J.includes("Parent")?V="Parent":J.length>0&&(V=J[0]),V&&(localStorage.setItem("ROLES",V),sessionStorage.setItem("ACTIVE_ROLE",V)),localStorage.removeItem(t.NOTIFICATION_ALERT_KEY),h&&(M=Be);const Ee=(String(s.data.preferredAppType||"").split(",").map(X=>X.trim().toUpperCase()).filter(Boolean)[0]||"")==="HS"?"HS":"MS";t.isCombineMsHs()||localStorage.setItem("ACTIVE_TIER",Ee);const Te=L==="ES"&&!J.includes("Admin")?`/es${M}`:M;window.location.href=Te},T=d.useCallback(async s=>{try{const _=(await K.switchAccountUser(s)).data;m(t.setModal({isOpen:!0,type:"warning",message:v("do_you_want_to_impersonate_this_user"),onConfirm:async()=>{m(t.setLoading(!0));try{const C={email:_.email,password:"default",accessToken:_.token,loginType:je.LoginType.Impersonate},b=await t.logIn(C),A={};for(let U=0;U<localStorage.length;U++){const I=localStorage.key(U);I&&(I==="SELECTED_TIER"||I.startsWith("SELECTED_TIER_")||I.startsWith("PREFERRED_ROLE_"))&&(A[I]=localStorage.getItem(I)||"")}localStorage.clear(),Object.keys(A).forEach(U=>{localStorage.setItem(U,A[U])}),q(b)}catch(C){t.setAlert({type:"danger",message:C.response?.data?.title||C.message})}m(t.setLoading(!1))}}))}catch(i){m(t.setAlert({type:"danger",message:i.response?.data?.title||i.message}))}},[l]);return{userList:o,totalItems:u,filters:l,queryName:r,fullName:f,getData:j,removeData:k,changeFilters:c,reDirectDetailPage:s=>{const i=s?`${Ae}/${s}`:Le;e(i)},switchUser:T,handleSyncRosterUsers:G,rosterUserInfo:x,userIds:g,onSelectAllUser:w,onSelectUser:y,isCheckAll:S,transferModal:N,closeTransferModal:z,confirmTransferRemove:p}},Ue={fontWeight:500},De={height:38,background:"#316cd9"},$e=({text:e,onClick:a,className:r=""})=>n.jsxs(E.Button,{onClick:a,color:"primary",style:De,className:`d-flex align-items-center ${r} gap-2`,children:[n.jsx(t.FaSyncAlt,{}),n.jsx("span",{style:Ue,children:e})]});function Fe(e){return t.GenIcon({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21 3H5a1 1 0 0 0-1 1v2.59c0 .523.213 1.037.583 1.407L10 13.414V21a1.001 1.001 0 0 0 1.447.895l4-2c.339-.17.553-.516.553-.895v-5.586l5.417-5.417c.37-.37.583-.884.583-1.407V4a1 1 0 0 0-1-1zm-6.707 9.293A.996.996 0 0 0 14 13v5.382l-2 1V13a.996.996 0 0 0-.293-.707L6 6.59V5h14.001l.002 1.583-5.71 5.71z"}}]})(e)}function He(e){return t.GenIcon({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19.023 16.977a35.13 35.13 0 0 1-1.367-1.384c-.372-.378-.596-.653-.596-.653l-2.8-1.337A6.962 6.962 0 0 0 16 9c0-3.859-3.14-7-7-7S2 5.141 2 9s3.14 7 7 7c1.763 0 3.37-.66 4.603-1.739l1.337 2.8s.275.224.653.596c.387.363.896.854 1.384 1.367l1.358 1.392.604.646 2.121-2.121-.646-.604c-.379-.372-.885-.866-1.391-1.36zM9 14c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z"}}]})(e)}function Pe(e){return t.GenIcon({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z",clipRule:"evenodd"}}]})(e)}function Ge(e){return t.GenIcon({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]})(e)}function ge(e){return t.GenIcon({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0 0 12.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]})(e)}function fe(e){return t.GenIcon({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM310.3 167.1a8 8 0 0 0-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]})(e)}const ze=(e,a)=>{d.useEffect(()=>{function r(o){e.current&&!e.current.contains(o.target)&&a?.()}return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e.current])},Ve=e=>{const{isOpen:a,sortBy:r,filters:o,users:u,searchBy:l,defaultOptions:c,selectedOptions:f,searchKey:g,onChangeSearchKey:R,onOptionsChange:h,onSearch:m,onClose:v,onChangeFilters:y,getOption:S}=e,[w,j]=d.useState(),[G,x]=d.useState([]),[N,F]=d.useState(o?.ExactRoleMatch??!1),z=d.useRef(null),p=d.useRef(null);ze(z,v);const{t:k}=ee.useTranslation(),O=d.useCallback(()=>{if(!a)return;const I=g?.trim?.()??"";l!=null&&!c&&m?.(I,l),l!=null&&c&&x(c.filter(P=>P.label.toLowerCase().includes(I.toLowerCase())))},[l,g,JSON.stringify(c),a]),q=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(O,500)},T=I=>{const P=I.target.value;R(P)},H=d.useCallback(()=>{const I=l===B.SearchBy.Role?{ExactRoleMatch:N}:{};h?.(w,l,I),v?.()},[JSON.stringify(w),N,l]),s=d.useCallback(I=>{const P=I.target.value??"";let $=w??[],D=$.indexOf(P);D>-1?$.splice(D,1):$=[...$,P],j($==null?$:[...$])},[JSON.stringify(w)]),i=d.useCallback(I=>{const P=I.target.checked;j(P?void 0:[])},[]),_=d.useCallback(()=>{y?.({...o,sortBy:r,isDescending:!0}),v?.()},[JSON.stringify(o),l]),C=d.useCallback(()=>{y?.({...o,sortBy:r,isDescending:!1}),v?.()},[JSON.stringify(o),l]),b=d.useMemo(()=>S?u.map(I=>S(I,k)):[],[JSON.stringify(u),JSON.stringify(S)]),A=o?.isDescending==!1&&o.sortBy===r,U=!!o?.isDescending&&o.sortBy===r;return d.useEffect(()=>{j(f?[...f]:void 0)},[JSON.stringify(f),a]),d.useEffect(()=>{x(c||[])},[JSON.stringify(c)]),d.useEffect(()=>{F(o?.ExactRoleMatch??!1)},[o?.ExactRoleMatch,a]),d.useEffect(()=>{q()},[g,a]),{ref:z,options:b,inputRef:p,sOptions:w,isAscending:A,isDescending:U,filteredOptions:G,searchKey:g,handleSearch:O,handleApplyFilter:H,handleOptionSelected:s,handleOptionSelectedAll:i,handleSortDesc:_,handleSortAsc:C,handleChangeSearchKey:T,isExactRoleMatch:N,setIsExactRoleMatch:F}},qe=e=>{const{defaultOptions:a,onClose:r,getOption:o,searchBy:u}=e,{t:l}=ee.useTranslation(),{ref:c,inputRef:f,options:g,sOptions:R,isAscending:h,isDescending:m,filteredOptions:v,searchKey:y,handleChangeSearchKey:S,handleApplyFilter:w,handleOptionSelected:j,handleOptionSelectedAll:G,handleSortDesc:x,handleSortAsc:N,isExactRoleMatch:F,setIsExactRoleMatch:z}=Ve(e);return n.jsx(E.Popover,{...e,hideArrow:!0,className:t.styles["popover-zindex"],children:n.jsx(E.PopoverBody,{className:"pb-3",children:n.jsxs("div",{ref:c,className:t.styles.popover,children:[n.jsxs("div",{className:`d-flex flex-column ${t.styles.popover__sort}`,children:[n.jsx(E.Label,{className:"font-weight-bold",children:"Sort"}),n.jsxs("div",{className:`px-1 ${t.styles.popover__sort__item} ${h&&t.styles["popover__sort__item--active"]}`,onClick:N,children:[n.jsx(ge,{className:"mr-1"}),"Ascending"]}),n.jsxs("div",{className:`px-1 mt-1 ${t.styles.popover__sort__item} ${m&&t.styles["popover__sort__item--active"]}`,onClick:x,children:[n.jsx(fe,{className:"mr-1"}),"Descending"]})]}),(typeof o<"u"||!!a)&&n.jsxs(d.Fragment,{children:[n.jsx("div",{className:"border border-top-1 border-bottom-0 mx-1 my-2"}),n.jsxs("div",{className:"d-flex flex-column",children:[n.jsxs("div",{className:"d-flex justify-content-between align-items-center mb-2 px-1",children:[n.jsx(E.Label,{className:"font-weight-bold mb-0",children:"Filter"}),u===B.SearchBy.Role&&n.jsxs("div",{className:"d-flex align-items-center",style:{gap:"5px",cursor:"pointer"},onClick:()=>z(!F),children:[n.jsx("input",{type:"checkbox",id:"exact-role-match-checkbox",checked:F,onChange:p=>z(p.target.checked),onClick:p=>p.stopPropagation(),style:{cursor:"pointer",margin:0}}),n.jsx("label",{htmlFor:"exact-role-match-checkbox",className:"small font-weight-normal text-muted mb-0",style:{cursor:"pointer",userSelect:"none",fontSize:"12px"},onClick:p=>p.stopPropagation(),children:l("exact_match","Exact match")})]})]}),n.jsxs("div",{className:`position-relative px-1 ${t.styles.popover__search}`,children:[n.jsx(He,{className:`position-absolute ${t.styles.popover__search__icon}`}),n.jsx(E.Input,{ref:f,className:t.styles.popover__search__input,value:y,onChange:S})]}),n.jsxs("div",{className:`mx-1 mt-2 p-2 bg-light ${t.styles.popover__options}`,children:[n.jsxs(E.FormGroup,{className:"d-flex align-items-center",check:!0,style:{gap:"8px"},children:[n.jsx(E.Input,{type:"checkbox",onChange:G,checked:R==null})," ",n.jsx(E.Label,{check:!0,children:"(Select all)"})]}),!!o&&!a&&g.map(p=>n.jsxs(E.FormGroup,{className:"d-flex align-items-center",check:!0,style:{gap:"8px"},children:[n.jsx(E.Input,{type:"checkbox",value:p.value,onChange:j,checked:R?.includes(p.value)||R==null})," ",n.jsx(E.Label,{check:!0,children:p.label})]},p.value)),!!a&&v.map(p=>n.jsxs(E.FormGroup,{className:"d-flex align-items-center",check:!0,style:{gap:"8px"},children:[n.jsx(E.Input,{type:"checkbox",value:p.value,onChange:j,checked:R?.includes(p.value)||R==null})," ",n.jsx(E.Label,{check:!0,children:p.label})]},p.value))]})]}),n.jsxs("div",{className:"d-flex justify-content-end mt-3",style:{gap:"8px"},children:[n.jsx(E.Button,{color:"primary",className:"mr-2",size:"sm",onClick:w,children:"Apply Filter"}),n.jsx(E.Button,{color:"secondary",size:"sm",onClick:r,children:"Cancel"})]})]})]})})})},Je=({data:e,popoverId:a,filters:r,searchString:o,users:u,selectedOptions:l,onOptionsChange:c,onSearch:f,onChangeFilters:g,onOpenFilter:R,onClose:h,isCenter:m,isActive:v=!1})=>{const{t:y}=ee.useTranslation(),[S,w]=d.useState(""),j=d.useMemo(()=>e.sortBy!=null?B.userOrders[e.sortBy]:"",[e.sortBy]),G=d.useMemo(()=>a===j,[j,a]),x=()=>{R?.(j,e.searchBy,S,e.sortBy)},N=F=>{w(F)};return n.jsx("th",{className:e.className,children:j&&e.sortBy!==void 0?n.jsxs("div",{className:`w-100 d-flex ${m?"justify-content-center":"justify-content-between"} align-items-center ${t.styles["table-filter-icon"]}`,children:[y(e.name),n.jsxs("div",{className:"ml-2 p-1",id:j,onClick:x,style:{cursor:"pointer"},children:[e.sortBy!==void 0&&e.sortBy===r?.sortBy&&n.jsx("span",{children:r.isDescending?n.jsx(fe,{}):n.jsx(ge,{})}),r?.searchByStrings?.length&&e.searchBy===r?.searchBy?n.jsx(Pe,{color:v?"#007bff":"#242424"}):n.jsx(Fe,{color:v?"#007bff":"#242424"})]}),n.jsx(qe,{placement:"bottom-end",target:j,users:u,isOpen:G,filters:r,sortBy:e.sortBy,searchKey:S,searchBy:e.searchBy,searchString:o,defaultOptions:e.options,selectedOptions:l,onClose:h,onSearch:f,getOption:e.getOption,onChangeFilters:g,onOptionsChange:c,onChangeSearchKey:N})]}):y(e.name)})},Ke=()=>{try{const e=t.getAccessToken()?.split(".")[1];if(!e)return null;const a=atob(e.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(decodeURIComponent(a.split("").map(r=>"%"+r.charCodeAt(0).toString(16).padStart(2,"0")).join("")))}catch{return null}},We=(e=Ke())=>{const a=["es","ms","hs"].filter(r=>String(e?.[`${r}_roles`]??"").split(",").some(o=>o.trim().toLowerCase()==="admin"));return a.length===0?B.GRADE:(t.isCombineMsHs()&&(a.includes("ms")||a.includes("hs"))&&a.push("ms","hs"),B.GRADE_DEFAULT.filter(r=>a.includes(r.schoolLevel)).map(r=>r.value))},Ye=(e,a)=>{const r=[];if(a===B.TeacherType.Teacher)for(const u of e)for(const l of u.teachers||[])r.push({label:l.mainTeacherEmail,value:l.teacherUserId,name:l.mainTeacherName});else if(a===B.TeacherType.Assistant)for(const u of e)u.assistantEmail&&u.assistantUserId&&r.push({label:u.assistantEmail,value:u.assistantUserId,name:u.assistantName||""});else if(a===B.TeacherType.Counselor)for(const u of e)for(const l of u.counselors||[])r.push({label:l.counselorEmail,value:l.counselorUserId,name:l.counselorName});const o=new Map;for(const u of r)o.has(u.value)||o.set(u.value,u);return Array.from(o.values()).sort((u,l)=>u.label.localeCompare(l.label))},Xe=["K","1","2","3","4","5"],Qe=["6","7","8"],Ze=["9","10","11","12","12/13","PCS"],es=e=>{const a=e.gradeLevel?String(e.gradeLevel).trim():"";if(a){if(Ze.includes(a))return"hs";if(Xe.includes(a))return"es";if(Qe.includes(a))return"ms"}return e.schoolLevel?e.schoolLevel.toLowerCase():"ms"},Se=e=>{if(!e)return;const a=es(e);return t.isCombineMsHs()&&a==="hs"?"ms":a},ye=(e,a)=>{if(!a)return!0;const r=e?.schoolLevel?String(e.schoolLevel).toLowerCase():"";return!r||t.isCombineMsHs()&&a==="ms"&&r.includes("hs")?!0:r===a||r.includes(a)||r==="both"},ss=(e,a,r)=>{const o=a?.[0],u=r?.find(c=>c.id===o),l=Se(u);return e.filter(c=>ye(c,l))},ts=e=>{const{headers:a,filters:r,onChangeFilters:o,isStudentFilter:u,teacherOptions:l,assistantOptions:c,counselorOptions:f,secondaryTeacherOptions:g}=e,[R,h]=d.useState(),[m,v]=d.useState([]),[y,S]=d.useState({...B.DEFAULT_FILTER_POPOVER,isDescending:r.isDescending,searchString:r.searchString}),w=Y.useDispatch(),j=pe.useLocation(),G=d.useCallback(async p=>{try{const O=(u?await K.getStudentFilter(y):await K.getFilterRosterUser({...y,byStudent:p})).data?.items||[];v(O)}catch(k){w(t.setAlert({type:"danger",message:k.response?.data?.title||k.message}))}},[JSON.stringify(y),u]),x=d.useCallback((p,k,O,q)=>{h(p),S({...y,searchBy:k,searchStringBy:O,isDescending:r.sortBy===q?r.isDescending:void 0,searchString:r.searchString})},[JSON.stringify(y),r.isDescending,r.searchString]),N=()=>{h("")},F=d.useCallback((p,k)=>{S({...y,searchBy:k,searchStringBy:p})},[JSON.stringify(y)]),z=d.useCallback((p,k,O)=>{k&&o?.({...r,...O,currentPage:1,[B.SearchBy[k]]:p})},[JSON.stringify(r)]);return d.useEffect(()=>{if(!j.pathname.includes("users/assign-student"))return;const p=O=>O.sort((q,T)=>q.localeCompare(T)),k=y.searchStringBy?.toLowerCase()||"";if(y.searchBy===B.SearchBy.Grade)v(We());else{let O=[];switch(y.searchBy){case B.SearchBy.Name:G(!0);break;case B.SearchBy.Teacher:O=l?.map(s=>s.label).filter(Boolean)||[];break;case B.SearchBy.Assistant:O=c?.map(s=>s.label).filter(Boolean)||[];break;case B.SearchBy.Counselor:O=f?.map(s=>s.label).filter(Boolean)||[];break;case B.SearchBy.SecondaryTeacher:O=g?.map(s=>s.label).filter(Boolean)||[];break}const q=Array.from(new Set(O)),T=k?q.filter(s=>s.toLowerCase().includes(k)):q,H=p(T);v(H)}},[JSON.stringify(y),l,c,f,g,j.pathname]),d.useEffect(()=>{if(y.searchBy===void 0)return;const p=a?.find(O=>O.searchBy===y.searchBy);if(p?.options&&p.options.length>0||!p?.getOption)return;j.pathname.includes("users/assign-student")||G()},[JSON.stringify(y),j.pathname,a]),{popoverFilters:y,popoverId:R,users:m,handleFilterIcon:x,handleCloseFilter:N,handleSearch:F,handleChangeFilters:z}},xe=({headers:e,filters:a,onChangeFilters:r,isStudentFilter:o,teacherOptions:u=[],assistantOptions:l=[],counselorOptions:c=[],secondaryTeacherOptions:f=[]})=>{const{popoverId:g,users:R,handleFilterIcon:h,handleCloseFilter:m,handleSearch:v,handleChangeFilters:y}=ts({headers:e,filters:a,onChangeFilters:r,isStudentFilter:o,teacherOptions:u,assistantOptions:l,counselorOptions:c,secondaryTeacherOptions:f}),S=Object.entries(a).filter(([x,N])=>N!==""&&!(Array.isArray(N)&&N.length===0)&&N!==null&&N!==void 0).map(([x])=>x),w=Object.entries(B.SearchBy).filter(([x,N])=>isNaN(Number(x))),j=S.map(x=>w.find(([N])=>N===x)).filter(x=>!!x),G=x=>{if(x.searchBy===void 0)return;const N=a[B.SearchBy[x.searchBy]];return Array.isArray(N)?N:a.searchBy===x.searchBy?a.searchByStrings:void 0};return n.jsx("tr",{children:e.map(x=>x.onSelectAll?n.jsx("th",{className:`align-middle text-center ${x.className}`,children:n.jsx("input",{type:"checkbox",onChange:()=>x.onSelectAll?.(),checked:x.isCheckAll??!1})},x.name):n.jsx(Je,{users:R,data:x,isCenter:x.isCenter,filters:a,popoverId:g,selectedOptions:G(x),onSearch:v,onClose:m,onOpenFilter:h,onChangeFilters:r,onOptionsChange:y,isActive:typeof x.searchBy=="number"&&j.some(([N,F])=>F===x.searchBy)},x.name))})},ns=()=>{const e=Y.useDispatch(),a=Y.useSelector(f=>f?.common?.user?.schoolName)||"",r=async f=>{e(t.setLoading(!0));try{const g=t.isCombineMsHs(),R=await K.getRosterUserExport(g&&f.Tiers?.length?{...f,Tiers:t.expandCombinedTierFilter(f.Tiers)}:f),h=R.data.items||R.data,m=g?h.map(t.mergeHsIntoMs):h,v=o(m),y=document.createElement("a");y.href=v,y.download=`${a}_Users_Report.csv`,y.click()}catch(g){e(t.setAlert({type:"danger",message:g.response?.data?.title||g.message}))}e(t.setLoading(!1))},o=f=>{let g=`First Name,Last Name,Email,Phone,Age,Grade,Tiers,Role,Active Status,Create Time,Roster Sourced Id,Roster Status,Roster Family Name,Roster Middle Name,Roster Given Name,Roster Email,Roster Role,Roster Grades,Teachers,Assistants,Counselors,SupportTeachers,EduTeachers
2
+ `;const R=f.map(h=>{const m=h.dateOfBirth!==t.DATE_MIN_VALUE?ie.differenceInCalendarYears(new Date,ie.parseISO(h.dateOfBirth)):"";return`${c(h.firstName)},${c(h.lastName)},${c(h.email)},${c(h.phoneNumber)},${m},${c(h.grade)},${c(h.appType||"")},${c(h.roles.join(", ").replace("SecondaryTeacher","SupportTeacher"))},${h.isActive?"Active":"Inactive"},${t.formatLocalTime(h?.createTime,"yyyy-MM-dd HH:mm")},${c(h.sourcedId)},${c(h.rosterUser?.status)},${c(h.rosterUser?.familyName)},${c(h.rosterUser?.middleName)},${c(h.rosterUser?.givenName)},${c(h.rosterUser?.email)},${c(h.rosterUser?.role)},${c(h.rosterUser?.grades)},${c(h.teachers)},${c(h.assistants)},${c(h.counselors)},${c(h.supportTeachers)},${c(h.eduTeachers)}`}).join(`
3
+ `);return`${B.CSV_PREFIX}${g}${encodeURIComponent(R)}`},u=async f=>{e(t.setLoading(!0));try{const g=await K.getTeacherClassCodesExport(f),R=g?.data?.items||g?.data||[],h=l(R),m=document.createElement("a");m.href=h,m.download="Classcode.csv",m.click()}catch(g){e(t.setAlert({type:"danger",message:g.response?.data?.title||g.message}))}e(t.setLoading(!1))},l=f=>{let g=`Teacher name,Teacher Email,Teacher code
4
+ `;const m=(Array.isArray(f)?f:[]).filter(v=>v.roles&&v.roles.includes("Teacher")).map(v=>`${c(v.fullName)},${c(v.email)},${c(v?.assignCode||"")}`).join(`
5
+ `);return`${B.CSV_PREFIX}${g}${encodeURIComponent(m)}`},c=f=>f?`"${f.replace(/"/g,'""').replaceAll(/\n/g," ")}"`:"";return{exportUsers:r,exportClassCodes:u}},ve=`${t.BASE_URL}/api/ImportCsv/csv`,ne=`${t.BASE_URL}/api/Teacher`,as=(e,a)=>t.apiUpload.post(`${ve}/${a}`,e),ue=e=>t.apiUpload.post(`${ve}/importClassReflection`,e),rs=(e,a)=>t.apiUpload.post(`${ne}/adminImportStudentByTeacherId/${e}`,a),os=e=>t.apiUpload.post(`${ne}/adminImport`,e),cs=(e=!0)=>t.api.get(`${ne}/download-template-file-user?hasEsSchool=${e}`),ls=(e,a,r=!0)=>t.apiUpload.post(`${ne}/validate-csv-template-student/${a}?hasEsSchool=${r}`,e);var Ce=(e=>(e.Students="students",e.Subjects="subjects",e.Grades="grades",e.Attendances="attendances",e.ClassReflection="classReflection",e.Others="others",e.AllUser="allUser",e))(Ce||{});const ae="csvupload",he={teacherName:"",teacherEmail:"",studentIds:[],file:""},is=()=>{const e=Y.useDispatch(),a=Y.useSelector(T=>T.common.isLoading),[r,o]=d.useState(null),[u,l]=d.useState(),[c,f]=d.useState([]),[g,R]=d.useState(he),[h,m]=d.useState(),v=window.location.hostname,y=v.includes("isb")||v.includes("stage"),[S,w]=d.useState(0),[j,G]=d.useState(""),x=async()=>{e(t.setLoading(!0));try{const s=await cs();var T=new Blob([t.toUkTemplate(s.data.content)],{type:"text/csv"});const i=window.URL.createObjectURL(T);var H=document.createElement("a");H.href=i,H.setAttribute("download",s.data.nameFile),H.click(),e(t.setAlert({type:"success",message:"Download successfully"}))}catch(s){e(t.setAlert({type:"danger",message:s.message}))}e(t.setLoading(!1))},N=d.useCallback(async T=>{if(!r||!T)return;e(t.setLoading(!0));try{T=await t.ukYearCsvToGradeCsv(T);const _=new FormData;if(_.append("file",T,T.name),r=="allUser"){let b=(await T.text()).trim();const A=b.split(`
6
+ `).map(M=>M.trim()),U=A.findIndex(M=>M.split(",").includes("FirstName"));if(U===0)throw new Error("Invalid CSV: Missing header row.");b=A.slice(U).join(`
7
+ `);const I=de.parse(b,{header:!0,skipEmptyLines:!0}),P=I.meta.fields,$=I.data;if(!P)throw new Error("Unable to determine header from CSV file");const D=20,L=[];for(let M=0;M<$.length;M+=D){const W=$.slice(M,M+D),se=de.unparse({fields:P,data:W});L.push(se)}for(let M=0;M<L.length;M++){const W=new Blob([L[M]],{type:"text/csv"}),se=new FormData;se.append("file",W,`students_chunk${M+1}.csv`),await os(se)}}else y?r=="classReflection"&&await ue(_):await as(_,r.toString());e(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(_){e(t.setAlert({type:"danger",message:_.response?.data?.title||_.message}))}e(t.setLoading(!1));const H=document.getElementById(ae),s=document.getElementById("import-student"),i=document.getElementById("import-classReflection");H&&(H.value=""),s&&(s.value=""),i&&(i.value="")},[r]),F=async T=>{if(!S){e(t.setAlert({type:"danger",message:"Select teacher before import csv"}));return}if(!r||!T)return;e(t.setLoading(!0));try{T=await t.ukYearCsvToGradeCsv(T);const s=new FormData;s.append("file",T,T.name),await rs(S,s),e(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(s){e(t.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}e(t.setLoading(!1));const H=document.getElementById("teacherSelector");H&&(H.value="")},z=async T=>{if(!u||!u)return;e(t.setLoading(!0));try{const s=new FormData;s.append("file",u,u.name),s.append("teacherName",T.teacherName),s.append("teacherEmail",T.teacherEmail),T.studentIds.forEach(i=>{s.append("studentIds",i)}),await ue(s),e(t.setAlert({type:"success",message:"Import CSV successfully"})),R(he)}catch(s){e(t.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}e(t.setLoading(!1));const H=document.getElementById(ae);H&&(H.value="")},p=T=>{w(T.value)},k=T=>{m(T),G(T?.name||"")},O=()=>{if(!h){e(t.setAlert({type:"danger",message:"Select CSV to import"}));return}F(h)};return{isLoading:a,id:ae,setType:o,upload:N,initImportReflection:g,setInitImportReflection:R,onConfirm:z,CSVType:Ce,dataFile:u,setDataFile:l,setArrStudent:f,arrStudent:c,isCheckDomainIBS:y,onChangeTeacher:p,uploadByTeacherId:F,setDataFileImportStudent:k,onUpLoadStudentFile:O,defaultTeacher:S,fileName:j,onStudentSubmit:()=>{e(t.setModal({isOpen:!0,type:"warning",message:"Are you sure upload this file?",onConfirm:()=>{O()}}))},downloadTemplateUser:x}},ds=()=>{const e=Y.useDispatch(),a=async u=>{e(t.setLoading(!0));try{await K.postRequestResendMail(u),e(t.setAlert({type:"success",message:"Send Successfully"}))}catch(l){e(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}e(t.setLoading(!1))};return{handleSendMultiUsers:u=>{a({userIds:[...u]})},handleSendSingleUser:u=>{a({userIds:[u]})}}},us=({state:e,onClose:a,onConfirm:r})=>{const{t:o}=ee.useTranslation(),[u,l]=d.useState(null),[c,f]=d.useState(null),g=!!(e.msTeachers&&e.msTeachers.length>0),R=!!(e.esTeachers&&e.esTeachers.length>0),h=d.useMemo(()=>(e.msTeachers||[]).map(S=>{const w=S.name||S.fullName||"";return{label:w?`${w} (${S.email})`:S.email,value:S.id}}),[e.msTeachers]),m=d.useMemo(()=>(e.esTeachers||[]).map(S=>{const w=S.name||S.fullName||"";return{label:w?`${w} (${S.email})`:S.email,value:S.id}}),[e.esTeachers]),v=(!g||!!u)&&(!R||!!c),y=()=>{v&&r(u?.value,c?.value)};return n.jsxs(E.Modal,{centered:!0,isOpen:e.isOpen,toggle:a,zIndex:1201,children:[n.jsx(E.ModalHeader,{toggle:a,children:o("transfer_data_before_delete","Transfer Data Before Deletion")}),n.jsxs(E.ModalBody,{children:[n.jsx("p",{className:"text-muted mb-3",children:o("user_has_associated_data_notice","This educator currently has associated students, sessions, or records. Please select an active teacher to receive their data before removing.")}),g&&n.jsxs(E.FormGroup,{className:"mb-3",children:[n.jsxs(E.Label,{className:"font-weight-bold",children:[t.tierLabel(t.isCombineMsHs()?o("middle_high_school_transfer_teacher","Middle & High School (MS & HS) - Select Replacement Teacher"):o("middle_school_transfer_teacher","Middle School (MS) - Select Replacement Teacher"),"Secondary - Select Replacement Teacher")," *"]}),n.jsx(t.CustomSelector,{value:u,options:h,placeholder:o("select_teacher","Select teacher"),className:t.styles["custom-chip-teacher-select"],onChange:S=>l(S),isClearable:!0})]}),R&&n.jsxs(E.FormGroup,{className:"mb-3",children:[n.jsxs(E.Label,{className:"font-weight-bold",children:[t.tierLabel(o("elementary_school_transfer_teacher","Elementary School (ES) - Select Replacement Teacher"),"Primary - Select Replacement Teacher")," *"]}),n.jsx(t.CustomSelector,{value:c,options:m,placeholder:o("select_teacher","Select teacher"),className:t.styles["custom-chip-teacher-select"],onChange:S=>f(S),isClearable:!0})]})]}),n.jsxs(E.ModalFooter,{children:[n.jsx(E.Button,{color:"secondary",onClick:a,children:o("cancel","Cancel")}),n.jsx(E.Button,{color:"primary",onClick:y,disabled:!v,children:o("confirm_and_delete","Confirm & Delete")})]})]})},re={fontWeight:500},oe={height:38,backgroundColor:"#2eb85c",borderColor:"#2eb85c"},hs={display:"inline-block",fontSize:11,fontWeight:700,color:"#3b4ba8",backgroundColor:"#e9ecfb",borderRadius:4,padding:"1px 6px",marginRight:6,textTransform:"uppercase"},ce=e=>t.isUkSystem()?Array.from(new Set(e.split(",").map(a=>a.trim()==="ES"?"P1":"S2"))).join(", "):e,me=({label:e})=>n.jsx("span",{style:hs,children:e}),ms=({label:e})=>n.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,color:"#3b4ba8",backgroundColor:"#e9ecfb",borderRadius:4,padding:"3px 8px",textTransform:"uppercase"},children:e}),ps=({isActive:e,t:a})=>n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",fontSize:12,fontWeight:600,color:e?"#047857":"#6b7280",backgroundColor:e?"#d1fae5":"#f3f4f6",borderRadius:"20px",padding:"4px 12px"},children:[n.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e?"#10b981":"#9ca3af",marginRight:"8px"}}),a(e?"active":"inactive")]}),le=e=>(e||[]).map(a=>a==="SecondaryTeacher"?"SupportTeacher":a).join(", "),gs="user",be=()=>{const{queryName:e,userList:a,totalItems:r,filters:o,fullName:u,removeData:l,changeFilters:c,reDirectDetailPage:f,switchUser:g,handleSyncRosterUsers:R,rosterUserInfo:h,onSelectUser:m,userIds:v,onSelectAllUser:y,isCheckAll:S,transferModal:w,closeTransferModal:j,confirmTransferRemove:G}=Me(),{handleSendMultiUsers:x}=ds(),{upload:N}=is(),{exportUsers:F,exportClassCodes:z}=ns(),{t:p}=ee.useTranslation(),{getLabel:k,system:O}=t.useGradeLabel(),q=()=>F(o),T=()=>z(o),H=d.useMemo(()=>[{name:"",isCenter:!0,onSelectAll:y,isCheckAll:S}].concat(B.UserColumns.map(s=>s.searchBy===B.SearchBy.Tiers&&t.isCombineMsHs()?{...s,options:(s.options||[]).filter(i=>!i.value.includes("HS"))}:s.searchBy===B.SearchBy.Grade?{...s,name:O==="UK"?"Year":"grade",options:(s.options||B.gradeOptions).map(i=>({...i,label:k(i.value)}))}:s)),[y,S,O,k]);return n.jsxs("div",{className:`fadeIn animated h-100 ${t.screenWidth<=767?t.styles["p-0-12"]:""}`,children:[n.jsx("h5",{className:"mt-4 mb-2",children:p(`${gs}`)}),n.jsxs(E.Row,{className:"my-2",children:[n.jsx(E.Col,{md:8,children:n.jsx(t.SearchBoxContainer,{text:p("create_user"),onClick:()=>f(),initValue:e||"",onSearch:s=>c({searchString:s}),placeholder:p("type_something_to_search_by_user_name")})}),n.jsxs(E.Col,{md:4,className:"d-flex justify-content-end align-items-center",children:[p("total_of_users")," : ",r]}),n.jsxs(E.Col,{md:12,className:"d-flex justify-content-end my-2 flex-wrap",style:{gap:"8px"},children:[n.jsx("button",{className:"btn btn-success d-flex align-items-center border-0",style:oe,onClick:()=>x(v),children:n.jsx("p",{className:`${t.styles["button-content"]} mb-0`,style:re,children:p("welcome_email_resend")})}),n.jsx(E.Input,{id:"import-user",className:"d-none",type:"file",onChange:s=>N(s.target.files[0]),accept:"text/csv"}),n.jsx($e,{text:p("sync_roster_users"),onClick:R}),n.jsxs("button",{className:"btn btn-success d-flex align-items-center border-0 p-0",style:oe,onClick:T,children:[n.jsx("div",{className:`${t.styles["button-icon"]}`,children:n.jsx("img",{src:"images/export-icon.svg",alt:""})}),n.jsx("p",{className:`${t.styles["button-content"]} mb-0`,style:re,children:p("export_class_code_to_csv")})]}),n.jsxs("button",{className:"btn btn-success d-flex align-items-center border-0 p-0",style:oe,onClick:q,children:[n.jsx("div",{className:`${t.styles["button-icon"]}`,children:n.jsx("img",{src:"images/export-icon.svg",alt:""})}),n.jsx("p",{className:`${t.styles["button-content"]} mb-0`,style:re,children:p("export_to_csv")})]})]})]}),n.jsxs(E.Row,{className:"mb-2",children:[n.jsx(E.Col,{md:12,children:n.jsx("div",{style:{overflow:"auto"},children:n.jsxs(E.Table,{bordered:!0,hover:!0,striped:!0,size:"sm",children:[n.jsx("thead",{children:n.jsx(xe,{headers:H,filters:o,fullName:u,onChangeFilters:c})}),n.jsxs("tbody",{children:[a&&a.length>0&&a.map(s=>{const i=new Set((s.appType||"").split(",").map(L=>L.trim().toUpperCase()).filter(Boolean));i.size===0&&(s.esRoles&&s.esRoles.length>0&&i.add("ES"),s.msRoles&&s.msRoles.length>0&&i.add("MS"),s.hsRoles&&s.hsRoles.length>0&&i.add("HS"));let C=["ES","MS","HS"].filter(L=>i.has(L));const b=(s.roles||[]).some(L=>L.toLowerCase()==="student")||(s.esRoles||[]).some(L=>L.toLowerCase()==="student")||(s.msRoles||[]).some(L=>L.toLowerCase()==="student")||(s.hsRoles||[]).some(L=>L.toLowerCase()==="student"),A=String(s.grade||s.gradeLevel||s.rosterUser?.grades||"").trim().replace(/^0+(?=\d)/,"");if(b){const L=String(s.grade||s.gradeLevel||"").trim(),M=String(s.preferredAppType||"").trim().toUpperCase();C=[!t.isCombineMsHs()&&(M==="HS"||t.HS_GRADES.includes(L))?"HS":M==="ES"||t.ES_GRADES.includes(L)?"ES":"MS"]}const U=C.includes("MS"),I=C.includes("HS"),P=C.includes("ES"),$=U&&I&&(s.msRoles||[]).slice().sort().join(",")===(s.hsRoles||[]).slice().sort().join(","),D=[];return P&&D.push({tierLabel:"ES",roles:s.esRoles&&s.esRoles.length>0?s.esRoles:b?s.roles:s.esRoles}),$?D.push({tierLabel:"MS, HS",roles:s.msRoles||s.hsRoles}):(U&&D.push({tierLabel:"MS",roles:s.msRoles&&s.msRoles.length>0?s.msRoles:b?s.roles:s.msRoles}),I&&D.push({tierLabel:"HS",roles:s.hsRoles&&s.hsRoles.length>0?s.hsRoles:b?s.roles:s.hsRoles})),n.jsxs("tr",{children:[n.jsx("td",{className:"align-middle",children:n.jsx("input",{type:"checkbox",onChange:()=>m(s.id),checked:v.includes(s.id)??!1})}),n.jsx("td",{className:"align-middle",children:n.jsx(t.LinkEditButton,{label:`${s.fullName}`,onClick:()=>f(s.id)})}),n.jsx("td",{className:"align-middle",children:s.email}),n.jsx("td",{className:"align-middle",children:b?k(A):""}),n.jsx("td",{className:"align-middle",children:D.length>1?n.jsx(n.Fragment,{children:D.map((L,M)=>n.jsxs("div",{className:M>0?"mt-1":"",children:[n.jsx(me,{label:ce(L.tierLabel)}),le(L.roles)]},L.tierLabel))}):D.length===1?n.jsxs("div",{children:[n.jsx(me,{label:ce(D[0].tierLabel)}),le(D[0].roles||s.roles)]}):!!s.roles&&le(s.roles)}),n.jsx("td",{className:"align-middle text-uppercase",children:C.length>0&&n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",alignItems:"center",width:"fit-content"},children:ce(C.join(", ")).split(", ").map(L=>n.jsx(ms,{label:L},L))})}),n.jsx("td",{className:"align-middle",children:n.jsx(ps,{isActive:s.isActive,t:p})}),n.jsx("td",{className:"align-middle",children:t.formatLocalTime(s?.createTime,"yyyy-MM-dd HH:mm")}),n.jsx("td",{children:h(s)}),n.jsx("td",{className:"align-middle",children:n.jsx(t.FaUsersCog,{style:{fontSize:"18px",margin:"0 10px",cursor:"pointer"},onClick:()=>g(s.id)})}),n.jsx("td",{className:"align-middle",style:{padding:"0 15px"},children:n.jsx(t.DeleteButtonIcon,{onClick:()=>l(s.id)})})]},`${s.id}_${s.appType||""}`)}),(!a||!a.length)&&n.jsx("tr",{children:n.jsx("td",{colSpan:12,className:"p-0",children:n.jsx(t.EmptyDataAlert,{className:"mb-0",label:p("user")})})})]})]})})}),n.jsx(E.Col,{md:12,children:n.jsx(t.CustomPagination,{filters:o,totalRecordCount:r,changePageSize:s=>c({pageSize:s}),changePage:s=>c({currentPage:s})})})]}),n.jsx(us,{state:w,onClose:j,onConfirm:G})]})},fs=Object.freeze(Object.defineProperty({__proto__:null,default:be},Symbol.toStringTag,{value:"Module"}));exports.AiOutlineDownload=Ge;exports.TableHeader=xe;exports.UserList=be;exports.UserList$1=fs;exports.extractStaffList=Ye;exports.filterOptionsBySchoolLevel=ss;exports.matchesStudentTier=ye;exports.resolveStudentTier=Se;exports.validateCsvApi=ls;
@@ -0,0 +1,241 @@
1
+ import { ay as o, az as s } from "./index-CfBp3NrB.mjs";
2
+ var a = /* @__PURE__ */ ((e) => (e[e.Id = 0] = "Id", e[e.Name = 1] = "Name", e[e.Email = 2] = "Email", e[e.Age = 3] = "Age", e[e.Role = 4] = "Role", e[e.Status = 5] = "Status", e[e.CreatedAt = 6] = "CreatedAt", e[e.RosterUser = 7] = "RosterUser", e[e.Grade = 8] = "Grade", e[e.Teacher = 9] = "Teacher", e[e.Assistant = 10] = "Assistant", e[e.Counselor = 11] = "Counselor", e[e.SecondaryTeacher = 12] = "SecondaryTeacher", e[e.Tiers = 13] = "Tiers", e))(a || {}), l = /* @__PURE__ */ ((e) => (e[e.Id = 0] = "Id", e[e.Name = 1] = "Name", e[e.Email = 2] = "Email", e[e.Role = 3] = "Role", e[e.RosterUser = 4] = "RosterUser", e[e.Status = 5] = "Status", e[e.Grade = 6] = "Grade", e[e.Teacher = 7] = "Teacher", e[e.Assistant = 8] = "Assistant", e[e.Counselor = 9] = "Counselor", e[e.SecondaryTeacher = 10] = "SecondaryTeacher", e[e.Tiers = 11] = "Tiers", e))(l || {}), i = /* @__PURE__ */ ((e) => (e[e.Teacher = 0] = "Teacher", e[e.Assistant = 1] = "Assistant", e[e.Counselor = 2] = "Counselor", e[e.SecondaryTeacher = 3] = "SecondaryTeacher", e))(i || {});
3
+ const r = {
4
+ [a.Id]: "filter-id",
5
+ [a.Name]: "filter-name",
6
+ [a.Email]: "filter-email",
7
+ [a.Age]: "filter-age",
8
+ [a.Role]: "filter-role",
9
+ [a.Status]: "filter-status",
10
+ [a.CreatedAt]: "filter-createdAt",
11
+ [a.RosterUser]: "filter-roster",
12
+ [a.Grade]: "filter-grade",
13
+ [a.Teacher]: "filter-teacher",
14
+ [a.Assistant]: "filter-assistant",
15
+ [a.Counselor]: "filter-counselor",
16
+ [a.SecondaryTeacher]: "filter-secondary",
17
+ [a.Tiers]: "filter-tiers"
18
+ }, n = [
19
+ { label: "PK", value: "PK" },
20
+ { label: "K", value: "K" },
21
+ { label: "G", value: "G" },
22
+ { label: "1", value: "1" },
23
+ { label: "2", value: "2" },
24
+ { label: "3", value: "3" },
25
+ { label: "4", value: "4" },
26
+ { label: "5", value: "5" },
27
+ { label: "6", value: "6" },
28
+ { label: "7", value: "7" },
29
+ { label: "8", value: "8" },
30
+ { label: "9", value: "9" },
31
+ { label: "10", value: "10" },
32
+ { label: "11", value: "11" },
33
+ { label: "12", value: "12" },
34
+ ...s ? [{ label: "12/13", value: "12/13" }] : [],
35
+ { label: "13", value: "13" }
36
+ ], c = [
37
+ {
38
+ name: "name",
39
+ isCenter: !0,
40
+ sortBy: a.Name,
41
+ className: "align-top"
42
+ },
43
+ {
44
+ name: "email",
45
+ isCenter: !0,
46
+ sortBy: a.Email,
47
+ className: "align-top"
48
+ },
49
+ {
50
+ name: "grade",
51
+ isCenter: !0,
52
+ sortBy: a.Grade,
53
+ searchBy: l.Grade,
54
+ className: "align-top",
55
+ options: n
56
+ },
57
+ {
58
+ name: "role",
59
+ isCenter: !0,
60
+ sortBy: a.Role,
61
+ searchBy: l.Role,
62
+ className: "align-top",
63
+ options: o
64
+ },
65
+ {
66
+ name: "tiers",
67
+ isCenter: !0,
68
+ sortBy: a.Tiers,
69
+ searchBy: l.Tiers,
70
+ className: "align-top",
71
+ // Khop CHINH XAC voi "AppType hieu luc" tu API mappingRosterUsers:
72
+ // "ES"/"MS" = user chi thuoc (hoac chi con active o) 1 ben;
73
+ // "ES, MS" = user dang active o ca 2 ben.
74
+ options: [
75
+ { label: "ES", value: "ES" },
76
+ { label: "MS", value: "MS" },
77
+ { label: "HS", value: "HS" },
78
+ { label: "ES, MS", value: "ES, MS" },
79
+ { label: "MS, HS", value: "MS, HS" },
80
+ { label: "ES, HS", value: "ES, HS" },
81
+ { label: "ES, MS, HS", value: "ES, MS, HS" }
82
+ ]
83
+ },
84
+ {
85
+ name: "active_status",
86
+ isCenter: !0,
87
+ sortBy: a.Status,
88
+ searchBy: l.Status,
89
+ className: "align-top",
90
+ options: [
91
+ {
92
+ label: "Active",
93
+ value: "true"
94
+ },
95
+ {
96
+ label: "Inactive",
97
+ value: "false"
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ name: "created_time",
103
+ isCenter: !0,
104
+ sortBy: a.CreatedAt,
105
+ className: "align-top"
106
+ },
107
+ {
108
+ name: "information_roster_sourced_id_full_name_email",
109
+ isCenter: !0,
110
+ sortBy: a.RosterUser,
111
+ searchBy: l.RosterUser,
112
+ className: "align-top",
113
+ options: [
114
+ { label: "Has Source", value: "has_source" },
115
+ { label: "No Source", value: "no_source" }
116
+ ]
117
+ },
118
+ {
119
+ name: "impersonate",
120
+ isCenter: !0,
121
+ className: "align-top"
122
+ },
123
+ {
124
+ name: "delete",
125
+ isCenter: !0,
126
+ className: "align-top"
127
+ }
128
+ ], t = {
129
+ value: 10
130
+ }, v = {
131
+ searchString: "",
132
+ currentPage: 1,
133
+ pageSize: t.value,
134
+ // Mac dinh hien tat ca status, active truoc (IAM tra list da sort theo ten,
135
+ // sort status la stable nen trong moi nhom van theo ten).
136
+ sortBy: a.Status,
137
+ isDescending: !0
138
+ }, m = {
139
+ searchString: "",
140
+ currentPage: 1,
141
+ pageSize: t.value
142
+ }, b = {
143
+ currentPage: 1,
144
+ pageSize: 200
145
+ }, E = "data:text/csv;charset=utf-8,", S = {
146
+ assistantId: "",
147
+ counselors: [],
148
+ secondaryTeacherId: "",
149
+ teacher: [],
150
+ assistantEmail: "",
151
+ secondaryTeacherEmail: ""
152
+ }, h = {
153
+ studentId: 0,
154
+ id: "",
155
+ email: "",
156
+ fullName: "",
157
+ gradeLevel: "",
158
+ phoneNumber: "",
159
+ isActive: !0,
160
+ dateOfBirth: "",
161
+ profileImageFileName: "",
162
+ quote: "",
163
+ assistantName: "",
164
+ assistantEmail: "",
165
+ assistantUserId: "",
166
+ counselors: [],
167
+ secondaryTeacherName: "",
168
+ secondaryTeacherEmail: "",
169
+ secondaryTeacherUserId: "",
170
+ teachers: []
171
+ }, d = [
172
+ { label: "PK", value: "PK", schoolLevel: "es" },
173
+ { label: "K", value: "K", schoolLevel: "es" },
174
+ { label: "G", value: "G", schoolLevel: "es" },
175
+ { label: "1", value: "1", schoolLevel: "es" },
176
+ { label: "2", value: "2", schoolLevel: "es" },
177
+ { label: "3", value: "3", schoolLevel: "es" },
178
+ { label: "4", value: "4", schoolLevel: "es" },
179
+ { label: "5", value: "5", schoolLevel: "es" },
180
+ { label: "6", value: "6", schoolLevel: "ms" },
181
+ { label: "7", value: "7", schoolLevel: "ms" },
182
+ { label: "8", value: "8", schoolLevel: "ms" },
183
+ { label: "9", value: "9", schoolLevel: "ms" },
184
+ { label: "10", value: "10", schoolLevel: "hs" },
185
+ { label: "11", value: "11", schoolLevel: "hs" },
186
+ { label: "12", value: "12", schoolLevel: "hs" },
187
+ ...s ? [{ label: "12/13", value: "12/13", schoolLevel: "hs" }] : [],
188
+ { label: "13", value: "13", schoolLevel: "hs" }
189
+ ], g = [
190
+ "PK",
191
+ "K",
192
+ "G",
193
+ "1",
194
+ "2",
195
+ "3",
196
+ "4",
197
+ "5",
198
+ "6",
199
+ "7",
200
+ "8",
201
+ "9",
202
+ "10",
203
+ "11",
204
+ "12",
205
+ ...s ? ["12/13"] : [],
206
+ "13"
207
+ ], f = {
208
+ assistantRemoveUserId: [],
209
+ counselorRemoveUserIds: [],
210
+ teacherRemoveUserIds: [],
211
+ teacherSwitchDataUserId: "",
212
+ assistantSwitchDataUserId: "",
213
+ counselorSwitchDataUserId: "",
214
+ supportTeacherRemoveUserIds: [],
215
+ supportTeacherSwitchDataUserId: ""
216
+ }, L = {
217
+ id: "",
218
+ firstName: "",
219
+ lastName: "",
220
+ email: "",
221
+ fullName: "",
222
+ roles: []
223
+ };
224
+ export {
225
+ E as C,
226
+ m as D,
227
+ d as G,
228
+ l as S,
229
+ i as T,
230
+ a as U,
231
+ S as a,
232
+ f as b,
233
+ L as c,
234
+ v as d,
235
+ g as e,
236
+ b as f,
237
+ c as g,
238
+ n as h,
239
+ h as i,
240
+ r as u
241
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("./index-CD8bO3wO.js");var l=(e=>(e[e.Id=0]="Id",e[e.Name=1]="Name",e[e.Email=2]="Email",e[e.Age=3]="Age",e[e.Role=4]="Role",e[e.Status=5]="Status",e[e.CreatedAt=6]="CreatedAt",e[e.RosterUser=7]="RosterUser",e[e.Grade=8]="Grade",e[e.Teacher=9]="Teacher",e[e.Assistant=10]="Assistant",e[e.Counselor=11]="Counselor",e[e.SecondaryTeacher=12]="SecondaryTeacher",e[e.Tiers=13]="Tiers",e))(l||{}),a=(e=>(e[e.Id=0]="Id",e[e.Name=1]="Name",e[e.Email=2]="Email",e[e.Role=3]="Role",e[e.RosterUser=4]="RosterUser",e[e.Status=5]="Status",e[e.Grade=6]="Grade",e[e.Teacher=7]="Teacher",e[e.Assistant=8]="Assistant",e[e.Counselor=9]="Counselor",e[e.SecondaryTeacher=10]="SecondaryTeacher",e[e.Tiers=11]="Tiers",e))(a||{}),t=(e=>(e[e.Teacher=0]="Teacher",e[e.Assistant=1]="Assistant",e[e.Counselor=2]="Counselor",e[e.SecondaryTeacher=3]="SecondaryTeacher",e))(t||{});const n={[l.Id]:"filter-id",[l.Name]:"filter-name",[l.Email]:"filter-email",[l.Age]:"filter-age",[l.Role]:"filter-role",[l.Status]:"filter-status",[l.CreatedAt]:"filter-createdAt",[l.RosterUser]:"filter-roster",[l.Grade]:"filter-grade",[l.Teacher]:"filter-teacher",[l.Assistant]:"filter-assistant",[l.Counselor]:"filter-counselor",[l.SecondaryTeacher]:"filter-secondary",[l.Tiers]:"filter-tiers"},o=[{label:"PK",value:"PK"},{label:"K",value:"K"},{label:"G",value:"G"},{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"},{label:"7",value:"7"},{label:"8",value:"8"},{label:"9",value:"9"},{label:"10",value:"10"},{label:"11",value:"11"},{label:"12",value:"12"},...s.isMalvernCollege?[{label:"12/13",value:"12/13"}]:[],{label:"13",value:"13"}],u=[{name:"name",isCenter:!0,sortBy:l.Name,className:"align-top"},{name:"email",isCenter:!0,sortBy:l.Email,className:"align-top"},{name:"grade",isCenter:!0,sortBy:l.Grade,searchBy:a.Grade,className:"align-top",options:o},{name:"role",isCenter:!0,sortBy:l.Role,searchBy:a.Role,className:"align-top",options:s.USER_ROLE_FILTER_OPTIONS},{name:"tiers",isCenter:!0,sortBy:l.Tiers,searchBy:a.Tiers,className:"align-top",options:[{label:"ES",value:"ES"},{label:"MS",value:"MS"},{label:"HS",value:"HS"},{label:"ES, MS",value:"ES, MS"},{label:"MS, HS",value:"MS, HS"},{label:"ES, HS",value:"ES, HS"},{label:"ES, MS, HS",value:"ES, MS, HS"}]},{name:"active_status",isCenter:!0,sortBy:l.Status,searchBy:a.Status,className:"align-top",options:[{label:"Active",value:"true"},{label:"Inactive",value:"false"}]},{name:"created_time",isCenter:!0,sortBy:l.CreatedAt,className:"align-top"},{name:"information_roster_sourced_id_full_name_email",isCenter:!0,sortBy:l.RosterUser,searchBy:a.RosterUser,className:"align-top",options:[{label:"Has Source",value:"has_source"},{label:"No Source",value:"no_source"}]},{name:"impersonate",isCenter:!0,className:"align-top"},{name:"delete",isCenter:!0,className:"align-top"}],i={value:10},r={searchString:"",currentPage:1,pageSize:i.value,sortBy:l.Status,isDescending:!0},c={searchString:"",currentPage:1,pageSize:i.value},v={currentPage:1,pageSize:200},m="data:text/csv;charset=utf-8,",E={assistantId:"",counselors:[],secondaryTeacherId:"",teacher:[],assistantEmail:"",secondaryTeacherEmail:""},b={studentId:0,id:"",email:"",fullName:"",gradeLevel:"",phoneNumber:"",isActive:!0,dateOfBirth:"",profileImageFileName:"",quote:"",assistantName:"",assistantEmail:"",assistantUserId:"",counselors:[],secondaryTeacherName:"",secondaryTeacherEmail:"",secondaryTeacherUserId:"",teachers:[]},S=[{label:"PK",value:"PK",schoolLevel:"es"},{label:"K",value:"K",schoolLevel:"es"},{label:"G",value:"G",schoolLevel:"es"},{label:"1",value:"1",schoolLevel:"es"},{label:"2",value:"2",schoolLevel:"es"},{label:"3",value:"3",schoolLevel:"es"},{label:"4",value:"4",schoolLevel:"es"},{label:"5",value:"5",schoolLevel:"es"},{label:"6",value:"6",schoolLevel:"ms"},{label:"7",value:"7",schoolLevel:"ms"},{label:"8",value:"8",schoolLevel:"ms"},{label:"9",value:"9",schoolLevel:"ms"},{label:"10",value:"10",schoolLevel:"hs"},{label:"11",value:"11",schoolLevel:"hs"},{label:"12",value:"12",schoolLevel:"hs"},...s.isMalvernCollege?[{label:"12/13",value:"12/13",schoolLevel:"hs"}]:[],{label:"13",value:"13",schoolLevel:"hs"}],d=["PK","K","G","1","2","3","4","5","6","7","8","9","10","11","12",...s.isMalvernCollege?["12/13"]:[],"13"],h={assistantRemoveUserId:[],counselorRemoveUserIds:[],teacherRemoveUserIds:[],teacherSwitchDataUserId:"",assistantSwitchDataUserId:"",counselorSwitchDataUserId:"",supportTeacherRemoveUserIds:[],supportTeacherSwitchDataUserId:""},T={id:"",firstName:"",lastName:"",email:"",fullName:"",roles:[]};exports.CSV_PREFIX=m;exports.DEFAULT_FILTER=r;exports.DEFAULT_FILTER_POPOVER=v;exports.DEFAULT_STUDENT_FILTER=c;exports.GRADE=d;exports.GRADE_DEFAULT=S;exports.SearchBy=a;exports.TeacherType=t;exports.UserColumns=u;exports.UserOrder=l;exports.gradeOptions=o;exports.initAssignStd=b;exports.initStaffDeleteBulk=h;exports.initialStaffBulk=E;exports.initialUserChoice=T;exports.userOrders=n;