PageSourceSearch

https://clipo.ai/assets/CreativeActivitySurveyBatchUploadPage-B-pmz5sV.js

js clipo.ai collected 2026-10-05 11:57:35 UTC 12,900 bytes, 2 lines download raw bytes

1import{r as K,j as e,k as p,T as l,P as q,n as j,aE as Q,cK as Y,B as k,e as W,gK as J,a9 as V,dC as i,dF as I,dr as t,ds as w,dD as P,dG as E,dH as b,jG as G,dE as X,an as ee,a as te,y as se,w as N,x as T,c as ie,t as R,lW as re,S as ae,ad as ne}from"./index-aREvobyF.js";import{P as oe}from"./PageMetaHeader-6lUw-EYb.js";import{S as $}from"./SimpleTable-DF7EMZw0.js";import{C as le}from"./CreativeActivitySurveyResponseModal-Bkm_85AM.js";import{u as M,a as ce,r as de}from"./xlsx-Dxpd-3wM.js";import{s as pe}from"./file-CYbLPrGl.js";import"./link-box-DcUyRFYn.js";import"./table-BqH1TAsn.js";try{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="06ce07fd-40d7-4561-8329-800b1cbde6ac",s._sentryDebugIdIdentifier="sentry-dbid-06ce07fd-40d7-4561-8329-800b1cbde6ac")}catch{}const ye=({onFileUpload:s,onTemplateDownload:r})=>{const y=K.useRef(null),o=c=>{var a;const n=(a=c.target.files)==null?void 0:a[0];n&&s(n),c.target.value=""};return e.jsxs(p,{gap:5,children:[e.jsxs(p,{gap:3,children:[e.jsx(l,{textStyle:"t4-semibold-compact",children:"1. 엑셀 파일 업로드"}),e.jsx(l,{textStyle:"b3-medium",color:"fg",children:"아래에서 템플릿을 다운받아, 설문 내용을 양식에 맞춰 입력해 주세요."})]}),e.jsxs(p,{gap:3,children:[e.jsx(l,{textStyle:"b2-semibold",color:"fg",children:"파일 업로드"}),e.jsxs(q,{gap:3,children:[e.jsxs(j,{colorPalette:"blue",variant:"solid",onClick:()=>{var c;return(c=y.current)==null?void 0:c.click()},children:[e.jsx(Q,{}),"파일 업로드"]}),e.jsxs(j,{colorPalette:"blue",variant:"surface",onClick:r,children:[e.jsx(Y,{}),"설문 응답 템플릿 다운로드"]}),e.jsx("input",{ref:y,type:"file",accept:".xlsx,.xls,.csv",style:{display:"none"},onChange:o})]}),e.jsxs(k,{bg:"bg.subtle",border:"1px solid",borderColor:"border",borderRadius:"lg",p:4,children:[e.jsxs(l,{textStyle:"b3-semibold-compact",color:"fg",mb:1,children:["※ 반드시 위의"," ",e.jsx(l,{as:"span",color:"blue.fg",children:"[설문 응답 템플릿]"}),"을 다운받아, 양식에 맞춰 작성 후 업로드해 주세요. 다른 양식은 사용할 수 없어요."]}),e.jsxs(p,{as:"ul",pl:5,gap:0,listStyleType:"disc",children:[e.jsxs(l,{as:"li",textStyle:"b3-regular",color:"fg",children:["학번·이름 옆의"," ",e.jsx(l,{as:"span",textStyle:"b3-semibold-compact",color:"blue.fg",children:"C1열부터 설문 문항을 한 칸에 하나씩"})," ","넣고,"," ",e.jsx(l,{as:"span",textStyle:"b3-semibold-compact",color:"blue.fg",children:"학생 답변은 해당 학생 행에 입력"}),"해 주세요."]}),e.jsx(l,{as:"li",textStyle:"b3-regular",color:"fg",children:"설문의 학생 응답은 항목 별로 1,000자 이내로 작성해 주세요."}),e.jsx(l,{as:"li",textStyle:"b3-regular",color:"fg",children:"파일 용량은 20MB까지 가능해요."})]})]})]})]})},me=(s,r)=>r.map((y,o)=>({key:`preview-${s.memberKey}-${o}`,question:y,answer:s.answers[o]??"",created_at:new Date().toISOString()})),ue=s=>
1({key:s.memberKey,identity:s.studentIdentity,name:s.studentName,year:new Date().getFullYear(),grade:0,class_num:0,number:0}),z=({label:s,value:r})=>e.jsxs(q,{gap:2,align:"center",children:[e.jsx(V,{colorPalette:"gray",variant:"subtle",size:"sm",children:s}),e.jsx(l,{textStyle:"b2-medium",children:r})]}),be=({parsedData:s})=>{const[r,y]=K.useState(null);if(!s)return e.jsxs(p,{gap:4,children:[e.jsx(l,{textStyle:"t4-semibold-compact",children:"2. 업로드 파일 확인"}),e.jsx(k,{border:"1px solid",borderColor:"border",borderRadius:"lg",overflow:"hidden",children:e.jsxs(p,{align:"center",py:20,gap:4,children:[e.jsx(k,{bg:"bg.muted",borderRadius:"full",p:3,display:"flex",alignItems:"center",justifyContent:"center",children:e.jsx(W,{as:J,boxSize:5,color:"fg.muted"})}),e.jsxs(p,{gap:2,textAlign:"center",children:[e.jsx(l,{textStyle:"b1-semibold",color:"fg",children:"파일을 업로드해 주세요."}),e.jsx(l,{textStyle:"b2-regular",color:"fg.muted",children:"업로드 후 등록할 내용을 확인할 수 있어요."})]})]})})]});const o=s.questions.map((a,m)=>({key:`q-${m}`,cells:[{key:"no",children:m+1},{key:"question",children:a}]})),c=s.questions.length,n=s.rows.map(a=>{const m=a.answers.filter(x=>x.trim()!=="").length;return{key:a.memberKey,cells:[{key:"학번",children:a.studentIdentity,w:"table.xs"},{key:"이름",children:a.studentName,w:"table.xs"},{key:"응답수",children:`${m}/${c}`,w:"table.xs"},...s.questions.map((x,v)=>{var A;return{key:`문항${v+1}`,children:(A=a.answers[v])!=null&&A.trim()?e.jsx(l,{truncate:!0,textStyle:"b3-regular",children:a.answers[v]}):e.jsx(l,{color:"fg.subtle",children:"-"}),display:{base:"none",md:"table-cell"}}}),{key:"자세히보기",children:e.jsx(j,{variant:"ghost",colorPalette:"blue",size:"xs",onClick:()=>y({student:ue(a),surveyResponses:me(a,s.questions)}),children:"자세히 보기"}),w:"100px"}]}});return e.jsxs(e.Fragment,{children:[e.jsxs(p,{gap:6,children:[e.jsx(l,{textStyle:"t4-semibold-compact",children:"2. 업로드 파일 확인"}),s.unmatchedIdentities.length>0&&e.jsx(k,{bg:"red.subtle",border:"1px solid",borderColor:"red.muted",borderRadius:"lg",p:3,children:e.jsxs(l,{textStyle:"b3-medium",color:"red.fg",children:["등록되지 않은 학번: ",e.jsx("strong",{children:s.unmatchedIdentities.join(", ")})]})}),e.jsxs(p,{gap:3,children:[e.jsx(z,{label:"문항 수",value:`${s.questions.length}개`}),e.jsx(k,{overflow:"hidden",children:e.jsx($,{size:"sm",rows:o,header:{columns:[{key:"no",children:"No.",w:"table.xs"},{key:"question",children:"설문 문항"}]}})})]}),e.jsxs(p,{gap:3,children:[e.jsx(z,{label:"응답 학생 수",value:`${s.rows.length}명`}),e.jsx(k,{overflow:"hidden",children:e.jsx($,{size:"sm",rows:n,header:{columns:[{key:"학번",children:"학번",w:"table.xs"},{key:"이름",children:"이름",w:"table.xs"},{key:"응답수",children:"응답 수",w:"table.xs"},...s.questions.map((a,m)=>({key:`문항${m+1}`,children:`문항 ${m+1}`,display:{base:"none",md:"table-cell"}})),{key:"자세히보기",children:"자세히 보기",w:"table.sm"}]}})})]})]}),r&&e.jsx(le,{student:r.student,surveyResponses:r.surveyResponses,open:!0,onClose:()=>y(null)})]})},xe=0,F=2,ve=(s,r,y)=>{const o=de(s,{type:"array"}),c=o.Sheets[o.SheetNames[0]],n=M.sheet_to_json(c,{header:1,defval:""});if(n.length<1)return{filename:r,questions:[],rows:[],unmatchedIdentities:[]};const[a,...m]=n,x=a.slice(F).map(d=>String(d??"")),v=x.map((d,g)=>d.trim()?g:-1).filter(d=>d!==-1),A=v.map(d=>x[d]),U=new Map(y.map(d=>[d.student.identity,d])),S=[],C=[];for(const d of m){const g=String(d[xe]??"").trim();if(!g)continue;const u=U.get(g);if(!u){C.push(g);continue}const _=d.slice(F);S.push({memberKey:u.key,studentIdentity:g,studentName:u.student.name,answers:v.map(h=>String(_[h]??""))})}return{filename:r,questions:A,rows:S,unmatchedIdentities:C}},ge=(s,r=[])=>{const y=["학번","이름",...r],o=s.map(a=>[a.student.identity,a.student.name,...r.map(()=>"")]),c=M.aoa_to_sheet([y,...o]),n=M.book_new();return M.book_append_sheet(n,c,"Sheet1"),ce(n,{type:"array",bookType:"xlsx"})},he="",fe=100,Ae=6;i({activity_type:P(["autonomous","career","club"]),year:w().int().describe("학년도"),name:t().max(fe).default(he).describe("활동명 (동아리 필수)"),grade:I([w().int().min(1).max(Ae),E()]).optional().describe("학년 (자율/진로 필수)"),class_num:I([w().int().min(1),E()]).optional().describe("반 (자율/진로 필수)")});i({activity_key:t()});i({activity_key:t()});const _e=100;i({name:t().min(1).max(_e).describe("동아리명")});i({activity_key:t()});i({activity_key:t()});i({activity_key:t()});const ke=new RegExp("[A-Za-z0-9-_]{22}"),Ce=[],we=new RegExp("[A-Za-z0-9-_]{22}"),je=[];i({add_student_keys:b(t().regex(ke)).default(Ce).describe("추가할 학생 key"),remove_member_keys:b(t().regex(we)).default(je).describe("제거할 멤버 key")});i({activity_key:t(),member_key:t()});const Se="",Be=1e3,Re="",Me="[]",Ie="[]";i({keywords:t().max(Be).default(Se).describe("키워드/메모"),student_level:P(["H","M","L",""]).default(Re).describe("활동 수준"),delete_file_keys:t().default(Me).describe("삭제할 파일 key 목록 (JSON array str)"),delete_survey_response_keys:t().default(Ie).describe("삭제할 설문 응답 key 목록 (JSON array str)"),pdf_file:I([G(Blob),E()]).optional()});i({activity_key:t(),member_key:t()});i({activity_key:t()});const Ee=new RegExp("[A-Za-z0-9-_]{22}");i({items:I([b(i({member_key:t().regex(Ee),start_page:w().int().min(1),end_page:w().int().min(1)})),t(),E()]).optional().describe("항목 목록"),file:G(Blob)});i({activity_key:t()});const D=1e3,Ue=new RegExp("[A-Za-z0-9-_]{22}");i({filename:t().describe("원본 파일명"),questions:b(t().max(D)).describe("공통 질문 목록"),member_answers:b(i({member_key:t().regex(Ue),answers:b(t()).describe("질문 순서에 대응하는 답변 목록")})).describe("멤버별 답변 목록")});i({activity_key:t()});const Te=new RegExp("[A-Za-z0-9-_]{22}"),Ke="",qe="",Pe=[];i({items:b(i({member_key:t().regex(Te),keywords:t().default(Ke).describe("키워드/메모"),student_level:P(["H","M","L",""]).default(qe).describe("활동 수준")})).default(Pe).describe("일괄 수정 항목 목록")});i({activity_key:t()});const De=new RegExp("[A-Za-z0-9-_]{22}"),Le=[];i({items:b(i({member_key:t().regex(De),content:t().describe("최종 기록 내용")})).default(Le).describe("일괄 저장 항목 목록")});i({activity_key:t()});i({label:t().describe("삭제할 일괄 업로드 라벨"),target:t().describe("삭제 대상: 'files' 또는 'survey_responses'")}
1);i({activity_key:t()});i({activity_key:t(),member_key:t()});const Ne="",$e=100;i({custom_content:t().max($e).default(Ne).describe("교사 직접 작성 콘텐츠")});i({activity_key:t(),member_key:t()});i({activity_key:t(),member_key:t(),element_key:t()});i({is_selected:X().describe("선택 여부")});i({activity_key:t()});const ze=new RegExp("[A-Za-z0-9-_]{22}");i({member_keys:b(t().regex(ze)).describe("대상 멤버 key 목록")});i({activity_key:t()});const Fe=new RegExp("[A-Za-z0-9-_]{22}"),Ge="보통",Oe="";i({member_keys:b(t().regex(Fe)).describe("대상 멤버 key 목록"),length_preset:t().default(Ge).describe("짧게 / 보통 / 길게"),user_message:t().default(Oe).describe("교사 메모")});i({activity_key:t()});i({activity_key:t()});const Ze=D,He=D,st=()=>{const{activityKey:s}=ee(),r=te(),y=se(),[o,c]=K.useState(null),{data:n}=N(T.creativeActivities.detail(s)),{data:a,isPending:m}=N(T.creativeActivities.detail(s)._ctx.members),x=a??[],{mutate:v,isPending:A}=ie({mutationFn:()=>{if(!o)throw new Error("no data");return re.appsCreativeActivitiesApiSurveyBatchExcelUpload({activityKey:s,requestBody:{filename:o.filename,questions:o.questions,member_answers:o.rows.map(u=>({member_key:u.memberKey,answers:u.answers}))}})},onSuccess:()=>{R.create({title:"자료가 등록되었습니다.",type:"success"}),y.invalidateQueries({queryKey:T.creativeActivities.detail(s)._ctx.members.queryKey}),r(-1)}}),U=u=>{const _=new FileReader;_.readAsArrayBuffer(u),_.onload=h=>{var L;const O=(L=h.target)==null?void 0:L.result,Z=x.map(f=>({key:f.key,student:{identity:f.student.identity,name:f.student.name}})),B=ve(O,u.name,Z);if(B.questions.some(f=>f.length>Ze)){c(null),R.create({title:"각 질문은 1,000자 이내로 입력해 주세요.",type:"error"});return}if(B.rows.some(f=>f.answers.some(H=>H.length>He))){c(null),R.create({title:"각 응답은 1,000자 이내로 입력해 주세요.",type:"error"});return}if(B.rows.length===0){c(null),R.create({title:"등록할 정보가 없습니다",type:"error"});return}c(B)}},S=()=>{const u=x.map(h=>({key:h.key,student:{identity:h.student.identity,name:h.student.name}})),_=ge(u);pe(new Blob([_]),"설문_응답_템플릿.xlsx")},C=n!=null&&n.grade?`${n.grade}학년`:"",d=n!=null&&n.class_num?`${n.class_num}반`:"",g=C||d?` : ${C} ${d}`:"";return m?e.jsx(p,{align:"center",py:20,children:e.jsx(ae,{role:"status"})}):e.jsxs(p,{rowGap:0,children:[e.jsx(oe,{title:`설문 응답 일괄 등록${g}`,description:"학생들이 제출한 설문 응답을 엑셀로 일괄 등록할 수 있어요. 등록한 응답은 AI가 분석할 때 학생 활동 자료로 활용돼요.",backLink:"-1"}),e.jsxs(p,{bg:"white",borderRadius:"xl",p:6,gap:6,shadow:"sm",children:[e.jsx(ye,{onFileUpload:U,onTemplateDownload:S}),e.jsx(p,{height:"1px",bg:"border"}),e.jsx(be,{parsedData:o})]}),e.jsxs(q,{justify:"flex-end",columnGap:3,pt:6,pb:10,children:[e.jsx(j,{variant:"outline",colorPalette:"blue",borderRadius:"full",onClick:()=>r(-1),children:"이전으로"}),e.jsxs(j,{colorPalette:"blue",borderRadius:"full",disabled:!o,loading:A,onClick:()=>v(),children:[e.jsx(ne,{}),"등록 완료"]})]})]})};export{st as default};
2//# sourceMappingURL=CreativeActivitySurveyBatchUploadPage-B-pmz5sV.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.