1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9983],{2036:(e,t,i)=>{i.d(t,{A:()=>s});let s=(0,i(4082).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},9689:(e,t,i)=>{i.d(t,{A:()=>s});let s=(0,i(4082).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},9983:(e,t,i)=>{i.r(t),i.d(t,{ContenutoCarrello:()=>k});var s=i(4183),o=i(2335),a=i(7035),l=i(5508),r=i(2305),n=i(5741),c=i(3125),d=i(5112),m=i(3846),u=i(9170);function p(){var e;let t=(0,a.c)("carrello"),i=(0,a.c)("fedelta.premio"),l=(0,o.useId)(),r=(0,u.It)(e=>e.codicePremio),n=(0,u.It)(e=>e.impostaCodicePremio),d=(0,u.It)(e=>e.preventivo),[m,p]=(0,o.useState)([]);if((0,o.useEffect)(()=>{let e=new AbortController;return(async()=>{try{var t;let i=await fetch("/api/i-miei-premi",{signal:e.signal});if(!i.ok)return;let s=null!=(t=(await i.json()).premi)?t:[];p(s);let o=u.It.getState().codicePremio;""===o||s.some(e=>e.codice===o)||u.It.getState().impostaCodicePremio("")}catch(e){}})(),()=>e.abort()},[]),0===m.length)return null;let x=null!=(e=null==d?void 0:d.premio)?e:null;return(0,s.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"premi-del-cliente",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:t("premioTitolo")}),(0,s.jsxs)("label",{className:(0,c.cn)("flex min-h-11 cursor-pointer items-center gap-3 rounded-sm border px-3 py-2","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",""===r?"border-primary bg-primary/10":"border-border"),children:[(0,s.jsx)(c.sx,{name:l,"data-testid":"premio-nessuno",checked:""===r,onChange:()=>n(""),className:"size-5"}),(0,s.jsx)("span",{className:"text-sm",children:t("premioNessuno")})]}),m.map(e=>(0,s.jsxs)("label",{className:(0,c.cn)("flex min-h-11 cursor-pointer items-center gap-3 rounded-sm border px-3 py-2","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",r===e.codice?"border-primary bg-primary/10":"border-border"),children:[(0,s.jsx)(c.sx,{name:l,"data-testid":"premio-scelta",value:e.codice,checked:r===e.codice,onChange:()=>n(e.codice),className:"size-5"}),(0,s.jsx)("span",{className:"text-sm",children:t("premioVoce",{premio:i(e.tipo),codice:e.codice})})]},e.codice)),(null==x?void 0:x.applicato)&&null!==x.tipo&&(0,s.jsx)("p",{role:"status","data-testid":"premio-applicato",className:"text-sm text-success",children:t("premioApplicato",{premio:i(x.tipo)})}),(null==x?void 0:x.motivo)==="non_applicabile"&&(0,s.jsx)("p",{role:"status","data-testid":"premio-non-applicabile",className:"text-sm text-warning",children:t("premioNonApplicabile")})]})}var x=i(7915);let h=(0,i(4082).A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var v=i(2036),f=i(9689),g=i(4684);function b(e){var t,i,l;let{riga:r,calcolata:n,locale:d,confermato:m=!0}=e,p=(0,a.c)("carrello"),x=(0,o.useId)(),b=(0,u.It)(e=>e.cambiaQuantita),j=(0,u.It)(e=>e.cambiaNote),N=(0,u.It)(e=>e.rimuovi),[y,z]=(0,o.useState)(""!==r.note),k=null!=(t=null==n?void 0:n.nome)?t:r.nome,C=(null!=(i=null==n?void 0:n.prezzoUnitario)?i:r.prezzoVisto)+(null!=(l=null==n?void 0:n.prezzoOpzioni)?l:0),I=void 0!==n&&!n.disponibile;return(0,s.jsxs)("li",{className:(0,c.cn)("flex flex-col gap-3 border-b border-border py-4 last:border-b-0",I&&"opacity-70"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:(0,c.cn)("font-medium",I&&"line-through"),children:k}),n&&n.descrizioneScelte.length>0&&(0,s.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:n.descrizioneScelte.join(" \xb7 ")}),n&&n.descrizioneExtra.length>0&&(0,s.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:n.descrizioneExtra.map(e=>"+ ".concat(e)).join(" \xb7 ")}),I&&(0,s.jsx)("p",{className:"mt-1 text-sm font-medium text-sold-out",children:p("esauritoInCarrello",{prodotto:k})})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-end",children:[(0,s.jsx)(g.L,{centesimi:C*r.quantita,locale:d,className:(0,
1c.cn)("font-semibold",!m&&"text-muted-foreground")}),!m&&(0,s.jsx)("span",{"data-confermato":"false",className:"text-xs text-muted-foreground",children:p("prezzoDaAggiornare")})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center rounded-sm border border-border",children:[(0,s.jsx)("button",{type:"button",onClick:()=>b(r.chiave,r.quantita-1),"aria-label":p("diminuisci",{prodotto:k}),className:"grid size-11 place-items-center rounded-l-sm text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset",children:(0,s.jsx)(h,{className:"size-4","aria-hidden":"true"})}),(0,s.jsx)("span",{"aria-live":"polite",className:"w-10 text-center text-sm font-semibold tabular-nums",children:r.quantita}),(0,s.jsx)("button",{type:"button",onClick:()=>b(r.chiave,r.quantita+1),"aria-label":p("aumenta",{prodotto:k}),className:"grid size-11 place-items-center rounded-r-sm text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset",children:(0,s.jsx)(v.A,{className:"size-4","aria-hidden":"true"})})]}),(0,s.jsx)("button",{type:"button",onClick:()=>N(r.chiave),"aria-label":p("rimuovi",{prodotto:k}),className:"grid size-11 place-items-center rounded-sm text-muted-foreground hover:text-error focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:(0,s.jsx)(f.A,{className:"size-4","aria-hidden":"true"})}),(0,s.jsx)("button",{type:"button",onClick:()=>z(e=>!e),"aria-expanded":y,"aria-controls":x,className:"ml-auto min-h-11 rounded-sm px-2 text-sm text-muted-foreground underline underline-offset-4 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:p("note")})]}),y&&(0,s.jsx)(c.TM,{id:x,value:r.note,onChange:e=>j(r.chiave,e.target.value),placeholder:p("notePlaceholder"),"aria-label":p("noteDi",{prodotto:k}),maxLength:280,rows:2,className:"text-sm"})]})}var j=i(2439),N=i(7237),y=i(1665),z=i(8745);function k(e){var t,i,n;let{indirizzoPizzeria:h,attivo:v=!0,onNavigazione:f}=e,g=(0,a.c)("carrello"),y=(0,l.Ym)(),k=(0,o.useId)(),I=(0,u.It)(e=>e.righe),A=(0,u.It)(e=>e.codiceSconto),w=(0,u.It)(e=>e.preventivo),M=(0,u.It)(e=>e.errore),S=(0,u.It)(e=>e.caricamento),_=(0,u.It)(e=>e.impostaCodiceSconto),{ricarica:P}=(0,z.u)(v&&I.length>0);if(0===I.length)return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[w&&(0,s.jsx)(d.x,{preventivo:w,locale:y}),(0,s.jsxs)("div",{className:"flex flex-col items-center gap-4 py-8 text-center",children:[(0,s.jsx)(r.A,{className:"size-10 text-muted-foreground","aria-hidden":"true"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-xl",children:g("vuoto")}),(0,s.jsx)("p",{className:"mt-1 text-muted-foreground",children:g("vuotoTesto")})]}),(0,s.jsx)(c.$n,{asChild:!0,children:(0,s.jsx)(N.N_,{href:"/menu",onClick:f,children:g("vaiAlMenu")})})]})]});let E=new Map(null!=(n=null==w?void 0:w.righe.map(e=>[e.chiave,e]))?n:[]);return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[null!==M&&(0,s.jsxs)("div",{role:"alert","data-testid":"preventivo-non-aggiornato",className:"flex flex-col gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm",children:[(0,s.jsx)("p",{children:g(null===w?"erroreRete":"preventivoVecchio")}),(0,s.jsx)(c.$n,{type:"button",variant:"outline",size:"sm",onClick:P,className:"self-start",children:g("riprova")})]}),w&&(0,s.jsx)(d.x,{preventivo:w,locale:y}),(0,s.jsx)("ul",{className:"flex flex-col",children:I.map(e=>(0,s.jsx)(b,{riga:e,calcolata:E.get(e.chiave),locale:y,confermato:null===M},e.chiave))}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("label",{htmlFor:k,className:"text-sm text-muted-foreground",children:g("codiceSconto")}),(0,s.jsx)("div",{className:"flex gap-2",children:(0,s.jsx)(c.pd,{id:k,type:"text",value:A,onChange:e=>_(e.target.value),placeholder:g("codiceScontoPlaceholder"),autoComplete:"off",spellCheck:!1,maxLength:48,"data-testid":"campo-codice-sconto"})}),(null==w||null==(t=w.sconto)?void 0:t.valido)&&(0,s.jsx)("p",{role:"status",className:"text-sm text-success",children:g("scontoApplicato",{codice:w.sconto.codice})}),(null==w||null==(i=w.sconto)?void 0:i.valido)&&w.sconto.soloPrimoOrdine&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"sconto-primo-ordine",children:g("scontoValeAlPrimoOrdine")})]}),(0,s.jsx)(p,{}),(0,s.jsx)(m.f,{preventivo:w,locale:y,indirizzoPizzeria:h}),w&&(0,s.jsx)(j.Z,{preventivo:w,locale:y}),w&&(0,s.jsx)(x.h,{preventivo:w,locale:y}),w&&(0,s.jsx)(C,{preventivo:w,locale:y,onNavigazione:f,aggiornamentoFallito:null!==M}),(0,s.jsx)("p",{"aria-live":"polite",className:"sr-only",children:S?g("ricalcolo"):""})]})}function C(e){let t,{preventivo:i,locale:o,onNavigazione:l,aggiornamentoFallito:r}=e,d=(0,a.c)("carrello"),m=(0,u.It)(e=>e.orario),p=(0,y.r)({preventivo:i,orarioScelto:m,aggiornamentoFallito:r}).length>0;return(0,s.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-4",children:[!i.soddisfaMinimo&&i.mancanteAlMinimo>0&&(0,s.jsx)("p",{role:"status",className:"text-sm font-medium text-warning",children:d("sottoMinimo",{importo:(t=i.mancanteAlMinimo,(0,n.fI9)(t,n.QEh[o]))})}),!i.siOrdina&&(0,s.jsxs)("div",{role:"status","data-testid":"motivo-chiusura","data-stato":i.ingresso,className:"rounded-md bg-secondary/60 p-3 text-sm",children:[(0,s.jsx)("p",{className:"font-medium",children:d("ordini_sospesi"===i.ingresso?"ingressoSospeso":"nessunaFascia")}
1),(0,s.jsx)("p",{className:"mt-1 text-muted-foreground",children:d("ordini_sospesi"===i.ingresso?"ingressoSospesoTesto":"nessunaFasciaTesto")})]}),p?(0,s.jsx)(c.$n,{size:"lg",disabled:!0,"aria-disabled":"true","data-testid":"vai-al-pagamento","data-bloccato":"true",className:"w-full",children:d("checkoutBloccato")}):(0,s.jsx)(c.$n,{asChild:!0,size:"lg","data-bloccato":"false",className:"w-full",children:(0,s.jsx)(N.N_,{href:"/checkout","data-testid":"vai-al-pagamento","data-evento":"bottone_vai_al_pagamento",onClick:l,children:d("vaiAlCheckout")})})]})}}}]);
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.