1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5169],{67027:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(57437),i=n(2265),r=n(21124),a=n(26544);let l=e=>new Intl.DateTimeFormat("en-CA",{timeZone:"Europe/Rome"}).format(new Date(e)),u=(e,t)=>{let n=new Date(e).toLocaleTimeString("it-IT",{hour:"2-digit",minute:"2-digit",timeZone:"Europe/Rome"});return null==t?n:(0,r.S1)(e,t)||n};function c(e){let{ordine:t,minutiSlot:n,onSpostato:r,accetta:c,classeBottone:s}=e,d=(0,a.K7)(),[m,f]=(0,i.useState)(!1),[h,p]=(0,i.useState)(()=>l(t.data_ora_ritiro)),[g,v]=(0,i.useState)(null),[w,b]=(0,i.useState)(""),[y,x]=(0,i.useState)(!0),[S,E]=(0,i.useState)(""),[N,j]=(0,i.useState)(""),[k,D]=(0,i.useState)("");(0,i.useEffect)(()=>{if(!m||!h)return;let e=!0;return v(null),fetch("/api/asporto/slots?date=".concat(h,"&tipo=").concat("delivery"===t.tipo?"delivery":"pickup")).then(e=>e.json()).then(t=>{e&&v((null==t?void 0:t.ok)?t.slots:[])}).catch(()=>{e&&v([])}),()=>{e=!1}},[m,h,t.tipo]);let T=async e=>{if(w&&!S){E(e?"accetta":"sposta"),j("");try{let o=await fetch("/api/asporto/orders/".concat(t.id,"/orario"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data_ora_ritiro:w,avvisa:!e&&y&&!!t.telefono})}).then(e=>e.json()).catch(()=>null);if(!(null==o?void 0:o.ok)){j((null==o?void 0:o.error)||"Spostamento non riuscito");return}r(o.ordine,!!o.avvisato);let i=o.avvisato?"Spostato a {ora} \xb7 cliente avvisato":"Spostato a {ora}";D(d(i).replace("{ora}",u(o.ordine.data_ora_ritiro,n))),f(!1),b(""),e&&c&&await c()}finally{E("")}}},z="h-9 rounded-lg bg-zyu-card border border-zyu-border px-2 text-sm text-white outline-none focus:border-gold-400";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{onClick:()=>{f(e=>!e),D(""),j("")},className:null!=s?s:"flex-1 h-9 rounded-lg text-sm font-semibold border border-zyu-border text-gray-300 hover:text-white hover:bg-zyu-card",children:["\uD83D\uDD52 ",m?d("Annulla"):d("Sposta orario")]}),k&&!m&&(0,o.jsxs)("div",{className:"w-full text-xs text-green-400",children:["â ",k]}),m&&(0,o.jsxs)("div",{className:"w-full rounded-lg bg-zyu-card border border-zyu-border p-2 space-y-2",children:[(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsx)("input",{type:"date",min:l(new Date().toISOString()),value:h,onChange:e=>{p(e.target.value),b("")},className:z+" w-[7.5rem]"}),(0,o.jsxs)("select",{value:w,onChange:e=>b(e.target.value),className:z+" flex-1",children:[(0,o.jsx)("option",{value:"",children:null===g?d("Carico gli orariâ¦"):g.length?d("â nuovo orario â"):d("Nessun orario in questo giorno")}),(null!=g?g:[]).map(e=>(0,o.jsxs)("option",{value:e.iso,disabled:!e.disponibile,children:[e.label,e.disponibile?"":d(" (pieno)")]},e.iso))]})]}),t.telefono&&(0,o.jsxs)("label",{className:"flex items-center gap-2 text-[12px] text-gray-300 cursor-pointer",children:[(0,o.jsx)("input",{type:"checkbox",checked:y,onChange:e=>x(e.target.checked),className:"accent-gold-400"}),c?d("Avvisa il cliente del nuovo orario (WhatsApp/SMS) â con \xabSposta e accetta\xbb lo dice gi\xe0 la conferma"):d("Avvisa il cliente del nuovo orario (WhatsApp/SMS)")]}),N&&(0,o.jsx)("div",{className:"text-xs text-red-400",children:d(N)}),(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsx)("button",{onClick:()=>T(!1),disabled:!w||!!S,className:"flex-1 h-9 rounded-lg text-sm font-bold border border-emerald-600 text-emerald-400 hover:bg-emerald-600/10 disabled:opacity-40",children:"sposta"===S?d("Spostoâ¦"):d("Sposta ordine")}),c&&(0,o.jsx)("button",{onClick:()=>T(!0),disabled:!w||!!S,className:"flex-1 h-9 rounded-lg text-sm font-bold bg-emerald-600 text-white hover:bg-emerald-500 disabled:opacity-40",children:"accetta"===S?d("Sposto e accettoâ¦"):d("â Sposta e accetta")})]})]})]})}},21124:function(e,t,n){n.d(t,{S1:function(){return r}}),n(71565);let o={Mon:"lun",Tue:"mar",Wed:"mer",Thu:"gio",Fri:"ven",Sat:"sab",Sun:"dom"};function i(e){let{h:t,mi:n}=function(e){let t=new Intl.DateTimeFormat("en-GB",{timeZone:"Europe/Rome",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(e).reduce((e,t)=>
1(e[t.type]=t.value,e),{});return{y:+t.year,mo:+t.month,da:+t.day,h:"24"===t.hour?0:+t.hour,mi:+t.minute,wd:o[t.weekday]}}(e);return"".concat(String(t).padStart(2,"0"),":").concat(String(n).padStart(2,"0"))}function r(e,t){let n=new Date(e instanceof Date?e.getTime():e);if(isNaN(n.getTime()))return"";if(!Number.isFinite(t)||t<=0)return i(n);let o=new Date(n.getTime()+6e4*t);return"".concat(i(n),"/").concat(i(o))}},26544:function(e,t,n){n.d(t,{K7:function(){return s},LM:function(){return u},o_:function(){return c}});var o=n(2265);let i="omnyu_lingua",r="omnyu:lingua",a=null,l=null;function u(e){try{localStorage.setItem(i,e),window.dispatchEvent(new CustomEvent(r,{detail:e}))}catch(e){}}function c(){let[e,t]=(0,o.useState)("it");return(0,o.useEffect)(()=>{let e=()=>t(function(){try{return"zh"===localStorage.getItem(i)?"zh":"it"}catch(e){return"it"}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),e}function s(){let e=c(),[t,n]=(0,o.useState)(a);return(0,o.useEffect)(()=>{"zh"===e&&(a?Promise.resolve(a):(l||(l=fetch("/i18n/zh.json").then(e=>e.ok?e.json():Promise.reject(Error("http "+e.status))).then(e=>{if(!e||!Object.keys(e).length)throw Error("dizionario vuoto");return a=e,e}).catch(()=>(l=null,{}))),l)).then(n)},[e]),(0,o.useCallback)(n=>"zh"!==e?n:(null==t?void 0:t[n])||n,[t,e])}},57234:function(e,t,n){n.d(t,{KJ:function(){return s},Xj:function(){return o},vs:function(){return c},yB:function(){return u}});let o=3e5,i=!0,r=null,a=new Set;function l(){"undefined"!=typeof document&&(window.self===window.top||"undefined"==typeof IntersectionObserver||r||(r=new IntersectionObserver(e=>{let t=e.filter(e=>e.target===document.documentElement),n=t[t.length-1];n&&i!==n.isIntersecting&&(i=n.isIntersecting,a.forEach(e=>e()))})).observe(document.documentElement))}function u(){return"undefined"==typeof document||(l(),!document.hidden&&i)}function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e5,o=new Intl.DateTimeFormat("en-GB",{timeZone:"Europe/Rome",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(t),i=e=>{var t;return Number(null===(t=o.find(t=>t.type===e))||void 0===t?void 0:t.value)},r=3600*i("hour")+60*i("minute")+i("second");return r<7200||r>=34200?e:Math.max(e,Math.min(n,(34200-r)*1e3))}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("undefined"==typeof document)return()=>{};let{subito:i=!0,notteMs:r=3e5,sempre:s=!1}=n,d=!0,m=!1,f=0,h=i?Number.NEGATIVE_INFINITY:Date.now(),p=null,g=Math.max(3*t,6e4),v=()=>{if(!d||!s&&!u()&&Date.now()-h<o||m&&Date.now()-h<g)return;let t=++f;m=!0,h=Date.now();let n=()=>{t===f&&(m=!1)};try{Promise.resolve(e()).catch(()=>{}).finally(n)}catch(e){n()}},w=()=>{d&&(p=setTimeout(b,c(t,new Date,r)))},b=()=>{p=null,v(),w()},y=()=>{!d||!u()||Date.now()-h<t||(p&&clearTimeout(p),p=null,v(),w())};document.addEventListener("visibilitychange",y);let x="undefined"==typeof document||window.self===window.top||"undefined"==typeof IntersectionObserver?()=>{}:(a.add(y),l(),()=>{a.delete(y)});return i&&v(),w(),()=>{d=!1,p&&clearTimeout(p),document.removeEventListener("visibilitychange",y),x()}}},52515:function(e,t,n){n.d(t,{$v:function(){return u},L_:function(){return s},SB:function(){return a},by:function(){return l},cZ:function(){return c},mp:function(){return r}});let o=new Set(["accedi","agenti","ai","api","app-titolare","assistant","automation","c","chiosco","cassa.webmanifest","chiosco.webmanifest","clienti","clienti-yellgo","consegne","coupon","disiscrivi","elimina-account","f","fidelity","fonts","forms","gp","home","info","interazioni","iscriviti","knowledge","link","login","m","memorie","menu","messaggi","monitor","ordina","pc","prenota","prenotazioni","privacy","remarketing","rinnova","sala","sala-mobile","sala-mobile.webmanifest","sala.webmanifest","sondaggio","t","tag","tavolo","termini","tessera","timbra","wallet","whatsapp","prezzi","demo","partner","chi-siamo","note-legali","gestionale","icons","i18n","omnyu","tv"]),i=/^[a-z0-9][a-z0-9-]*$/;function r(e){let t=/^\/([^/]+)(\/.*)?$/.exec(e);if(!t)return{locale:"",resto:e};let n=t[1];return!i.test(n)||o.has(n)?{locale:"",resto:e}:{locale:n,resto:t[2]||"/"}}function a(e){return r(e).resto}function l(e,t){return e?"/"===t?"/".concat(e):"/".concat(e).concat(t):t}function u(){let{locale:e}=r(window.location.pathname);return window.location.origin+(e?"/".concat(e):"")}function c(e){if(e.startsWith("//")||r(e).locale)return e;let{locale:t}=r(window.location.pathname);return l(t,e)}function s(e,t){if("string"==typeof e&&e.startsWith("/api/")){let{locale:n}=r(window.location.pathname);return fetch(l(n,e),t)}return fetch(e,t)}}}]);
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.