1import{r as e,j as s}from"./react-vendor.B75MsAI9.js";import{u as a,t as l,D as t,r as n,p as i,dc as r,dd as o,O as d,de as c,U as m,N as u,z as p,S as _,M as j,T as f,o as x,a as h,df as v,dg as b,H as $,dh as C,ab as g,di as y,g as N,w}from"./AuthModalContainer.CwDh3qj_.js";import{i as E}from"./isEmpty.B73GR3ul.js";import{B as M}from"./main.Bj0Ml4GZ.js";import{B as S}from"./Block.DxpdHCJY.js";import{J as T}from"./JotformModal.DbG8nPqa.js";/* empty css */import{f as k}from"./format.BkS4g1vO.js";import"./RTLProvider.Dbr8G8Qw.js";import"./LazyFontLoader.pvie9HdJ.js";import"./en-US.BYLOiXxf.js";const L=()=>{a();const L=l(),{classroom:I}=t(),[F]=n(),J=F.get("language")||"en",z="pb-student-classroom",[B,O]=e.useState(!1),[D,U]=e.useState(""),[H,P]=e.useState(null),[R,V]=e.useState(""),A=i(e=>e.viewport),W=i(e=>e.flpHome),Z=i(e=>e.user),{isFetchingStaticContent:q,classroomStaticText:G,studentClass:K,students:Q,isJotformVisible:X,jotformUrl:Y,jotformType:ee,validClass:se}=W,{isLoggedIn:ae,isFetchingMe:le,profile:te}=Z,ne=null==te?void 0:te.id,ie=null==te?void 0:te.profile_type;null==te||te.first_name,null==te||te.last_name,e.useEffect(()=>{ne&&L(r({locale:J,userId:ne}))},[L,J,ne]),e.useEffect(()=>{ae&&ne&&(L(o({code:null,locale:J,id:ne})).then(e=>{!1===e.already_verified?window.location.href=d.flpClassroom(J):e.already_verified&&e.locale!==J&&(window.location.href=d.flpClassroom(e.locale))}),I&&L(c({locale:J,id:I,userId:ne})))},[L,ae,ne,J,I]);const re=()=>!!window.location.host.includes("storyweaver.org.in");if(q||E(G)||le)return s.jsx(m,{});if(!ae)return s.jsx(u,{to:d.flpClassroom(J).replace(`/${p}`,""),replace:!0});if(!se)return s.jsx(u,{to:d.flpMyClassroom(J).replace(`/${p}`,""),replace:!0});const oe=[{title:G.backToClassroom,href:d.flpMyClassroom(J),isInternal:!0}],de=s.jsxs("div",{children:[s.jsxs("span",{children:[(()=>{let e=0;return Q.forEach(s=>{s.endline&&s.baseline&&(e+=1)}),e})(),"/",Q.length]})," Â ",G.defaultExerciseCompleted]}),ce=e=>{const{gtmEvent:s}=e;window.dataLayer&&window.dataLayer.push({event:s,category:`${w.flpOneToMany}_${J}`,label:N.createClassroom,item_type:null,item_id:null,item_value:null,user_profile:ie,user_id:ne})};return s.jsxs("div",{className:z,children:[s.jsx(M,{paths:oe,parentClassName:`${z}__brd-crumb`}),s.jsxs(S,{background:"transparent",parentClassName:`${z}__head-section`,children:[s.jsx("div",{className:`${z}__class-title`,children:G.classroomDashboard}),s.jsxs("div",{children:[s.jsx("span",{className:`${z}__class-sub-title`,children:K.section})," |"," ",s.jsx("span",{children:K.school})]}),s.jsx("div",{children:s.jsx("input",{type:"text",value:R,placeholder:G.searchForStudent,onChange:e=>{V(e.target.value)},className:`${z}__search-field`})}),A.medium&&de]}),s.jsxs(S,{parentClassName:`${z}__section`,noHorizontalPadding:!0,noVerticalPadding:!0,children:[Q&&Q.filter(e=>e.name.toLowerCase().includes(R.toLowerCase())).map((e,a)=>((e,a,l)=>{const{id:t,name:n,created_at:i,baseline:r,endline:o}=a;return s.jsxs("div",{className:`${z}__add-section`,children:[s.jsxs("div",{className:`${z}__add-btn`,children:[s.jsx("div",{className:`${z}__index`,children:e}),s.jsxs("div",{className:`${z}__details`,children:[s.jsxs("p",{className:`${z}__name`,children:[n," ",s.jsx("span",{className:`${z}__edit-icon`,onClick:()=>{O(!0),U(n.trim()),P(t)},children:s.jsx(_,{name:"edit-student",pushRight:!0,pushLeft:!0,size:"s"})})]}),s.jsxs("p",{children:[G.addedOnText," ",i?k(new Date(i),"do MMM, yyyy"):""]})]})]}),s.jsxs("div",{className:`${z}__actions`,children:[r?s.jsx(x,{parentClassName:`${z}__baseline-btn ${z}__btn-complete`,label:G.exerciseCompleted}):s.jsx(x,{parentClassName:`${z}__baseline-btn`,label:G.startExercise,onClick:()=>{l({gtmEvent:h.startBaseline}),(e=>{let s;s=re()?K.baseline_jotform:g.dummyJotforms.flpBaselineOneToMany[J][K.grade],e&&L(y({url:`${s}?student_id=${e||null}`,type:"baseline"}))})(t)}}),o?s.jsx(x,{parentClassName:`${z}__baseline-btn ${z}__btn-complete`,label:G.endlineExerciseCompleted}):s.jsx(x,{parentClassName:r&&K.endline_enabled?`${z}__baseline-btn`:`${z}__baseline-btn ${z}__btn-disabled`,label:G.startEndlineExercise,disabled:!r||!K.endline_enabled,onClick:()=>{l({gtmEvent:h.startEndline}),(e=>{let s;
1s=re()?K.endline_jotform:g.dummyJotforms.flpEndlineOneToMany[J][K.grade],e&&L(y({url:`${s}?student_id=${e||null}`,type:"endline"}))})(t)}})]})]})})(a+1,e,ce)),s.jsx("div",{className:`${z}__add-section ${z}__add-section--block`,children:s.jsxs("div",{className:`${z}__add`,onClick:()=>O(!0),children:[s.jsxs("span",{className:`${z}__add-btn`,children:[s.jsx(_,{name:"icon-plus",pushRight:!0,size:"sm"}),G.addStudent]}),s.jsxs("p",{children:["(",G.andStartExercise,")"]})]})})]}),!A.medium&&s.jsxs("div",{className:`${z}__search-count`,children:[" ",de]}),X&&s.jsx(T,{url:Y,viewport:A,closeJotformModal:()=>{L(v()),P(null)},getUserStatus:()=>{window.location.reload()},lang:J,jotformType:ee}),B&&s.jsxs(j,{onClose:()=>{O(!1),U("")},parentClassName:`${z}__modal`,children:[s.jsxs("div",{className:`${z}__modal-wrapper`,children:[s.jsx("span",{className:`${z}__modal-title`,children:G.studentName}),s.jsx(f,{name:"name",onChange:e=>U(e.target.value),value:D,parentClassName:`${z}__input`,autoFocus:!0}),(e=>{let s=Q.map(e=>e.name&&e.name.toLowerCase().trim());if(H){let e=Q.findIndex(e=>e.id===H);s.splice(e,1)}return!!s.includes(e.toLowerCase().trim())})(D)&&s.jsx("p",{className:`${z}__modal-error`,children:G.duplicateWarning})]}),s.jsxs("div",{className:`${z}__btn-modal`,children:[s.jsx(x,{variant:"flp",label:G.deleteText,onClick:()=>(U(""),O(!1),void P(null))}),s.jsx(x,{variant:"primary",label:G.saveText,onClick:e=>(async(e,s)=>{var a,l;e.preventDefault();try{if(s){const e=await L(b({name:D.trim(),id:s,locale:J,userId:ne}));L(c({locale:J,id:I,userId:ne})),"ok"===(null==e?void 0:e.status)&&L($({type:"info",content:null==(a=e.data)?void 0:a.message})),O(!1),P(null),U("")}else{const e=await L(C({name:D.trim(),id:I,locale:J,userId:ne}));L(c({locale:J,id:I,userId:ne})),"ok"===(null==e?void 0:e.status)&&L($({type:"info",content:null==(l=e.data)?void 0:l.message})),O(!1),U("")}}catch(t){}})(e,H),disabled:!D.trim(),parentClassName:`${z}__modal-submit`})]})]})]})};export{L as default}; 2//# sourceMappingURL=index.DFCt9y9P.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.