mario-core 2.0.32-release → 2.0.33-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 (187) hide show
  1. package/dist/Dashboard-BIhv8car.js +1 -0
  2. package/dist/Dashboard-BY5BVLIW.mjs +206 -0
  3. package/dist/Dashboard-BYXh-LYm.mjs +206 -0
  4. package/dist/Dashboard-Bp0ko4Nx.js +1 -0
  5. package/dist/Dashboard-BxX4EZkL.mjs +206 -0
  6. package/dist/Dashboard-CLvLdCvD.mjs +206 -0
  7. package/dist/Dashboard-CjDPZlwI.js +1 -0
  8. package/dist/Dashboard-D4yeROnn.mjs +206 -0
  9. package/dist/Dashboard-D6igZd4M.js +1 -0
  10. package/dist/Dashboard-D7X8bg8t.mjs +206 -0
  11. package/dist/Dashboard-DRaSlZLc.js +1 -0
  12. package/dist/Dashboard-DbI4E9od.js +1 -0
  13. package/dist/EmailTemplateDetail-B-Kab5TK.mjs +443 -0
  14. package/dist/EmailTemplateDetail-BJGaN7uh.js +1 -0
  15. package/dist/EmailTemplateDetail-BOqn4rkr.mjs +417 -0
  16. package/dist/EmailTemplateDetail-BlhCa_EF.mjs +443 -0
  17. package/dist/EmailTemplateDetail-CW0ymDWF.mjs +443 -0
  18. package/dist/EmailTemplateDetail-CZKvX-_q.js +1 -0
  19. package/dist/EmailTemplateDetail-D4EupjNO.js +1 -0
  20. package/dist/EmailTemplateDetail-DDbJbMWn.js +1 -0
  21. package/dist/EmailTemplateDetail-DP04M6QH.js +1 -0
  22. package/dist/EmailTemplateDetail-DSeAyn-F.mjs +443 -0
  23. package/dist/EmailTemplateDetail-J5R0X631.mjs +443 -0
  24. package/dist/EmailTemplateDetail-c2RcFzG5.js +1 -0
  25. package/dist/EmailTemplateList-BAVOo58z.js +1 -0
  26. package/dist/EmailTemplateList-BMCpm7sf.js +1 -0
  27. package/dist/EmailTemplateList-BQCcXdif.mjs +170 -0
  28. package/dist/EmailTemplateList-BVB1lsW7.mjs +170 -0
  29. package/dist/EmailTemplateList-BVfQCPzA.js +1 -0
  30. package/dist/EmailTemplateList-C-aj1Pl0.mjs +170 -0
  31. package/dist/EmailTemplateList-C5c2T4_M.mjs +170 -0
  32. package/dist/EmailTemplateList-D3G-A7Jo.js +1 -0
  33. package/dist/EmailTemplateList-DPQTaV4-.js +1 -0
  34. package/dist/EmailTemplateList-JRLV6pZW.mjs +170 -0
  35. package/dist/EmailTemplateList-ZTs0DmjS.js +1 -0
  36. package/dist/EmailTemplateList-gwkheOgx.mjs +168 -0
  37. package/dist/GalleryList-BU1m_MP_.js +1 -0
  38. package/dist/GalleryList-BftIdfu8.js +1 -0
  39. package/dist/GalleryList-Bl4FojYJ.mjs +329 -0
  40. package/dist/GalleryList-ByJ1_7Qx.mjs +329 -0
  41. package/dist/GalleryList-CVzc1xGW.js +1 -0
  42. package/dist/GalleryList-D5E7p3kE.mjs +329 -0
  43. package/dist/GalleryList-D5ZydfSV.js +1 -0
  44. package/dist/GalleryList-DHblERzG.js +1 -0
  45. package/dist/GalleryList-DXnU-Aou.mjs +329 -0
  46. package/dist/GalleryList-DpM906eg.mjs +329 -0
  47. package/dist/GalleryList-ZJ_mdpVZ.js +1 -0
  48. package/dist/GalleryList-oJNXivHy.mjs +329 -0
  49. package/dist/Login-A2cXwovI.mjs +1380 -0
  50. package/dist/Login-B69XhtIm.mjs +1380 -0
  51. package/dist/Login-BLyikyni.mjs +1380 -0
  52. package/dist/Login-Bwr0h4GC.js +1 -0
  53. package/dist/Login-C12Whvdx.js +1 -0
  54. package/dist/Login-CIcbHD7-.mjs +1380 -0
  55. package/dist/Login-D7gUoYyV.js +1 -0
  56. package/dist/Login-DEMe7ra6.js +1 -0
  57. package/dist/Login-Dcwb-HaZ.js +1 -0
  58. package/dist/Login-Rwbmk--s.js +1 -0
  59. package/dist/Login-h3o1lUKK.mjs +1380 -0
  60. package/dist/Login-xn2j4Jqq.mjs +1380 -0
  61. package/dist/NotificationList--DZcYUS5.js +2 -0
  62. package/dist/NotificationList-D26jJ6Wc.mjs +3969 -0
  63. package/dist/NotificationList-DZ1epO3L.mjs +3969 -0
  64. package/dist/NotificationList-D_lGCmIS.js +2 -0
  65. package/dist/NotificationList-Da-pWu35.js +2 -0
  66. package/dist/NotificationList-Dogczlgr.mjs +3969 -0
  67. package/dist/NotificationList-Dv0JIP69.js +2 -0
  68. package/dist/NotificationList-DygQSzwE.mjs +3969 -0
  69. package/dist/NotificationList-Ku1m25fI.mjs +3969 -0
  70. package/dist/NotificationList-Ml4QiyAE.mjs +3969 -0
  71. package/dist/NotificationList-_AHdv4bs.js +2 -0
  72. package/dist/NotificationList-rKx7xooX.js +2 -0
  73. package/dist/SkillList-BUDiP8Ba.mjs +386 -0
  74. package/dist/SkillList-Btum0zIE.js +1 -0
  75. package/dist/SkillList-C-dw1122.js +1 -0
  76. package/dist/SkillList-C0ZfIxCl.js +1 -0
  77. package/dist/SkillList-CZTd0oz_.mjs +386 -0
  78. package/dist/SkillList-DPU-l8aA.js +1 -0
  79. package/dist/SkillList-DTxT0Hbn.js +1 -0
  80. package/dist/SkillList-DVXAACsz.mjs +386 -0
  81. package/dist/SkillList-DX530KHp.mjs +386 -0
  82. package/dist/SkillList-DahOq8Os.mjs +386 -0
  83. package/dist/SkillList-DivkFIrP.mjs +386 -0
  84. package/dist/SkillList-yosFFVsc.js +1 -0
  85. package/dist/TeacherSelector-5UVov2Wf.mjs +30 -0
  86. package/dist/TeacherSelector-Bi582rEx.mjs +30 -0
  87. package/dist/TeacherSelector-BmmfQxU8.js +1 -0
  88. package/dist/TeacherSelector-BngXAzRe.mjs +30 -0
  89. package/dist/TeacherSelector-C7-XuXfb.mjs +30 -0
  90. package/dist/TeacherSelector-C9Z5JX-P.js +1 -0
  91. package/dist/TeacherSelector-CZ1DrLUk.js +1 -0
  92. package/dist/TeacherSelector-CbJ1kPyV.js +1 -0
  93. package/dist/TeacherSelector-CkGdl96R.js +1 -0
  94. package/dist/TeacherSelector-CxDiVyno.mjs +30 -0
  95. package/dist/TeacherSelector-DomtJIQi.js +1 -0
  96. package/dist/TeacherSelector-mjBcHGJF.mjs +30 -0
  97. package/dist/TheContent-B42qwDUV.mjs +38 -0
  98. package/dist/TheContent-BW03X6oT.mjs +38 -0
  99. package/dist/TheContent-CayaQR9C.js +1 -0
  100. package/dist/TheContent-CiU0FBTA.mjs +38 -0
  101. package/dist/TheContent-D5Qx4QXe.js +1 -0
  102. package/dist/TheContent-DHWnB8WX.js +1 -0
  103. package/dist/TheContent-DPy5BFuN.js +1 -0
  104. package/dist/TheContent-Dl7_h11H.mjs +38 -0
  105. package/dist/TheContent-DxN9-GIu.mjs +38 -0
  106. package/dist/TheContent-H-Hg7kIq.js +1 -0
  107. package/dist/TheContent-aEfXKW_H.mjs +38 -0
  108. package/dist/TheContent-xUKaH5bl.js +1 -0
  109. package/dist/UserContainer-3dOz3yZF.js +5 -0
  110. package/dist/UserContainer-B-abn6--.js +5 -0
  111. package/dist/UserContainer-BIl8c0yJ.js +5 -0
  112. package/dist/UserContainer-BjYrV0kt.mjs +2783 -0
  113. package/dist/UserContainer-BoJ73Ko9.js +5 -0
  114. package/dist/UserContainer-CFnSfW2A.js +5 -0
  115. package/dist/UserContainer-CGlDCED1.mjs +2771 -0
  116. package/dist/UserContainer-CqTUtCe6.mjs +2770 -0
  117. package/dist/UserContainer-CtYpysOo.mjs +2771 -0
  118. package/dist/UserContainer-Cu6koTiw.mjs +2771 -0
  119. package/dist/UserContainer-Dz991Fto.mjs +2770 -0
  120. package/dist/UserContainer-d3ywqdWh.js +5 -0
  121. package/dist/UserDetail-BCLssfN6.mjs +902 -0
  122. package/dist/UserDetail-BRCOabYu.mjs +902 -0
  123. package/dist/UserDetail-BsWWKLof.js +1 -0
  124. package/dist/UserDetail-CkMU6eej.js +1 -0
  125. package/dist/UserDetail-Cl6y6AtA.js +1 -0
  126. package/dist/UserDetail-CqBaMe5l.mjs +902 -0
  127. package/dist/UserDetail-D36q7Em-.mjs +902 -0
  128. package/dist/UserDetail-DFjYZZOc.js +1 -0
  129. package/dist/UserDetail-DIGlXdot.mjs +914 -0
  130. package/dist/UserDetail-DizNdqsR.mjs +902 -0
  131. package/dist/UserDetail-DwNEJ0kC.js +1 -0
  132. package/dist/UserDetail-Wn1wTs2Z.js +1 -0
  133. package/dist/UserList-4XLAsuI5.mjs +1205 -0
  134. package/dist/UserList-B9_Ok-O-.js +5 -0
  135. package/dist/UserList-BAirPxDM.js +7 -0
  136. package/dist/UserList-BFRsUwHp.js +5 -0
  137. package/dist/UserList-BgtFj_YA.mjs +1171 -0
  138. package/dist/UserList-BjEBqEMi.mjs +1205 -0
  139. package/dist/UserList-C6MCzl4Q.js +7 -0
  140. package/dist/UserList-CLDgmfZl.mjs +1171 -0
  141. package/dist/UserList-CRqA2Kvb.js +7 -0
  142. package/dist/UserList-D-5W9tzb.mjs +1205 -0
  143. package/dist/UserList-D63-z7TV.mjs +1205 -0
  144. package/dist/UserList-DX_DRp8l.js +7 -0
  145. package/dist/constants-1VW88-cg.mjs +320 -0
  146. package/dist/constants-B09dcc2W.js +1 -0
  147. package/dist/constants-BSg1aI4R.js +1 -0
  148. package/dist/constants-BXFDJA-1.js +1 -0
  149. package/dist/constants-BdoFiMvT.mjs +320 -0
  150. package/dist/constants-BrOUFw2c.js +1 -0
  151. package/dist/constants-ClfPwBI0.mjs +320 -0
  152. package/dist/constants-D3RqPPqz.mjs +320 -0
  153. package/dist/constants-D5ZWXomx.js +1 -0
  154. package/dist/constants-DiRwIQ5M.mjs +320 -0
  155. package/dist/constants-bWeajrBe.js +1 -0
  156. package/dist/constants-dgRR32rI.mjs +320 -0
  157. package/dist/containers/EmailTemplate/hooks/useEmailTemplateDetail.d.ts +1 -0
  158. package/dist/containers/User/constants/types.d.ts +1 -0
  159. package/dist/containers/User/hooks/useExportUsersCsv.d.ts +1 -0
  160. package/dist/index-B3Kqv7dj.mjs +17787 -0
  161. package/dist/index-BTWI5jDz.js +15 -0
  162. package/dist/index-C1gw45bw.mjs +17792 -0
  163. package/dist/index-CFAFmJ4F.mjs +17782 -0
  164. package/dist/index-D6pNkzlV.mjs +17787 -0
  165. package/dist/index-DDw_4X4u.js +15 -0
  166. package/dist/index-DVZt7HdB.js +15 -0
  167. package/dist/index-Di2zNE1O.mjs +17792 -0
  168. package/dist/index-DzHydV61.js +15 -0
  169. package/dist/index-Ihdym4EQ.js +15 -0
  170. package/dist/index-UpEZLqQV.js +15 -0
  171. package/dist/index-cuQPyXoT.mjs +17772 -0
  172. package/dist/index.js +1 -1
  173. package/dist/index.modern.js +1 -1
  174. package/dist/mailCategoryService-BbqIjbpT.mjs +11 -0
  175. package/dist/mailCategoryService-C1sorb9h.js +1 -0
  176. package/dist/mailCategoryService-CZ9m51K4.js +1 -0
  177. package/dist/mailCategoryService-C_Lq0Uks.mjs +11 -0
  178. package/dist/mailCategoryService-DcwLjTWD.mjs +11 -0
  179. package/dist/mailCategoryService-DexSxwen.js +1 -0
  180. package/dist/mailCategoryService-DrZXrEp2.js +1 -0
  181. package/dist/mailCategoryService-DyLMoDxP.mjs +11 -0
  182. package/dist/mailCategoryService-LumZqQLL.mjs +11 -0
  183. package/dist/mailCategoryService-MyMGdKSl.mjs +11 -0
  184. package/dist/mailCategoryService-Pl31B1JT.js +1 -0
  185. package/dist/mailCategoryService-lvLdr9b4.js +1 -0
  186. package/dist/mario-core.css +1 -1
  187. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ import { jsx as a, jsxs as e } from "react/jsx-runtime";
