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]="a0b9eb7e-ddcd-5d64-a24f-738aa9e0842f")}catch(e){}}(); 3import{ay as C,q as m,j as e,bI as R,N as _,bJ as H,bK as L,bL as F,R as y,a as P,bM as $,y as p,bN as O,U as q,c as Y,P as i,t as g,B as D,bO as M,u as U,v as z,aD as W,ae as B,D as K}from"./index-CVhO1mfm.js";import{P as Q,a as V}from"./PermissionRequest-ChLiACfX.js";import{o as c,f as G,e as v,b as J,u as I,O as X}from"./index-C5Xw5HCy.js";import"./whatsappLink-CCcWEDnq.js";import"./Products-Clk528Gk.js";function Z(){const s=C(),r=m(({customerManagement:t})=>{var a,o;return(o=(a=t==null?void 0:t.main)==null?void 0:a.customerDetails)==null?void 0:o.have_password}),n=()=>{s(H())};return e.jsxs("div",{className:"cursor-pointer rounded-md border border-gray-100 bg-white hover:shadow-md",onClick:n,children:[e.jsxs("div",{className:"flex items-center space-x-4 p-3 sm:space-x-5 sm:p-4",children:[e.jsx("div",{className:"rounded-full bg-gray-100 p-2 text-gray-400 sm:p-3",children:e.jsx(R,{className:"h-10 w-10"})}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"text-lg font-semibold leading-6 text-gray-600",children:"Pedidos finalizados"}),r?e.jsx("div",{className:"text-msm text-gray-500 text-opacity-80",children:"Os pedidos finalizados são mostrados apenas após informar sua senha."}):e.jsx("div",{className:"text-msm text-gray-500 text-opacity-80",children:"Os pedidos finalizados são mostrados apenas após o cadastro de uma senha."})]}),e.jsx(_,{className:"text-xl text-gray-400"})]}),e.jsx("div",{className:"flex items-center justify-between space-x-3 border-t border-gray-200 border-opacity-50 p-4 pt-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"relative mr-3 flex h-3 w-3",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-gray-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-3 w-3 rounded-full bg-gray-400"})]}),r?e.jsx("span",{className:"text-msm font-semibold text-gray-600",children:"Informe sua senha"}):e.jsx("span",{className:"text-msm font-semibold text-gray-600",children:"Clique aqui e cadastre sua senha"})]})})]})}var T={exports:{}};(function(s,r){(function(n,t){s.exports=t()})(L,function(){return function(n,t,a){t.prototype.isToday=function(){var o="YYYY-MM-DD",l=a();return this.format(o)===l.format(o)}}})})(T);var ee=T.exports;const se=F(ee);p.extend(se);const te={delivery:"Delivery",takeout:"Retirada",onsite:"No local",closed_table:"Mesa"};function w(s){const r=O[p(s).month()];return p(s).isToday()?"[hoje], HH:mm":`D [de] [${r}], HH:mm`}function E({order:s}){const r=P(),n=m(({company:u})=>{var d;return(d=u.company.flags)==null?void 0:d.hide_order_status_from_client}),t=y.useMemo(()=>{var u;if(((u=s.status_changes)==null?void 0:u.length)>0){const d=$(s.status_changes,["id"],["desc"])[0];if(d){const b=w(d.created_at),x=s.status==="pending_payment"?"pending_payment":d.status;return{label:c[x].label,date:p(d.updated_at).format(b),textColor:c[x].textColor,bgColor:c[x].bgColor,Icon:c[x].Icon}}}return{label:c[s.status].label,date:p(s.created_at).format(w(s.created_at)),textColor:c[s.status].textColor,bgColor:c[s.status].bgColor,Icon:c[s.status].Icon}},[s.created_at,s.status,s.status_changes]),a=O[p(s.created_at).month()],o=p(s.created_at).format(`D [de] [${a}] [de] YYYY`),l=!s.has_satisfaction_survey&&s.status==="closed"&&!G(s.updated_at),j=l||s.status!=="closed"&&s.status!=="canceled";return e.jsxs("div",{className:"cursor-pointer rounded-md border border-gray-100 bg-white hover:shadow-md",onClick:()=>r.push({search:`?${J}=${s.uid}`}),children:[e.jsxs("div",{className:"flex items-center space-x-4 p-3 sm:space-x-5 sm:p-4",children:[e.jsx("div",{className:"rounded-full p-2 sm:p-3",style:{color:t.textColor,backgroundColor:t.bgColor},children:t.Icon&&e.jsx(t.Icon,{className:"h-10 w-10 fill-current"})}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"text-lg font-semibold leading-6 text-gray-600",children:["Pedido Nº ",s.order_number]}),e.jsxs("div",{className:"flex items-center text-msm text-gray-500 text-opacity-80",children:["Feito em ",o]}),e.jsxs("div",{className:"flex items-center space-x-4 text-msm text-gray-500 text-opacity-80",children:[e.jsxs("span",{children:["Tipo:"," ",e.jsx("strong",{className:"font-semibold text-gray-600",children:te[s.order_type]})]}),e.jsxs("span",{children:["Total:"," ",e.jsx("strong",{className:"font-semibold text-gray-600",children:q.formatMonetaryValue(s.final_value)})]})]})]}),e.jsx(_,{className:"text-xl",style:{color:t.textColor}})]}),l&&e.jsx("div",{className:"flex items-center justify-between space-x-3 border-t border-gray-200 border-opacity-50 p-4 pt-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"relative mr-3 flex",children:[e.jsx(v,{className:"absolute inline-flex animate-ping rounded-full text-xl text-yellow-300 opacity-75"}),e.jsx(v,{className:"relative inline-flex rounded-full text-xl text-yellow-300"})]}),e.jsx("span",{className:"text-msm font-medium text-yellow-400 text-opacity-80",children:"Avalie o pedido"})]})}),!l&&!n&&t&&e.jsxs("div",{className:"flex items-center justify-between space-x-3 border-t border-gray-200 border-opacity-50 p-4 pt-3",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"relative mr-3 flex h-3 w-3",children:[e.jsx("span",{className:Y("absolute inline-flex h-full w-full rounded-full opacity-75",j&&"animate-ping"),style:{backgroundColor:t.textColor}}),e.jsx("span",{className:"relative inline-flex h-3 w-3 rounded-full",style:{backgroundColor:t.textColor}})]}),e.jsx("span",{className:"text-msm text-gray-500 text-opacity-80",children:t.label})]}),s.status==="pending_payment"?e.jsx("span",{className:"flex-shrink-0 animate-pulse text-msm font-medium text-gray-700",style:{color:t.textColor},children:"Dirija-se ao caixa"}):e.jsx("span",{className:"flex-shrink-0 text-msm text-gray-500 text-opacity-80",children:t.date})]})]})}E.propTypes={order:i.shape({id:i.number,uid:i.string,order_number:i.number,status_changes:i.arrayOf(i.shape({status:i.string,created_at:i.string}
3)),order_type:i.string,created_at:i.string,status:i.string,final_value:i.number,has_satisfaction_survey:i.bool,updated_at:i.string}).isRequired};const S=y.memo(E);function A(){return e.jsxs("div",{className:"rounded-md border border-gray-100 bg-white",children:[e.jsxs("div",{className:"flex items-center space-x-4 p-3 sm:space-x-5 sm:p-4",children:[e.jsx("div",{className:"animate-pulse rounded-full bg-gray-200 p-2 sm:p-3",children:e.jsx("div",{className:"h-10 w-10 rounded-full bg-gray-200"})}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded-md bg-gray-200 sm:w-56"}),e.jsx("div",{className:"h-4 w-40 animate-pulse rounded-md bg-gray-200"}),e.jsx("div",{className:"h-4 w-36 animate-pulse rounded-md bg-gray-200"})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 border-opacity-50 p-4 pt-3",children:[e.jsxs("div",{className:"flex items-center py-0.5",children:[e.jsx("span",{className:"relative mr-3 h-3 w-3 animate-pulse rounded-md bg-gray-200"}),e.jsx("span",{className:"h-4 w-32 animate-pulse rounded-md bg-gray-200 sm:w-44"})]}),e.jsx("span",{className:"h-4 w-16 animate-pulse rounded-md bg-gray-200 py-0.5 sm:w-24"})]})]})}function ae(){const s=m(({customerManagement:a})=>a.main.currentState),r=m(({customerManagement:a})=>a.main.customerDetails.id),{orders:n,isLoading:t}=I(r);return s!==g.AUTHENTICATED?e.jsx(Z,{}):t?[1,2,3,4].map(a=>e.jsx(A,{},a)):n?n.map(a=>e.jsx(S,{order:a},a.id)):null}function re(){const s=C(),r=n=>{n.preventDefault(),s(M())};return e.jsx("div",{className:"flex h-80 w-full items-center justify-center",children:e.jsx("div",{className:"relative w-full max-w-xs overflow-hidden rounded-md border border-gray-200 bg-white p-4 sm:p-6",children:e.jsxs("form",{className:"flex flex-col justify-center space-y-8",children:[e.jsx("h3",{className:"text-center text-lg font-medium text-gray-700",children:"Identifique-se"}),e.jsx("div",{className:"mx-auto max-w-xs text-center text-sm text-gray-700",children:"Entre na sua conta para ter acesso aos seus pedidos"}),e.jsx(D,{variant:"contained",color:"primary",size:"large",fullWidth:!0,type:"submit",onClick:r,children:"Entrar"})]})})})}const ne=s=>z.get(s).then(r=>r.data);function k(s){const{data:r,error:n}=U(s?`/api/menu/company/client/${s}/pending_orders`:null,ne,{dedupingInterval:1e4,revalidateOnFocus:!1,refreshInterval:t=>(t==null?void 0:t.length)>0?3e4:12e4});return{orders:r,isLoading:!n&&!r,isError:n}}function ie(){const s=m(({customerManagement:t})=>t.main.customerDetails.id),{orders:r,isLoading:n}=k(s);return n?[1,2,3,4].map(t=>e.jsx(A,{},t)):r?r.map(t=>e.jsx(S,{order:t},t.id)):null}function ue(){const s=W("(min-width:1024px)"),r=m(({customerManagement:f})=>f.main.currentState),n=m(({customerManagement:f})=>f.main.customerDetails.id),t=m(({customerManagement:f})=>f.main.customerDetails.orders_quantity),{orders:a,isLoading:o}=k(n),{orders:l,isLoading:j,isLoadingMore:u,isReachingEnd:d,loadMore:b,refresh:x}=I(n),h=y.useRef(null);y.useEffect(()=>{if(a&&h.current===null){h.current=a.length;return}a&&a.length!==h.current&&(x(),h.current=a.length)},[x,a]);const N=!o&&!(a!=null&&a.length)>0&&(r===g.AUTHENTICATED&&!j&&!(l!=null&&l.length)>0||r!==g.AUTHENTICATED&&!t);return e.jsxs("div",{className:"mx-auto w-full max-w-screen-lg px-3 sm:px-8",children:[e.jsx("div",{className:"mt-6 flex items-center justify-between sm:mt-8",children:e.jsx("div",{className:"flex-shrink-0 text-2xl font-semibold text-gray-700 sm:text-3xl",children:"Seus pedidos"})}),N&&e.jsxs("div",{className:"flex h-100 flex-col items-center justify-center space-y-5 text-gray-400",children:[e.jsx(B,{className:"h-20 w-20 fill-current sm:h-24 sm:w-24"}),e.jsx("div",{className:"text-center text-lg font-semibold uppercase",children:"Nenhum pedido encontrado"})]}),!N&&(r===g.UNKNOWN?e.jsx("div",{className:"flex h-full w-full items-center justify-between",children:e.jsx(re,{})}):e.jsxs("div",{className:"mb-12",children:[e.jsxs("div",{className:"my-8 grid grid-cols-1 gap-4 md:grid-cols-2",children:[!s&&e.jsx(Q,{}),e.jsx(ie,{}),e.jsx(ae,{})]}),(l==null?void 0:l.length)>0&&!d&&e.jsx(D,{fullWidth:!0,onClick:b,disabled:u,className:"text-gray-500",children:u?e.jsx(K,{color:"primary",size:"1.5rem"}):"Ver mais pedidos"})]})),e.jsx(X,{}),s&&e.jsx(V,{})]})}
3export{ue as default}; 4 5//# debugId=a0b9eb7e-ddcd-5d64-a24f-738aa9e0842f
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.