import{ax as m,e9 as U,aI as h,cb as k,L as x,ao as e,aq as d,az as g,aj as f,bN as T,iO as b,iP as j}from"./app-k0jcl5PQ.js";import{B as y}from"./B7GcIt_R.chunk.js";import{U as A}from"./Cwqt_GYK.chunk.js";import{u as M}from"./CyqCElfh.chunk.js";import{U as v}from"./B4GO8DD1.chunk.js";import{u as C}from"./wuHL1Gkg.chunk.js";import{U as I}from"./9ls1F1Ve.chunk.js";import"./Djb1f-EX.chunk.js";import"./CCtuxSlD.chunk.js";import"./CPXlV0fg.chunk.js";import"./2FvGdRks.chunk.js";import"./U4M4wGTR.chunk.js";import"./Bpw1_OdO.chunk.js";import"./fstW5ZQE.chunk.js";function w(s){var c;const[t,r]=m(U.BULK_USER_UPLOAD);h.useEffect(()=>{r("existingUserToAdd",s.existingUsers)},[]);const n=s.existingUsers,i=M(n,{idField:"lookupId",preselectedIds:n.map(a=>a.lookupId)}),o=s.userType===k.Learner?"userManager.existingStudent":"userManager.existsingStaff",u=x.encloseNamespace(o),p={firstName:u("tooltip",{field:"first name"}),lastName:u("tooltip",{field:"last name"}),username:u("tooltip",{field:"username"})};return!((c=s.users)!=null&&c.length)||!s.users?e.jsx(e.Fragment,{}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"h4",children:e.jsx(d,{namespace:o,phrase:"heading"})}),e.jsxs("main",{className:"pb-3",children:[e.jsx("p",{children:e.jsx(d,{namespace:o,phrase:"subheading"})}),e.jsx("p",{children:e.jsx(d,{namespace:o,phrase:"actions"})}),e.jsx(A,{tableHeightOffset:s.tableHeightOffset,users:n,invalidUsers:{},userType:s.userType,appLinks:s.appLinks,isChecked:i.isChecked,tooltips:p,checkboxId:"bulk-upload-review-existing-accounts",onToggleCheckbox:a=>{t.existingUserToAdd.find(l=>l.lookupId===a)?r("existingUserToAdd",t.existingUserToAdd.filter(l=>l.lookupId!==a)):r("existingUserToAdd",[...t.existingUserToAdd,s.users.find(l=>l.lookupId===a)]),i.onToggleItem(a)},onToggleBulkCheckbox:a=>{i.onToggleBulk(),a.target.checked?r("existingUserToAdd",s.existingUsers):r("existingUserToAdd",[])},bulkCheckboxChecked:i.bulkChecked,bulkIndeterminate:i.hasSomeSelections()})]})]})}const L="userManager.bulkUserUploadReviewExistingAccounts";function K(s){const{users:t,existingUsersHash:r}=C(),n=g(f.currentUser()),i=g(n.data&&I.yearGroups(n.data.customerId));T({title:x.getPhrase(L,"pageTitle")});const o=b(s.userType);return!n.data||!i.data?e.jsx(e.Fragment,{}):e.jsx(v.Provider,{value:j.Primary,children:e.jsx(y,{appLinks:o,userType:s.userType,currentStep:"review-existing-accounts",canAddExistingUsers:!0,children:e.jsx("div",{className:"px-3",children:e.jsx(w,{users:t,closePopup:s.closePopup,appLinks:o,userType:s.userType,yearGroups:i.data,existingUsers:t==null?void 0:t.filter(u=>!!r[u.lookupId])})})})})}export{K as BulkUserUploadReviewExistingAccountsView};
//# sourceMappingURL=Dy3ZeRGx.chunk.js.map
