import{ao as e,aO as w,aS as l,aq as r,L as C,cb as g,aI as u,ax as L,e9 as M,i$ as E,bN as P,iV as f,az as p,bu as A,aj as R,iO as W,b0 as H,iW as J,iP as O,v as V}from"./app-k0jcl5PQ.js";import{W as b}from"./BgdsWk2A.chunk.js";import{R as U}from"./BlKMjFEf.chunk.js";import{B as _}from"./9ic7OkpL.chunk.js";import{W as q}from"./2FvGdRks.chunk.js";import{W as z}from"./BwaXQJMJ.chunk.js";import{B as F}from"./B7GcIt_R.chunk.js";import{U as $}from"./B4GO8DD1.chunk.js";import{u as D}from"./wuHL1Gkg.chunk.js";import{J as G}from"./hKqzfsO4.chunk.js";import"./BDviDDog.chunk.js";import"./wCY37Ze3.chunk.js";import"./Djb1f-EX.chunk.js";import"./CCtuxSlD.chunk.js";import"./CPXlV0fg.chunk.js";import"./fstW5ZQE.chunk.js";const K="_noAccount_1y7nv_1",Y={noAccount:K},N="userManager.bulkUserUploadAccountInfo",T=C.encloseNamespace(N);function Q(s){const t=s.users.length-s.existingUsers.length;return e.jsxs(w.Provider,{value:N,children:[e.jsxs(U,{className:"mb-2",children:[e.jsx(l,{xs:4,className:"font-weight-500",children:e.jsx(r,{phrase:"statuses"})}),e.jsx(l,{xs:8,className:"font-weight-500",children:e.jsx(r,{phrase:"changesTo"})})]}),!!t&&e.jsxs(U,{className:"mb-2",children:[e.jsxs(l,{xs:4,children:[e.jsx(b,{className:Y.noAccount,children:T("noAccount")}),e.jsx("div",{children:e.jsx(r,{phrase:s.userType===g.Learner?"studentCount":"staffCount",options:{smartCount:t}})})]}),e.jsx(l,{xs:8,children:e.jsx("div",{children:e.jsx(r,{phrase:s.userType===g.Learner?"willCreate":"willInvite"})})})]}),!!s.existingUsers.length&&e.jsxs(U,{className:"mb-2",children:[e.jsxs(l,{xs:4,children:[e.jsx(b,{children:T("existingAccount")}),e.jsx("div",{children:e.jsx(r,{phrase:s.userType===g.Learner?"studentCount":"staffCount",options:{smartCount:s.existingUsers.length}})})]}),e.jsx(l,{xs:8,children:e.jsx("div",{children:e.jsx(r,{phrase:"willAdd"})})})]})]})}const d="userManager.bulkUserUploadConfirmation",j=C.encloseNamespace(d);function X(s){const t=u.useRef(null),[,i]=L(M.BULK_USER_ACTIONS),{setOnClickConfirm:a}=u.useContext(E);u.useEffect(()=>{var n;i("scrollContainer",(n=t.current)==null?void 0:n.view)},[t.current]);const o=s.userType===g.Learner;u.useEffect(()=>{a(()=>s.onClickConfirm)},[s.onClickConfirm]);function m(n){function x(){return s.existingUsersHash[n.lookupId]?j(o?"existingStudentAccount":"existingStaffAccount"):j("noAccount")}return e.jsx("div",{className:"flex-shrink-0 me-2",children:x()})}return e.jsxs(e.Fragment,{children:[e.jsxs(z,{children:[e.jsx("h4",{className:"h6",children:e.jsx(r,{namespace:d,phrase:"heading"})}),e.jsxs("ul",{className:"mt-1 ps-3 ms-1",children:[e.jsx("li",{children:e.jsx(r,{namespace:d,phrase:o?"creationInfoStudent":"creationInfoStaff"})}),e.jsx("li",{children:e.jsx(r,{namespace:d,phrase:o?"addInfoStudent":"addInfoStaff"})})]}),e.jsx("div",{className:"rounded p-2 bg-light-blue",children:e.jsx(Q,{users:s.users,existingUsers:s.existingUsers,userType:s.userType})})]}),e.jsx("h3",{className:"h6 mt-3",children:e.jsx(r,{namespace:d,phrase:o?"headingStudents":"headingStaff",options:{smartCount:s.users.length}})}),e.jsx(q,{items:s.users,rowHeight:55,ref:t,getComponent:n=>e.jsx(_,{user:{...n,name:n.firstName,id:n.lookupId,masterYearGroup:null},userType:s.userType,imageCdnUrl:s.imageCdnUrl,customBadge:()=>m(n)},n.lookupId)})]})}const Z="userManager.userUploadConfirmation";function fe(s){var k;const{users:t,existingUsersHash:i,existingUserToAdd:a,deleteUsers:o}=D();P({title:C.getPhrase(Z,"pageTitle")}),u.useEffect(()=>{var c;(a==null?void 0:a.length)<((c=Object.keys(i))==null?void 0:c.length)&&o(f.getDeletedExistingUsers(t,i,a).map(h=>h.lookupId))},[]);const m=p(A.version()),n=p(A.config()),x=p(R.currentUser()),y=W(s.userType),v=H(),I=J.useCreateJobErrorAlert();function S(){var h;const c=f.getJobData({users:f.getNewUsers(t,i),existingUsers:a,customerId:(h=x.data)==null?void 0:h.customerId,userType:s.userType});v(G.createUserJob(c,m.data,B,I))}function B(c){V.trigger({...y.userUploadStatus.polling,params:{userType:s.userType,jobId:c.id}})}return!x.data||!n.data||!m.hasCompleted?e.jsx(e.Fragment,{}):e.jsx($.Provider,{value:O.Primary,children:e.jsx(F,{appLinks:y,userType:s.userType,currentStep:"confirmation",canAddExistingUsers:!0,children:e.jsx("div",{className:"px-3",children:e.jsx(X,{onClickConfirm:S,users:t,existingUsers:a,existingUsersHash:i,userType:s.userType,imageCdnUrl:(k=n.data)==null?void 0:k.imageCdnUrl})})})})}export{fe as BulkUserUploadConfirmationView};
//# sourceMappingURL=CN2UyW8x.chunk.js.map
