PageSourceSearch

https://portal.cardapioweb.com/assets/LatestOrdersPage-UJUqUzjx.js

js cardapioweb.com collected 2026-09-24 11:58:11 UTC 31,278 bytes, 6 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="aaa91dfd-124b-5d2b-ba50-92c0afdf059c")}catch(e){}}();
3const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-wnI_Ult4.js","assets/index-Cs-In7Vx.js","assets/index-DP2k1umP.css","assets/AddPaymentPointDialog-Szy62P03.js","assets/constants-CGt9nw53.js","assets/chunk-BhLx_Kux.js","assets/CheckBoxOutlineBlankRounded-B4fof7Ef.js","assets/CheckBoxRounded-9nIk-vPl.js","assets/countBy-EJ7lCbpH.js","assets/shop-DcM_z8AG.js","assets/LocationOnRounded-iAbEw2do.js","assets/SettingsRounded-B2QVmdGs.js","assets/useDrop-DkAvtxPl.js","assets/Badge-afidKPqR.js","assets/ListItemSecondaryAction-j8rMQwuS.js","assets/ToggleButtonGroup-Bhd5Hj6n.js","assets/profile.actions-5K7DhYPO.js","assets/index-kCik8b3g.js","assets/react-virtualized-auto-sizer.esm-KOBZLcdN.js","assets/cloneDeep-WMrv_9GL.js","assets/cloneDeep-CWttLxUo.js","assets/IfoodWidget-BTbiMJWu.js","assets/index-Cs5iyk11.css"])))=>i.map(i=>d[i]);
4import{e as Q,f as X,g as Z,h as ee,i as te,r as A,R as e,Y as z,f4 as Ve,D as Oe,q as Ce,I as Se,s as Fe,t as Ie,x as _,b3 as We,o as k,$ as ae,a0 as ne,V as B,a1 as Ye,v as P,fu as He,as as De,ae as le,l as U,bk as Ge,c9 as Ue,fk as V,fl as Le,fm as Te,fn as Me,fi as F,n as Re,bt as J,f6 as Je,cJ as ce,cv as oe,M as se,k as ze,aE as Ae,bd as ie,bc as Ke,fv as Qe,fw as Xe,w as W,fx as Ze,Q as et,W as tt,aR as at,cH as ue,aU as me,C as nt,bL as lt,ca as st,fy as rt,a6 as Pe,db as i,bu as Y,fz as ct,E as ot,aY as it,L as ut,O as mt,ar as dt,ah as je,aq as ft,fA as de,fB as pt,ap as gt,fC as Et,fD as vt,fE as ht,fF as xt,fG as yt,fH as bt,a$ as _t,fI as Nt,de as fe,a5 as wt,T as K,fJ as kt,cp as Ot,aT as Ct,fK as St,d2 as It}from"./index-Cs-In7Vx.js";import{B as Dt}from"./Badge-afidKPqR.js";import{L as qe}from"./ListItemSecondaryAction-j8rMQwuS.js";import{T as pe,a as L}from"./ToggleButtonGroup-Bhd5Hj6n.js";import{c as Lt}from"./countBy-EJ7lCbpH.js";import{u as Tt}from"./profile.actions-5K7DhYPO.js";import{R as Mt}from"./index-kCik8b3g.js";import{A as Rt}from"./react-virtualized-auto-sizer.esm-KOBZLcdN.js";import{c as $e}from"./cloneDeep-WMrv_9GL.js";import{s as zt,h as At}from"./IfoodWidget-BTbiMJWu.js";var T={},ge;function Pt(){if(ge)return T;ge=1;var t=Q(),a=X();Object.defineProperty(T,"__esModule",{value:!0}),T.default=void 0;var n=a(Z()),l=t(ee()),s=(0,l.default)(n.createElement("path",{d:"M6 5H3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm14 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm-7 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1z"}),"ViewWeek");return T.default=s,T}var jt=Pt();const qt=te(jt),Be=A.createContext(),$t=Be.Provider,Bt=()=>A.useContext(Be);function Vt(){const{openDialog:t}=Bt();return e.createElement(z,{variant:"outlined",className:"whitespace-nowrap bg-white",onClick:t,startIcon:e.createElement(Ve,null)},"Gestão de entregas")}var M={},Ee;function Ft(){if(Ee)return M;Ee=1;var t=Q(),a=X();Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var n=a(Z()),l=t(ee()),s=(0,l.default)(n.createElement("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"}),"LockOutlined");return M.default=s,M}var Wt=Ft();const Yt=te(Wt),Ht="/assets/gestao_entregas-BM3chvLX.png";function Gt({onClick:t}){const a=_(({globalCompany:s})=>s.company.id),n=_(({auth:s})=>s.user.user?.id),l=s=>{s.stopPropagation(),We.track("delivery_management_module_interest",{company_id:a,user_id:n}),t()};return e.createElement(z,{variant:"outlined",className:"whitespace-nowrap bg-white opacity-60",onClick:l,startIcon:e.createElement(Yt,null)},"Gestão de entregas")}function Ut({open:t,onClose:a}){return e.createElement(Oe,{open:t,onClose:a,BackdropProps:{style:{backgroundColor:"rgba(0,0,0,0.45)"}},PaperProps:{className:"shadow-lg rounded-12"},keepMounted:!1,maxWidth:"xl"},e.createElement(Ce,{className:"px-24 pb-0"},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("span",null,"Gestão de entregas"),e.createElement(Se,{style:{padding:9},onClick:a},e.createElement(Fe,null)))),e.createElement(Ie,{className:"p-0"},e.createElement("div",{className:"flex flex-col items-center space-y-24 px-24 pb-32"},e.createElement("img",{src:Ht,alt:"Locked Module",className:"h-512"}),e.createElement("div",{className:"flex max-w-lg flex-col items-center space-y-20 text-center text-gray-700"},e.createElement("div",{className:"text-20 font-bold sm:text-24"},"Conhece o nosso ",e.createElement("span",{style:{color:"#ED9521"}},"Módulo de gestão de entregas"),"?"),e.createElement("div",{className:"text-16 font-light text-gray-600 sm:text-18"},"Tenha controle total das suas entregas com visualização no mapa, link do entregador, roteirização automática, relatórios completos e muito mais!"),e.createElement("div",{className:"flex flex-col space-y-4 text-18 font-bold text-gray-600 sm:text-20"},e.createElement("span",null,"Gostaria de ter esse módulo? "),e.createElement("span",{style:{color:"#ED9521"}},"Fale com o nosso suporte!"))))))}const Jt=e.lazy(()=>B.smartImport(()=>Ye(()=>import("./index-wnI_Ult4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))));function Kt(){const[t,a]=e.useState(!1),[n,l]=e.useState(!1),[s,o]=e.useState(!1),E=k("(min-width:1050px)"),{hasModule:m}=ae(),c=e.useMemo(()=>({isDialogOpen:t,openDialog:()=>a(!0),closeDialog:()=>a(!1),loading:s,setLoading:o}),[s,t]);return E?m(ne.DELIVERY_MANAGEMENT_MODULE)?e.createElement($t,{value:c},e.createElement(A.Suspense,null,e.createElement(Jt,null)),e.createElement(Vt,null)):e.createElement(e.Fragment,null,e.createElement(Gt,{onClick:()=>{l(!0)}}),e.createElement(Ut,{open:n,onClose:()=>{l(!1)}})):null}function Qt(t){switch(t){case"delivery":return e.createElement(V,null);case"takeout":return e.createElement(Me,null);case"onsite":return e.createElement(Te,null);case"closed_table":return e.createElement(Le,null);default:return e.createElement(V,null)}}function ve({order:t}){if(!t||!Object.keys(F).includes(t.sales_channel))return null;const a=F[t.sales_channel];if(!a)return null;const{icon:n,iconSizeClass:l}=a;return n&&e.createElement(n,{className:l})}function Xt({order:t}){const a=P(),n=e.useCallback(l=>a(He(l)),[a]);return e.createElement("div",{className:"flex min-w-320 items-center justify-center space-x-16 text-gray-600"},e.createElement("div",null,e.createElement(De,null,Qt(t.checkout.orderType))),e.createElement("div",{className:"flex-1"},e.createElement("div",{className:"flex items-center text-15"},e.createElement("div",{className:"max-w-full truncate font-semibold capitalize text-gray-700"},t.checkout.client_name||t.checkout.client?.name||"Cliente não identificado")),t.checkout.scheduled_date&&t.checkout.scheduled_period?e.createElement("span",{className:"mt-4 flex items-center space-x-8"},e.createElement(ve,{order:t}),e.createElement("span",{className:"flex items-center text-14",style:{color:"rgba(0, 0, 0, 0.54)",lineHeight:1.43}},e.createElement(le,{fontSize:"small",className:"mr-4"},"event"),` ${U(t.checkout.scheduled_date,"YYYY/MM/DD").format("DD/MM")} (${t.checkout.scheduled_period})`)):e.createElement("span",{className:"mt-4 flex items-center space-x-8 text-gray-500"},e.createElement(ve,{order:t}),e.createElement("span",null,`Total ${B.formatMonetaryValue(t.total+t.checkout.deliveryFeeDetails.value)}`))),e.createElement(Ge,{tooltip:"Excluir pedido salvo",onClick:l=>{l.stopPropagation(),n(t.id)}},e.createElement(Ue,null)))}const Zt={type:"desktop",orientation:"landscape"};function re(){const[t,a]=A.useState(Zt),n=k("(max-width: 480px)"),l=k("(min-width: 480px) and (max-width: 650px)"),s=k("(min-width: 650px) and (max-width: 850px)"),o=k("(min-width: 850px) and (max-width: 1600px)"),E=k("(min-width: 1600px)"),m=k("(orientation: portrait)");return A.useEffect(()=>{const c=m?"portrait":"landscape";let p=null;n?p="xsDevice":l?p="phone":s?p="tablet":o?p="desktop":p="xlDevice",a({type:p,orientation:c})},[n,l,s,o,E,m]),t}const ea=W({paper:{border:"1px solid #d3d4d5",padding:0}})(t=>e.createElement(se,{elevation:0,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...t})),ta=W(t=>({root:{"&:hover":{cursor:"default",backgroundColor:"#fff"}}}))(ze);function aa(){const t=P(),a=Re(),n=re(),{hasModule:l}=ae(),[s,o]=e.useState(!1),E=_(({lastOrders:u})=>u.status),m=_(({lastOrders:u})=>u.searchText),c=_(({placeOrder:u})=>u?.placeOrder?.savedOrders),[p,d]=e.useState(null),[g,y]=e.useState(null),r=k("(min-width:1280px)");e.useEffect(()=>{o(n.type!=="desktop"&&n.type!=="xlDevice")},[n]);const h=u=>{d(u.currentTarget)},b=()=>{d(null)},x=u=>{y(u.currentTarget)},N=()=>{y(null)},j=u=>{t(Qe(u.target.value))},I=(u,O)=>{O!==null&&t(Ze(u,O))},q=u=>{t(Xe(u))&&(N(),a.push("/latest-orders/fazer-pedido"))};return e.createElement("div",{className:"flex flex-1 items-center justify-between"},e.createElement("div",{className:"mr-20 flex w-full items-center"},e.createElement(J,{variant:"outlined",className:"mr-12 flex w-full max-w-384 flex-1 items-center space-x-8 rounded-6 border border-solid border-gray-200 bg-gray-50 px-8 py-1 text-16 text-gray-600 sm:w-288",elevation:1},e.createElement(le,{className:"mr-8",color:"action"},"search"),e.createElement(Je,{placeholder:"Pesquise por cliente ou número do pedido",className:"flex flex-1 text-16 text-gray-600",disableUnderline:!0,fullWidth:!0,value:m,onChange:j})),l(ne.PDV_MODULE)&&e.createElement("div",{className:"flex h-36 flex-1 space-x-12"},e.createElement(z,{variant:"contained",color:"primary",size:"small",className:!s&&!c?.length>0?"min-w-160":"min-w-auto",disableRipple:!0,disableElevation:!0,startIcon:!s&&!c?.length>0&&e.createElement(ce,null),onClick:()=>{a.push("/latest-orders/fazer-pedido")}},s||c?.length>0?e.createElement(ce,null):"Novo Pedido"),c?.length>0&&e.createElement(e.Fragment,null,e.createElement(Dt,{anchorOrigin:{vertical:"top",horizontal:"right"},color:"primary",invisible:c.length<2,badgeContent:c.length},e.createElement(z,{"aria-haspopup":"true",variant:"outlined",className:"h-36 min-w-auto",color:"primary",size:"small",disableRipple:!0,disableElevation:!0,onClick:u=>c.length===1?q(c[0].id):x(u),startIcon:!s&&e.createElement(oe,{fontSize:"small"})},s?e.createElement(oe,{fontSize:"small"}):"Continuar Pedido")),e.createElement(se,{anchorEl:g,open:!!g,onClose:N,getContentAnchorEl:null,elevation:0,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:{className:"border-1 border-solid border-grey-border mt-8 shadow rounded-8",elevation:0}},c.map(u=>e.createElement(ze,{key:u.id,onClick:()=>q(u.id),className:"py-12 pl-16 pr-12"},e.createElement(Xt,{key:u.id,order:u}))))))),e.createElement("div",{className:"flex space-x-12"},e.createElement(Kt,null),!s&&e.createElement(z,{"aria-haspopup":"true",variant:"outlined",className:"min-w-192 bg-white",onClick:h,startIcon:e.createElement(qt,null)},"Ajustar layout")),e.createElement(ea,{id:"customized-menu",anchorEl:p,open:!!p,onClose:b,className:"mt-4 p-0"},Object.values(E).map(u=>e.createElement(ta,{key:u.name,className:"min-w-320 py-8",disableRipple:!0},e.createElement(Ae,{primary:u.name}),e.createElement(qe,null,r?e.createElement(pe,{size:"small",value:u.option,exclusive:!0,onChange:(O,D)=>I(u.status,D)},e.createElement(L,{value:1},e.createElement("div",{className:"min-w-16"},"1")),e.createElement(L,{value:2},e.createElement("div",{className:"min-w-16"},"2")),e.createElement(L,{value:3,disabled:u.alwaysVisible},e.createElement(ie,{fontSize:"small"}))):e.createElement(pe,{size:"small",value:u.option===2?1:u.option,exclusive:!0,onChange:(O,D)=>I(u.status,D)},e.createElement(L,{value:1},e.createElement(Ke,{fontSize:"small"})),e.createElement(L,{value:3,disabled:u.alwaysVisible},e.createElement(ie,{fontSize:"small"}))))))))}var R={},he;function na(){if(he)return R;he=1;var t=Q(),a=X();Object.defineProperty(R,"__esModule",{value:!0}),R.default=void 0;var n=a(Z()),l=t(ee()),s=(0,l.default)(n.createElement("path",{d:"M8.1 13.34l2.83-2.83-6.19-6.18c-.48-.48-1.31-.35-1.61.27-.71 1.49-.45 3.32.78 4.56l4.19 4.18zm6.78-1.81c1.53.71 3.68.21 5.27-1.38 1.91-1.91 2.28-4.65.81-6.12-1.46-1.46-4.2-1.1-6.12.81-1.59 1.59-2.09 3.74-1.38 5.27l-9.05 9.05c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 14.41l6.18 6.18c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 13l1.47-1.47z"}),"LocalDiningRounded");return R.default=s,R}var la=na();const sa=te(la);async function ra(t,a){return(await et.post("/api/v1/company/setting/change_multiple_delivery_rules",{deadline:t,operation:a})).data}function $({icon:t,text:a,handleClick:n}){return e.createElement("div",{className:"flex flex-shrink-0 cursor-pointer items-center justify-center space-x-6 rounded-6 bg-gray-200 p-4 text-14 font-bold text-gray-500 opacity-100 transition-colors hover:bg-gray-300",onClick:n},e.createElement("div",{className:"flex items-center"},t),e.createElement("div",{className:"rounded-4 bg-white px-8 py-4 font-bold"},a))}
4function xe({title:t,description:a,field:n="delivery",time:l,mutate:s,isLoading:o,preparation:E}){const m=tt(),[c,p]=e.useState(!1),d=re(),[g,y]=e.useState(!1),r=P(),h=e.useCallback(async(b,x)=>{y(!0);try{if(n==="delivery")await ra(b,x),await s(),m.success("Salvo com sucesso!");else{const N=x==="+"?E+b:E-b;N>=0?(await r(Tt({preparation_time:N})),await Promise.all([r(at()),s()])):m.info("O tempo de preparo não pode ser negativo")}}catch{m.error("Não foi possível salvar as alterações")}y(!1)},[n,s,E,m,r]);return e.useEffect(()=>{p(d.type!=="desktop"&&d.type!=="xlDevice")},[d]),e.createElement("div",{className:"space-y-16 p-12 text-16 text-gray-700"},e.createElement("div",{className:"space-y-8"},e.createElement("div",{className:"font-bold"},t),e.createElement("div",{className:"font-light"},a)),c&&e.createElement("div",{className:"max-w-128 whitespace-nowrap rounded-6 bg-gray-200 px-12 py-6 text-15 font-bold sm:max-w-224"},l),e.createElement("div",{className:"flex w-full items-center space-x-12 text-gray-600"},e.createElement($,{icon:e.createElement(ue,{className:"text-20"}),text:"10 min",handleClick:()=>h(10,"-")}),e.createElement($,{icon:e.createElement(ue,{className:"text-20"}),text:"5 min",handleClick:()=>h(5,"-")}),!c&&e.createElement("div",{className:"max-w-220 whitespace-nowrap rounded-6 bg-gray-200 px-12 py-6 text-15 font-bold"},l),e.createElement($,{icon:e.createElement(me,{className:"text-20"}),text:"5 min",handleClick:()=>h(5,"+")}),e.createElement($,{icon:e.createElement(me,{className:"text-20"}),text:"10 min",handleClick:()=>h(10,"+")})),(g||o)&&e.createElement("div",{className:"absolute inset-0 z-999 flex flex-col items-center justify-center bg-white opacity-75"},e.createElement(nt,{color:"primary"})))}function ca(){const{data:t,error:a,mutate:n,isLoading:l}=lt("/api/v2/company/delivery_and_preparation_time",st,{dedupingInterval:12e4});return{data:t,isLoading:l,isError:a,mutate:n}}function oa(){const[t,a]=e.useState(null),{data:n,isLoading:l,mutate:s}=ca(),o=_(({globalCompany:g})=>g.company?.flags?.enable_map_on_delivery_fee_setup),E=()=>{a(null)},m=g=>{a(g.currentTarget)};if(!o)return null;const c=(n?.delivery_min||0)+(n?.preparation||0),p=(n?.delivery_max||0)+(n?.preparation||0),d=c===p?`${c} min`:`${c} - ${p} min`;return e.createElement(e.Fragment,null,e.createElement("div",{className:"flex flex-shrink-0 cursor-pointer items-center justify-center space-x-12 overflow-hidden rounded-6 bg-gray-200 p-4 pr-6 font-bold text-gray-500 transition-colors hover:bg-gray-300",onClick:m},e.createElement("div",{className:"flex"},e.createElement("div",{className:"flex items-center pl-4 pr-8"},e.createElement(sa,{className:"h-20 w-20 py-0"})),e.createElement("div",{className:"rounded-4 bg-white px-8 py-1 text-14"},l?e.createElement("div",{className:"flex w-full animate-pulse flex-col items-center space-y-12 py-1"},e.createElement("div",{className:"flex h-16 w-52 items-center justify-center rounded-4 bg-gray-200"})):`${n?.preparation||0} min`)),e.createElement("div",{className:"flex"},e.createElement("div",{className:"flex items-center pr-8"},e.createElement(rt,{className:"h-20 w-20 py-0"})),e.createElement("div",{className:"rounded-4 bg-white px-8 py-1 text-14"},l?e.createElement("div",{className:"flex w-full animate-pulse flex-col items-center space-y-12 py-1"},e.createElement("div",{className:"flex h-16 w-52 items-center justify-center rounded-4 bg-gray-200"})):d))),e.createElement(se,{anchorEl:t,open:!!t,onClose:E,getContentAnchorEl:null,elevation:0,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:{className:"border-1 border-solid border-grey-border mt-8 shadow rounded-8 w-full sm:max-w-640",elevation:0}},e.createElement(xe,{title:"Tempo de preparo",description:"Este tempo serve para pedidos de retirada e ele é somado ao tempo de entrega em todas as áreas de entrega.",field:"takeout",time:`${n?.preparation||0} min`,preparation:n?.preparation||0,mutate:s,isLoading:l}),e.createElement(xe,{title:"Tempo de entrega",description:"Este intervalo indica o menor e o maior tempo de entrega em todas as áreas, já considerando o tempo de preparo. Modificações resultarão no aumento ou redução do tempo de entrega em todas as áreas.",field:"delivery",t
4ime:d,preparation:n?.preparation||0,mutate:s,isLoading:l})))}function ia(t,a){t=t.replace(/^#/,"");const n=parseInt(t,16),l=n>>16&255,s=n>>8&255,o=n&255;return`rgba(${l}, ${s}, ${o}, ${a})`}function G({children:t,textColor:a,value:n,color:l,selected:s,onClick:o,opacity:E=.6}){return e.createElement("div",{style:{backgroundColor:ia(l,E),color:a},className:Pe("flex min-w-0 flex-shrink-0 cursor-pointer items-center overflow-hidden rounded-6 bg-white p-4 text-12 font-bold transition-colors",s?"opacity-100":"opacity-30"),onClick:o},n>=0&&e.createElement("div",{className:"pl-8 pr-12"},n),e.createElement("div",{className:"rounded-4 bg-white px-12 py-4"},t))}const ua=[{status:i.scheduled_confirmed.status,requirement:[i.scheduled_confirmed.status]},{status:i.waiting_confirmation.status,requirement:[i.waiting_confirmation.status]},{status:i.pending_payment.status,requirement:[i.pending_payment.status,i.pending_online_payment.status]},{status:i.confirmed.status,requirement:[i.confirmed.status]},{status:i.released.status,requirement:[i.released.status]},{status:i.waiting_to_catch.status,requirement:[i.waiting_to_catch.status]},{status:i.delivered.status,requirement:[i.delivered.status]},{status:i.canceled.status,requirement:[i.canceled.status,i.canceling.status,i.waiting_cancellation_approval.status]}];function ma({lastOrders:t,orderStatusFilter:a,setOrderStatusFilter:n,ordersLength:l,orderSalesChannelFilter:s,setOrderSalesChannelFilter:o}){const{hasModule:E}=ae(),m=_(({globalCompany:r})=>r.company?.flags?.enable_map_on_delivery_fee_setup),c=e.useCallback((r,h)=>{h.forEach(b=>{r(x=>x.includes(b)?x.filter(N=>N!==b):[...x,b])})},[]);function p(r){if(s.includes(r)){const h=s.filter(b=>b!==r);return o(h)}return s.length===1?o([]):o([...s,r])}const d=e.useMemo(()=>Lt(Object.values(t),"status"),[t]),g=e.useCallback(({id:r})=>{let h=[r];[i.pending_payment.status,i.pending_online_payment.status].includes(r)&&(h=[i.pending_payment.status,i.pending_online_payment.status]),[i.canceled.status,i.canceling.status,i.waiting_cancellation_approval.status].includes(r)&&(h=[i.canceled.status,i.canceling.status,i.waiting_cancellation_approval.status]);const b=h.map(x=>d[x]||0).reduce((x,N)=>x+N,0);return e.createElement(G,{key:r,value:b,color:i[r].color,textColor:i[r].textColor,onClick:()=>c(n,h),selected:!a.length||a.includes(r)},i[r].name)},[a,d,c,n]),y=ua.filter(r=>r.requirement.some(h=>d[h]>0));return y.length?e.createElement("div",{className:"flex w-full gap-12 overflow-x-auto"},e.createElement(oa,null),E(ne.IFOOD)&&l?.ifoodCount>0&&e.createElement("div",{className:"flex gap-12"},m&&e.createElement("div",{className:"my-2 max-h-full rounded-2 bg-gray-200",style:{width:2}}),e.createElement(G,{opacity:1,value:l?.internalCount||0,color:"#E4E7EB",textColor:"#6A7280",onClick:()=>p("platform"),selected:!s.length||s.includes("platform")},"Plataforma"),e.createElement(G,{value:l?.ifoodCount||0,color:"#EA1D2C",textColor:"#800000",onClick:()=>p("ifood"),selected:!s.length||s.includes("ifood")},"iFood"),e.createElement("div",{className:"my-2 max-h-full rounded-2 bg-gray-200",style:{width:2}})),e.createElement("div",{className:"flex gap-12"},y.map(r=>e.createElement(g,{key:r.status,id:r.status})))):null}function da(){return e.createElement("div",{className:"sk-cube-grid"},e.createElement("div",{className:"sk-cube sk-cube1 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube2 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube3 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube4 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube5 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube6 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube7 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube8 bg-gray-300"}),e.createElement("div",{className:"sk-cube sk-cube9 bg-gray-300"}))}const fa=e.memo(({order:t,onUpdate:a})=>{const n=Y(),l=_(({orderListener:s})=>s?.lastOrders);return e.useEffect(()=>{const s=t?.id;s&&l&&l[s]&&t.updated_at<l[s].updated_at&&a()},[l,a,t,n]),null});function ye(){const t=Y(),{data:a,isLoading:n,isError:l,isValidating:s,mutate:o}=ct(t?.orderId);return t?.orderId?n?e.createElement("div",{className:"relative flex h-full w-full items-center justify-center"},e.createElement(da,null)):l?e.createElement("div",{className:"relative flex h-full w-full items-center justify-center"},e.createElement(it,{title:"Não foi possível buscar o pedido"})):e.createElement("div",{className:"relative flex h-full w-full"},e.createElement(fa,{order:a,onUpdate:o}),!n&&s&&e.createElement("div",{className:"absolute left-0 right-0 z-20 rounded-t-8"},e.createElement(ut,{color:"primary",className:"w-full"})),e.createElement(mt,{order:a,onlyRead:!1})):e.createElement("div",{className:"relative flex h-full w-full items-center justify-center"},e.createElement(ot,{title:"Nenhum pedido selecionado"}))}const pa=W(t=>({root:{height:66,paddingLeft:8,paddingRight:135},button:{"&:hover":{}},selected:{backgroundColor:"rgba(0,0,0,0.08) !important"}}))(t=>e.createElement(ft,{...t}));function be({order:t}){if(!t||!Object.keys(F).includes(t.sales_channel))return null;const a=F[t.sales_channel];if(!a)return null;const{icon:n,iconSizeClass:l,textColorClass:s}=a,o=t.external_display_id||t.ifood_display_id;return e.createElement("div",{className:"flex items-center space-x-6"},n&&e.createElement(n,{className:l}),e.createElement("div",{className:Pe("font-bold",s)},o),e.createElement(pt,{order:t}))}function ga({order:t,style:a}){const n=P(),l=Y(),s=_(({lastOrders:g})=>g.status),o=_(({orderListener:g})=>g?.nowTime),E=_(({orderListener:g})=>g?.serverDiffTimestamp),m=(g,y)=>{const r=U.duration(y.diff(g)).asMinutes();return r>60?`${parseInt(r/60)} h ${parseInt(r%60)} min`:`${parseInt(r)} min`},c=()=>{l.orderId===t.id.toString()?n(de()):n(de(t.id))};function p(g){switch(g){case"delivery":return e.createElement(V,null);case"takeout":return e.createElement(Me,null);case"onsite":return e.createElement(Te,null);case"closed_table":return e.createElement(Le,null);default:return e.createElement(V,null)}}const d=t.needs_action?"#c4b5fd":s[t.status].color;return e.createElement("div",{style:a},e.createElement(pa,{button:!0,selected:l.orderId===t.id.toString(),disableRipple:!0,onClick:c,style:{borderLeft:`5px solid ${d}`}},e.createElement(dt,{className:"mr-12 min-w-0"},e.createElement(De,null,p(t.order_type))),e.createElement(Ae,{primary:e.createElement("div",{className:"flex items-center text-15"},e.createElement("div",{className:"max-w-full truncate font-semibold capitalize text-gray-700"},t.client_name||t.client?.name||"Cliente não identificado"),e.createElement("div",{className:"ml-8 text-13 text-gray-500"},"#",t.order_number)),secondary:t.scheduled_date&&t.scheduled_period?e.createElement("span",{className:"mt-4 flex items-center space-x-8"},e.createElement(be,{order:t}),e.createElement("span",{className:"flex items-center text-14",style:{color:"rgba(0, 0, 0, 0.54)",lineHeight:1.43}},e.createElement(le,{fontSize:"small",className:"mr-4"},"event"),` ${U(t.scheduled_date,"YYYY/MM/DD").format("DD/MM")} (${t.scheduled_period})`)):e.createElement("span",{className:"mt-4 flex items-center space-x-8 text-gray-500"},e.createElement(be,{order:t}),e.createElement("span",null,B.formatMonetaryValue(t.final_value))),primaryTypographyProps:{className:"truncate font-600"}}),e.createElement(qe,{style:{right:12}},e.createElement("div",{className:"flex flex-col text-13",style:{minWidth:105}},e.createElement("span",{className:"px-3 py-1 text-center text-gray-700"},m(B.correctTime(t.created_at,E),o)),e.createElement("span",{className:"mt-1 rounded-4 px-3 py-1 text-center text-gray-800",style:{backgroundColor:d}},t.needs_action?"Ação necessária":s[t.status].name)))),e.createElement(je,null))}const Ea=({data:t,index:a,style:n})=>{const l=t[a];return e.createElement(ga,{key:l.id,order:l,style:n})};function _e({orders:t}){return t?e.createElement("div",{className:"absolute inset-0 flex flex-col"},e.createElement("div",{className:"relative flex flex-1 flex-col overflow-auto overflow-x-hidden"},e.createElement(Rt,null,({height:a,width:n})=>e.createElement(gt,{className:"h-full w-full p-0"}
4,e.createElement(Et,{className:"List",height:a,itemCount:Object.values(t).length,itemSize:66,width:n,itemData:Object.values(t)},Ea))))):null}const va={searchText:"",status:$e(i),selectedOrder:null,loading:!1},ha=(t=va,a)=>{switch(a.type){case bt:return{...t,searchText:a.payload};case yt:{const n={...t,status:{...t.status,[a.status]:{...t.status[a.status],option:a.option}}},l={};return Object.entries(n.status).forEach(([s,o])=>l[s]=o.option),localStorage.setItem("cardapio_web_layout_order",JSON.stringify(l)),n}case xt:return{...t,status:$e(a.payload)};case ht:return{...t,loading:!0};case vt:return{...t,loading:!1};default:return t}},xa=t=>({root:{margin:0,padding:t.spacing(2)},closeButton:{position:"absolute",right:t.spacing(1),top:t.spacing(1),color:t.palette.grey[500]}}),Ne=t=>t&&typeof t=="string"?Ot(Ct(t.toLowerCase())):"",ya=W(xa)(t=>{const{children:a,classes:n,onClose:l,...s}=t;return e.createElement(Ce,{disableTypography:!0,className:n.root,...s},e.createElement(K,{variant:"h6"},a),l?e.createElement(Se,{"aria-label":"close",className:n.closeButton,onClick:l},e.createElement(It,null)):null)});function we(t,a){if(t.needs_action!==a.needs_action)return a.needs_action-t.needs_action;const n=i[t.status].priority-i[a.status].priority;if(n===0){const{priority:l}=i[t.status],{order:s,orderBy:o}=St[l],E=(m,c,p,d)=>{if(!p||Array.isArray(p)&&p.length===0||!d||Array.isArray(d)&&d.length===0)return 0;const g=Array.isArray(p)?[...p]:[p],y=Array.isArray(d)?[...d]:[d],r=g.shift();return y.shift()==="desc"?c[r]===m[r]?E(m,c,g,y):c[r]<m[r]?1:-1:c[r]===m[r]?E(m,c,g,y):c[r]>m[r]?1:-1};return E(t,a,o,s)}else return n}function ke(){return"Seus pedidos aparecerão aqui"}function ba(){const t=P(),[a,n]=e.useState([]),[l,s]=e.useState(!1),o=_(({orderListener:v})=>v?.lastOrders),E=_(({lastOrders:v})=>v?.searchText),m=_(({lastOrders:v})=>v.status),[c,p]=e.useState(null),[d,g]=e.useState(null),[y,r]=e.useState(""),[h,b]=e.useState(""),[x,N]=e.useState([]),j=k("(min-width:1350px)"),I=re(),q=Re(),u=Y();e.useEffect(()=>{const v=setTimeout(()=>{zt()},2e3);return()=>{clearTimeout(v),At()}},[]),e.useEffect(()=>{s(I.type!=="desktop"&&I.type!=="xlDevice")},[I]),e.useEffect(()=>{if(o&&m){let v=[],C=[],S=[];if(E){const f=Ne(E);v=Object.values(o).filter(w=>Ne(w.client_name).includes(f)||w.order_number?.toString().includes(f)||w.ifood_display_id?.toString().includes(f)||w.external_display_id?.toString().includes(f)).sort(we)}else v=Object.values(o).sort(we);if(a.length>0&&(v=v.filter(f=>a.includes(f.status))),x.length>0){const f=x.includes("platform"),w=x.includes("ifood");f&&!w&&(v=v.filter(H=>H.sales_channel!=="ifood")),w&&!f&&(v=v.filter(H=>H.sales_channel==="ifood"))}if(j?(C=Object.values(m).filter(f=>f.option===1).map(f=>f.status),S=Object.values(m).filter(f=>f.option===2).map(f=>f.status),r(ke()),b(ke())):(C=Object.values(m).filter(f=>f.option===1||f.option===2).map(f=>f.status),r("Seus pedidos aparecerão aqui")),C.length>0){const f=v.filter(w=>C.includes(w.status));p(f)}else p(null);if(S.length>0){const f=v.filter(w=>S.includes(w.status));g(f)}else g(null)}},[o,m,a,j,E,x]),e.useEffect(()=>{t(Nt())},[t]);const O=()=>{q.push("/latest-orders")},D=e.useMemo(()=>{const v=Object.keys(fe).concat("internal").reduce((C,S)=>{const f=`${S}Count`;return C[f]=0,C},{});return o&&Object.values(o).forEach(S=>{if(Object.keys(fe).includes(S.sales_channel)){const f=`${S.sales_channel}Count`;v[f]++}else v.internalCount++}),v},[o]);return!c&&!d?e.createElement(wt,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"mx-8 mb-12 mt-20 space-y-12 rounded-6 border border-solid border-grey-border bg-white p-12 sm:mx-28"},e.createElement(aa,null),e.createElement(ma,{lastOrders:o,orderStatusFilter:a,setOrderStatusFilter:n,ordersLength:D,orderSalesChannelFilter:x,setOrderSalesChannelFilter:N})),e.createElement("div",{className:"flex h-full flex-1 px-0 py-0 pt-0 sm:px-28 sm:pb-20"},e.createElement(J,{className:`flex w-full overflow-hidden rounded-4 ${!l&&"sm:w-1/2"} ${c&&d?"lg:w-3/5":"lg:w-1/3"}`,variant:"outlined"},c&&e.createElement("div",{className:"relative flex w-full flex-1"},c.length>0?e.createElement(_e,{orders:c}):e.createElement("div",{className:"mx-40 flex h-full flex-1 items-center justify-center text-center"},e.createElement(K,{color:"textSecondary",variant:"h6"},y))),c&&d&&e.createElement(je,{orientation:"vertical",flexItem:!0}),d&&e.createElement("div",{className:"relative flex w-full flex-1"},d.length>0?e.createElement(_e,{orders:d}):e.createElement("div",{className:"mx-40 flex h-full flex-1 items-center justify-center text-center"},e.createElement(K,{color:"textSecondary",variant:"h6"},h)))),!l&&e.createElement(J,{className:"ml-16 flex flex-1 overflow-hidden rounded-4",variant:"outlined"},e.createElement(ye,null))),e.createElement(kt,{basePathname:"latest-orders"}),l&&e.createElement(Oe,{disableEnforceFocus:!0,fullScreen:l,open:!!u.orderId,className:"max-w-full",onClose:O},e.createElement(ya,{onClose:O},"Detalhes do pedido"),e.createElement(Ie,{className:"relative h-full max-w-full p-0"},e.createElement(ye,null))),e.createElement(Mt,null))}const _a=_t("lastOrders",ha)(ba),Ma=Object.freeze(Object.defineProperty({__proto__:null,default:_a},Symbol.toStringTag,{value:"Module"}));
4export{Ma as L,Bt as u};
5
6//# debugId=aaa91dfd-124b-5d2b-ba50-92c0afdf059c

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.