2
+ import { memo as m, Suspense as r } from "react";
3
+ import { useLocation as p, Routes as h, Route as t } from "react-router-dom";
4
+ import { CContainer as g } from "@coreui/react";
5
+ import { C as u } from "./index-cuQPyXoT.mjs";
6
+ const N = /* @__PURE__ */ a("div", { className: "app-initial-loader", style: { position: "relative", height: "100%", minHeight: "400px", backgroundColor: "transparent", width: "100%" }, children: /* @__PURE__ */ e("div", { className: "loader-container", children: [
7
+ /* @__PURE__ */ a(
8
+ "img",
9
+ {
10
+ src: "/images/mario-logo.png",
11
+ alt: "Mario Education Logo",
12
+ className: "loader-logo",
13
+ style: { maxWidth: "220px" }
14
+ }
15
+ ),
16
+ /* @__PURE__ */ a("div", { className: "loading-text", children: "Loading your page..." }),
17
+ /* @__PURE__ */ e("div", { className: "loading-dots", children: [
18
+ /* @__PURE__ */ a("span", { className: "dot" }),
19
+ /* @__PURE__ */ a("span", { className: "dot" }),
20
+ /* @__PURE__ */ a("span", { className: "dot" })
21
+ ] })
22
+ ] }) }), f = ({ routes: i }) => {
23
+ const s = p(), { pathname: o } = s, l = o.includes("/admin") ? "" : "box-container", d = o.includes("/admin") ? "p-4" : "";
24
+ return /* @__PURE__ */ a("main", { className: `c-main ${l}`, style: { height: "100%" }, children: /* @__PURE__ */ a(g, { fluid: !0, className: `h-100 ${d}`, style: { flex: 1 }, children: /* @__PURE__ */ a(r, { fallback: N, children: /* @__PURE__ */ e(h, { children: [
25
+ i.map((n, c) => /* @__PURE__ */ a(
26
+ t,
27
+ {
28
+ path: n.path,
29
+ element: /* @__PURE__ */ a(n.component, {})
30
+ },
31
+ c
32
+ )),
33
+ /* @__PURE__ */ a(t, { path: "*", element: /* @__PURE__ */ a(u, {}) })
34
+ ] }) }) }) });
35
+ }, L = m(f);
36
+ export {
37
+ L as default
38
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-Ihdym4EQ.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
@@ -0,0 +1,38 @@
1
+ import { jsx as a, jsxs as e } from "react/jsx-runtime";
2
+ import { memo as m, Suspense as r } from "react";
3
+ import { useLocation as p, Routes as h, Route as t } from "react-router-dom";
4
+ import { CContainer as g } from "@coreui/react";
5
+ import { C as u } from "./index-Di2zNE1O.mjs";
6
+ const N = /* @__PURE__ */ a("div", { className: "app-initial-loader", style: { position: "relative", height: "100%", minHeight: "400px", backgroundColor: "transparent", width: "100%" }, children: /* @__PURE__ */ e("div", { className: "loader-container", children: [
7
+ /* @__PURE__ */ a(
8
+ "img",
9
+ {
10
+ src: "/images/mario-logo.png",
11
+ alt: "Mario Education Logo",
12
+ className: "loader-logo",
13
+ style: { maxWidth: "220px" }
14
+ }
15
+ ),
16
+ /* @__PURE__ */ a("div", { className: "loading-text", children: "Loading your page..." }),
17
+ /* @__PURE__ */ e("div", { className: "loading-dots", children: [
18
+ /* @__PURE__ */ a("span", { className: "dot" }),
19
+ /* @__PURE__ */ a("span", { className: "dot" }),
20
+ /* @__PURE__ */ a("span", { className: "dot" })
21
+ ] })
22
+ ] }) }), f = ({ routes: i }) => {
23
+ const s = p(), { pathname: o } = s, l = o.includes("/admin") ? "" : "box-container", d = o.includes("/admin") ? "p-4" : "";
24
+ return /* @__PURE__ */ a("main", { className: `c-main ${l}`, style: { height: "100%" }, children: /* @__PURE__ */ a(g, { fluid: !0, className: `h-100 ${d}`, style: { flex: 1 }, children: /* @__PURE__ */ a(r, { fallback: N, children: /* @__PURE__ */ e(h, { children: [
25
+ i.map((n, c) => /* @__PURE__ */ a(
26
+ t,
27
+ {
28
+ path: n.path,
29
+ element: /* @__PURE__ */ a(n.component, {})
30
+ },
31
+ c
32
+ )),
33
+ /* @__PURE__ */ a(t, { path: "*", element: /* @__PURE__ */ a(u, {}) })
34
+ ] }) }) }) });
35
+ }, L = m(f);
36
+ export {
37
+ L as default
38
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-DzHydV61.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-BTWI5jDz.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-UpEZLqQV.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
@@ -0,0 +1,38 @@
1
+ import { jsx as a, jsxs as e } from "react/jsx-runtime";
2
+ import { memo as m, Suspense as r } from "react";
3
+ import { useLocation as p, Routes as h, Route as t } from "react-router-dom";
4
+ import { CContainer as g } from "@coreui/react";
5
+ import { C as u } from "./index-C1gw45bw.mjs";
6
+ const N = /* @__PURE__ */ a("div", { className: "app-initial-loader", style: { position: "relative", height: "100%", minHeight: "400px", backgroundColor: "transparent", width: "100%" }, children: /* @__PURE__ */ e("div", { className: "loader-container", children: [
7
+ /* @__PURE__ */ a(
8
+ "img",
9
+ {
10
+ src: "/images/mario-logo.png",
11
+ alt: "Mario Education Logo",
12
+ className: "loader-logo",
13
+ style: { maxWidth: "220px" }
14
+ }
15
+ ),
16
+ /* @__PURE__ */ a("div", { className: "loading-text", children: "Loading your page..." }),
17
+ /* @__PURE__ */ e("div", { className: "loading-dots", children: [
18
+ /* @__PURE__ */ a("span", { className: "dot" }),
19
+ /* @__PURE__ */ a("span", { className: "dot" }),
20
+ /* @__PURE__ */ a("span", { className: "dot" })
21
+ ] })
22
+ ] }) }), f = ({ routes: i }) => {
23
+ const s = p(), { pathname: o } = s, l = o.includes("/admin") ? "" : "box-container", d = o.includes("/admin") ? "p-4" : "";
24
+ return /* @__PURE__ */ a("main", { className: `c-main ${l}`, style: { height: "100%" }, children: /* @__PURE__ */ a(g, { fluid: !0, className: `h-100 ${d}`, style: { flex: 1 }, children: /* @__PURE__ */ a(r, { fallback: N, children: /* @__PURE__ */ e(h, { children: [
25
+ i.map((n, c) => /* @__PURE__ */ a(
26
+ t,
27
+ {
28
+ path: n.path,
29
+ element: /* @__PURE__ */ a(n.component, {})
30
+ },
31
+ c
32
+ )),
33
+ /* @__PURE__ */ a(t, { path: "*", element: /* @__PURE__ */ a(u, {}) })
34
+ ] }) }) }) });
35
+ }, L = m(f);
36
+ export {
37
+ L as default
38
+ };
@@ -0,0 +1,38 @@
1
+ import { jsx as a, jsxs as e } from "react/jsx-runtime";
2
+ import { memo as m, Suspense as r } from "react";
3
+ import { useLocation as p, Routes as h, Route as t } from "react-router-dom";
4
+ import { CContainer as g } from "@coreui/react";
5
+ import { C as u } from "./index-B3Kqv7dj.mjs";
6
+ const N = /* @__PURE__ */ a("div", { className: "app-initial-loader", style: { position: "relative", height: "100%", minHeight: "400px", backgroundColor: "transparent", width: "100%" }, children: /* @__PURE__ */ e("div", { className: "loader-container", children: [
7
+ /* @__PURE__ */ a(
8
+ "img",
9
+ {
10
+ src: "/images/mario-logo.png",
11
+ alt: "Mario Education Logo",
12
+ className: "loader-logo",
13
+ style: { maxWidth: "220px" }
14
+ }
15
+ ),
16
+ /* @__PURE__ */ a("div", { className: "loading-text", children: "Loading your page..." }),
17
+ /* @__PURE__ */ e("div", { className: "loading-dots", children: [
18
+ /* @__PURE__ */ a("span", { className: "dot" }),
19
+ /* @__PURE__ */ a("span", { className: "dot" }),
20
+ /* @__PURE__ */ a("span", { className: "dot" })
21
+ ] })
22
+ ] }) }), f = ({ routes: i }) => {
23
+ const s = p(), { pathname: o } = s, l = o.includes("/admin") ? "" : "box-container", d = o.includes("/admin") ? "p-4" : "";
24
+ return /* @__PURE__ */ a("main", { className: `c-main ${l}`, style: { height: "100%" }, children: /* @__PURE__ */ a(g, { fluid: !0, className: `h-100 ${d}`, style: { flex: 1 }, children: /* @__PURE__ */ a(r, { fallback: N, children: /* @__PURE__ */ e(h, { children: [
25
+ i.map((n, c) => /* @__PURE__ */ a(
26
+ t,
27
+ {
28
+ path: n.path,
29
+ element: /* @__PURE__ */ a(n.component, {})
30
+ },
31
+ c
32
+ )),
33
+ /* @__PURE__ */ a(t, { path: "*", element: /* @__PURE__ */ a(u, {}) })
34
+ ] }) }) }) });
35
+ }, L = m(f);
36
+ export {
37
+ L as default
38
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-DVZt7HdB.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
@@ -0,0 +1,38 @@
1
+ import { jsx as a, jsxs as e } from "react/jsx-runtime";
2
+ import { memo as m, Suspense as r } from "react";
3
+ import { useLocation as p, Routes as h, Route as t } from "react-router-dom";
4
+ import { CContainer as g } from "@coreui/react";
5
+ import { C as u } from "./index-D6pNkzlV.mjs";
6
+ const N = /* @__PURE__ */ a("div", { className: "app-initial-loader", style: { position: "relative", height: "100%", minHeight: "400px", backgroundColor: "transparent", width: "100%" }, children: /* @__PURE__ */ e("div", { className: "loader-container", children: [
7
+ /* @__PURE__ */ a(
8
+ "img",
9
+ {
10
+ src: "/images/mario-logo.png",
11
+ alt: "Mario Education Logo",
12
+ className: "loader-logo",
13
+ style: { maxWidth: "220px" }
14
+ }
15
+ ),
16
+ /* @__PURE__ */ a("div", { className: "loading-text", children: "Loading your page..." }),
17
+ /* @__PURE__ */ e("div", { className: "loading-dots", children: [
18
+ /* @__PURE__ */ a("span", { className: "dot" }),
19
+ /* @__PURE__ */ a("span", { className: "dot" }),
20
+ /* @__PURE__ */ a("span", { className: "dot" })
21
+ ] })
22
+ ] }) }), f = ({ routes: i }) => {
23
+ const s = p(), { pathname: o } = s, l = o.includes("/admin") ? "" : "box-container", d = o.includes("/admin") ? "p-4" : "";
24
+ return /* @__PURE__ */ a("main", { className: `c-main ${l}`, style: { height: "100%" }, children: /* @__PURE__ */ a(g, { fluid: !0, className: `h-100 ${d}`, style: { flex: 1 }, children: /* @__PURE__ */ a(r, { fallback: N, children: /* @__PURE__ */ e(h, { children: [
25
+ i.map((n, c) => /* @__PURE__ */ a(
26
+ t,
27
+ {
28
+ path: n.path,
29
+ element: /* @__PURE__ */ a(n.component, {})
30
+ },
31
+ c
32
+ )),
33
+ /* @__PURE__ */ a(t, { path: "*", element: /* @__PURE__ */ a(u, {}) })
34
+ ] }) }) }) });
35
+ }, L = m(f);
36
+ export {
37
+ L as default
38
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-DDw_4X4u.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-UpEZLqQV.js"),fe=require("./UserList-B9_Ok-O-.js"),u=require("react"),c=require("reactstrap"),H=require("react-i18next"),f=require("./constants-B09dcc2W.js"),ye=require("./TeacherSelector-CbJ1kPyV.js"),Q=require("react-redux"),Fe=require("react-select"),Pe=require("formik"),qe=require("yup"),Je=require("papaparse");function ze(n){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const i in n)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(o,i,r.get?r:{enumerable:!0,get:()=>n[i]})}}return o.default=n,Object.freeze(o)}const ge=ze(qe),Ve=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(f.DEFAULT_STUDENT_FILTER),[m,_]=u.useState(0),[x,l]=u.useState(!1),[h,j]=u.useState([]),[d,w]=u.useState([]),[U,L]=u.useState(f.initAssignStd),C="",p=E=>{const A={...r,...E};A.searchString&&E.searchString&&E.searchString!=r.searchString&&(A.currentPage=1),a(A)},I=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)).flatMap(S=>S.teachers),A=new Map;return E.forEach(S=>{A.has(S.teacherUserId)||A.set(S.teacherUserId,S)}),Array.from(A.values()).map(S=>({value:S.teacherUserId,label:S.mainTeacherEmail}))},[d,h]),O=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)).flatMap(S=>S.counselors),A=new Map;return E.forEach(S=>{A.has(S.counselorUserId)||A.set(S.counselorUserId,S)}),Array.from(A.values()).map(S=>({value:S.counselorUserId,label:S.counselorEmail}))},[d,h]),$=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)&&S.assistantUserId).map(S=>({value:S.assistantUserId,label:S.assistantEmail})),A=new Map;return E.forEach(S=>{A.has(S.value)||A.set(S.value,S)}),Array.from(A.values())},[o,h]),P=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)&&S.secondaryTeacherUserId).map(S=>({value:S.secondaryTeacherUserId,label:S.secondaryTeacherEmail})),A=new Map;return E.forEach(S=>{A.has(S.value)||A.set(S.value,S)}),Array.from(A.values())},[o,h]),te=u.useCallback(E=>{E!==r.sortBy?p({sortBy:E,orderBy:"ASC",currentPage:1}):p({sortBy:E,orderBy:r.orderBy!=="DESC"?"DESC":"ASC",currentPage:1})},[JSON.stringify(r)]),K=async()=>{n(t.setLoading(!0));try{const E=Object.entries(r).filter(([b,M])=>M!==void 0).reduce((b,[M,B])=>(b[M]=B,b),{}),A={};for(const b in E){const M=b.charAt(0).toLowerCase()+b.slice(1);A[M]=E[b]}const S=await f.getAssignStudentApi(A);i(S?.data?.items),_(S?.data?.totalItems)}catch(E){n(t.setAlert({type:"danger",message:E.response?.data?.title||E.message}))}n(t.setLoading(!1))},V=()=>{l(!x),j(o.map(E=>E.id)),w(o),x&&(j([]),w([]))},ae=E=>{const{id:A,checked:S}=E.target;if(S){j(M=>[...M,A]);const b=o.find(M=>M.id===A);b&&w(M=>[...M,b])}else j(b=>b.filter(M=>M!==A)),w(b=>b.filter(M=>M.id!==A))},ne=u.useCallback(()=>{r.currentPage==1?K():p({currentPage:1}),j([]),w([]),l(!1)},[JSON.stringify(r)]);return u.useEffect(()=>{K()},[JSON.stringify(r)]),u.useEffect(()=>{document.title="User | Assign student"},[]),u.useEffect(()=>{p({...r,searchString:C})},[C]),{handelSort:te,handleRetrievedData:ne,totalItem:m,userList:o,filters:r,changeFilters:p,handleSelectAll:V,handleClickCheck:ae,isCheckAll:x,isCheck:h,fullName:C,selectedUser:U,setSelectedUser:L,userSelected:d,getDataUserList:K,studentTeacherSelected:I,studentCounselorSelected:O,studentAssistantSelected:$,studentSecondaryTeacherSelected:P}},He=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getCounselors();l.data.items&&i(l.data.items.map?.(h=>({label:h.email,value:h.id}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.find(d=>d.value===l);a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedCounselors:r,counselorOptions:o,handleSelectCounselor:_,handleCreateCounselorOption:x,setSelectedCounselors:a}},We=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getAssistants();l.data.items&&i(l.data.items.map?.(h=>({label:h.email,value:h.id}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.find(d=>d.value===l);a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedAssistants:r,assistantOptions:o,handleSelectAssistant:_,handleCreateAssistantOption:x,setSelectedAssistants:a}},Ge=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getSecondaryTeachers();l.data.items&&i(l.data.items.map?.(h=>({label:h.email,value:h.id,id:h.secondaryTeacherId}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.find(d=>d.value===l);a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedSecondaryTeachers:r,secondaryTeacherOptions:o,handleSelectSecondaryTeacher:_,handleCreateSecondaryTeacherOption:x,setSelectedSecondaryTeachers:a}},Ke=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getTeachers({sortBy:"Email"});l.data&&i(l.data.map?.(h=>({label:h.email,value:h.id}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.filter(d=>l.includes(d.value));a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedTeachers:r,teacherOptions:o,handleSelectTeacher:_,handleCreateTeacherOption:x,setSelectedTeachers:a}},Qe=(n,o)=>{const i=[];if(o===f.TeacherType.Teacher)for(const a of n)for(const m of a.teachers||[])i.push({label:m.mainTeacherEmail,value:m.teacherUserId,name:m.mainTeacherName});else if(o===f.TeacherType.Assistant)for(const a of n)a.assistantEmail&&a.assistantUserId&&i.push({label:a.assistantEmail,value:a.assistantUserId,name:a.assistantName||""});else if(o===f.TeacherType.Counselor)for(const a of n)for(const m of a.counselors||[])i.push({label:m.counselorEmail,value:m.counselorUserId,name:m.counselorName});const r=new Map;for(const a of i)r.has(a.value)||r.set(a.value,a);return Array.from(r.values()).sort((a,m)=>a.label.localeCompare(m.label))},Xe=(n,o,i,r,a,m,_,x)=>{const l=Q.useDispatch(),[h,j]=u.useState(!1),[d,w]=u.useState(f.initialStaffBulk),[U,L]=u.useState(!1),[C,p]=u.useState(!1),[I,O]=u.useState(f.TeacherType.Teacher),[$,P]=u.useState([]),[te,K]=u.useState([]),[V,ae]=u.useState([]),[ne,E]=u.useState({header:"",titleSelect:"",selectPlaceholder:"",changeTitle:"",changePlaceholder:""}),[A,S]=u.useState(""),[b,M]=u.useState(""),[B,W]=u.useState(!1),[J,G]=u.useState(0),[z,le]=u.useState([]),[X,re]=u.useState(""),[ce,Y]=u.useState(!1),[Z,ee]=u.useState(!1),[F,se]=u.useState(f.initStaffDeleteBulk),q=g=>{se({...F,...g})},oe=g=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select students!"}));return}ee(!Z),w({...f.initialStaffBulk}),se({...f.initStaffDeleteBulk})},ie=()=>{Y(!ce),re("")},he=g=>{z.includes(g)?le(z.filter(y=>y!==g)):le([...z,g])},me=g=>{G(y=>y===g?-1:g)},xe=g=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select students!"}));return}j(!h),w({...f.initialStaffBulk})},Se=(g,y,v)=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select students!"}));return}switch(ae(g),K(Qe(g,y)),O(y),y){case f.TeacherType.Teacher:E({header:"switch_teacher",titleSelect:"current_teacher_name",selectPlaceholder:"select_teacher",changeTitle:"select_teacher_change",changePlaceholder:"select_teacher_change"});break;case f.TeacherType.Assistant:E({header:"switch_assistant",titleSelect:"current_assistant_name",selectPlaceholder:"",changeTitle:"",changePlaceholder:"select_assistant_change"});break;case f.TeacherType.Counselor:E({header:"switch_counselor",titleSelect:"current_counselor_name",selectPlaceholder:"select_counselor",changeTitle:"select_counselor_change",changePlaceholder:"select_counselor_change"});break;case f.TeacherType.SecondaryTeacher:E({header:"switch_support_teacher",titleSelect:"current_assistant_name",selectPlaceholder:"",changeTitle:"",changePlaceholder:"select_support_teacher_change"});break}p(!C),P(v)},ue=()=>{P([]),p(!1),W(!1),O(f.TeacherType.Teacher),K([]),S(""),M(""),E({header:"",titleSelect:"",selectPlaceholder:"",changeTitle:"",changePlaceholder:""}),le([])},je=()=>{W(!1),G(0),le([])},Ce=async(g,y)=>{l(t.setModal({isOpen:!0,type:"warning",message:`Do you want to change ${y===f.TeacherType.Teacher?"teacher":y===f.TeacherType.Assistant?"assistant":y===f.TeacherType.SecondaryTeacher?"support teacher":"counselor"} for ${g.length} student(s)?`,onConfirm:async()=>{l(t.setLoading(!0));try{const v=y===f.TeacherType.Teacher?await f.changeMultiTeacherOfStudent(g):y===f.TeacherType.Assistant?await f.changeAssistantOfStudents(g):y===f.TeacherType.Counselor?await f.changeMultiCounselorsOfStudent(g):await f.changeSecondaryTeacherOfStudents(g);v&&v?.data&&(ue(),a?.(),await _(),l(t.setAlert({type:"success",message:`Change ${y===f.TeacherType.Teacher?"teacher":y===f.TeacherType.Assistant?"assistant":y===f.TeacherType.SecondaryTeacher?"support teacher":"counselor"} successfully`})))}catch(v){l(t.setAlert({type:"danger",message:v.response?.data?.title||v.message}))}l(t.setLoading(!1))}}))},_e=()=>{let g=[];switch(I){case f.TeacherType.Teacher:g=V.filter(y=>{const v=y.teachers.map(D=>D.teacherUserId);return v.includes(b)&&!v.includes(A)}).map(y=>({studentId:y.studentId,teacher:b,teacherChange:A}));break;case f.TeacherType.Counselor:g=V.filter(y=>{const v=y.counselors.map(D=>D.counselorUserId);return v.includes(b)&&!v.includes(A)}).map(y=>({studentId:y.studentId,counselor:b,counselorChange:A}));break;case f.TeacherType.Assistant:g=V.filter(y=>y?.assistantUserId&&y?.teachers?.length>0).map(y=>({studentId:y.studentId,assistantUserId:A}));break;case f.TeacherType.SecondaryTeacher:g=V.filter(y=>y?.secondaryTeacherUserId&&y?.teachers?.length>0).map(y=>({studentId:y.studentId,secondaryTeacherId:A}));break}if(g.length===0){l(t.setAlert({type:"danger",message:"No change to update!"}));return}Ce(g||[],I)},Ie=g=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select student(s)!"}));return}L(!U)},be=(g,y)=>{switch(g){case"assistant":w({...d,assistantId:y.value,assistantEmail:y.label});break;case"secondary":w({...d,secondaryTeacherId:y.value,secondaryTeacherEmail:y.label});break;case"grade":w({...d,gradeLevel:y.value});break}},Ne=g=>{w({...d,teacher:g})},we=g=>{w({...d,counselors:g})},pe=async g=>{l(t.setLoading(!0));try{await f.assignStudentsApi(g),l(t.setAlert({type:"success",message:"Student assigned successfully"})),a?.(),ue()}catch(y){l(t.setAlert({type:"danger",message:y.response?.data?.title||y.message}))}l(t.setLoading(!1))},Ae=u.useCallback(g=>{if(g.length===0){l(t.setAlert({type:"danger",message:"Not found selected student."}));return}if(g.some(D=>{const N=n?.[D],s=o?.[D],T=i?.[D],k=r?.[D];return!N&&!s&&!T&&!k})){l(t.setAlert({type:"danger",message:"Please select/add teacher for all selected student first."}));return}const v=g.map(D=>{const N=n?.[D],s=o?.[D],T=i?.[D],k=r?.[D],R={id:D};return N&&(R.mainTeacherUserId=N?N.map(de=>de.value):void 0,R.mainTeacherEmail=N?N.map(de=>de.label):void 0),s&&(R.assistantUserId=s?.value&&typeof s?.value=="string"?s?.value:void 0,R.assistantEmail=s?.value&&typeof s?.value=="number"?s?.label:void 0),T&&(R.counselorUserIds=T?T.map(de=>de.value):void 0,R.counselorEmails=T?T.map(de=>de.label):void 0),k&&(R.secondaryTeacherUserId=k?.value&&typeof k?.value=="string"?k?.value:void 0,R.secondaryTeacherEmail=k?.value&&typeof k?.value=="number"?k?.label:void 0),R});pe([...v])},[JSON.stringify(n),JSON.stringify(o),JSON.stringify(i),JSON.stringify(r)]),Ue=u.useCallback(g=>{const y=n?.[g],v=o?.[g],D=i?.[g],N=r?.[g];if(!y&&!v&&!D&&!N){l(t.setAlert({type:"danger",message:"Please select/add teacher for selected student first."}));return}const s={id:g};y&&(s.mainTeacherUserId=y?y.map(T=>T.value):void 0,s.mainTeacherEmail=y?y.map(T=>T.label):void 0),v&&(s.assistantUserId=v?.value&&typeof v?.value=="string"?v?.value:void 0,s.assistantEmail=v?.value&&typeof v?.value=="number"?v?.label:void 0),D&&(s.counselorUserIds=D?D.map(T=>T.value):void 0,s.counselorEmails=D?D.map(T=>T.label):void 0),N&&(s.secondaryTeacherUserId=N?.value&&typeof N?.value=="string"?N?.value:void 0,s.secondaryTeacherEmail=N?.value&&typeof N?.value=="number"?N?.label:void 0),pe([s])},[JSON.stringify(n),JSON.stringify(o),JSON.stringify(i),JSON.stringify(r)]),ve=async g=>{if(g.length===0){l(t.setAlert({type:"danger",message:"Not found selected student."}));return}if(d.teacher.length===0&&d.counselors.length===0&&!d.assistantId&&!d.secondaryTeacherId){l(t.setAlert({type:"danger",message:"No change to assign!"}));return}const y=x?.filter(v=>g?.includes(v.id))?.every(v=>Array.isArray(v.teachers)&&v.teachers.length>0)??!1;if(d.teacher.length===0&&!y){l(t.setAlert({type:"danger",message:"Please assign a teacher to each student before giving other educators access to them"}));return}l(t.setLoading(!0));try{if(d.teacher.length>0&&x&&x.length>0){const N=x.filter(s=>g.includes(s.id)).map(s=>{const T=s.teachers?.map(R=>R.teacherUserId)||[],k=d.teacher.filter(R=>!T.includes(R.id));return{id:s.id,mainTeacherUserId:k.map(R=>R.id),mainTeacherEmail:k.map(R=>R.email)}}).filter(s=>s.mainTeacherUserId.length>0||s.mainTeacherEmail.length>0);N.length>0&&await f.assignStudentsApi(N)}if(d.counselors.length>0&&x&&x.length>0){const N=x.filter(s=>g.includes(s.id)).map(s=>{const T=s.counselors?.map(R=>R.counselorUserId)||[],k=d.counselors.filter(R=>!T.includes(R.id));return{id:s.id,counselorUserIds:k.map(R=>R.id),counselorEmails:k.map(R=>R.email)}}).filter(s=>s.counselorUserIds.length>0||s.counselorEmails.length>0);N.length>0&&await f.assignStudentsApi(N)}const v=x?.filter(N=>!N.assistantUserId);if(v&&v?.length>0&&d.assistantId){const N=v.map(s=>({id:s.id,assistantUserId:d.assistantId,assistantEmail:d.assistantEmail}));await f.assignStudentsApi(N.filter(s=>s!==void 0))}const D=x?.filter(N=>!N.secondaryTeacherUserId);if(D&&D?.length>0&&d.secondaryTeacherId){const N=D.map(s=>({id:s.id,secondaryTeacherUserId:d.secondaryTeacherId,secondaryTeacherEmail:d.secondaryTeacherEmail}));await f.assignStudentsApi(N.filter(s=>s!==void 0))}l(t.setAlert({type:"success",message:"Student assigned successfully"})),a?.(),ue(),xe()}catch(v){l(t.setAlert({type:"danger",message:v.response?.data?.title||v.message}))}l(t.setLoading(!1))},ke=async g=>{if(d.teacher.length===0){l(t.setAlert({type:"danger",message:"Please select teacher before assign!"}));return}if(z.length>0&&!g){Y(!0);return}const y={id:m?.id||"",mainTeacherUserId:d.teacher.filter(v=>!m?.teachers?.some(D=>D.teacherUserId===v.id)).map(v=>v.id)||[],mainTeacherEmail:d.teacher.filter(v=>!m?.teachers?.some(D=>D.teacherUserId===v.id)).map(v=>v.email)||[],assistantUserId:d?.assistantId?d?.assistantId:void 0,assistantEmail:d?.assistantEmail?d?.assistantEmail:void 0,counselorUserIds:d.counselors.map(v=>v.id)||[],counselorEmails:d.counselors.map(v=>v.email)||[],secondaryTeacherUserId:d?.secondaryTeacherId?d?.secondaryTeacherId:void 0,secondaryTeacherEmail:d?.secondaryTeacherEmail?d?.secondaryTeacherEmail:void 0,removeTeacherUserIds:z,teacherSwitchUserId:g||""};d?.gradeLevel&&d.gradeLevel!==m?.gradeLevel&&await f.addGradeToStudent(m?.id||"",d?.gradeLevel),pe([y])},Ee=async(g,y)=>{l(t.setLoading(!0));try{(await f.updateStatusAll(g)).status==200&&(l(t.setAlert({type:"success",message:`Inactive ${g.length} Students successfully`})),y())}catch(v){l(t.setAlert({type:"danger",message:v.response?.data?.title||v.message}))}L(!U),l(t.setLoading(!1))},Me=u.useCallback(async g=>{if(F.assistantRemoveUserId.length&&!F.assistantSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select an assistant to transfer data!"}));return}if(F.teacherRemoveUserIds.length&&!F.teacherSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select a teacher to transfer data!"}));return}if(F.counselorRemoveUserIds.length&&!F.counselorSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select a counselor to transfer data!"}));return}if(F.supportTeacherRemoveUserIds.length&&!F.supportTeacherSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select a support teacher to transfer data!"}));return}l(t.setLoading(!0));try{await f.removeBulkStaff({...F,studentUserIds:g||[]}),a?.(),await _()}catch(y){l(t.setAlert({type:"danger",message:y.response?.data?.title||y.message}))}oe(),l(t.setLoading(!1))},[F]);return u.useEffect(()=>(m?.id&&w({teacher:m?.teachers?.map(g=>({id:g.teacherUserId,email:g.mainTeacherEmail})),assistantId:m?.assistantUserId,assistantEmail:m?.assistantEmail,counselors:m?.counselors?.map(g=>({id:g.counselorUserId,email:g.counselorEmail})),secondaryTeacherEmail:m?.secondaryTeacherEmail,secondaryTeacherId:m?.secondaryTeacherUserId,gradeLevel:m?.gradeLevel}),()=>{w(f.initialStaffBulk)}),[m]),{handleAssignSingleStudent:Ue,handleAssignMultiStudent:Ae,openModelBulk:h,handleToggleModel:xe,handleChangeStaffBulk:be,staffBulkAssign:d,onAssignStaffToStudents:ve,handleToggleInactiveModal:Ie,openInactiveModal:U,handleInactiveStudents:Ee,handleChangeTeacherBulk:Ne,handleEditAssignForStudents:ke,handleToggleSwitchModel:Se,openSwitchModal:C,optionsSwitch:$,modalType:I,textModal:ne,teacherSwitchList:te,onCloseSwitchModal:ue,handleUpdateSwitch:_e,setTeacherChangeUserId:S,setTeacherSelectForChangeUserId:M,teacherSelectForChangeUserId:b,openDetailModal:B,setOpenDetailModal:W,toggleCollapse:me,activeIndex:J,handleChangeCounselorBulk:we,onClose:je,removeTeacherUserIds:z,onSelectRemoveTeacher:he,openModelSwitchDataTeacher:ce,onToggleModelSwitchDataTeacher:ie,teacherSwitchUserId:X,setTeacherSwitchUserId:re,onToggleModelDeleteBulk:oe,openModelDeleteBulk:Z,handelChangeStaffRemove:q,switchStaffUsers:F,handleRemoveBulkStaff:Me}};function Ye(n){return t.GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M228.9 79.9L51.8 403.1C40.6 423.3 55.5 448 78.9 448h354.3c23.3 0 38.2-24.7 27.1-44.9L283.1 79.9c-11.7-21.2-42.5-21.2-54.2 0zM273.6 214L270 336h-28l-3.6-122h35.2zM256 402.4c-10.7 0-19.1-8.1-19.1-18.4s8.4-18.4 19.1-18.4 19.1 8.1 19.1 18.4-8.4 18.4-19.1 18.4z"}}]})(n)}const Ze=n=>{const{textModal:o,isOpen:i,teachers:r,options:a,onClose:m,onSave:_,modalType:x,setTeacherChangeUserId:l,setTeacherSelectForChangeUserId:h,teacherSelectForChangeUserId:j}=n,{t:d}=H.useTranslation();return e.jsxs(c.Modal,{centered:!0,isOpen:i,toggle:m,zIndex:1201,children:[e.jsx(c.ModalHeader,{className:t.styles["header-assign-for-student"],children:d(o.header)}),e.jsxs(c.ModalBody,{children:[x!==f.TeacherType.Assistant||x!==f.TeacherType.SecondaryTeacher&&e.jsxs(u.Fragment,{children:[e.jsx("div",{children:d(o.titleSelect)}),e.jsx("ul",{style:{maxHeight:200,overflow:"auto"},children:r.map(w=>e.jsxs("li",{children:[w.name,"-",w.label]},w.label))})]}),(x===f.TeacherType.Teacher||x===f.TeacherType.Counselor)&&e.jsxs(u.Fragment,{children:[e.jsx("div",{children:d(o.selectPlaceholder)}),e.jsx(t.CustomSelector,{options:r,value:r.filter(w=>w.value===j),placeholder:d(o.selectPlaceholder),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:w=>{h(w.value)},isClearable:!0,style:{maxWidth:120}})]}),e.jsx("div",{children:d(o.changeTitle)}),e.jsx(ye.TeacherSelector,{options:a,onChange:w=>{x!==f.TeacherType.SecondaryTeacher?l(w.value):l(w.id)},placeholder:d(o.changePlaceholder),className:"flex-grow-1 mb-3"})]}),e.jsxs(c.ModalFooter,{className:"textModal-right",children:[e.jsx(c.Button,{onClick:()=>m(!1),children:d("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>{_()},children:d("save")})]})]})},es=u.forwardRef(Ze),ss=({openDetailModal:n,onClose:o,selectedUser:i,staffBulkAssign:r,teacherOptions:a,handleChangeTeacherBulk:m,handleChangeCounselorBulk:_,assistantOptions:x,counselorOptions:l,secondaryTeacherOptions:h,handleChangeStaffBulk:j,handleEditAssignForStudents:d,toggleCollapse:w,activeIndex:U})=>{const{t:L}=H.useTranslation(),C=[i?.teachers||[],i?.counselors||[]];return e.jsxs(c.Modal,{centered:!0,isOpen:n,toggle:()=>o(),zIndex:1201,children:[e.jsxs(c.ModalHeader,{className:t.styles["header-assign-for-student"],children:[e.jsxs("div",{children:["Assign student ",i?.fullName]}),e.jsxs("div",{children:["Grade ",i?.gradeLevel]})]}),e.jsxs(c.ModalBody,{children:[C.map((p,I)=>e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`btn ${t.styles["btn-collapse"]} ${U===I?"btn-link ":""}`,onClick:()=>w(I),children:[L(I===0?"current_teacher_name":"current_counselor_name")," ",`(${p.length})`," ",e.jsx("i",{className:`fa fa-angle-${U===I?"up":"down"}`})]}),e.jsx(c.Collapse,{isOpen:U===I,children:e.jsx(c.Card,{children:e.jsx(c.CardBody,{children:p.length>0?p.map(O=>I===0?e.jsxs("li",{children:[O.mainTeacherName," - ",O.mainTeacherEmail]},O.mainTeacherEmail):e.jsxs("li",{children:[O.counselorName," - ",O.counselorEmail]},O.counselorUserId)):e.jsx("div",{children:L("no_data")})})})})]},I)),e.jsx("div",{children:L("teacher_email")}),e.jsx(t.CustomSelector,{isMulti:!0,value:r.teacher.filter(p=>!i.teachers?.some(I=>I.teacherUserId===p.id)).map(p=>({label:p.email,value:p.id})),options:a.filter(p=>!i.teachers?.some(I=>I.teacherUserId===p.value)),placeholder:L("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:p=>{const I=p.map(O=>({id:O.value,email:O.label}));m(I)},isClearable:!0,style:{maxWidth:120}}),e.jsx("div",{children:L("assistant_email")}),e.jsx(ye.TeacherSelector,{value:x.find(p=>p.value==r.assistantId||p.label==r.assistantEmail)||null,options:x,onChange:p=>{j("assistant",p)},placeholder:L("select_assistant"),className:"flex-grow-1 mb-3"}),e.jsx("div",{children:L("counselor_email")}),e.jsx(t.CustomSelector,{isMulti:!0,value:r.counselors.filter(p=>!i.counselors?.some(I=>I.counselorUserId===p.id)).map(p=>({label:p.email,value:p.id})),options:l.filter(p=>!i.counselors?.some(I=>I.counselorUserId===p.value)),placeholder:L("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:p=>{const I=p.map(O=>({id:O.value,email:O.label}));_(I)},isClearable:!0,style:{maxWidth:120}}),e.jsx("div",{children:L("support_teacher_email")}),e.jsx(ye.TeacherSelector,{value:h.find(p=>p.value==r.secondaryTeacherId||p.label==r.secondaryTeacherEmail)||null,options:h,onChange:p=>{j("secondary",p)},placeholder:L("select_support_teacher"),className:"flex-grow-1"}),e.jsx("div",{children:L("grade")}),e.jsx(Fe,{value:f.GRADE_DEFAULT.find(p=>p.value===r.gradeLevel),options:f.GRADE_DEFAULT,placeholder:L("select_grade"),className:"flex-grow-1 mb-3",onChange:p=>{j("grade",p)},styles:{container:p=>({...p,maxWidth:120})}})]}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>o(),children:L("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>{d()},children:L("save")})]})]})},ts=({open:n,onClose:o,teachers:i,onConfirm:r,teacherSwitchUserId:a,setTeacherSwitchUserId:m})=>{const{t:_}=H.useTranslation();return e.jsxs(c.Modal,{centered:!0,isOpen:n,toggle:()=>o(),zIndex:1201,children:[e.jsx(c.ModalHeader,{className:t.styles["header-assign-for-student"],children:e.jsx("div",{children:"Select teacher switch data"})}),e.jsx(c.ModalBody,{className:"p-0",children:e.jsx("div",{className:t.styles["switch-data-teachers"],children:i.map(x=>e.jsx("p",{onClick:()=>m(x.teacherUserId),className:`${t.styles["switch-data-teacher-item"]} ${x.teacherUserId==a?t.styles["item-checked"]:""}`,children:x.mainTeacherName}))})}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>o(),children:_("cancel")}),e.jsx(c.Button,{disabled:!a,color:"primary",onClick:async()=>{await r(a),o()},children:_("save")})]})]})},as=({teachers:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select teacher to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.teacherRemoveUserIds.includes(a.value))||[],options:n.filter(a=>!i.teacherRemoveUserIds.includes(a.value)&&a.value!==i.teacherSwitchDataUserId)||[],placeholder:r("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({teacherRemoveUserIds:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the teacher to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.teacherSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.teacherRemoveUserIds.includes(a.value)&&a.value!==i.teacherSwitchDataUserId)||[],placeholder:r("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{console.log("value",a),o({teacherSwitchDataUserId:a?.value})},isClearable:!0})]})},ns=({counselors:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select counselor to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.counselorRemoveUserIds.includes(a.value))||[],options:n.filter(a=>!i.counselorRemoveUserIds.includes(a.value)&&a.value!==i.counselorSwitchDataUserId)||[],placeholder:r("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({counselorRemoveUserIds:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the counselor to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.counselorSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.counselorRemoveUserIds.includes(a.value)&&a.value!==i.counselorSwitchDataUserId)||[],placeholder:r("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-counselor-select"]}`,onChange:a=>{o({counselorSwitchDataUserId:a?.value})},isClearable:!0})]})},ls=({tabs:n})=>{const{t:o}=H.useTranslation(),[i,r]=u.useState(0),a=_=>{r(_)},m=()=>e.jsx(c.Row,{children:e.jsxs(c.Col,{xl:12,children:[e.jsx(c.Nav,{tabs:!0,children:n.map((_,x)=>{const l=x===i;return e.jsx(c.NavItem,{children:e.jsx(c.NavLink,{className:`${l?"active":""} cursor-pointer`,onClick:()=>a(x),style:{color:l?"#316CD9":"#242424"},children:o(_.title)})},x)})}),e.jsx(c.TabContent,{activeTab:i,className:"border-bottom-0 border-left-0 border-right-0 p-3",children:n.map((_,x)=>e.jsx(c.TabPane,{tabId:x,children:e.jsx(_.component,{})},x))})]})});return e.jsx("div",{className:"animated fadeIn",children:m()})},rs=({assistants:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select assistant to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.assistantRemoveUserId.includes(a.value))||[],options:n.filter(a=>!i.assistantRemoveUserId.includes(a.value)&&a.value!==i.assistantSwitchDataUserId)||[],placeholder:r("select_assistant"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({assistantRemoveUserId:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the assistant to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.assistantSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.assistantRemoveUserId.includes(a.value)&&a.value!==i.assistantSwitchDataUserId)||[],placeholder:r("select_assistant"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-assistant-select"]}`,onChange:a=>{console.log("value",a),o({assistantSwitchDataUserId:a?.value})},isClearable:!0})]})},cs=({secondaryTeachers:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select support teacher to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.supportTeacherRemoveUserIds.includes(a.value))||[],options:n.filter(a=>!i.supportTeacherRemoveUserIds.includes(a.value)&&a.value!==i.supportTeacherSwitchDataUserId)||[],placeholder:r("select_support_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({supportTeacherRemoveUserIds:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the support teacher to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.supportTeacherSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.supportTeacherRemoveUserIds.includes(a.value)&&a.value!==i.supportTeacherSwitchDataUserId)||[],placeholder:r("select_support_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({supportTeacherSwitchDataUserId:a?.value})},isClearable:!0})]})},os=({open:n,onClose:o,teachers:i,onChangeStaffRemove:r,switchStaffUsers:a,assistants:m,onRemoveBulkStaff:_,counselors:x,studentUserIds:l,secondaryTeachers:h})=>{const{t:j}=H.useTranslation(),d=[{title:"Remove Teacher",component:()=>e.jsx(as,{teachers:i,onChangeStaffRemove:r,switchStaffUsers:a})},{title:"Remove Assistant",component:()=>e.jsx(rs,{assistants:m,onChangeStaffRemove:r,switchStaffUsers:a})},{title:"Remove Counselor",component:()=>e.jsx(ns,{counselors:x,onChangeStaffRemove:r,switchStaffUsers:a})},{title:"Remove Support Teacher",component:()=>e.jsx(cs,{secondaryTeachers:h,onChangeStaffRemove:r,switchStaffUsers:a})}];return e.jsxs(c.Modal,{size:"lg",centered:!0,isOpen:n,toggle:()=>o(),zIndex:1201,children:[e.jsx(c.ModalHeader,{className:`${t.styles["header-assign-for-student"]} border-0`,children:e.jsx("div",{children:"Remove Bulk"})}),e.jsx(c.ModalBody,{className:"p-0",children:e.jsx(ls,{tabs:d})}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>o(),children:j("cancel")}),e.jsx(c.Button,{disabled:!a.teacherRemoveUserIds.length&&!a.assistantRemoveUserId&&!a.counselorRemoveUserIds.length,color:"primary",onClick:async()=>{await _(l)},children:"Remove"})]})]})},is=()=>{const{t:n}=H.useTranslation(),{selectedTeachers:o,teacherOptions:i,setSelectedTeachers:r}=Ke(),{selectedAssistants:a,assistantOptions:m,setSelectedAssistants:_}=We(),{selectedCounselors:x,counselorOptions:l,setSelectedCounselors:h}=He(),{selectedSecondaryTeachers:j,secondaryTeacherOptions:d,setSelectedSecondaryTeachers:w}=Ge(),{isCheck:U,isCheckAll:L,userList:C,filters:p,totalItem:I,handleClickCheck:O,handleSelectAll:$,changeFilters:P,fullName:te,handleRetrievedData:K,selectedUser:V,setSelectedUser:ae,getDataUserList:ne,userSelected:E,studentTeacherSelected:A,studentCounselorSelected:S,studentAssistantSelected:b,studentSecondaryTeacherSelected:M}=Ve(),B=()=>{K(),r(void 0),_(void 0),h(void 0),w(void 0)},{openModelBulk:W,handleToggleModel:J,staffBulkAssign:G,handleChangeStaffBulk:z,onAssignStaffToStudents:le,handleToggleInactiveModal:X,openInactiveModal:re,handleInactiveStudents:ce,handleChangeTeacherBulk:Y,handleChangeCounselorBulk:Z,handleEditAssignForStudents:ee,modalType:F,openSwitchModal:se,optionsSwitch:q,textModal:oe,teacherSwitchList:ie,onCloseSwitchModal:he,handleUpdateSwitch:me,setTeacherChangeUserId:xe,setTeacherSelectForChangeUserId:Se,teacherSelectForChangeUserId:ue,openDetailModal:je,setOpenDetailModal:Ce,toggleCollapse:_e,activeIndex:Ie,onClose:be,removeTeacherUserIds:Ne,openModelSwitchDataTeacher:we,onToggleModelSwitchDataTeacher:pe,teacherSwitchUserId:Ae,setTeacherSwitchUserId:Ue,onToggleModelDeleteBulk:ve,openModelDeleteBulk:ke,handelChangeStaffRemove:Ee,switchStaffUsers:Me,handleRemoveBulkStaff:g}=Xe(o,a,x,j,B,V,ne,E),y=[{name:"",isCenter:!0,onSelectAll:$,isCheckAll:L,className:`align-top ${t.styles["fixed-width-40"]}`},{name:"student_name",isCenter:!0,sortBy:f.UserOrder.Name,searchBy:f.SearchBy.Name,className:`align-top ${t.styles["fixed-width"]}`,getOption:s=>({label:s||"empty",value:s})},{name:"grade",isCenter:!0,sortBy:f.UserOrder.Grade,searchBy:f.SearchBy.Grade,className:`align-center justify-center ${t.styles["fixed-width-80"]}`,getOption:s=>({label:s||"empty",value:s})},{name:"teacher_emails",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.Teacher,searchBy:f.SearchBy.Teacher,getOption:s=>({label:s||"empty",value:s})},{name:"assistant_email",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.Assistant,searchBy:f.SearchBy.Assistant,getOption:s=>({label:s||"empty",value:s})},{name:"counselor_emails",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.Counselor,searchBy:f.SearchBy.Counselor,getOption:s=>({label:s||"empty",value:s})},{name:"support_teacher_email",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.SecondaryTeacher,searchBy:f.SearchBy.SecondaryTeacher,getOption:s=>({label:s||"empty",value:s})}],[v,D]=u.useState(null),N=s=>{D(T=>T===s?null:s)};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mt-4 mb-2",children:n("assign_student")}),e.jsxs(c.Row,{className:"my-2",children:[e.jsx(c.Col,{md:3,children:e.jsx(t.SearchBox,{initValue:p?.searchString||"",onSearch:s=>P({searchString:s}),placeholder:n("type_something_to_search_students")})}),e.jsx(c.Col,{md:8,className:"d-flex justify-content-end align-items-center",children:e.jsx(c.Row,{className:"mb-2",children:e.jsxs(c.Col,{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4},children:[e.jsx(c.Button,{onClick:()=>J(U),color:"primary",style:{background:"#316cd9"},children:n("assign_bulk")}),e.jsx(c.Button,{onClick:()=>ve(U),color:"primary",style:{background:"#316cd9"},children:n("delete_bulk")}),e.jsx(c.Button,{onClick:()=>X(U),color:"primary",style:{background:"#316cd9"},children:n("inactive_students")})]})})}),e.jsxs(c.Col,{md:1,className:"d-flex justify-content-end align-items-center",style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:[n("total_of_users"),": ",I]})]}),e.jsxs(c.Modal,{centered:!0,isOpen:W,toggle:()=>J(),zIndex:1201,children:[e.jsx(c.ModalHeader,{children:n("assign_bulk_student")}),e.jsxs(c.ModalBody,{children:[e.jsx(t.CustomSelector,{isMulti:!0,value:G.teacher.map(s=>({label:s.email,value:s.id})),options:i,placeholder:n("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:s=>{const T=s.map(k=>({id:k.value,email:k.label}));Y(T)},isClearable:!0,style:{maxWidth:120}}),e.jsx(ye.TeacherSelector,{value:m.find(s=>s.value==G.assistantId||s.label==G.assistantEmail)||null,options:m,onChange:s=>z("assistant",s),placeholder:n("select_assistant"),className:"flex-grow-1 mb-3"}),e.jsx(t.CustomSelector,{isMulti:!0,value:G.counselors.map(s=>({label:s.email,value:s.id})),options:l,placeholder:n("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:s=>{const T=s.map(k=>({id:k.value,email:k.label}));Z(T)},isClearable:!0,style:{maxWidth:120}}),e.jsx(ye.TeacherSelector,{value:d.find(s=>s.value==G.secondaryTeacherId||s.label==G.secondaryTeacherEmail)||null,options:d,onChange:s=>z("secondary",s),placeholder:n("select_support_teacher"),className:"flex-grow-1"})]}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>J(),children:n("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>le(U),children:n("assign")})]})]}),e.jsxs(c.Modal,{centered:!0,isOpen:re,toggle:()=>X(),zIndex:1201,children:[e.jsx(c.ModalHeader,{children:n("inactive_students")}),e.jsxs(c.ModalBody,{style:{display:"flex",gap:12},children:[e.jsx(Ye,{color:"red",size:30}),e.jsx(c.CardText,{style:{fontSize:20,margin:0,display:"flex",alignItems:"center"},children:n("are_you_sure_you_want_to_inactive_students",{number:U.length})})]}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>X(),children:n("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>ce(U,B),children:n("confirm")})]})]}),e.jsxs(c.Row,{className:"mb-2",children:[e.jsx(c.Col,{md:12,children:e.jsx("div",{children:e.jsxs(c.Table,{bordered:!0,hover:!0,striped:!0,size:"sm",className:`${t.styles["table-fixed"]}`,children:[e.jsx("thead",{children:e.jsx(fe.TableHeader,{headers:y,filters:p,fullName:te,onChangeFilters:P,teacherOptions:i,assistantOptions:m,counselorOptions:l,secondaryTeacherOptions:d})}),C&&C.length>0?e.jsx("tbody",{children:C.map((s,T)=>e.jsxs("tr",{children:[e.jsx("td",{className:`align-middle text-center ${t.styles["fixed-width-40"]}`,children:e.jsx("input",{id:s.id,type:"checkbox",onChange:O,checked:U.includes(s.id)})}),e.jsxs("td",{className:`align-middle ${t.styles["fixed-width"]}`,id:`student_name_${s.id}_${T}`,onMouseEnter:()=>N(`student_name_${s.id}_${T}`),onMouseLeave:()=>N(`student_name_${s.id}_${T}`),children:[e.jsx("button",{type:"button",className:`${t.styles["button-user-name"]} btn-link`,onClick:()=>{ae(s),Ce(!0)},children:s.fullName}),e.jsx(c.Tooltip,{placement:"top",isOpen:v===`student_name_${s.id}_${T}`,target:`student_name_${s.id}_${T}`,children:s.fullName})]}),e.jsx("td",{className:`align-middle ${t.styles["fixed-width"]}`,id:`student_email_${s.id}_${T}`,onMouseEnter:()=>N(`student_email_${s.id}_${T}`),onMouseLeave:()=>N(`student_email_${s.id}_${T}`),children:e.jsx("p",{children:s.gradeLevel})}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_teacher_${s.id}_${T}`,onMouseEnter:()=>N(`student_teacher_${s.id}_${T}`),onMouseLeave:()=>N(`student_teacher_${s.id}_${T}`),children:[!!s.teachers&&s.teachers.length>0&&e.jsx(u.Fragment,{children:s.teachers.map(k=>e.jsxs("p",{className:"mb-0",children:[k.mainTeacherName," - ",k.mainTeacherEmail]},k.mainTeacherEmail))}),!!s.teachers&&s.teachers.length>0&&e.jsx(c.Tooltip,{placement:"top",isOpen:v===`student_teacher_${s.id}_${T}`,target:`student_teacher_${s.id}_${T}`,children:s.teachers.map(k=>e.jsxs("p",{className:"mb-0",children:[k.mainTeacherName," - ",k.mainTeacherEmail]},k.mainTeacherEmail))})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_assistant_${s.id}_${T}`,onMouseEnter:()=>N(`student_assistant_${s.id}_${T}`),onMouseLeave:()=>N(`student_assistant_${s.id}_${T}`),children:[!!s.assistantEmail&&e.jsxs("p",{className:"mb-0",children:[s.assistantName," - ",s.assistantEmail]}),!!s.assistantEmail&&e.jsxs(c.Tooltip,{placement:"top",isOpen:v===`student_assistant_${s.id}_${T}`,target:`student_assistant_${s.id}_${T}`,children:[s.assistantName,"-",s.assistantEmail]})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_counselor_${s.id}_${T}`,onMouseEnter:()=>N(`student_counselor_${s.id}_${T}`),onMouseLeave:()=>N(`student_counselor_${s.id}_${T}`),children:[!!s.counselors&&s.counselors.length>0&&e.jsx(u.Fragment,{children:s.counselors.map(k=>e.jsxs("p",{className:"mb-0",children:[k.counselorName," - ",k.counselorEmail]},k.counselorUserId))}),!!s.counselors&&s.counselors.length>0&&e.jsx(c.Tooltip,{placement:"top",isOpen:v===`student_counselor_${s.id}_${T}`,target:`student_counselor_${s.id}_${T}`,children:s.counselors.map(k=>e.jsxs("p",{className:"mb-0",children:[k.counselorName," - ",k.counselorEmail]},k.counselorUserId))})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_secondary_teacher_${s.id}_${T}`,onMouseEnter:()=>N(`student_secondary_teacher_${s.id}_${T}`),onMouseLeave:()=>N(`student_secondary_teacher_${s.id}_${T}`),children:[!!s.secondaryTeacherEmail&&e.jsxs("p",{className:"mb-0",children:[s.secondaryTeacherName," - ",s.secondaryTeacherEmail]}),!!s.secondaryTeacherEmail&&e.jsxs(c.Tooltip,{placement:"top",isOpen:v===`student_secondary_teacher_${s.id}_${T}`,target:`student_secondary_teacher_${s.id}_${T}`,children:[s.secondaryTeacherName," - ",s.secondaryTeacherEmail]})]})]},s.id))}):e.jsx("div",{style:{width:"max-content",padding:20},children:n("no_data")})]})})}),e.jsx(c.Col,{md:12,children:e.jsx(t.CustomPagination,{filters:p,totalRecordCount:I,changePageSize:s=>P({pageSize:s}),changePage:s=>P({currentPage:s})})})]}),e.jsx(ss,{openDetailModal:je,onClose:be,selectedUser:V,staffBulkAssign:G,teacherOptions:i,handleChangeTeacherBulk:Y,handleChangeCounselorBulk:Z,assistantOptions:m,counselorOptions:l,secondaryTeacherOptions:d,handleChangeStaffBulk:z,handleEditAssignForStudents:ee,toggleCollapse:_e,activeIndex:Ie}),e.jsx(es,{textModal:oe,isOpen:se,teachers:ie,options:q,onClose:he,onSave:me,modalType:F,setTeacherChangeUserId:xe,setTeacherSelectForChangeUserId:Se,teacherSelectForChangeUserId:ue}),e.jsx(ts,{open:we,onClose:pe,teachers:V?.teachers?.filter(s=>!Ne.includes(s.teacherUserId))||[],onConfirm:ee,teacherSwitchUserId:Ae,setTeacherSwitchUserId:Ue}),e.jsx(os,{open:ke,onClose:ve,teachers:A,onChangeStaffRemove:Ee,switchStaffUsers:Me,counselors:S,assistants:b,onRemoveBulkStaff:g,studentUserIds:U,secondaryTeachers:M})]})},ds=()=>{const n=Q.useDispatch(),[o,i]=u.useState(f.initialUserChoice),[r,a]=u.useState([]),[m,_]=u.useState(""),x=async()=>{try{const h=await t.getTeacher();a(h.data)}catch(h){n(t.setAlert({type:"danger",message:h.response?.data?.title||h.message}))}},l=r.map(h=>({label:`${h.name} - ${h.email}`,value:h.id}));return u.useEffect(()=>{o.roles?.includes("Teacher")&&x()},[o]),{userChoiced:o,setUserChoiced:i,teacherList:r,options:l,setTeacherChangeId:_,teacherChangeId:m}},us="User deleted list",hs=()=>{const{userChoiced:n,setUserChoiced:o,options:i,teacherChangeId:r,setTeacherChangeId:a}=ds(),[m,_]=u.useState([]),[x,l]=u.useState(0),{filters:h,changeFilters:j}=t.useFilters(),d=Q.useDispatch(),w=u.useRef(null),U=()=>{w&&w.current&&w.current.toggle()},L=()=>{a(""),o(f.initialUserChoice)},C=u.useCallback(async()=>{d(t.setLoading(!0));try{const I=await t.get(h),{items:O,totalItems:$}=I.data;_(O),l($)}catch(I){d(t.setAlert({type:"danger",message:I.response?.data?.title||I.message}))}d(t.setLoading(!1))},[d,h]);u.useEffect(()=>{document.title=us},[]),u.useEffect(()=>{C()},[h]);const p=u.useCallback(I=>{d(t.setModal({isOpen:!0,type:"warning",message:"Do you want to remove this user?",onConfirm:async()=>{d(t.setLoading(!0));try{n.roles.includes("Teacher")?await t.remove(I,r):await t.remove(I),d(t.setAlert({type:"success",message:"Remove user successfully"})),U(),L(),j({currentPage:1})}catch(O){d(t.setAlert({type:"danger",message:O.response?.data?.title||O.message}))}d(t.setLoading(!1))}}))},[h,r,n]);return{userList:m,totalItems:x,filters:h,getData:C,removeData:p,changeFilters:j,modal:w,openModal:U,userChoiced:n,setUserChoiced:o,options:i,teacherChangeId:r,setTeacherChangeId:a,resetData:L}},ms=(n,o)=>{const{header:i,removeData:r,resetData:a,userChoiced:m,options:_,teacherChangeId:x,setTeacherChangeId:l}=n,{t:h}=H.useTranslation(),j=()=>{var d=window.location.origin+"/api/ExportDataUser/"+m.id;window.open(d)};return e.jsx(t.CommonModal,{header:i,ref:o,onCancel:()=>{a()},children:e.jsx(c.Row,{children:e.jsxs(c.Col,{md:12,className:"mb-2",children:[e.jsx("p",{children:h("export_user_data")}),e.jsx("div",{className:"pb-3",children:e.jsx(c.Button,{color:"success",onClick:()=>{j()},style:{color:"#fff"},children:h("download_users_data")})}),e.jsx("p",{children:"Delete user"}),!!m&&e.jsxs("div",{children:[m.roles.includes("Student")&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),style:{color:"#fff"},children:h("delete_user")})]}),m.roles.includes("Admin")&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),children:h("delete_user")})]}),m.roles.includes("Teacher")&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"warning",children:h("alert_delete_user")}),e.jsx(t.CustomSelector,{options:_,defaultValue:x,placeholder:"select_teacher_change",onChange:d=>l(d.value)}),!!x&&e.jsxs("div",{className:"mt-2",children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),children:h("delete_user")})]})]}),(m.roles.includes("Parent")||m.roles.includes("Counselor")||m.roles.includes("SecondaryTeacher"))&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),children:h("delete_user")})]})]})]})})})},ps=u.forwardRef(ms),gs="user_deleted",fs=()=>{const{userList:n,totalItems:o,filters:i,changeFilters:r,removeData:a,openModal:m,modal:_,userChoiced:x,setUserChoiced:l,options:h,teacherChangeId:j,setTeacherChangeId:d,resetData:w}=hs(),{t:U}=H.useTranslation(),L=C=>{C&&l(C),m()};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mt-4 mb-2",children:U(gs)}),e.jsxs(c.Row,{className:"my-2",children:[e.jsx(c.Col,{md:8,children:e.jsx(t.SearchBox,{initValue:i.searchString,onSearch:C=>r({searchString:C}),placeholder:U("type_something_to_search_reflection_result")})}),e.jsxs(c.Col,{md:4,className:"d-flex justify-content-end align-items-center",children:[U("total_of_users"),": ",o]})]}),e.jsxs(c.Row,{className:"mb-2",children:[e.jsx(c.Col,{md:12,children:n&&n.length>0?e.jsx("div",{children:e.jsxs(c.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"align-top",children:U("name")}),e.jsx("th",{className:"align-top",children:U("email")}),e.jsx("th",{className:"align-top",children:U("role")})]})}),e.jsx("tbody",{children:n.map(C=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",children:e.jsx(t.LinkEditButton,{label:`${C.fullName}`,onClick:()=>L(C)})}),e.jsx("td",{className:"align-middle",children:C.email}),e.jsx("td",{className:"align-middle",children:!!C.roles&&C.roles.map(p=>p==="SecondaryTeacher"?"SupportTeacher":p).join(", ")})]},C.id))})]})}):e.jsx(t.EmptyDataAlert,{label:U("user")})}),e.jsx(c.Col,{md:12,children:e.jsx(t.CustomPagination,{filters:i,totalRecordCount:o,changePageSize:C=>r({pageSize:C}),changePage:C=>r({currentPage:C})})})]}),e.jsx(ps,{ref:_,header:x.fullName,onCancel:()=>{},userChoiced:x,removeData:a,options:h,teacherChangeId:j,setTeacherChangeId:d,resetData:w})]})},ys={padding:"4px 8px",marginBottom:0,borderRadius:"4px",color:"#fff",fontWeight:500,fontSize:"14px",height:"56px",justifyContent:"center"},Te=({htmlFor:n,isDisabled:o,text:i,backgroundColor:r,onClick:a,isClassReflection:m})=>e.jsxs(c.Label,{htmlFor:n,role:"button",tabIndex:0,className:`d-flex align-items-center justfy-content-center mr-2
2
+ ${m?"w-25":""}
3
+ ${o?"":"cursor-pointer hover-opacity"}`,style:{...ys,backgroundColor:r,opacity:o?.5:1,gap:"8px"},onClick:_=>a(),children:[e.jsx("i",{className:"fa fa-paperclip mr-1","aria-hidden":"true"}),i]}),Re=`${t.BASE_URL}/api/ImportCsv/csv`,Le=`${t.BASE_URL}/api/Teacher`,xs=(n,o)=>t.apiUpload.post(`${Re}/${o}`,n),Oe=n=>t.apiUpload.post(`${Re}/importClassReflection`,n),vs=(n,o)=>t.apiUpload.post(`${Le}/adminImportStudentByTeacherId/${n}`,o),Ts=n=>t.api.post(`${Le}/adminImportChunkUser`,n),Ss=()=>t.api.get(`${Le}/download-template-file-user`);var $e=(n=>(n.Students="students",n.Subjects="subjects",n.Grades="grades",n.Attendances="attendances",n.ClassReflection="classReflection",n.Others="others",n.AllUser="allUser",n))($e||{});const js=[{text:"import_users",backgroundColor:"#0abde3",type:"allUser"}],Cs=[{text:"import_class_reflection",backgroundColor:"#e74c3c",type:"classReflection"}],_s="CSV Import",De="csvupload",Be={teacherName:"",teacherEmail:"",studentIds:[],file:""},Is=()=>{const n=Q.useDispatch(),o=Q.useSelector(b=>b.common.isLoading),[i,r]=u.useState(null),[a,m]=u.useState(),[_,x]=u.useState([]),[l,h]=u.useState(Be),[j,d]=u.useState(),[w,U]=u.useState([]),C=window.location.hostname.includes("isb"),[p,I]=u.useState(0),[O,$]=u.useState("");u.useEffect(()=>{document.title=_s},[]);const P=C?js:Cs,te=async()=>{n(t.setLoading(!0));try{const B=await Ss();var b=new Blob([B.data.content],{type:"text/csv"});const W=window.URL.createObjectURL(b);var M=document.createElement("a");M.href=W,M.setAttribute("download",B.data.nameFile),M.click(),n(t.setAlert({type:"success",message:"Download successfully"}))}catch(B){n(t.setAlert({type:"danger",message:B.message}))}n(t.setLoading(!1))},K=u.useCallback(async b=>{if(!i||!b)return;n(t.setLoading(!0));try{const J=new FormData;J.append("file",b,b.name);const G=i==="allUser"?t.CsvImportType.Admin:t.CsvImportType.Teacher,z=await fe.validateCsvApi(J,G);if(z.data&&z.data.length>0){U(z.data),n(t.setLoading(!1)),n(t.setAlert({type:"danger",message:"Please use the file as per the template."}));return}if(i=="allUser"){let X=(await b.text()).trim();const re=X.split(`
4
+ `).map(q=>q.trim()),ce=re.findIndex(q=>q.split(",").includes("First Name"));if(ce===0)throw new Error("Invalid CSV: Missing header row.");X=re.slice(ce).join(`
5
+ `);const Y=Je.parse(X,{header:!0,skipEmptyLines:!0}),Z=Y.meta.fields,ee=Y.data;if(!ee.length){n(t.setLoading(!1)),n(t.setAlert({type:"danger",message:"The file has no data or some column names are misformed."}));return}const F=10,se=[];for(let q=0;q<ee.length;q+=F){const ie=ee.slice(q,q+F).map(he=>Object.values(he).map(me=>(me??"").toString().trim()));Z&&ie.unshift(Z),console.log({valuesOnly:ie}),se.push(ie)}for(let q=0;q<se.length;q++)await Ts({chunks:se[q]}),await new Promise(oe=>setTimeout(oe,500))}else C?i=="classReflection"&&await Oe(J):await xs(J,i.toString());n(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(J){console.error("❌ Upload failed",J),n(t.setAlert({type:"danger",message:J.response?.data?.title||J.message}))}n(t.setLoading(!1));const M=document.getElementById(De),B=document.getElementById("import-student"),W=document.getElementById("import-classReflection");M&&(M.value=""),B&&(B.value=""),W&&(W.value="")},[i]),V=async b=>{if(!p){n(t.setAlert({type:"danger",message:"Select teacher before import csv"}));return}if(!i||!b)return;n(t.setLoading(!0));try{const B=new FormData;B.append("file",b,b.name),await vs(p,B),n(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(B){n(t.setAlert({type:"danger",message:B.response?.data?.title||B.message}))}n(t.setLoading(!1));const M=document.getElementById("teacherSelector");M&&(M.value="")},ae=async b=>{if(!a||!a)return;n(t.setLoading(!0));try{const B=new FormData;B.append("file",a,a.name),B.append("teacherName",b.teacherName),B.append("teacherEmail",b.teacherEmail),b.studentIds.forEach(W=>{B.append("studentIds",W)}),await Oe(B),n(t.setAlert({type:"success",message:"Import CSV successfully"})),h(Be)}catch(B){n(t.setAlert({type:"danger",message:B.response?.data?.title||B.message}))}n(t.setLoading(!1));const M=document.getElementById(De);M&&(M.value="")},ne=b=>{I(b.value)},E=b=>{d(b),$(b?.name||"")},A=()=>{if(!j){n(t.setAlert({type:"danger",message:"Select CSV to import"}));return}V(j)};return{isLoading:o,buttons:P,id:De,setType:r,upload:K,initImportReflection:l,setInitImportReflection:h,onConfirm:ae,CSVType:$e,dataFile:a,setDataFile:m,setArrStudent:x,arrStudent:_,isCheckDomainIBS:C,onChangeTeacher:ne,uploadByTeacherId:V,setDataFileImportStudent:E,onUpLoadStudentFile:A,defaultTeacher:p,fileName:O,onStudentSubmit:()=>{n(t.setModal({isOpen:!0,type:"warning",message:"Are you sure upload this file?",onConfirm:()=>{A()}}))},downloadTemplateUser:te,errorsValidate:w,setErrorsValidate:U}},bs=ge.object({teacherName:ge.string()?.trim().required(),teacherEmail:ge.string()?.trim().email("Invalid email").required(),studentIds:ge.array().required().test("test students","Please choose student",function(){return!!this.parent.studentIds&&!!this.parent.studentIds.length}),file:ge.string()?.trim().required()}),Ns=()=>{const{initImportReflection:n,onConfirm:o,isLoading:i,setType:r,id:a,CSVType:m,dataFile:_,setDataFile:x,setArrStudent:l,buttons:h,upload:j,isCheckDomainIBS:d,downloadTemplateUser:w,errorsValidate:U,setErrorsValidate:L}=Is(),{t:C}=H.useTranslation();return e.jsx("div",{className:"animated fadeIn pt-3",children:d?e.jsxs(e.Fragment,{children:[e.jsx(c.Input,{className:"d-none",type:"file",id:"import-user",onChange:p=>j(p.target.files[0]),accept:"text/csv"}),e.jsx(c.Input,{className:"d-none",type:"file",id:"import-classReflection",onChange:p=>j(p.target.files[0]),accept:"text/csv"}),e.jsx("div",{className:"class-reflection",children:e.jsx(Pe.Formik,{initialValues:n,enableReinitialize:!0,validationSchema:bs,onSubmit:(p,I)=>{o(p),x(""),l([]),I.resetForm()},children:p=>{const{touched:I,errors:O}=p;return e.jsxs(c.Row,{className:"mb-2",children:[e.jsx(c.Input,{className:"d-none",type:"file",id:a,onChange:$=>{x($.target.files[0]),p.setFieldValue("file","imported");const P=document.getElementById(a);P&&(P.value="")},accept:"text/csv"}),e.jsx(c.Col,{md:6,className:"mb-2 d-flex mt-5",children:e.jsxs(c.Row,{className:"w-100 flex-column",children:[e.jsxs(c.Col,{md:12,className:"",children:[e.jsx(t.RequiredLabel,{text:C("import_class_reflection")}),e.jsx(Te,{htmlFor:"import-classReflection",text:C("import_class_reflection"),isDisabled:i,backgroundColor:"#e74c3c",onClick:()=>{r(m.ClassReflection)}},"Import class reflections"),!!_&&e.jsx("p",{style:{color:"#007bff",fontStyle:"italic",marginTop:"5px"},children:_.name})]}),!_&&e.jsx(c.Col,{md:12,className:"mb-2",children:I.file&&O.file&&e.jsx(t.ErrorHandler,{text:O.file})})]})}),e.jsx(c.Col,{md:6,className:"mb-2",children:e.jsxs(c.Row,{className:"flex-column",children:[e.jsx(c.Col,{md:12,className:"mb-2 text-right",style:{textAlign:"right"},children:e.jsx(c.Button,{role:"button",color:"primary",onClick:()=>w(),children:e.jsxs("p",{className:"d-flex align-items-center mb-0",children:[C("download_template")," ",e.jsx(fe.AiOutlineDownload,{size:20,className:"ml-2"})]})})}),e.jsxs(c.Col,{md:12,className:"mb-2",children:[e.jsx(t.RequiredLabel,{text:C("import_users")}),h.map($=>e.jsx(Te,{htmlFor:"import-user",text:$.text,isDisabled:i,backgroundColor:$.backgroundColor,onClick:()=>r($.type)},$.text))]}),U?.length>0&&U.map(($,P)=>e.jsx(t.ErrorHandler,{text:$},P))]})})]})}})})]}):e.jsx(e.Fragment,{children:e.jsxs(c.Row,{children:[e.jsx(c.Col,{md:12,className:"mt-2 mb-2 text-left",children:e.jsx(c.Button,{role:"button",color:"primary",onClick:()=>w(),children:e.jsxs("p",{className:"d-flex align-items-center mb-0",children:[C("download_template")," ",e.jsx(fe.AiOutlineDownload,{size:20,className:"ml-2"})]})})}),e.jsxs(c.Col,{md:6,className:"mb-3",children:[e.jsx(c.Input,{id:"import-user",className:"d-none",type:"file",onChange:p=>j(p.target.files[0]),accept:"text/csv"}),e.jsx(t.RequiredLabel,{text:C("import_users")}),e.jsx(Te,{htmlFor:"import-user",text:C("import_users"),isDisabled:i,backgroundColor:"#0abde3",onClick:()=>{r(m.AllUser),U.length>0&&L([])}},"import-users")]}),U.length>0&&U.map((p,I)=>e.jsx(t.ErrorHandler,{text:p},I)),e.jsxs(c.Col,{md:6,className:"mb-3",children:[e.jsx(c.Input,{className:"d-none",type:"file",id:a,onChange:p=>j(p.target.files[0]),accept:"text/csv"}),h.map(p=>e.jsxs(e.Fragment,{children:[e.jsx(t.RequiredLabel,{text:C(p.text)}),e.jsx(Te,{htmlFor:a,text:C(p.text),isDisabled:i,backgroundColor:p.backgroundColor,onClick:()=>r(p.type)},p.text)]}))]})]})})})},ws=[{path:"/admin/users/user-list",title:"user_list",component:fe.UserList},{path:"/admin/users/assign-student",title:"assign_student",component:is},{path:"/admin/users/user-deleted",title:"user_deleted",component:fs},{path:"/admin/users/import-csv",title:"csv_import",component:Ns}],As=()=>e.jsx(t.CustomTabs,{tabs:ws});exports.default=As;
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DVZt7HdB.js"),fe=require("./UserList-BFRsUwHp.js"),u=require("react"),c=require("reactstrap"),H=require("react-i18next"),f=require("./constants-bWeajrBe.js"),ye=require("./TeacherSelector-CkGdl96R.js"),Q=require("react-redux"),Fe=require("react-select"),Pe=require("formik"),qe=require("yup"),Je=require("papaparse");function ze(n){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const i in n)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(o,i,r.get?r:{enumerable:!0,get:()=>n[i]})}}return o.default=n,Object.freeze(o)}const ge=ze(qe),Ve=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(f.DEFAULT_STUDENT_FILTER),[m,_]=u.useState(0),[x,l]=u.useState(!1),[h,j]=u.useState([]),[d,w]=u.useState([]),[U,L]=u.useState(f.initAssignStd),C="",p=E=>{const A={...r,...E};A.searchString&&E.searchString&&E.searchString!=r.searchString&&(A.currentPage=1),a(A)},I=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)).flatMap(S=>S.teachers),A=new Map;return E.forEach(S=>{A.has(S.teacherUserId)||A.set(S.teacherUserId,S)}),Array.from(A.values()).map(S=>({value:S.teacherUserId,label:S.mainTeacherEmail}))},[d,h]),O=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)).flatMap(S=>S.counselors),A=new Map;return E.forEach(S=>{A.has(S.counselorUserId)||A.set(S.counselorUserId,S)}),Array.from(A.values()).map(S=>({value:S.counselorUserId,label:S.counselorEmail}))},[d,h]),$=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)&&S.assistantUserId).map(S=>({value:S.assistantUserId,label:S.assistantEmail})),A=new Map;return E.forEach(S=>{A.has(S.value)||A.set(S.value,S)}),Array.from(A.values())},[o,h]),q=u.useMemo(()=>{const E=o.filter(S=>h.includes(S.id)&&S.secondaryTeacherUserId).map(S=>({value:S.secondaryTeacherUserId,label:S.secondaryTeacherEmail})),A=new Map;return E.forEach(S=>{A.has(S.value)||A.set(S.value,S)}),Array.from(A.values())},[o,h]),te=u.useCallback(E=>{E!==r.sortBy?p({sortBy:E,orderBy:"ASC",currentPage:1}):p({sortBy:E,orderBy:r.orderBy!=="DESC"?"DESC":"ASC",currentPage:1})},[JSON.stringify(r)]),K=async()=>{n(t.setLoading(!0));try{const E=Object.entries(r).filter(([b,M])=>M!==void 0).reduce((b,[M,B])=>(b[M]=B,b),{}),A={};for(const b in E){const M=b.charAt(0).toLowerCase()+b.slice(1);A[M]=E[b]}const S=await f.getAssignStudentApi(A);i(S?.data?.items),_(S?.data?.totalItems)}catch(E){n(t.setAlert({type:"danger",message:E.response?.data?.title||E.message}))}n(t.setLoading(!1))},V=()=>{l(!x),j(o.map(E=>E.id)),w(o),x&&(j([]),w([]))},ae=E=>{const{id:A,checked:S}=E.target;if(S){j(M=>[...M,A]);const b=o.find(M=>M.id===A);b&&w(M=>[...M,b])}else j(b=>b.filter(M=>M!==A)),w(b=>b.filter(M=>M.id!==A))},ne=u.useCallback(()=>{r.currentPage==1?K():p({currentPage:1}),j([]),w([]),l(!1)},[JSON.stringify(r)]);return u.useEffect(()=>{K()},[JSON.stringify(r)]),u.useEffect(()=>{document.title="User | Assign student"},[]),u.useEffect(()=>{p({...r,searchString:C})},[C]),{handelSort:te,handleRetrievedData:ne,totalItem:m,userList:o,filters:r,changeFilters:p,handleSelectAll:V,handleClickCheck:ae,isCheckAll:x,isCheck:h,fullName:C,selectedUser:U,setSelectedUser:L,userSelected:d,getDataUserList:K,studentTeacherSelected:I,studentCounselorSelected:O,studentAssistantSelected:$,studentSecondaryTeacherSelected:q}},He=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getCounselors();l.data.items&&i(l.data.items.map?.(h=>({label:h.email,value:h.id}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.find(d=>d.value===l);a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedCounselors:r,counselorOptions:o,handleSelectCounselor:_,handleCreateCounselorOption:x,setSelectedCounselors:a}},We=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getAssistants();l.data.items&&i(l.data.items.map?.(h=>({label:h.email,value:h.id}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.find(d=>d.value===l);a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedAssistants:r,assistantOptions:o,handleSelectAssistant:_,handleCreateAssistantOption:x,setSelectedAssistants:a}},Ge=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getSecondaryTeachers();l.data.items&&i(l.data.items.map?.(h=>({label:h.email,value:h.id,id:h.secondaryTeacherId}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.find(d=>d.value===l);a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedSecondaryTeachers:r,secondaryTeacherOptions:o,handleSelectSecondaryTeacher:_,handleCreateSecondaryTeacherOption:x,setSelectedSecondaryTeachers:a}},Ke=()=>{const n=Q.useDispatch(),[o,i]=u.useState([]),[r,a]=u.useState(),m=async()=>{try{const l=await f.getTeachers({sortBy:"Email"});l.data&&i(l.data.map?.(h=>({label:h.email,value:h.id}))||[])}catch(l){n(t.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}},_=u.useCallback((l,h)=>{let j=o.filter(d=>l.includes(d.value));a({...r,[h]:j})},[JSON.stringify(r),JSON.stringify(o)]),x=u.useCallback((l,h,j)=>{i([...o,l]),j&&a({...r,[h]:l})},[JSON.stringify(o),JSON.stringify(r)]);return u.useEffect(()=>{m()},[]),{selectedTeachers:r,teacherOptions:o,handleSelectTeacher:_,handleCreateTeacherOption:x,setSelectedTeachers:a}},Qe=(n,o)=>{const i=[];if(o===f.TeacherType.Teacher)for(const a of n)for(const m of a.teachers||[])i.push({label:m.mainTeacherEmail,value:m.teacherUserId,name:m.mainTeacherName});else if(o===f.TeacherType.Assistant)for(const a of n)a.assistantEmail&&a.assistantUserId&&i.push({label:a.assistantEmail,value:a.assistantUserId,name:a.assistantName||""});else if(o===f.TeacherType.Counselor)for(const a of n)for(const m of a.counselors||[])i.push({label:m.counselorEmail,value:m.counselorUserId,name:m.counselorName});const r=new Map;for(const a of i)r.has(a.value)||r.set(a.value,a);return Array.from(r.values()).sort((a,m)=>a.label.localeCompare(m.label))},Xe=(n,o,i,r,a,m,_,x)=>{const l=Q.useDispatch(),[h,j]=u.useState(!1),[d,w]=u.useState(f.initialStaffBulk),[U,L]=u.useState(!1),[C,p]=u.useState(!1),[I,O]=u.useState(f.TeacherType.Teacher),[$,q]=u.useState([]),[te,K]=u.useState([]),[V,ae]=u.useState([]),[ne,E]=u.useState({header:"",titleSelect:"",selectPlaceholder:"",changeTitle:"",changePlaceholder:""}),[A,S]=u.useState(""),[b,M]=u.useState(""),[B,W]=u.useState(!1),[J,G]=u.useState(0),[z,le]=u.useState([]),[X,re]=u.useState(""),[ce,Y]=u.useState(!1),[Z,ee]=u.useState(!1),[F,se]=u.useState(f.initStaffDeleteBulk),P=g=>{se({...F,...g})},oe=g=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select students!"}));return}ee(!Z),w({...f.initialStaffBulk}),se({...f.initStaffDeleteBulk})},de=()=>{Y(!ce),re("")},he=g=>{z.includes(g)?le(z.filter(y=>y!==g)):le([...z,g])},me=g=>{G(y=>y===g?-1:g)},xe=g=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select students!"}));return}j(!h),w({...f.initialStaffBulk})},Se=(g,y,v)=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select students!"}));return}switch(ae(g),K(Qe(g,y)),O(y),y){case f.TeacherType.Teacher:E({header:"switch_teacher",titleSelect:"current_teacher_name",selectPlaceholder:"select_teacher",changeTitle:"select_teacher_change",changePlaceholder:"select_teacher_change"});break;case f.TeacherType.Assistant:E({header:"switch_assistant",titleSelect:"current_assistant_name",selectPlaceholder:"",changeTitle:"",changePlaceholder:"select_assistant_change"});break;case f.TeacherType.Counselor:E({header:"switch_counselor",titleSelect:"current_counselor_name",selectPlaceholder:"select_counselor",changeTitle:"select_counselor_change",changePlaceholder:"select_counselor_change"});break;case f.TeacherType.SecondaryTeacher:E({header:"switch_support_teacher",titleSelect:"current_assistant_name",selectPlaceholder:"",changeTitle:"",changePlaceholder:"select_support_teacher_change"});break}p(!C),q(v)},ue=()=>{q([]),p(!1),W(!1),O(f.TeacherType.Teacher),K([]),S(""),M(""),E({header:"",titleSelect:"",selectPlaceholder:"",changeTitle:"",changePlaceholder:""}),le([])},je=()=>{W(!1),G(0),le([])},Ce=async(g,y)=>{l(t.setModal({isOpen:!0,type:"warning",message:`Do you want to change ${y===f.TeacherType.Teacher?"teacher":y===f.TeacherType.Assistant?"assistant":y===f.TeacherType.SecondaryTeacher?"support teacher":"counselor"} for ${g.length} student(s)?`,onConfirm:async()=>{l(t.setLoading(!0));try{const v=y===f.TeacherType.Teacher?await f.changeMultiTeacherOfStudent(g):y===f.TeacherType.Assistant?await f.changeAssistantOfStudents(g):y===f.TeacherType.Counselor?await f.changeMultiCounselorsOfStudent(g):await f.changeSecondaryTeacherOfStudents(g);v&&v?.data&&(ue(),a?.(),await _(),l(t.setAlert({type:"success",message:`Change ${y===f.TeacherType.Teacher?"teacher":y===f.TeacherType.Assistant?"assistant":y===f.TeacherType.SecondaryTeacher?"support teacher":"counselor"} successfully`})))}catch(v){l(t.setAlert({type:"danger",message:v.response?.data?.title||v.message}))}l(t.setLoading(!1))}}))},_e=()=>{let g=[];switch(I){case f.TeacherType.Teacher:g=V.filter(y=>{const v=y.teachers.map(D=>D.teacherUserId);return v.includes(b)&&!v.includes(A)}).map(y=>({studentId:y.studentId,teacher:b,teacherChange:A}));break;case f.TeacherType.Counselor:g=V.filter(y=>{const v=y.counselors.map(D=>D.counselorUserId);return v.includes(b)&&!v.includes(A)}).map(y=>({studentId:y.studentId,counselor:b,counselorChange:A}));break;case f.TeacherType.Assistant:g=V.filter(y=>y?.assistantUserId&&y?.teachers?.length>0).map(y=>({studentId:y.studentId,assistantUserId:A}));break;case f.TeacherType.SecondaryTeacher:g=V.filter(y=>y?.secondaryTeacherUserId&&y?.teachers?.length>0).map(y=>({studentId:y.studentId,secondaryTeacherId:A}));break}if(g.length===0){l(t.setAlert({type:"danger",message:"No change to update!"}));return}Ce(g||[],I)},Ie=g=>{if(g&&g.length===0){l(t.setAlert({type:"danger",message:"Please select student(s)!"}));return}L(!U)},be=(g,y)=>{switch(g){case"assistant":w({...d,assistantId:y.value,assistantEmail:y.label});break;case"secondary":w({...d,secondaryTeacherId:y.value,secondaryTeacherEmail:y.label});break;case"grade":w({...d,gradeLevel:y.value});break}},Ne=g=>{w({...d,teacher:g})},we=g=>{w({...d,counselors:g})},pe=async g=>{l(t.setLoading(!0));try{await f.assignStudentsApi(g),l(t.setAlert({type:"success",message:"Student assigned successfully"})),a?.(),ue()}catch(y){l(t.setAlert({type:"danger",message:y.response?.data?.title||y.message}))}l(t.setLoading(!1))},Ae=u.useCallback(g=>{if(g.length===0){l(t.setAlert({type:"danger",message:"Not found selected student."}));return}if(g.some(D=>{const N=n?.[D],s=o?.[D],T=i?.[D],k=r?.[D];return!N&&!s&&!T&&!k})){l(t.setAlert({type:"danger",message:"Please select/add teacher for all selected student first."}));return}const v=g.map(D=>{const N=n?.[D],s=o?.[D],T=i?.[D],k=r?.[D],R={id:D};return N&&(R.mainTeacherUserId=N?N.map(ie=>ie.value):void 0,R.mainTeacherEmail=N?N.map(ie=>ie.label):void 0),s&&(R.assistantUserId=s?.value&&typeof s?.value=="string"?s?.value:void 0,R.assistantEmail=s?.value&&typeof s?.value=="number"?s?.label:void 0),T&&(R.counselorUserIds=T?T.map(ie=>ie.value):void 0,R.counselorEmails=T?T.map(ie=>ie.label):void 0),k&&(R.secondaryTeacherUserId=k?.value&&typeof k?.value=="string"?k?.value:void 0,R.secondaryTeacherEmail=k?.value&&typeof k?.value=="number"?k?.label:void 0),R});pe([...v])},[JSON.stringify(n),JSON.stringify(o),JSON.stringify(i),JSON.stringify(r)]),Ue=u.useCallback(g=>{const y=n?.[g],v=o?.[g],D=i?.[g],N=r?.[g];if(!y&&!v&&!D&&!N){l(t.setAlert({type:"danger",message:"Please select/add teacher for selected student first."}));return}const s={id:g};y&&(s.mainTeacherUserId=y?y.map(T=>T.value):void 0,s.mainTeacherEmail=y?y.map(T=>T.label):void 0),v&&(s.assistantUserId=v?.value&&typeof v?.value=="string"?v?.value:void 0,s.assistantEmail=v?.value&&typeof v?.value=="number"?v?.label:void 0),D&&(s.counselorUserIds=D?D.map(T=>T.value):void 0,s.counselorEmails=D?D.map(T=>T.label):void 0),N&&(s.secondaryTeacherUserId=N?.value&&typeof N?.value=="string"?N?.value:void 0,s.secondaryTeacherEmail=N?.value&&typeof N?.value=="number"?N?.label:void 0),pe([s])},[JSON.stringify(n),JSON.stringify(o),JSON.stringify(i),JSON.stringify(r)]),ve=async g=>{if(g.length===0){l(t.setAlert({type:"danger",message:"Not found selected student."}));return}if(d.teacher.length===0&&d.counselors.length===0&&!d.assistantId&&!d.secondaryTeacherId){l(t.setAlert({type:"danger",message:"No change to assign!"}));return}const y=x?.filter(v=>g?.includes(v.id))?.every(v=>Array.isArray(v.teachers)&&v.teachers.length>0)??!1;if(d.teacher.length===0&&!y){l(t.setAlert({type:"danger",message:"Please assign a teacher to each student before giving other educators access to them"}));return}l(t.setLoading(!0));try{if(d.teacher.length>0&&x&&x.length>0){const N=x.filter(s=>g.includes(s.id)).map(s=>{const T=s.teachers?.map(R=>R.teacherUserId)||[],k=d.teacher.filter(R=>!T.includes(R.id));return{id:s.id,mainTeacherUserId:k.map(R=>R.id),mainTeacherEmail:k.map(R=>R.email)}}).filter(s=>s.mainTeacherUserId.length>0||s.mainTeacherEmail.length>0);N.length>0&&await f.assignStudentsApi(N)}if(d.counselors.length>0&&x&&x.length>0){const N=x.filter(s=>g.includes(s.id)).map(s=>{const T=s.counselors?.map(R=>R.counselorUserId)||[],k=d.counselors.filter(R=>!T.includes(R.id));return{id:s.id,counselorUserIds:k.map(R=>R.id),counselorEmails:k.map(R=>R.email)}}).filter(s=>s.counselorUserIds.length>0||s.counselorEmails.length>0);N.length>0&&await f.assignStudentsApi(N)}const v=x?.filter(N=>!N.assistantUserId);if(v&&v?.length>0&&d.assistantId){const N=v.map(s=>({id:s.id,assistantUserId:d.assistantId,assistantEmail:d.assistantEmail}));await f.assignStudentsApi(N.filter(s=>s!==void 0))}const D=x?.filter(N=>!N.secondaryTeacherUserId);if(D&&D?.length>0&&d.secondaryTeacherId){const N=D.map(s=>({id:s.id,secondaryTeacherUserId:d.secondaryTeacherId,secondaryTeacherEmail:d.secondaryTeacherEmail}));await f.assignStudentsApi(N.filter(s=>s!==void 0))}l(t.setAlert({type:"success",message:"Student assigned successfully"})),a?.(),ue(),xe()}catch(v){l(t.setAlert({type:"danger",message:v.response?.data?.title||v.message}))}l(t.setLoading(!1))},ke=async g=>{if(d.teacher.length===0){l(t.setAlert({type:"danger",message:"Please select teacher before assign!"}));return}if(z.length>0&&!g){Y(!0);return}const y={id:m?.id||"",mainTeacherUserId:d.teacher.filter(v=>!m?.teachers?.some(D=>D.teacherUserId===v.id)).map(v=>v.id)||[],mainTeacherEmail:d.teacher.filter(v=>!m?.teachers?.some(D=>D.teacherUserId===v.id)).map(v=>v.email)||[],assistantUserId:d?.assistantId?d?.assistantId:void 0,assistantEmail:d?.assistantEmail?d?.assistantEmail:void 0,counselorUserIds:d.counselors.map(v=>v.id)||[],counselorEmails:d.counselors.map(v=>v.email)||[],secondaryTeacherUserId:d?.secondaryTeacherId?d?.secondaryTeacherId:void 0,secondaryTeacherEmail:d?.secondaryTeacherEmail?d?.secondaryTeacherEmail:void 0,removeTeacherUserIds:z,teacherSwitchUserId:g||""};d?.gradeLevel&&d.gradeLevel!==m?.gradeLevel&&await f.addGradeToStudent(m?.id||"",d?.gradeLevel),pe([y])},Ee=async(g,y)=>{l(t.setLoading(!0));try{(await f.updateStatusAll(g)).status==200&&(l(t.setAlert({type:"success",message:`Inactive ${g.length} Students successfully`})),y())}catch(v){l(t.setAlert({type:"danger",message:v.response?.data?.title||v.message}))}L(!U),l(t.setLoading(!1))},Me=u.useCallback(async g=>{if(F.assistantRemoveUserId.length&&!F.assistantSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select an assistant to transfer data!"}));return}if(F.teacherRemoveUserIds.length&&!F.teacherSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select a teacher to transfer data!"}));return}if(F.counselorRemoveUserIds.length&&!F.counselorSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select a counselor to transfer data!"}));return}if(F.supportTeacherRemoveUserIds.length&&!F.supportTeacherSwitchDataUserId){l(t.setAlert({type:"danger",message:"Please select a support teacher to transfer data!"}));return}l(t.setLoading(!0));try{await f.removeBulkStaff({...F,studentUserIds:g||[]}),a?.(),await _()}catch(y){l(t.setAlert({type:"danger",message:y.response?.data?.title||y.message}))}oe(),l(t.setLoading(!1))},[F]);return u.useEffect(()=>(m?.id&&w({teacher:m?.teachers?.map(g=>({id:g.teacherUserId,email:g.mainTeacherEmail})),assistantId:m?.assistantUserId,assistantEmail:m?.assistantEmail,counselors:m?.counselors?.map(g=>({id:g.counselorUserId,email:g.counselorEmail})),secondaryTeacherEmail:m?.secondaryTeacherEmail,secondaryTeacherId:m?.secondaryTeacherUserId,gradeLevel:m?.gradeLevel}),()=>{w(f.initialStaffBulk)}),[m]),{handleAssignSingleStudent:Ue,handleAssignMultiStudent:Ae,openModelBulk:h,handleToggleModel:xe,handleChangeStaffBulk:be,staffBulkAssign:d,onAssignStaffToStudents:ve,handleToggleInactiveModal:Ie,openInactiveModal:U,handleInactiveStudents:Ee,handleChangeTeacherBulk:Ne,handleEditAssignForStudents:ke,handleToggleSwitchModel:Se,openSwitchModal:C,optionsSwitch:$,modalType:I,textModal:ne,teacherSwitchList:te,onCloseSwitchModal:ue,handleUpdateSwitch:_e,setTeacherChangeUserId:S,setTeacherSelectForChangeUserId:M,teacherSelectForChangeUserId:b,openDetailModal:B,setOpenDetailModal:W,toggleCollapse:me,activeIndex:J,handleChangeCounselorBulk:we,onClose:je,removeTeacherUserIds:z,onSelectRemoveTeacher:he,openModelSwitchDataTeacher:ce,onToggleModelSwitchDataTeacher:de,teacherSwitchUserId:X,setTeacherSwitchUserId:re,onToggleModelDeleteBulk:oe,openModelDeleteBulk:Z,handelChangeStaffRemove:P,switchStaffUsers:F,handleRemoveBulkStaff:Me}};function Ye(n){return t.GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M228.9 79.9L51.8 403.1C40.6 423.3 55.5 448 78.9 448h354.3c23.3 0 38.2-24.7 27.1-44.9L283.1 79.9c-11.7-21.2-42.5-21.2-54.2 0zM273.6 214L270 336h-28l-3.6-122h35.2zM256 402.4c-10.7 0-19.1-8.1-19.1-18.4s8.4-18.4 19.1-18.4 19.1 8.1 19.1 18.4-8.4 18.4-19.1 18.4z"}}]})(n)}const Ze=n=>{const{textModal:o,isOpen:i,teachers:r,options:a,onClose:m,onSave:_,modalType:x,setTeacherChangeUserId:l,setTeacherSelectForChangeUserId:h,teacherSelectForChangeUserId:j}=n,{t:d}=H.useTranslation();return e.jsxs(c.Modal,{centered:!0,isOpen:i,toggle:m,zIndex:1201,children:[e.jsx(c.ModalHeader,{className:t.styles["header-assign-for-student"],children:d(o.header)}),e.jsxs(c.ModalBody,{children:[x!==f.TeacherType.Assistant||x!==f.TeacherType.SecondaryTeacher&&e.jsxs(u.Fragment,{children:[e.jsx("div",{children:d(o.titleSelect)}),e.jsx("ul",{style:{maxHeight:200,overflow:"auto"},children:r.map(w=>e.jsxs("li",{children:[w.name,"-",w.label]},w.label))})]}),(x===f.TeacherType.Teacher||x===f.TeacherType.Counselor)&&e.jsxs(u.Fragment,{children:[e.jsx("div",{children:d(o.selectPlaceholder)}),e.jsx(t.CustomSelector,{options:r,value:r.filter(w=>w.value===j),placeholder:d(o.selectPlaceholder),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:w=>{h(w.value)},isClearable:!0,style:{maxWidth:120}})]}),e.jsx("div",{children:d(o.changeTitle)}),e.jsx(ye.TeacherSelector,{options:a,onChange:w=>{x!==f.TeacherType.SecondaryTeacher?l(w.value):l(w.id)},placeholder:d(o.changePlaceholder),className:"flex-grow-1 mb-3"})]}),e.jsxs(c.ModalFooter,{className:"textModal-right",children:[e.jsx(c.Button,{onClick:()=>m(!1),children:d("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>{_()},children:d("save")})]})]})},es=u.forwardRef(Ze),ss=({openDetailModal:n,onClose:o,selectedUser:i,staffBulkAssign:r,teacherOptions:a,handleChangeTeacherBulk:m,handleChangeCounselorBulk:_,assistantOptions:x,counselorOptions:l,secondaryTeacherOptions:h,handleChangeStaffBulk:j,handleEditAssignForStudents:d,toggleCollapse:w,activeIndex:U})=>{const{t:L}=H.useTranslation(),C=[i?.teachers||[],i?.counselors||[]];return e.jsxs(c.Modal,{centered:!0,isOpen:n,toggle:()=>o(),zIndex:1201,children:[e.jsxs(c.ModalHeader,{className:t.styles["header-assign-for-student"],children:[e.jsxs("div",{children:["Assign student ",i?.fullName]}),e.jsxs("div",{children:["Grade ",i?.gradeLevel]})]}),e.jsxs(c.ModalBody,{children:[C.map((p,I)=>e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`btn ${t.styles["btn-collapse"]} ${U===I?"btn-link ":""}`,onClick:()=>w(I),children:[L(I===0?"current_teacher_name":"current_counselor_name")," ",`(${p.length})`," ",e.jsx("i",{className:`fa fa-angle-${U===I?"up":"down"}`})]}),e.jsx(c.Collapse,{isOpen:U===I,children:e.jsx(c.Card,{children:e.jsx(c.CardBody,{children:p.length>0?p.map(O=>I===0?e.jsxs("li",{children:[O.mainTeacherName," - ",O.mainTeacherEmail]},O.mainTeacherEmail):e.jsxs("li",{children:[O.counselorName," - ",O.counselorEmail]},O.counselorUserId)):e.jsx("div",{children:L("no_data")})})})})]},I)),e.jsx("div",{children:L("teacher_email")}),e.jsx(t.CustomSelector,{isMulti:!0,value:r.teacher.filter(p=>!i.teachers?.some(I=>I.teacherUserId===p.id)).map(p=>({label:p.email,value:p.id})),options:a.filter(p=>!i.teachers?.some(I=>I.teacherUserId===p.value)),placeholder:L("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:p=>{const I=p.map(O=>({id:O.value,email:O.label}));m(I)},isClearable:!0,style:{maxWidth:120}}),e.jsx("div",{children:L("assistant_email")}),e.jsx(ye.TeacherSelector,{value:x.find(p=>p.value==r.assistantId||p.label==r.assistantEmail)||null,options:x,onChange:p=>{j("assistant",p)},placeholder:L("select_assistant"),className:"flex-grow-1 mb-3"}),e.jsx("div",{children:L("counselor_email")}),e.jsx(t.CustomSelector,{isMulti:!0,value:r.counselors.filter(p=>!i.counselors?.some(I=>I.counselorUserId===p.id)).map(p=>({label:p.email,value:p.id})),options:l.filter(p=>!i.counselors?.some(I=>I.counselorUserId===p.value)),placeholder:L("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:p=>{const I=p.map(O=>({id:O.value,email:O.label}));_(I)},isClearable:!0,style:{maxWidth:120}}),e.jsx("div",{children:L("support_teacher_email")}),e.jsx(ye.TeacherSelector,{value:h.find(p=>p.value==r.secondaryTeacherId||p.label==r.secondaryTeacherEmail)||null,options:h,onChange:p=>{j("secondary",p)},placeholder:L("select_support_teacher"),className:"flex-grow-1"}),e.jsx("div",{children:L("grade")}),e.jsx(Fe,{value:f.GRADE_DEFAULT.find(p=>p.value===r.gradeLevel),options:f.GRADE_DEFAULT,placeholder:L("select_grade"),className:"flex-grow-1 mb-3",onChange:p=>{j("grade",p)},styles:{container:p=>({...p,maxWidth:120})}})]}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>o(),children:L("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>{d()},children:L("save")})]})]})},ts=({open:n,onClose:o,teachers:i,onConfirm:r,teacherSwitchUserId:a,setTeacherSwitchUserId:m})=>{const{t:_}=H.useTranslation();return e.jsxs(c.Modal,{centered:!0,isOpen:n,toggle:()=>o(),zIndex:1201,children:[e.jsx(c.ModalHeader,{className:t.styles["header-assign-for-student"],children:e.jsx("div",{children:"Select teacher switch data"})}),e.jsx(c.ModalBody,{className:"p-0",children:e.jsx("div",{className:t.styles["switch-data-teachers"],children:i.map(x=>e.jsx("p",{onClick:()=>m(x.teacherUserId),className:`${t.styles["switch-data-teacher-item"]} ${x.teacherUserId==a?t.styles["item-checked"]:""}`,children:x.mainTeacherName}))})}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>o(),children:_("cancel")}),e.jsx(c.Button,{disabled:!a,color:"primary",onClick:async()=>{await r(a),o()},children:_("save")})]})]})},as=({teachers:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select teacher to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.teacherRemoveUserIds.includes(a.value))||[],options:n.filter(a=>!i.teacherRemoveUserIds.includes(a.value)&&a.value!==i.teacherSwitchDataUserId)||[],placeholder:r("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({teacherRemoveUserIds:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the teacher to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.teacherSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.teacherRemoveUserIds.includes(a.value)&&a.value!==i.teacherSwitchDataUserId)||[],placeholder:r("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{console.log("value",a),o({teacherSwitchDataUserId:a?.value})},isClearable:!0})]})},ns=({counselors:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select counselor to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.counselorRemoveUserIds.includes(a.value))||[],options:n.filter(a=>!i.counselorRemoveUserIds.includes(a.value)&&a.value!==i.counselorSwitchDataUserId)||[],placeholder:r("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({counselorRemoveUserIds:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the counselor to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.counselorSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.counselorRemoveUserIds.includes(a.value)&&a.value!==i.counselorSwitchDataUserId)||[],placeholder:r("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-counselor-select"]}`,onChange:a=>{o({counselorSwitchDataUserId:a?.value})},isClearable:!0})]})},ls=({tabs:n})=>{const{t:o}=H.useTranslation(),[i,r]=u.useState(0),a=_=>{r(_)},m=()=>e.jsx(c.Row,{children:e.jsxs(c.Col,{xl:12,children:[e.jsx(c.Nav,{tabs:!0,children:n.map((_,x)=>{const l=x===i;return e.jsx(c.NavItem,{children:e.jsx(c.NavLink,{className:`${l?"active":""} cursor-pointer`,onClick:()=>a(x),style:{color:l?"#316CD9":"#242424"},children:o(_.title)})},x)})}),e.jsx(c.TabContent,{activeTab:i,className:"border-bottom-0 border-left-0 border-right-0 p-3",children:n.map((_,x)=>e.jsx(c.TabPane,{tabId:x,children:e.jsx(_.component,{})},x))})]})});return e.jsx("div",{className:"animated fadeIn",children:m()})},rs=({assistants:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select assistant to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.assistantRemoveUserId.includes(a.value))||[],options:n.filter(a=>!i.assistantRemoveUserId.includes(a.value)&&a.value!==i.assistantSwitchDataUserId)||[],placeholder:r("select_assistant"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({assistantRemoveUserId:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the assistant to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.assistantSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.assistantRemoveUserId.includes(a.value)&&a.value!==i.assistantSwitchDataUserId)||[],placeholder:r("select_assistant"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-assistant-select"]}`,onChange:a=>{console.log("value",a),o({assistantSwitchDataUserId:a?.value})},isClearable:!0})]})},cs=({secondaryTeachers:n,onChangeStaffRemove:o,switchStaffUsers:i})=>{const{t:r}=H.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select support teacher to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:n.filter(a=>i.supportTeacherRemoveUserIds.includes(a.value))||[],options:n.filter(a=>!i.supportTeacherRemoveUserIds.includes(a.value)&&a.value!==i.supportTeacherSwitchDataUserId)||[],placeholder:r("select_support_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({supportTeacherRemoveUserIds:a.map(m=>m.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the support teacher to transfer data to"}),e.jsx(t.CustomSelector,{value:n.find(a=>i.supportTeacherSwitchDataUserId==a.value)||null,options:n.filter(a=>!i.supportTeacherRemoveUserIds.includes(a.value)&&a.value!==i.supportTeacherSwitchDataUserId)||[],placeholder:r("select_support_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{o({supportTeacherSwitchDataUserId:a?.value})},isClearable:!0})]})},os=({open:n,onClose:o,teachers:i,onChangeStaffRemove:r,switchStaffUsers:a,assistants:m,onRemoveBulkStaff:_,counselors:x,studentUserIds:l,secondaryTeachers:h})=>{const{t:j}=H.useTranslation(),d=[{title:"Remove Teacher",component:()=>e.jsx(as,{teachers:i,onChangeStaffRemove:r,switchStaffUsers:a})},{title:"Remove Assistant",component:()=>e.jsx(rs,{assistants:m,onChangeStaffRemove:r,switchStaffUsers:a})},{title:"Remove Counselor",component:()=>e.jsx(ns,{counselors:x,onChangeStaffRemove:r,switchStaffUsers:a})},{title:"Remove Support Teacher",component:()=>e.jsx(cs,{secondaryTeachers:h,onChangeStaffRemove:r,switchStaffUsers:a})}];return e.jsxs(c.Modal,{size:"lg",centered:!0,isOpen:n,toggle:()=>o(),zIndex:1201,children:[e.jsx(c.ModalHeader,{className:`${t.styles["header-assign-for-student"]} border-0`,children:e.jsx("div",{children:"Remove Bulk"})}),e.jsx(c.ModalBody,{className:"p-0",children:e.jsx(ls,{tabs:d})}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>o(),children:j("cancel")}),e.jsx(c.Button,{disabled:!a.teacherRemoveUserIds.length&&!a.assistantRemoveUserId&&!a.counselorRemoveUserIds.length,color:"primary",onClick:async()=>{await _(l)},children:"Remove"})]})]})},is=()=>{const{t:n}=H.useTranslation(),{selectedTeachers:o,teacherOptions:i,setSelectedTeachers:r}=Ke(),{selectedAssistants:a,assistantOptions:m,setSelectedAssistants:_}=We(),{selectedCounselors:x,counselorOptions:l,setSelectedCounselors:h}=He(),{selectedSecondaryTeachers:j,secondaryTeacherOptions:d,setSelectedSecondaryTeachers:w}=Ge(),{isCheck:U,isCheckAll:L,userList:C,filters:p,totalItem:I,handleClickCheck:O,handleSelectAll:$,changeFilters:q,fullName:te,handleRetrievedData:K,selectedUser:V,setSelectedUser:ae,getDataUserList:ne,userSelected:E,studentTeacherSelected:A,studentCounselorSelected:S,studentAssistantSelected:b,studentSecondaryTeacherSelected:M}=Ve(),B=()=>{K(),r(void 0),_(void 0),h(void 0),w(void 0)},{openModelBulk:W,handleToggleModel:J,staffBulkAssign:G,handleChangeStaffBulk:z,onAssignStaffToStudents:le,handleToggleInactiveModal:X,openInactiveModal:re,handleInactiveStudents:ce,handleChangeTeacherBulk:Y,handleChangeCounselorBulk:Z,handleEditAssignForStudents:ee,modalType:F,openSwitchModal:se,optionsSwitch:P,textModal:oe,teacherSwitchList:de,onCloseSwitchModal:he,handleUpdateSwitch:me,setTeacherChangeUserId:xe,setTeacherSelectForChangeUserId:Se,teacherSelectForChangeUserId:ue,openDetailModal:je,setOpenDetailModal:Ce,toggleCollapse:_e,activeIndex:Ie,onClose:be,removeTeacherUserIds:Ne,openModelSwitchDataTeacher:we,onToggleModelSwitchDataTeacher:pe,teacherSwitchUserId:Ae,setTeacherSwitchUserId:Ue,onToggleModelDeleteBulk:ve,openModelDeleteBulk:ke,handelChangeStaffRemove:Ee,switchStaffUsers:Me,handleRemoveBulkStaff:g}=Xe(o,a,x,j,B,V,ne,E),y=[{name:"",isCenter:!0,onSelectAll:$,isCheckAll:L,className:`align-top ${t.styles["fixed-width-40"]}`},{name:"student_name",isCenter:!0,sortBy:f.UserOrder.Name,searchBy:f.SearchBy.Name,className:`align-top ${t.styles["fixed-width"]}`,getOption:s=>({label:s||"empty",value:s})},{name:"grade",isCenter:!0,sortBy:f.UserOrder.Grade,searchBy:f.SearchBy.Grade,className:`align-center justify-center ${t.styles["fixed-width-80"]}`,getOption:s=>({label:s||"empty",value:s})},{name:"teacher_emails",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.Teacher,searchBy:f.SearchBy.Teacher,getOption:s=>({label:s||"empty",value:s})},{name:"assistant_email",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.Assistant,searchBy:f.SearchBy.Assistant,getOption:s=>({label:s||"empty",value:s})},{name:"counselor_emails",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.Counselor,searchBy:f.SearchBy.Counselor,getOption:s=>({label:s||"empty",value:s})},{name:"support_teacher_email",isCenter:!0,className:"align-center justify-center",sortBy:f.UserOrder.SecondaryTeacher,searchBy:f.SearchBy.SecondaryTeacher,getOption:s=>({label:s||"empty",value:s})}],[v,D]=u.useState(null),N=s=>{D(T=>T===s?null:s)};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mt-4 mb-2",children:n("assign_student")}),e.jsxs(c.Row,{className:"my-2",children:[e.jsx(c.Col,{md:3,children:e.jsx(t.SearchBox,{initValue:p?.searchString||"",onSearch:s=>q({searchString:s}),placeholder:n("type_something_to_search_students")})}),e.jsx(c.Col,{md:8,className:"d-flex justify-content-end align-items-center",children:e.jsx(c.Row,{className:"mb-2",children:e.jsxs(c.Col,{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4},children:[e.jsx(c.Button,{onClick:()=>J(U),color:"primary",style:{background:"#316cd9"},children:n("assign_bulk")}),e.jsx(c.Button,{onClick:()=>ve(U),color:"primary",style:{background:"#316cd9"},children:n("delete_bulk")}),e.jsx(c.Button,{onClick:()=>X(U),color:"primary",style:{background:"#316cd9"},children:n("inactive_students")})]})})}),e.jsxs(c.Col,{md:1,className:"d-flex justify-content-end align-items-center",style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:[n("total_of_users"),": ",I]})]}),e.jsxs(c.Modal,{centered:!0,isOpen:W,toggle:()=>J(),zIndex:1201,children:[e.jsx(c.ModalHeader,{children:n("assign_bulk_student")}),e.jsxs(c.ModalBody,{children:[e.jsx(t.CustomSelector,{isMulti:!0,value:G.teacher.map(s=>({label:s.email,value:s.id})),options:i,placeholder:n("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:s=>{const T=s.map(k=>({id:k.value,email:k.label}));Y(T)},isClearable:!0,style:{maxWidth:120}}),e.jsx(ye.TeacherSelector,{value:m.find(s=>s.value==G.assistantId||s.label==G.assistantEmail)||null,options:m,onChange:s=>z("assistant",s),placeholder:n("select_assistant"),className:"flex-grow-1 mb-3"}),e.jsx(t.CustomSelector,{isMulti:!0,value:G.counselors.map(s=>({label:s.email,value:s.id})),options:l,placeholder:n("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:s=>{const T=s.map(k=>({id:k.value,email:k.label}));Z(T)},isClearable:!0,style:{maxWidth:120}}),e.jsx(ye.TeacherSelector,{value:d.find(s=>s.value==G.secondaryTeacherId||s.label==G.secondaryTeacherEmail)||null,options:d,onChange:s=>z("secondary",s),placeholder:n("select_support_teacher"),className:"flex-grow-1"})]}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>J(),children:n("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>le(U),children:n("assign")})]})]}),e.jsxs(c.Modal,{centered:!0,isOpen:re,toggle:()=>X(),zIndex:1201,children:[e.jsx(c.ModalHeader,{children:n("inactive_students")}),e.jsxs(c.ModalBody,{style:{display:"flex",gap:12},children:[e.jsx(Ye,{color:"red",size:30}),e.jsx(c.CardText,{style:{fontSize:20,margin:0,display:"flex",alignItems:"center"},children:n("are_you_sure_you_want_to_inactive_students",{number:U.length})})]}),e.jsxs(c.ModalFooter,{className:"text-right",children:[e.jsx(c.Button,{onClick:()=>X(),children:n("cancel")}),e.jsx(c.Button,{color:"primary",onClick:()=>ce(U,B),children:n("confirm")})]})]}),e.jsxs(c.Row,{className:"mb-2",children:[e.jsx(c.Col,{md:12,children:e.jsx("div",{children:e.jsxs(c.Table,{bordered:!0,hover:!0,striped:!0,size:"sm",className:`${t.styles["table-fixed"]}`,children:[e.jsx("thead",{children:e.jsx(fe.TableHeader,{headers:y,filters:p,fullName:te,onChangeFilters:q,teacherOptions:i,assistantOptions:m,counselorOptions:l,secondaryTeacherOptions:d})}),C&&C.length>0?e.jsx("tbody",{children:C.map((s,T)=>e.jsxs("tr",{children:[e.jsx("td",{className:`align-middle text-center ${t.styles["fixed-width-40"]}`,children:e.jsx("input",{id:s.id,type:"checkbox",onChange:O,checked:U.includes(s.id)})}),e.jsxs("td",{className:`align-middle ${t.styles["fixed-width"]}`,id:`student_name_${s.id}_${T}`,onMouseEnter:()=>N(`student_name_${s.id}_${T}`),onMouseLeave:()=>N(`student_name_${s.id}_${T}`),children:[e.jsx("button",{type:"button",className:`${t.styles["button-user-name"]} btn-link`,onClick:()=>{ae(s),Ce(!0)},children:s.fullName}),e.jsx(c.Tooltip,{placement:"top",isOpen:v===`student_name_${s.id}_${T}`,target:`student_name_${s.id}_${T}`,children:s.fullName})]}),e.jsx("td",{className:`align-middle ${t.styles["fixed-width"]}`,id:`student_email_${s.id}_${T}`,onMouseEnter:()=>N(`student_email_${s.id}_${T}`),onMouseLeave:()=>N(`student_email_${s.id}_${T}`),children:e.jsx("p",{children:s.gradeLevel})}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_teacher_${s.id}_${T}`,onMouseEnter:()=>N(`student_teacher_${s.id}_${T}`),onMouseLeave:()=>N(`student_teacher_${s.id}_${T}`),children:[!!s.teachers&&s.teachers.length>0&&e.jsx(u.Fragment,{children:s.teachers.map(k=>e.jsxs("p",{className:"mb-0",children:[k.mainTeacherName," - ",k.mainTeacherEmail]},k.mainTeacherEmail))}),!!s.teachers&&s.teachers.length>0&&e.jsx(c.Tooltip,{placement:"top",isOpen:v===`student_teacher_${s.id}_${T}`,target:`student_teacher_${s.id}_${T}`,children:s.teachers.map(k=>e.jsxs("p",{className:"mb-0",children:[k.mainTeacherName," - ",k.mainTeacherEmail]},k.mainTeacherEmail))})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_assistant_${s.id}_${T}`,onMouseEnter:()=>N(`student_assistant_${s.id}_${T}`),onMouseLeave:()=>N(`student_assistant_${s.id}_${T}`),children:[!!s.assistantEmail&&e.jsxs("p",{className:"mb-0",children:[s.assistantName," - ",s.assistantEmail]}),!!s.assistantEmail&&e.jsxs(c.Tooltip,{placement:"top",isOpen:v===`student_assistant_${s.id}_${T}`,target:`student_assistant_${s.id}_${T}`,children:[s.assistantName,"-",s.assistantEmail]})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_counselor_${s.id}_${T}`,onMouseEnter:()=>N(`student_counselor_${s.id}_${T}`),onMouseLeave:()=>N(`student_counselor_${s.id}_${T}`),children:[!!s.counselors&&s.counselors.length>0&&e.jsx(u.Fragment,{children:s.counselors.map(k=>e.jsxs("p",{className:"mb-0",children:[k.counselorName," - ",k.counselorEmail]},k.counselorUserId))}),!!s.counselors&&s.counselors.length>0&&e.jsx(c.Tooltip,{placement:"top",isOpen:v===`student_counselor_${s.id}_${T}`,target:`student_counselor_${s.id}_${T}`,children:s.counselors.map(k=>e.jsxs("p",{className:"mb-0",children:[k.counselorName," - ",k.counselorEmail]},k.counselorUserId))})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_secondary_teacher_${s.id}_${T}`,onMouseEnter:()=>N(`student_secondary_teacher_${s.id}_${T}`),onMouseLeave:()=>N(`student_secondary_teacher_${s.id}_${T}`),children:[!!s.secondaryTeacherEmail&&e.jsxs("p",{className:"mb-0",children:[s.secondaryTeacherName," - ",s.secondaryTeacherEmail]}),!!s.secondaryTeacherEmail&&e.jsxs(c.Tooltip,{placement:"top",isOpen:v===`student_secondary_teacher_${s.id}_${T}`,target:`student_secondary_teacher_${s.id}_${T}`,children:[s.secondaryTeacherName," - ",s.secondaryTeacherEmail]})]})]},s.id))}):e.jsx("div",{style:{width:"max-content",padding:20},children:n("no_data")})]})})}),e.jsx(c.Col,{md:12,children:e.jsx(t.CustomPagination,{filters:p,totalRecordCount:I,changePageSize:s=>q({pageSize:s}),changePage:s=>q({currentPage:s})})})]}),e.jsx(ss,{openDetailModal:je,onClose:be,selectedUser:V,staffBulkAssign:G,teacherOptions:i,handleChangeTeacherBulk:Y,handleChangeCounselorBulk:Z,assistantOptions:m,counselorOptions:l,secondaryTeacherOptions:d,handleChangeStaffBulk:z,handleEditAssignForStudents:ee,toggleCollapse:_e,activeIndex:Ie}),e.jsx(es,{textModal:oe,isOpen:se,teachers:de,options:P,onClose:he,onSave:me,modalType:F,setTeacherChangeUserId:xe,setTeacherSelectForChangeUserId:Se,teacherSelectForChangeUserId:ue}),e.jsx(ts,{open:we,onClose:pe,teachers:V?.teachers?.filter(s=>!Ne.includes(s.teacherUserId))||[],onConfirm:ee,teacherSwitchUserId:Ae,setTeacherSwitchUserId:Ue}),e.jsx(os,{open:ke,onClose:ve,teachers:A,onChangeStaffRemove:Ee,switchStaffUsers:Me,counselors:S,assistants:b,onRemoveBulkStaff:g,studentUserIds:U,secondaryTeachers:M})]})},ds=()=>{const n=Q.useDispatch(),[o,i]=u.useState(f.initialUserChoice),[r,a]=u.useState([]),[m,_]=u.useState(""),x=async()=>{try{const h=await t.getTeacher();a(h.data)}catch(h){n(t.setAlert({type:"danger",message:h.response?.data?.title||h.message}))}},l=r.map(h=>({label:`${h.name} - ${h.email}`,value:h.id}));return u.useEffect(()=>{o.roles?.includes("Teacher")&&x()},[o]),{userChoiced:o,setUserChoiced:i,teacherList:r,options:l,setTeacherChangeId:_,teacherChangeId:m}},us="User deleted list",hs=()=>{const{userChoiced:n,setUserChoiced:o,options:i,teacherChangeId:r,setTeacherChangeId:a}=ds(),[m,_]=u.useState([]),[x,l]=u.useState(0),{filters:h,changeFilters:j}=t.useFilters(),d=Q.useDispatch(),w=u.useRef(null),U=()=>{w&&w.current&&w.current.toggle()},L=()=>{a(""),o(f.initialUserChoice)},C=u.useCallback(async()=>{d(t.setLoading(!0));try{const I=await t.get(h),{items:O,totalItems:$}=I.data;_(O),l($)}catch(I){d(t.setAlert({type:"danger",message:I.response?.data?.title||I.message}))}d(t.setLoading(!1))},[d,h]);u.useEffect(()=>{document.title=us},[]),u.useEffect(()=>{C()},[h]);const p=u.useCallback(I=>{d(t.setModal({isOpen:!0,type:"warning",message:"Do you want to remove this user?",onConfirm:async()=>{d(t.setLoading(!0));try{n.roles.includes("Teacher")?await t.remove(I,r):await t.remove(I),d(t.setAlert({type:"success",message:"Remove user successfully"})),U(),L(),j({currentPage:1})}catch(O){d(t.setAlert({type:"danger",message:O.response?.data?.title||O.message}))}d(t.setLoading(!1))}}))},[h,r,n]);return{userList:m,totalItems:x,filters:h,getData:C,removeData:p,changeFilters:j,modal:w,openModal:U,userChoiced:n,setUserChoiced:o,options:i,teacherChangeId:r,setTeacherChangeId:a,resetData:L}},ms=(n,o)=>{const{header:i,removeData:r,resetData:a,userChoiced:m,options:_,teacherChangeId:x,setTeacherChangeId:l}=n,{t:h}=H.useTranslation(),j=()=>{var d=window.location.origin+"/api/ExportDataUser/"+m.id;window.open(d)};return e.jsx(t.CommonModal,{header:i,ref:o,onCancel:()=>{a()},children:e.jsx(c.Row,{children:e.jsxs(c.Col,{md:12,className:"mb-2",children:[e.jsx("p",{children:h("export_user_data")}),e.jsx("div",{className:"pb-3",children:e.jsx(c.Button,{color:"success",onClick:()=>{j()},style:{color:"#fff"},children:h("download_users_data")})}),e.jsx("p",{children:"Delete user"}),!!m&&e.jsxs("div",{children:[m.roles.includes("Student")&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),style:{color:"#fff"},children:h("delete_user")})]}),m.roles.includes("Admin")&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),children:h("delete_user")})]}),m.roles.includes("Teacher")&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"warning",children:h("alert_delete_user")}),e.jsx(t.CustomSelector,{options:_,defaultValue:x,placeholder:"select_teacher_change",onChange:d=>l(d.value)}),!!x&&e.jsxs("div",{className:"mt-2",children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),children:h("delete_user")})]})]}),(m.roles.includes("Parent")||m.roles.includes("Counselor")||m.roles.includes("SecondaryTeacher"))&&e.jsxs("div",{children:[e.jsx(c.Alert,{color:"danger",children:h("alert_delete_user")}),e.jsx(c.Button,{color:"danger",onClick:()=>r(m.id),children:h("delete_user")})]})]})]})})})},ps=u.forwardRef(ms),gs="user_deleted",fs=()=>{const{userList:n,totalItems:o,filters:i,changeFilters:r,removeData:a,openModal:m,modal:_,userChoiced:x,setUserChoiced:l,options:h,teacherChangeId:j,setTeacherChangeId:d,resetData:w}=hs(),{t:U}=H.useTranslation(),L=C=>{C&&l(C),m()};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mt-4 mb-2",children:U(gs)}),e.jsxs(c.Row,{className:"my-2",children:[e.jsx(c.Col,{md:8,children:e.jsx(t.SearchBox,{initValue:i.searchString,onSearch:C=>r({searchString:C}),placeholder:U("type_something_to_search_reflection_result")})}),e.jsxs(c.Col,{md:4,className:"d-flex justify-content-end align-items-center",children:[U("total_of_users"),": ",o]})]}),e.jsxs(c.Row,{className:"mb-2",children:[e.jsx(c.Col,{md:12,children:n&&n.length>0?e.jsx("div",{children:e.jsxs(c.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"align-top",children:U("name")}),e.jsx("th",{className:"align-top",children:U("email")}),e.jsx("th",{className:"align-top",children:U("role")})]})}),e.jsx("tbody",{children:n.map(C=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",children:e.jsx(t.LinkEditButton,{label:`${C.fullName}`,onClick:()=>L(C)})}),e.jsx("td",{className:"align-middle",children:C.email}),e.jsx("td",{className:"align-middle",children:!!C.roles&&C.roles.map(p=>p==="SecondaryTeacher"?"SupportTeacher":p).join(", ")})]},C.id))})]})}):e.jsx(t.EmptyDataAlert,{label:U("user")})}),e.jsx(c.Col,{md:12,children:e.jsx(t.CustomPagination,{filters:i,totalRecordCount:o,changePageSize:C=>r({pageSize:C}),changePage:C=>r({currentPage:C})})})]}),e.jsx(ps,{ref:_,header:x.fullName,onCancel:()=>{},userChoiced:x,removeData:a,options:h,teacherChangeId:j,setTeacherChangeId:d,resetData:w})]})},ys={padding:"4px 8px",marginBottom:0,borderRadius:"4px",color:"#fff",fontWeight:500,fontSize:"14px",height:"56px",justifyContent:"center"},Te=({htmlFor:n,isDisabled:o,text:i,backgroundColor:r,onClick:a,isClassReflection:m})=>e.jsxs(c.Label,{htmlFor:n,role:"button",tabIndex:0,className:`d-flex align-items-center justfy-content-center mr-2
2
+ ${m?"w-25":""}
3
+ ${o?"":"cursor-pointer hover-opacity"}`,style:{...ys,backgroundColor:r,opacity:o?.5:1,gap:"8px"},onClick:_=>a(),children:[e.jsx("i",{className:"fa fa-paperclip mr-1","aria-hidden":"true"}),i]}),Re=`${t.BASE_URL}/api/ImportCsv/csv`,Le=`${t.BASE_URL}/api/Teacher`,xs=(n,o)=>t.apiUpload.post(`${Re}/${o}`,n),Oe=n=>t.apiUpload.post(`${Re}/importClassReflection`,n),vs=(n,o)=>t.apiUpload.post(`${Le}/adminImportStudentByTeacherId/${n}`,o),Ts=n=>t.api.post(`${Le}/adminImportChunkUser`,n),Ss=()=>t.api.get(`${Le}/download-template-file-user`);var $e=(n=>(n.Students="students",n.Subjects="subjects",n.Grades="grades",n.Attendances="attendances",n.ClassReflection="classReflection",n.Others="others",n.AllUser="allUser",n))($e||{});const js=[{text:"import_users",backgroundColor:"#0abde3",type:"allUser"}],Cs=[{text:"import_class_reflection",backgroundColor:"#e74c3c",type:"classReflection"}],_s="CSV Import",De="csvupload",Be={teacherName:"",teacherEmail:"",studentIds:[],file:""},Is=()=>{const n=Q.useDispatch(),o=Q.useSelector(b=>b.common.isLoading),[i,r]=u.useState(null),[a,m]=u.useState(),[_,x]=u.useState([]),[l,h]=u.useState(Be),[j,d]=u.useState(),[w,U]=u.useState([]),C=window.location.hostname.includes("isb"),[p,I]=u.useState(0),[O,$]=u.useState("");u.useEffect(()=>{document.title=_s},[]);const q=C?js:Cs,te=async()=>{n(t.setLoading(!0));try{const B=await Ss();var b=new Blob([B.data.content],{type:"text/csv"});const W=window.URL.createObjectURL(b);var M=document.createElement("a");M.href=W,M.setAttribute("download",B.data.nameFile),M.click(),n(t.setAlert({type:"success",message:"Download successfully"}))}catch(B){n(t.setAlert({type:"danger",message:B.message}))}n(t.setLoading(!1))},K=u.useCallback(async b=>{if(!i||!b)return;n(t.setLoading(!0));try{const J=new FormData;J.append("file",b,b.name);const G=i==="allUser"?t.CsvImportType.Admin:t.CsvImportType.Teacher,z=await fe.validateCsvApi(J,G);if(z.data&&z.data.length>0){U(z.data),n(t.setLoading(!1)),n(t.setAlert({type:"danger",message:"Please use the file as per the template."}));return}if(i=="allUser"){let X=(await b.text()).trim();const re=X.split(`
4
+ `).map(P=>P.trim()),ce=re.findIndex(P=>P.split(",").includes("First Name"));if(ce===0)throw new Error("Invalid CSV: Missing header row.");X=re.slice(ce).join(`
5
+ `);const Y=Je.parse(X,{header:!0,skipEmptyLines:!0}),Z=Y.meta.fields,ee=Y.data;if(!ee.length){n(t.setLoading(!1)),n(t.setAlert({type:"danger",message:"The file has no data or some column names are misformed."}));return}const F=10,se=[];for(let P=0;P<ee.length;P+=F){const de=ee.slice(P,P+F).map(he=>Object.values(he).map(me=>(me??"").toString().trim()));Z&&de.unshift(Z),se.push(de)}for(let P=0;P<se.length;P++)await Ts({index:P,chunks:se[P]}),await new Promise(oe=>setTimeout(oe,500))}else C?i=="classReflection"&&await Oe(J):await xs(J,i.toString());n(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(J){console.error("❌ Upload failed",J),n(t.setAlert({type:"danger",message:J.response?.data?.title||J.message}))}n(t.setLoading(!1));const M=document.getElementById(De),B=document.getElementById("import-student"),W=document.getElementById("import-classReflection");M&&(M.value=""),B&&(B.value=""),W&&(W.value="")},[i]),V=async b=>{if(!p){n(t.setAlert({type:"danger",message:"Select teacher before import csv"}));return}if(!i||!b)return;n(t.setLoading(!0));try{const B=new FormData;B.append("file",b,b.name),await vs(p,B),n(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(B){n(t.setAlert({type:"danger",message:B.response?.data?.title||B.message}))}n(t.setLoading(!1));const M=document.getElementById("teacherSelector");M&&(M.value="")},ae=async b=>{if(!a||!a)return;n(t.setLoading(!0));try{const B=new FormData;B.append("file",a,a.name),B.append("teacherName",b.teacherName),B.append("teacherEmail",b.teacherEmail),b.studentIds.forEach(W=>{B.append("studentIds",W)}),await Oe(B),n(t.setAlert({type:"success",message:"Import CSV successfully"})),h(Be)}catch(B){n(t.setAlert({type:"danger",message:B.response?.data?.title||B.message}))}n(t.setLoading(!1));const M=document.getElementById(De);M&&(M.value="")},ne=b=>{I(b.value)},E=b=>{d(b),$(b?.name||"")},A=()=>{if(!j){n(t.setAlert({type:"danger",message:"Select CSV to import"}));return}V(j)};return{isLoading:o,buttons:q,id:De,setType:r,upload:K,initImportReflection:l,setInitImportReflection:h,onConfirm:ae,CSVType:$e,dataFile:a,setDataFile:m,setArrStudent:x,arrStudent:_,isCheckDomainIBS:C,onChangeTeacher:ne,uploadByTeacherId:V,setDataFileImportStudent:E,onUpLoadStudentFile:A,defaultTeacher:p,fileName:O,onStudentSubmit:()=>{n(t.setModal({isOpen:!0,type:"warning",message:"Are you sure upload this file?",onConfirm:()=>{A()}}))},downloadTemplateUser:te,errorsValidate:w,setErrorsValidate:U}},bs=ge.object({teacherName:ge.string()?.trim().required(),teacherEmail:ge.string()?.trim().email("Invalid email").required(),studentIds:ge.array().required().test("test students","Please choose student",function(){return!!this.parent.studentIds&&!!this.parent.studentIds.length}),file:ge.string()?.trim().required()}),Ns=()=>{const{initImportReflection:n,onConfirm:o,isLoading:i,setType:r,id:a,CSVType:m,dataFile:_,setDataFile:x,setArrStudent:l,buttons:h,upload:j,isCheckDomainIBS:d,downloadTemplateUser:w,errorsValidate:U,setErrorsValidate:L}=Is(),{t:C}=H.useTranslation();return e.jsx("div",{className:"animated fadeIn pt-3",children:d?e.jsxs(e.Fragment,{children:[e.jsx(c.Input,{className:"d-none",type:"file",id:"import-user",onChange:p=>j(p.target.files[0]),accept:"text/csv"}),e.jsx(c.Input,{className:"d-none",type:"file",id:"import-classReflection",onChange:p=>j(p.target.files[0]),accept:"text/csv"}),e.jsx("div",{className:"class-reflection",children:e.jsx(Pe.Formik,{initialValues:n,enableReinitialize:!0,validationSchema:bs,onSubmit:(p,I)=>{o(p),x(""),l([]),I.resetForm()},children:p=>{const{touched:I,errors:O}=p;return e.jsxs(c.Row,{className:"mb-2",children:[e.jsx(c.Input,{className:"d-none",type:"file",id:a,onChange:$=>{x($.target.files[0]),p.setFieldValue("file","imported");const q=document.getElementById(a);q&&(q.value="")},accept:"text/csv"}),e.jsx(c.Col,{md:6,className:"mb-2 d-flex mt-5",children:e.jsxs(c.Row,{className:"w-100 flex-column",children:[e.jsxs(c.Col,{md:12,className:"",children:[e.jsx(t.RequiredLabel,{text:C("import_class_reflection")}),e.jsx(Te,{htmlFor:"import-classReflection",text:C("import_class_reflection"),isDisabled:i,backgroundColor:"#e74c3c",onClick:()=>{r(m.ClassReflection)}},"Import class reflections"),!!_&&e.jsx("p",{style:{color:"#007bff",fontStyle:"italic",marginTop:"5px"},children:_.name})]}),!_&&e.jsx(c.Col,{md:12,className:"mb-2",children:I.file&&O.file&&e.jsx(t.ErrorHandler,{text:O.file})})]})}),e.jsx(c.Col,{md:6,className:"mb-2",children:e.jsxs(c.Row,{className:"flex-column",children:[e.jsx(c.Col,{md:12,className:"mb-2 text-right",style:{textAlign:"right"},children:e.jsx(c.Button,{role:"button",color:"primary",onClick:()=>w(),children:e.jsxs("p",{className:"d-flex align-items-center mb-0",children:[C("download_template")," ",e.jsx(fe.AiOutlineDownload,{size:20,className:"ml-2"})]})})}),e.jsxs(c.Col,{md:12,className:"mb-2",children:[e.jsx(t.RequiredLabel,{text:C("import_users")}),h.map($=>e.jsx(Te,{htmlFor:"import-user",text:$.text,isDisabled:i,backgroundColor:$.backgroundColor,onClick:()=>r($.type)},$.text))]}),U?.length>0&&U.map(($,q)=>e.jsx(t.ErrorHandler,{text:$},q))]})})]})}})})]}):e.jsx(e.Fragment,{children:e.jsxs(c.Row,{children:[e.jsx(c.Col,{md:12,className:"mt-2 mb-2 text-left",children:e.jsx(c.Button,{role:"button",color:"primary",onClick:()=>w(),children:e.jsxs("p",{className:"d-flex align-items-center mb-0",children:[C("download_template")," ",e.jsx(fe.AiOutlineDownload,{size:20,className:"ml-2"})]})})}),e.jsxs(c.Col,{md:6,className:"mb-3",children:[e.jsx(c.Input,{id:"import-user",className:"d-none",type:"file",onChange:p=>j(p.target.files[0]),accept:"text/csv"}),e.jsx(t.RequiredLabel,{text:C("import_users")}),e.jsx(Te,{htmlFor:"import-user",text:C("import_users"),isDisabled:i,backgroundColor:"#0abde3",onClick:()=>{r(m.AllUser),U.length>0&&L([])}},"import-users")]}),U.length>0&&U.map((p,I)=>e.jsx(t.ErrorHandler,{text:p},I)),e.jsxs(c.Col,{md:6,className:"mb-3",children:[e.jsx(c.Input,{className:"d-none",type:"file",id:a,onChange:p=>j(p.target.files[0]),accept:"text/csv"}),h.map(p=>e.jsxs(e.Fragment,{children:[e.jsx(t.RequiredLabel,{text:C(p.text)}),e.jsx(Te,{htmlFor:a,text:C(p.text),isDisabled:i,backgroundColor:p.backgroundColor,onClick:()=>r(p.type)},p.text)]}))]})]})})})},ws=[{path:"/admin/users/user-list",title:"user_list",component:fe.UserList},{path:"/admin/users/assign-student",title:"assign_student",component:is},{path:"/admin/users/user-deleted",title:"user_deleted",component:fs},{path:"/admin/users/import-csv",title:"csv_import",component:Ns}],As=()=>e.jsx(t.CustomTabs,{tabs:ws});exports.default=As;