1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[622],{704:(e,a,t)=>{"use strict";t.d(a,{T:()=>i});var s=t(7876),r=t(4232),n=t(5565);let i=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...r})});i.displayName="Textarea"},1188:(e,a,t)=>{"use strict";t.d(a,{BT:()=>o,Wu:()=>c,ZB:()=>l,Zp:()=>i,aR:()=>d});var s=t(7876),r=t(4232),n=t(5565);let i=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r})});i.displayName="Card";let d=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",t),...r})});d.displayName="CardHeader";let l=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("h3",{ref:a,className:(0,n.cn)("text-2xl font-semibold leading-none tracking-tight",t),...r})});l.displayName="CardTitle";let o=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("p",{ref:a,className:(0,n.cn)("text-sm text-muted-foreground",t),...r})});o.displayName="CardDescription";let c=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("p-6 pt-0",t),...r})});c.displayName="CardContent",r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("flex items-center p-6 pt-0",t),...r})}).displayName="CardFooter"},6689:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>k});var s=t(7876),r=t(4232),n=t(9099),i=t(8408),d=t(7525),l=t(9712),o=t(1188),c=t(9917),m=t(704),u=t(8283),f=t(8725),x=t(6076),p=t(2257),h=t(5565);let g=u.bL;u.YJ;let j=u.WT,y=r.forwardRef((e,a)=>{let{className:t,children:r,...n}=e;return(0,s.jsxs)(u.l9,{ref:a,className:(0,h.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[r,(0,s.jsx)(u.In,{asChild:!0,children:(0,s.jsx)(f.A,{className:"h-4 w-4 opacity-50"})})]})});y.displayName=u.l9.displayName;let N=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(u.PP,{ref:a,className:(0,h.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,s.jsx)(x.A,{className:"h-4 w-4"})})});N.displayName=u.PP.displayName;let b=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(u.wn,{ref:a,className:(0,h.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,s.jsx)(f.A,{className:"h-4 w-4"})})});b.displayName=u.wn.displayName;let v=r.forwardRef((e,a)=>{let{className:t,children:r,position:n="popper",...i}=e;return(0,s.jsx)(u.ZL,{children:(0,s.jsxs)(u.UC,{ref:a,className:(0,h.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[(0,s.jsx)(N,{}),(0,s.jsx)(u.LM,{className:(0,h.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,s.jsx)(b,{})]})})});v.displayName=u.UC.displayName,r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(u.JU,{ref:a,className:(0,h.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r})}).displayName=u.JU.displayName;let w=r.forwardRef((e,a)=>{let{className:t,children:r,...n}=e;return(0,s.jsxs)(u.q7,{ref:a,className:(0,h.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(u.VF,{children:(0,s.jsx)(p.A,{className:"h-4 w-4"})})}),(0,s.jsx)(u.p4,{children:r})]})});w.displayName=u.q7.displayName,r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(u.wv,{ref:a,className:(0,h.cn)("-mx-1 my-1 h-px bg-muted",t),...r})}).displayName=u.wv.displayName;var z=t(8728),C=t(3536),R=t(1810);function k(){let e=(0,n.useRouter)(),{toast:a}=(0,R.dj)(),[t,u]=(0,r.useState)(null),[f,x]=(0,r.useState)(!0),[p,h]=(0,r.useState)(""),[N,b]=(0,r.useState)(!1),[k,A]=(0,r.useState)(!1),P=(0,r.useCallback)(async()=>{if(e.query.id)try{let a=await fetch("/api/admin/messages/".concat(e.query.id));if(!a.ok)throw Error();let t=await a.json();u(t.message),h(t.message.notes||"")}catch(e){a({title:"BÅÄ
d",description:"Nie udaÅo siÄ pobraÄ wiadomoÅci"})}finally{x(!1)}},[e.query.id,a]);(0,r.useEffect)(()=>{P()},[P]);let Z=async e=>{if(t)try{await fetch("/api/admin/messages/".concat(t.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e})}),u({...t,status:e}),a({title:"Status zaktualizowany"})}catch(e){a({title:"BÅÄ
d",description:"Nie udaÅo siÄ zmieniÄ statusu"})}},T=async()=>{if(t){b(!0);try{await fetch("/api/admin/messages/".concat(t.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notes:p})}
1),a({title:"Notatki zapisane"})}catch(e){a({title:"BÅÄ
d",description:"Nie udaÅo siÄ zapisaÄ notatek"})}finally{b(!1)}}},_=async()=>{if(t)try{await fetch("/api/admin/messages/".concat(t.id),{method:"DELETE"}),a({title:"WiadomoÅÄ usuniÄta"}),e.push("/admin/messages")}catch(e){a({title:"BÅÄ
d",description:"Nie udaÅo siÄ usunÄ
Ä"})}},E=e=>new Date(e).toLocaleDateString("pl-PL",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"});return f?(0,s.jsx)(i.A,{title:"WiadomoÅÄ",breadcrumbs:[{label:"Panel gÅ\xf3wny",href:"/admin"},{label:"WiadomoÅci",href:"/admin/messages"}],children:(0,s.jsx)("div",{className:"flex justify-center py-16",children:(0,s.jsx)("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})})}):t?(0,s.jsxs)(i.A,{title:t.subject,breadcrumbs:[{label:"Panel gÅ\xf3wny",href:"/admin"},{label:"WiadomoÅci",href:"/admin/messages"}],actions:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("a",{href:"mailto:".concat(t.email,"?subject=Re: ").concat(encodeURIComponent(t.subject)),children:(0,s.jsxs)(c.$,{variant:"outline",children:[(0,s.jsx)(z.A,{className:"h-4 w-4 mr-2"}),"Odpowiedz"]})}),(0,s.jsxs)(c.$,{variant:"destructive",onClick:()=>A(!0),children:[(0,s.jsx)(C.A,{className:"h-4 w-4 mr-2"}),"UsuÅ"]})]}),children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,s.jsx)("div",{className:"lg:col-span-2 space-y-6",children:(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)(o.aR,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(o.ZB,{className:"text-lg",children:t.subject}),(0,s.jsx)(l.A,{status:t.status})]})}),(0,s.jsxs)(o.Wu,{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Od:"})," ",(0,s.jsx)("span",{className:"font-medium",children:t.name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"E-mail:"})," ",(0,s.jsx)("a",{href:"mailto:".concat(t.email),className:"text-primary hover:underline",children:t.email})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Data:"})," ",E(t.createdAt)]}),t.readAt&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Przeczytano:"})," ",E(t.readAt)]})]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:t.message})})]})]})}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)(o.aR,{children:(0,s.jsx)(o.ZB,{className:"text-sm",children:"Status"})}),(0,s.jsx)(o.Wu,{children:(0,s.jsxs)(g,{value:t.status,onValueChange:Z,children:[(0,s.jsx)(y,{children:(0,s.jsx)(j,{})}),(0,s.jsxs)(v,{children:[(0,s.jsx)(w,{value:"unread",children:"Nieprzeczytana"}),(0,s.jsx)(w,{value:"read",children:"Przeczytana"}),(0,s.jsx)(w,{value:"replied",children:"Odpowiedziana"}),(0,s.jsx)(w,{value:"archived",children:"Zarchiwizowana"})]})]})})]}),(0,s.jsxs)(o.Zp,{children:[(0,s.jsx)(o.aR,{children:(0,s.jsx)(o.ZB,{className:"text-sm",children:"Notatki wewnÄtrzne"})}),(0,s.jsxs)(o.Wu,{className:"space-y-3",children:[(0,s.jsx)(m.T,{value:p,onChange:e=>h(e.target.value),placeholder:"Twoje notatki...",rows:4}),(0,s.jsx)(c.$,{size:"sm",onClick:T,disabled:N,children:N?"Zapisywanie...":"Zapisz notatki"})]})]})]})]}),(0,s.jsx)(d.A,{open:k,onOpenChange:A,title:"UsuÅ wiadomoÅÄ",description:"Czy na pewno chcesz usunÄ
Ä tÄ wiadomoÅÄ? Tej operacji nie można cofnÄ
Ä.",onConfirm:_,confirmLabel:"UsuÅ"})]}):(0,s.jsx)(i.A,{title:"WiadomoÅÄ",breadcrumbs:[{label:"Panel gÅ\xf3wny",href:"/admin"},{label:"WiadomoÅci",href:"/admin/messages"}],children:(0,s.jsx)("p",{className:"text-muted-foreground",children:"Nie znaleziono wiadomoÅci."})})}},7525:(e,a,t)=>{"use strict";t.d(a,{A:()=>j});var s=t(7876),r=t(4232),n=t(2450),i=t(5565),d=t(9917);let l=n.bL;n.l9;let o=n.ZL,c=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.hJ,{className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:a})});c.displayName=n.hJ.displayName;let m=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsxs)(o,{children:[(0,s.jsx)(c,{}),(0,s.jsx)(n.UC,{ref:a,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1nded-lg",t),...r})]})});m.displayName=n.UC.displayName;let u=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",a),...t})};u.displayName="AlertDialogHeader";let f=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...t})};f.displayName="AlertDialogFooter";let x=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.hE,{ref:a,className:(0,i.cn)("text-lg font-semibold",t),...r})});x.displayName=n.hE.displayName;let p=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.VY,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",t),...r})});p.displayName=n.VY.displayName;let h=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.rc,{ref:a,className:(0,i.cn)((0,d.r)(),t),...r})});h.displayName=n.rc.displayName;let g=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.ZD,{ref:a,className:(0,i.cn)((0,d.r)({variant:"outline"}),"mt-2 sm:mt-0",t),...r})});function j(e){let{open:a,onOpenChange:t,title:r,description:n,onConfirm:i,confirmLabel:d="Potwierdź",destructive:o=!0}=e;return(0,s.jsx)(l,{open:a,onOpenChange:t,children:(0,s.jsxs)(m,{children:[(0,s.jsxs)(u,{children:[(0,s.jsx)(x,{children:r}),(0,s.jsx)(p,{children:n})]}),(0,s.jsxs)(f,{children:[(0,s.jsx)(g,{children:"Anuluj"}),(0,s.jsx)(h,{onClick:i,className:o?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"",children:d})]})]})})}g.displayName=n.ZD.displayName},8408:(e,a,t)=>{"use strict";t.d(a,{A:()=>o});var s=t(7876),r=t(9603),n=t(7328),i=t.n(n),d=t(8230),l=t.n(d);function o(e){var a;let{title:t,subtitle:n,breadcrumbs:d=[],actions:o,children:c}=e,{user:m}=(0,r.Jd)();return(0,s.jsxs)("div",{className:"min-h-screen bg-background",children:[(0,s.jsxs)(i(),{children:[(0,s.jsxs)("title",{children:[t," | Panel Administracyjny | Cali w MÄ
ce"]}),(0,s.jsx)("meta",{name:"robots",content:"noindex, nofollow"})]}),(0,s.jsx)("header",{className:"border-b bg-card",children:(0,s.jsxs)("div",{className:"container mx-auto px-4 py-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(l(),{href:"/admin",className:"text-xl font-bold text-primary",children:"Cali w MÄ
ce"}),(0,s.jsx)("span",{className:"text-muted-foreground",children:"|"}),(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:t})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:(null==m?void 0:m.firstName)||(null==m||null==(a=m.emailAddresses[0])?void 0:a.emailAddress)}),(0,s.jsx)(r.uF,{afterSignOutUrl:"/"})]})]})}),d.length>0&&(0,s.jsx)("nav",{className:"border-b bg-muted/30",children:(0,s.jsxs)("div",{className:"container mx-auto px-4 py-2 flex items-center gap-2 text-sm",children:[d.map((e,a)=>(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[a>0&&(0,s.jsx)("span",{className:"text-muted-foreground",children:"/"}),(0,s.jsx)(l(),{href:e.href,className:"text-muted-foreground hover:text-primary transition-colors",children:e.label})]},e.href)),(0,s.jsx)("span",{className:"text-muted-foreground",children:"/"}),(0,s.jsx)("span",{className:"text-foreground",children:t})]})}),(0,s.jsxs)("main",{className:"container mx-auto px-4 py-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-bold",children:t}),n&&(0,s.jsx)("p",{className:"text-muted-foreground mt-2",children:n})]}),o&&(0,s.jsx)("div",{children:o})]}),c]})]})}},9580:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/messages/[id]",function(){return t(6689)}])},9712:(e,a,t)=>{"use strict";t.d(a,{A:()=>o});var s=t(7876);t(4232);var r=t(7137),n=t(5565);let i=(0,r.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function d(e){let{className:a,variant:t,...r}=e;return(0,s.jsx)("div",{className:(0,n.cn)(i({variant:t}),a),...r})}let l={unread:{label:"Nieprzeczytana",variant:"default"},read:{label:"Przeczytana",variant:"secondary"},replied:{label:"Odpowiedziana",variant:"outline"},archived:{label:"Zarchiwizowana",variant:"secondary"}};function o(e){let{status:a}=e,t=l[a]||{label:a,variant:"secondary"};return(0,s.jsx)(d,{variant:t.variant,children:t.label})}},9917:(e,a,t)=>{"use strict";t.d(a,{$:()=>o,r:()=>l});var s=t(7876),r=t(4232),n=t(2987),i=t(7137),d=t(5565);let l=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=r.forwardRef((e,a)=>{let{className:t,variant:r,size:i,asChild:o=!1,...c}=e,m=o?n.DX:"button";return(0,s.jsx)(m,{className:(0,d.cn)(l({variant:r,size:i,className:t})),ref:a,...c})});o.displayName="Button"}},e=>{e.O(0,[695,303,197,636,593,792],()=>e(e.s=9580)),_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.