1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[91852],{28650:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/staff-login",function(){return a(63796)}])},63796:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return X}});var r=a(35944),s=a(67294),n=a(69280),o=a(38473),l=a(63351),i=a(56312),c=a(74864),m=a(30202),d=a(98029),u=a(94139),f=a(90986),h=a(98106),g=a(29568),p=a(72140),w=a(6708),_=a(1725),b=a(79986),y=a(31470),Z=a(47438),v=a(50154),z=a(40131),P=a(38797),k=a(23075),E=a(66616),S=a(16993),C=a(39332),R=a(87536),x=a(55678),I=a(20532),j=a(1604);let B=j.z.object({email:j.z.string().email("Invalid email address"),staffEmail:j.z.string().email("Invalid staff email address"),password:j.z.string().min(6,"Password must be at least 6 characters")}),A=e=>{let{onSwitchToSignup:t}=e,{t:a}=(0,k.L)("AdminAuth"),[j,A]=s.useState(!1),T=P.X.getState(),G=(0,C.useRouter)(),J=S.n.getPortalResortsPage(),L=(0,R.cI)({resolver:(0,i.F)(B),defaultValues:{email:"",staffEmail:"",password:""}}),N=function(){let e=(0,m.NL)(),t=(0,d.D)({mutationFn:async e=>{let{requestBody:t}=e,a=await (0,g.Sj)();return await a.portal.staffMembersController.staffLogsInToPlayer({requestBody:t})},onSuccess:()=>{(0,u.Gh)(e,"PortalGetTTmarketBasketItems"),(0,u.Gh)(e,"PortalGetBasketDetailById"),(0,u.Gh)(e,"VoucherProducts")},onError:e=>{var t;throw Error((null==e?void 0:null===(t=e.body)||void 0===t?void 0:t.message[0])||"Unknown error occurred")}});return(0,h.J)({mutation:t})}(),X=function(){let e=(0,m.NL)(),t=(0,d.D)({mutationFn:async t=>{let{customToken:a}=t,r=await (0,c._p)(f.lX,a);return await (0,u.TS)(e,...(0,u.Ys)()),r.user},onError:e=>{console.error("Custom token Firebase login failed:",e)}});return(0,h.J)({mutation:t})}(),U=async e=>{try{let{customToken:t}=await N.mutation.mutateAsync({requestBody:{playerEmail:e.email,staffEmail:e.staffEmail,password:e.password}}),s=await X.mutation.mutateAsync({customToken:t}),n=await (0,E.d)();if(!n||!s)return F(a("user_data_not_found","Uživatelsk\xe1 data nebyla nalezena!"));T.actions.loggedInUserReceived(s),T.actions.loggedInPlayer(n),G.push(J),(0,x.Am)((0,r.tZ)(v.b,{title:a("login_success","\xdaspÄÅ¡n\xe9 pÅihl\xe1Å¡en\xed"),description:a("welcome_back","v\xedtejte !")}),{containerId:"global"})}catch(e){q((null==e?void 0:e.message)||"Unknown error occurred")}},q=e=>{(0,x.Am)((0,r.tZ)(w.h,{title:e}),{containerId:"global"})},F=e=>{T.actions.userLoggedOut(),q(e)};return(0,r.BX)("form",{onSubmit:L.handleSubmit(U,e=>(0,I.bp)({errors:e})),children:[(0,r.tZ)(z.H,{size:"display_sm",weight:"semibold",color:o.colors.gray900,css:{textAlign:"left",[l.l0.md]:{fontSize:"1.5rem"}},children:a("staff_login_text","PÅihl\xe1Å¡en\xed zamÄstnanců")}),(0,r.tZ)(y.L,{size:"1.5rem"}),(0,r.BX)(n.K,{gap:"1.5rem",children:[(0,r.tZ)(Z.nv,{form:L,name:"email",label:a("player_email","E-mail hr\xe1Äe"),placeholder:a("enter_player_email","Zadejte svůj uživatelsk\xfd e-mail"),type:"email"}),(0,r.tZ)(Z.nv,{form:L,name:"staffEmail",label:a("staff_email","E-mail zamÄstnanců"),placeholder:a("enter_staff_email","Zadejte e-mailovou adresu sv\xe9ho zamÄstnance")}),(0,r.tZ)(Z.nv,{form:L,name:"password",label:a("password_field.label","Heslo"),placeholder:a("password_field.placeholder","Zadejte vaÅ¡e heslo"),type:j?"text":"password",rightContent:(0,r.tZ)(_.h,{onClick:()=>{A(e=>!e)},children:j?(0,r.tZ)(b.J,{name:"Eye",color:o.colors.gray500,css:{marginRight:"1rem"}}):(0,r.tZ)(b.J,{name:"EyeOff",color:o.colors.gray500,css:{marginRight:"1rem"}})})}),(0,r.tZ)(p.z,{css:{width:"100%"},submit:!0,disabled:L.formState.isSubmitting,children:a("login_text","PÅihl\xe1Å¡en\xed")}),(0,r.tZ)(p.z,{color:"link",onClick:t,children:a("signup_text","Registrace")})]})]})},T=j.z.object({name:j.z.string().min(1,"Name is required"),email:j.z.string().email("Invalid email address"),password:j.z.string().min(6,"Password must be at least 6 characters"),confirmPassword:j.z.string().min(6,"Password must be at least 6 characters")}).refine(e=>e.password===e.confirmPassword,{message:"Passwords don't match",path:["confirmPassword"]}),G=e=>{let{onSwitchToLogin:t}=e,{t:a}=(0,k.L)("AdminAuth"),[c,f]=s.useState(!1),P=()=>{f(e=>!e)},E=(0,R.cI)({resolver:(0,i.F)(T),defaultValues:{name:"",email:"",password:"",confirmPassword:""}}),S=function(){let e=(0,m.NL)(),t=(0,d.D)({mutationFn:async e=>{let{requestBody:t}=e,a=await (0,g.Sj)();return await a.portal.staffMembersController.staffMembersSignUp({requestBody:t})},onSuccess:()=>{(0,u.Gh)(e,"PortalGetTTmarketBasketItems"),(0,u.Gh)(e,"PortalGetBasketDetailById"),(0,u.Gh)(e,"VoucherProducts")},onError:e=>{var t;throw console.log(e),Error((null==e?void 0:null===(t=e.body)||void 0===t?void 0:t.message[0])||"Unknown error occurred")}});return(0,h.J)({mutation:t})}(),C=async e=>{try{if(!await S.mutation.mutateAsync({requestBody:{email:e.email,password:e.password,name:e.name}}))return;(0,x.Am)((0,r.tZ)(v.b,{title:a("success_signup_message","\xdaspÄch"),description:a("success_signup_description","Registrace \xfaspÄÅ¡n\xe1.")})),t()}catch(t){let e=t.message||"Unknown error occurred";(0,x.Am)((0,r.tZ)(w.h,{title:a("error__title","Chyba"),description:e}),{containerId:"global"})}};return(0,r.BX)("form",{onSubmit:E.handleSubmit(C,e=>(0,I.bp)({errors:e})),children:[(0,r.tZ)(z.H,{size:"display_sm",weight:"semibold",color:o.colors.gray900,css:{textAlign:"left",[l.l0.md]:{fontSize:"1.5rem"}},children:a("staff_signup","Registrace zamÄstnanců")}),(0,r.tZ)(y.L,{size:"1.5rem"}),(0,r.BX)(n.K,{gap:"1.5rem",children:[(0,r.tZ)(Z.nv,{form:E,name:"name",label:a("staff__name","Jm\xe9no zamÄstnance"),placeholder:a("enter_staff_name","Zadejte jm\xe9no sv\xe9ho zamÄstnance"),type:"text"}),(0,r.tZ)(Z.nv,{form:E,name:"email",label:a("staff_email","E-mail zamÄstnanců"),placeholder:a("enter_staff_email","Zadejte e-mailovou adresu sv\xe9ho zamÄstnance"),type:"email"}),(0,r.tZ)(Z.nv,{form:E,name:"password",label:a("password_field.label","Heslo"),placeholder:a("password_field.placeholder","Zadejte vaÅ¡e heslo"),type:c?"text":"password",rightContent:(0,r.tZ)(_.h,{onClick:P,children:c?(0,r.tZ)(b.J,{name:"Eye",color:o.colors.gray500,css:{marginRight:"1rem"}}):(0,r.tZ)(b.J,{name:"EyeOff",color:o.colors.gray500,css:{marginRight:"1rem"}})})}),(0,r.tZ)(Z.nv,{form:E,name:"confirmPassword",label:a("confirm_password","Potvrzen\xed hesla"),placeholder:a("confirm_password","PotvrÄte sv\xe9 heslo"),type:c?"text":"password",rightContent:(0,r.tZ)(_.h,{onClick:P,children:c?(0,r.tZ)(b.J,{name:"Eye",color:o.colors.gray500,css:{marginRight:"1rem"}}):(0,r.tZ)(b.J,{name:"EyeOff",color:o.colors.gray500,css:{marginRight:"1rem"}})})}),(0,r.tZ)(p.z,{css:{width:"100%"},submit:!0,disabled:E.formState.isSubmitting,children:a("signup_text","Registrace")}),(0,r.tZ)(p.z,{color:"link",onClick:t,children:a("login_text","PÅihl\xe1Å¡en\xed")})]})]})};var J=a(16448),L=a(24792),N=a(11163),X=()=>
1{let[e,t]=(0,s.useState)(!0),a=(0,P.X)(e=>e.currentUser),i=S.n.getPortalResortsPage(),c=(0,N.useRouter)();return(0,s.useEffect)(()=>{a&&c.push(i)},[!!a]),(0,r.tZ)(J.T,{children:(0,r.tZ)(n.K,{center:!0,css:{width:"100%",justifyContent:"center"},children:(0,r.tZ)(n.K,{css:{width:"100%",maxWidth:"28rem",padding:"2rem",backgroundColor:o.colors.baseWhite,borderRadius:"1rem",boxShadow:L.q.xxl,[l.l0.md]:{padding:"1.5rem"}},children:e?(0,r.tZ)(A,{onSwitchToSignup:()=>t(!1)}):(0,r.tZ)(G,{onSwitchToLogin:()=>t(!0)})})})})}}},function(e){e.O(0,[54736,68592,49774,92888,40179],function(){return e(e.s=28650)}),_N_E=e.O()}]);
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.