import{aw as u,j as r,az as l,ax as h,o as n,R as y,a2 as j,dJ as f}from"./app-BgLa5dit.js";import{S as C,b as p,a as G}from"./B11DWb8Z.chunk.js";import{E as c}from"./DTaYxhew.chunk.js";import{C as g}from"./BWCfLV66.chunk.js";import{D as x}from"./C4BcftDO.chunk.js";import{C as d}from"./q-IBKcuF.chunk.js";import{M as P}from"./DLXdkhC4.chunk.js";import"./CIRO_mWB.chunk.js";import"./DV8zX5C-.chunk.js";import"./CVqrJ8QP.chunk.js";import"./DJ0pq8J_.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";import"./Bs6fQ2wT.chunk.js";import"./BUT90D7O.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./Zwjmkasg.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./m4aqaK_l.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";function S(e){const a=u();return r.jsxs("div",{className:"mt-4",children:[r.jsx("p",{children:"Map school year groups to SSO provider:"}),r.jsx(x,{disableCollapse:!0,heading:"Year group",children:r.jsx("div",{className:"p-3",children:r.jsx(l,{children:e.yearGroupsMapping.map((s,i)=>r.jsx(h,{id:`yearMappings.${i}.ssoMapping`,name:`yearMappings.${i}.ssoMapping`,label:s.yearGroup.name,type:"text",disabled:!s.canBeSsoMapped,labelClassName:"col-2 me-3",formGroupClassname:"d-flex flex-now-wrap align-items-center",value:a.values.yearMappings[i].ssoMapping},i))})})})]})}function b(e){const a=n(d.yearGroups(e.id)),s=n(C.getSsoYearGroupsMappings(e.id));return r.jsxs(g,{id:e.id,currentStepId:p.YEAR_GROUP,queryParams:e.queryParams,isLoading:!a.hasCompleted,children:[r.jsx("h2",{className:"h3 mb-4",children:"Map year groups"}),r.jsx(c,{id:e.queryParams.idpId}),r.jsx(S,{yearGroupsMapping:s.data,idpId:e.queryParams.idpId})]})}function v(e){const a=u(),s=a.values.bindings||{};function i(){const t=e.masterYearGroups.reduce((o,m)=>(o[m.value]=[],o),{});a.setValues({...a.values,bindings:{...a.values.bindings,...t}})}return y.useEffect(()=>{a.validateForm()},[]),r.jsx("div",{className:"mt-4 crm-studio-container",children:r.jsx(x,{disableCollapse:!0,heading:"Year groups",button:r.jsx(f,{className:"btn-link text-info",onClick:i,children:"Clear values"}),children:r.jsx(l,{children:e.masterYearGroups.map(t=>{const o=t.value.toString();return r.jsxs("div",{className:j("row m-0 p-2"),children:[r.jsx("label",{className:"col-3 col-form-label",children:t.name}),r.jsx("div",{className:"col-9",children:r.jsx(P,{values:s[o]??[],onChange:m=>a.setFieldValue(`bindings.${o}`,m)})})]},o)})})})})}function M(e){const a=n(d.yearGroups(e.id)),s=n(d.customer(e.id));return r.jsxs(g,{id:e.id,currentStepId:p.YEAR_GROUP,queryParams:e.queryParams,isLoading:!a.hasCompleted||!s.hasCompleted,children:[r.jsx("h2",{className:"h3 mb-4",children:"Map year groups"}),r.jsx(c,{id:e.queryParams.idpId}),r.jsx(v,{masterYearGroups:a.data||[],idpId:e.queryParams.idpId,customer:s.data})]})}function ee(e){const{isShared:a}=G.getSsoManagementContext(e.queryParams.idpId);return a?r.jsx(M,{id:e.id,queryParams:e.queryParams}):r.jsx(b,{id:e.id,queryParams:e.queryParams})}export{ee as CustomerSsoWizardYearGroupContainerView};
//# sourceMappingURL=Cog-sDMP.chunk.js.map
