1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[251],{67667:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/classroom-template",function(){return t(99693)}])},51838:function(e,r,t){"use strict";t.d(r,{x:function(){return i}});var l=t(81367),a=t(20264),n=t(18206),i=function(e){return(0,a.jsx)(n.ZP,(0,l._)({},e))}},99693:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return pe}});var l=t(30865),a=t(60904),n=t(87451),i=t(5972),o=t(20264),s=t(49231),u=t(85344),c=t(50227),d=t(23088),f=t(49071),m=t(37861),p=t(7252),v=t(73277),h=t(80855),x=t(81367),g=t(33209),y=t(79260),j=t(75385),b=t(42784),_=t(1682),C=function(e){var r=e.onSuccess;setTimeout((function(){return null===r||void 0===r?void 0:r("ok")}),0)},S=function(e){var r=e.index,t=e.lens,l=e.actionLabel,a=(0,n._)((0,u.$G)(void 0,{keyPrefix:"features.classroomCreation.step-2"}),1)[0],i=v.Z.Title;return(0,o.jsx)(j.Z,{children:(0,o.jsxs)("div",{className:"flex flex-col gap-ant-md",children:[(0,o.jsx)(i,{level:5,className:"mb-0!",children:a("action.label",{index:r+1})}),l?(0,o.jsx)(v.Z.Text,{type:"secondary",children:l}):null,(0,o.jsx)(h.Qr,(0,g._)((0,x._)({},t.focus("erpIdentifier").interop()),{render:function(e){var r=e.field,t=e.fieldState.error;return(0,o.jsx)(y.Z.Item,{label:a("erpIdentifier.label"),required:!0,validateStatus:t?"error":"",help:null===t||void 0===t?void 0:t.message,layout:"vertical",className:"mb-0",children:(0,o.jsx)(b.I,(0,x._)({size:"large",placeholder:a("erpIdentifier.placeholder")},r))})}})),(0,o.jsx)(h.Qr,(0,g._)((0,x._)({},t.focus("erpFile").interop()),{render:function(e){var r,t=e.field,l=t.onBlur,n=t.onChange,i=t.name,s=t.ref,u=t.value,c=e.fieldState.error;return(0,o.jsxs)(y.Z.Item,{label:a("erpFile.label"),required:!0,validateStatus:c?"error":"",help:null===c||void 0===c?void 0:c.message,layout:"vertical",className:"mb-0",children:[(0,o.jsxs)(v.Z.Paragraph,{className:"mb-ant-sm! text-color-ant-secondary",children:[a("erpFile.description.ypareo"),(0,o.jsx)("br",{}),a("erpFile.description.googleSheet")," ",(0,o.jsx)(v.Z.Link,{href:f.iWv,target:"_blank",rel:"noopener noreferrer",children:a("erpFile.description.templateLink")})]}),(0,o.jsx)(_.g,{multiple:!1,maxCount:1,accept:".csv,.xlsx",fileList:(r=u,r?[{uid:"".concat(r.name,"-").concat(r.size,"-").concat(r.lastModified),name:r.name,status:"done"}]:[]),customRequest:C,onRemove:function(){return n(null),!0},onChange:function(e){if("removed"!==e.file.status&&0!==e.fileList.length){var r=e.file.originFileObj;r&&r!==u&&n(r)}else n(null)},children:(0,o.jsx)(m.z,{ref:s,name:i,size:"large",onBlur:l,children:a("erpFile.placeholder")})})]})}}))]})})},I=function(){var e=(0,n._)((0,u.$G)(void 0,{keyPrefix:"features.classroomCreation.step-2"}),1)[0],r=(0,h.Gc)().control,t=(0,p.Ou)({control:r}).focus("trainingActions"),l=(0,h.Dq)(t.interop()).fields,a=v.Z.Title;return(0,o.jsxs)("div",{children:[(0,o.jsx)(a,{level:4,children:e("actions.label")}),(0,o.jsx)("div",{className:"mb-ant-lg flex flex-col gap-ant-md",children:t.map(l,(function(e,r,t){return(0,o.jsx)(S,{index:t,lens:r,actionLabel:e.templateActionLabel},e.id)}))})]})},N=t(86703),w=t(7912),F=t(1114),H=t(4448),k=t(53924),E=t(33332),q=t(84490),Z=t(26620),A=function(e){var r=e.value,t=e.onChange,l=(0,N._)(e,["value","onChange"]),n=(0,a._)(r,Date)?r:r?(0,w.Qc)(r,"HH:mm",new Date):null;return(0,o.jsx)(k.M.TimePicker,(0,x._)({format:"HH:mm",showNow:!1,needConfirm:!1,hideDisabledOptions:!0,value:n&&(0,F.J)(n)?n:null,onChange:function(e){return null===t||void 0===t?void 0:t(e?(0,H.WU)(e,"HH:mm"):null)}},l))},P=function(){var e=(0,n._)((0,u.$G)(void 0,{keyPrefix:"features.classroomCreation.ClassroomCreateGeneralInformationFieldset"}),1)[0];return(0,o.jsxs)("div",{children:[(0,o.jsx)(h.Qr,{name:"title",render:function(r){var t=r.field,l=r.fieldState.error;return(0,o.jsx)(y.Z.Item,{label:e("title_field.label"),required:!0,validateStatus:l?"error":"",help:null===l||void 0===l?void 0:l.message,layout:"vertical",children:(0,o.jsx)(b.I,(0,x._)({size:"large",maxLength:100,showCount:!0,placeholder:e("title_field.placeholder")},t))})}}),(0,o.jsx)(h.Qr,{name:"location",render:function(r){var t=r.field,l=r.fieldState.error;return(0,o.jsx)(y.Z.Item,{label:e("location.label"),required:!0,validateStatus:l?"error":"",help:null===l||void 0===l?void 0:l.message,layout:"vertical",children:(0,o.jsx)(Z.A,(0,x._)({size:"large",placeholder:e("location.placeholder")},t))})}}),(0,o.jsx)(h.Qr,{name:"factory",render:function(r){var t=r.field,l=r.fieldState.error;return(0,o.jsx)(y.Z.Item,{label:e("factory.label"),required:!0,validateStatus:l?"error":"",help:null===l||void 0===l?void 0:l.message,layout:"vertical",children:(0,o.jsx)(E.B,(0,x._)({size:"large",placeholder:e("factory.placeholder")},t))})}}),(0,o.jsx)(h.Qr,{name:"language",render:function(r){var t=r.field,l=r.fieldState.error;return(0,o.jsx)(y.Z.Item,{label:e("language.label"),required:!0,validateStatus:l?"error":"",help:null===l||void 0===l?void 0:l.message,layout:"vertical",children:(0,o.jsx)(q.S,{size:"large",onBlur:t.onBlur,onChange:t.onChange,ref:t.ref,value:t.value})})}}),(0,o.jsxs)("div",{className:"flex gap-ant-md",children:[(0,o.jsx)(h.Qr,{name:"dailyStartHour",render:function(r){var t=r.field,l=t.value,a=t.onChange,n=r.fieldState.error,i=(0,N._)(r.field,["value","onChange"]);return(0,o.jsx)(y.Z.Item,{label:e("dailyStartHour.label"),required:!0,validateStatus:n?"error":"",help:null===n||void 0===n?void 0:n.message,layout:"vertical",className:"flex-1",children:(0,o.jsx)(A,(0,x._)({size:"large",placeholder:e("dailyStartHour.placeholder"),value:l,onCh
1ange:a},i))})}}),(0,o.jsx)(h.Qr,{name:"dailyEndHour",render:function(r){var t=r.field,l=t.value,a=t.onChange,n=r.fieldState.error,i=(0,N._)(r.field,["value","onChange"]);return(0,o.jsx)(y.Z.Item,{label:e("dailyEndHour.label"),required:!0,validateStatus:n?"error":"",help:null===n||void 0===n?void 0:n.message,layout:"vertical",className:"flex-1",children:(0,o.jsx)(A,(0,x._)({size:"large",placeholder:e("dailyEndHour.placeholder"),value:l,onChange:a},i))})}})]})]})},z=t(51503),L=t(8029),T={layout:"horizontal",column:1,size:"small",bordered:!0,styles:{label:{width:"170px",maxWidth:"170px"}}},G=v.Z.Title,O=function(){var e,r,t=(0,n._)((0,u.$G)(void 0,{keyPrefix:"features.classroomCreation.ClassroomCreateSummaryStep"}),1)[0],l=(0,(0,h.Gc)().watch)(),a=l.template_id||"",i=(0,f.IX1)({trainingTemplate:a},{enabled:Boolean(a)}),s=i.data,c=i.isLoading,d=a?c?(0,o.jsx)(L.O.Input,{active:!0,size:"small",className:"h-4! w-40!"}):(null===s||void 0===s?void 0:s.name)||"-":"-",m=l.language||"",p=(0,f.cQI)({language:m},{enabled:Boolean(m)}),v=p.data,y=p.isLoading,b=m?y?(0,o.jsx)(L.O.Input,{active:!0,size:"small",className:"h-4! w-40!"}
1):(null===v||void 0===v?void 0:v.title)||"-":"-",_=l.factory||"",C=(0,f.cmC)({factory:_},{enabled:Boolean(_)}),S=C.data,I=C.isLoading,N=_?I?(0,o.jsx)(L.O.Input,{active:!0,size:"small",className:"h-4! w-40!"}):(null===S||void 0===S?void 0:S.title)||"-":"-",w=l.location||"",F=(0,f.yUb)({location:w},{enabled:Boolean(w)}),H=F.data,k=F.isLoading,E=w?k?(0,o.jsx)(L.O.Input,{active:!0,size:"small",className:"h-4! w-40!"}):(null===H||void 0===H?void 0:H.title)||"-":"-",q=[{key:"template_id",label:t("template_id.label"),children:d},{key:"title",label:t("title.label"),children:l.title},{key:"location",label:t("location.label"),children:E},{key:"factory",label:t("factory.label"),children:N},{key:"language",label:t("language.label"),children:b},{key:"dailyStartHour",label:t("dailyStartHour.label"),children:l.dailyStartHour||"-"},{key:"dailyEndHour",label:t("dailyEndHour.label"),children:l.dailyEndHour||"-"}],Z=null!==(r=null===(e=l.trainingActions)||void 0===e?void 0:e.map((function(e,r){var l;return[{key:"action-".concat(r,"-template-action"),label:t("actionDetails.templateAction"),children:e.templateActionLabel||"-"},{key:"action-".concat(r,"-erp-identifier"),label:t("actionDetails.erpIdentifier"),children:e.erpIdentifier||"-"},{key:"action-".concat(r,"-file"),label:t("actionDetails.file"),children:(null===(l=e.erpFile)||void 0===l?void 0:l.name)||"-"}]})))&&void 0!==r?r:[];return(0,o.jsxs)(j.Z,{children:[(0,o.jsxs)("section",{children:[(0,o.jsx)(G,{level:3,className:"my-4",children:t("basicInfo.label")}),(0,o.jsx)(z.ZP,(0,g._)((0,x._)({},T),{items:q}))]}),Z.length>0&&(0,o.jsxs)("section",{children:[(0,o.jsx)(G,{level:3,className:"my-4",children:t("actions.label")}),Z.map((function(e,r){return(0,o.jsxs)(j.Z,{className:"mb-6",children:[(0,o.jsxs)(G,{level:4,className:"mb-2 text-sm! font-medium!",children:[t("action.label")," ",r+1]}),(0,o.jsx)(z.ZP,(0,g._)((0,x._)({},T),{column:2,bordered:!1,items:e}))]},r)}))]})]})},B=t(52634),R=t(1629),Q=t(17550),D=t(47360);function $(e){var r,t=e.templates,l=e.value,a=e.onChange,n=e.currentPage,i=e.perPage,s=e.totalItems,u=e.onPageChange,c=e.emptyMessage,d=t.map((function(e){return{key:(0,f.IJY)(e),template:e}}));return(0,o.jsxs)("div",{className:"flex flex-col gap-ant",children:[(0,o.jsx)(R.a,{rootClassName:"w-full",items:d,selectionMode:"single",selectedKeys:l?[l]:[],onSelectionChange:function(e){return null===a||void 0===a?void 0:a(null!==(r=e[0])&&void 0!==r?r:null)},showSelectionIndicator:!0,emptyState:(0,o.jsx)(B.H,{description:c,className:"py-8"}),renderItem:function(e){var r=e.item,t=e.props;return(0,o.jsx)(Q.H,(0,g._)((0,x._)({},t),{align:"center",className:"p-ant-sm",children:r.template.name}))}}),s>i&&(0,o.jsx)(D.t,{align:"center",current:n,pageSize:i,total:s,onChange:u,showSizeChanger:!1})]})}var M=t(40073),X=t(34445),U=t(51838);function V(e){var r,t,l=e.value,a=e.onChange,i=(0,n._)((0,u.$G)("translation",{keyPrefix:"features.classroomCreation.ClassroomCreateTemplateSelectStep"}),1)[0],c=(0,s.useState)(""),d=c[0],p=c[1],v=(0,s.useState)(1),h=v[0],x=v[1],g=(0,f.Uuu)({pagination:{page:h,perPage:5},filters:{title:d.trim()||null,status:f._4w.PUBLISHED}}),y=g.data,j=g.isLoading,_=g.isError,C=g.refetch,S=null!==(r=null===y||void 0===y?void 0:y["hydra:member"])&&void 0!==r?r:[],I=null!==(t=null===y||void 0===y?void 0:y["hydra:totalItems"])&&void 0!==t?t:0;return(0,o.jsxs)("div",{className:"flex flex-col gap-ant",children:[(0,o.jsx)(b.I,{placeholder:i("searchPlaceholder"),value:d,onChange:function(e){p(e.target.value),x(1)},prefix:(0,o.jsx)(X.e,{variant:"antd"}),allowClear:!0}),j?(0,o.jsx)("div",{className:"flex flex-col gap-ant-xs",children:Array.from({length:5}).map((function(e,r){return(0,o.jsxs)("div",{className:"flex flex-row items-center gap-ant-md",children:[(0,o.jsx)(L.O.Avatar,{active:!0,size:"small",shape:"circle"}),(0,o.jsx)(L.O.Node,{active:!0,className:"h-12! w-full! rounded-ant-lg!"})]},r)}))}):_?(0,o.jsx)(U.x,{status:"error",title:i("loadErrorTitle"),subTitle:i("loadError"),extra:[(0,o.jsx)(m.z,{type:"primary",iconPosition:"start",icon:(0,o.jsx)(M.Z,{}),onClick:function(){return C()},children:i("reload")},"reload")]}
1):(0,o.jsx)($,{templates:S,value:l,onChange:a,currentPage:h,perPage:5,totalItems:I,onPageChange:x,emptyMessage:i("noTemplatesFound")})]})}var W=t(64820),K=t(5224),J=t(2437),Y=t(89214),ee=t(81462),re=t(25913),te=t(66445),le=["csv","xlsx"],ae=10485760,ne=function(e){var r,t=null===(r=e.name.split(".").pop())||void 0===r?void 0:r.toLowerCase();return Boolean(t&&le.includes(t))},ie=function(e){return re.IX().of(function(e){return re.Ry({templateActionLabel:re.Z_().nullable().optional(),erpIdentifier:re.Z_().trim().required(e("step-2.erpIdentifier.required")),erpFile:re.nK().nullable().test("erpFile-required",e("step-2.erpFile.required"),(function(e){return(0,a._)(e,File)})).test("erpFile-extension",e("step-2.erpFile.invalidExtension"),(function(e){return!(0,a._)(e,File)||ne(e)})).test("erpFile-size",e("step-2.erpFile.tooLarge"),(function(e){return!(0,a._)(e,File)||e.size<=ae}))})}(e)).min(1,e("step-2.actions.required")).required(e("step-2.actions.required"))},oe={templateActionLabel:"",erpIdentifier:"",erpFile:null},se=function(){var e=(0,h.Gc)(),r=e.watch,t=e.setValue,l=e.clearErrors,a=r("template_id"),n=(0,s.useRef)(null),i=(0,f.IX1)({trainingTemplate:a||void 0},{enabled:Boolean(a)}).data;return(0,s.useEffect)((function(){if(!a)return n.current=null,void t("trainingActions",[]);if(i&&i["@id"]===a&&n.current!==a){var e,r=(0,W._)(null!==(e=i.trainingActions)&&void 0!==e?e:[]).sort((function(e,r){return e.rank-r.rank})).map((function(e){return{templateActionLabel:e.description,erpIdentifier:"",erpFile:null}}));l("trainingActions"),t("trainingActions",r,{shouldValidate:!0}),n.current=a}}),[l,t,i,a]),null},ue=function(){var e=(0,h.Gc)().setValue;return(0,o.jsx)(h.Qr,{name:"template_id",render:function(r){var t=r.field;return(0,o.jsx)(V,{value:t.value,onChange:function(r){r!==t.value&&(t.onChange(r),e("trainingActions",[]))}})}})},ce=function(e){var r=e.error,t=e.steps,l=e.currentStep,a=(0,h.Gc)(),n=a.setError,i=a.setFocus,o=(0,J.KE)(),u=(0,s.useRef)(null),c=(0,s.useRef)(null);return(0,s.useEffect)((function(){if(!r)return u.current=null,void(c.current=null);if(o&&u.current!==r){var e=(0,ee.Rn)(r);if(0!==e.length){e.forEach((function(e){var r=e.fieldPath,t=e.message;n(r,{type:"server",message:t})}));var l=e[0],a=(0,ee.Gb)(l.fieldPath,t);u.current=r,a<0||(c.current={fieldPath:l.fieldPath,stepIndex:a},o.jump(a))}else u.current=r}}),[r,o,n,t]),(0,s.useEffect)((function(){var e=c.current;if(e&&l===e.stepIndex){var r=window.setTimeout((function(){i(e.fieldPath),c.current=null}));return function(){return window.clearTimeout(r)}}}),[l,r,i]),null},de=function(e){var r=e.open,t=e.onSubmit,l=e.onCancel,a=e.error,i=(0,n._)((0,u.$G)(void 0,{keyPrefix:"features.classroomCreation"}),1)[0],s=function(e){return re.Ry((0,g._)((0,x._)({template_id:re.Z_().required(e("step-1.template.required")),title:re.Z_().trim().required(e("ClassroomCreateGeneralInformationFieldset.title_field.required")).min(10,e("ClassroomCreateGeneralInformationFieldset.title_field.tooShort",{min:10})).max(100,e("ClassroomCreateGeneralInformationFieldset.title_field.tooLong",{max:100})),location:re.Z_().required(e("ClassroomCreateGeneralInformationFieldset.location.required")),factory:re.Z_().required(e("ClassroomCreateGeneralInformationFieldset.factory.required"))},(0,te.hd)({required:e("step-2.dailyHours.required"),invalid:e("step-2.dailyHours.invalid"),endAfterStart:e("step-2.dailyHours.endAfterStart"),maxGap:e("step-2.dailyHours.maxGap")})),{trainingActions:ie(e),language:re.Z_().required(e("ClassroomCreateGeneralInformationFieldset.language.required"))}))}(i),c=function(e){return[{label:e("step-1.label"),stepTitle:e("step-1.title"),validate:["template_id"]},{label:e("step-2.label"),stepTitle:e("step-2.title"),validate:["title","location","factory","language","dailyStartHour","dailyEndHour","trainingActions"]},{label:e("step-3.label"),stepTitle:e("step-3.title"),validate:[]}]}(i);return(0,o.jsx)(J.Yr,{open:r,title:i("title"),schema:s,steps:c,defaultValues:{template_id:"",title:"",location:"",factory:"",dailyStartHour:"09:00",dailyEndHour:"17:00",trainingActions:[oe],language:""},onSubmit:t,onCancel:l,children:function(e){var r=e.currentStep;return(0,o.jsxs)("div",{className:"max-h-[70vh] overflow-y-auto p-ant",children:[(0,o.jsx)(se,{}),(0,o.jsx)(ce,{error:a,steps:c,currentStep:r}),a&&(0,o.jsx)(Y.b,{type:"error",message:(0,K.Z)(a,i("error.message")),showIcon:!0,closable:!0,className:"mb-4"}),0===r&&(0,o.jsx)(ue,{}),1===r&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(P,{}),(0,o.jsx)(I,{})]}),2===r&&(0,o.jsx)(O,{})]})}})},fe=t(72127),me=t(17886),pe=function(){var e=(0,n._)((0,u.$G)(void 0,{keyPrefix:"features.classroomCreation.page"}
1),1)[0],r=(0,s.useState)(!0),t=r[0],p=r[1],v=(0,s.useState)(null),h=v[0],x=v[1],g=(0,d.tv)(),y=(0,c.OT)().setActiveClassroom,j=(0,c.cD)().refetch,b=(0,f.e2N)().mutateAsync,_=function(){var e=(0,l._)((function(e){var r,t,l,n,o,s;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:if(!(null===(r=e.trainingActions)||void 0===r?void 0:r.length))return[2];x(null),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,b({trainingTemplate:e.template_id,title:e.title,location:e.location,language:e.language,factory:e.factory,dailyStartHour:e.dailyStartHour,dailyEndHour:e.dailyEndHour,trainingActions:e.trainingActions.map((function(e){return{erpIdentifier:e.erpIdentifier,erpFile:null!==(t=e.erpFile)&&void 0!==t?t:void 0}}))})];case 2:return l=i.sent(),[4,j()];case 3:return i.sent(),n=(0,f.sRO)(l),y(n),p(!1),g.push({route:d.AW.CLASSROOMS_LEARNERS,query:{classroomId:n}}),[3,5];case 4:throw o=i.sent(),s=(0,a._)(o,Error)?o:new Error(String(o)),x(s),s;case 5:return[2]}}))}));return function(r){return e.apply(this,arguments)}}();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(me.Z,{title:e("metaTitle")}),(0,o.jsxs)(fe.X,{title:e("pageTitle"),children:[t?null:(0,o.jsx)(m.z,{type:"primary",onClick:function(){return p(!0)},children:e("reopenForm")}),(0,o.jsx)(de,{open:t,onSubmit:_,onCancel:function(){x(null),p(!1)},error:h})]})]})}}},function(e){e.O(0,[8206,1503,3198,9774,2888,179],(function(){return r=67667,e(e.s=r);var r}));var r=e.O();_N_E=r}]); 2//# sourceMappingURL=classroom-template-a66e73e07b29aa02.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.