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]="35f3bf5e-42db-5ce9-bd77-009dbaeaeae6")}catch(e){}}(); 3import{r as l,w as he,i as N,_ as ve,f as ye,R as y,a8 as ee,a9 as be,aa as te,ab as je,j as n,y as f,ac as we,ad as Y,a0 as Ce,U as re,P as d,a2 as Z,x as Te,B as Me,D as De}from"./index-CVhO1mfm.js";import{u as I,g as Ee,c as Se,m as _,a as ae,P as Ne,b as Ie,K as _e,d as $e,e as Pe,T,f as ke,p as Oe,h as Le,M as Re,D as We,i as He}from"./pt-br-Cs7Pe8Tj.js";import{T as ze,a as J}from"./Tabs-BmQOOuI1.js";import{S as ne}from"./apiEndpoints-BbCkNzPE.js";import{u as ie}from"./useLogisticsPIN-DX0Kedau.js";import{S as Fe,a as Ve,E as Ge}from"./Error-BQ-LaZz6.js";_({toolbarLandscape:{flexWrap:"wrap"},toolbarAmpmLeftPadding:{paddingLeft:50},separator:{margin:"0 4px 0 2px",cursor:"default"},hourMinuteLabel:{display:"flex",justifyContent:"flex-end",alignItems:"flex-end"},hourMinuteLabelAmpmLandscape:{marginTop:"auto"},hourMinuteLabelReverse:{flexDirection:"row-reverse"},ampmSelection:{marginLeft:20,marginRight:-20,display:"flex",flexDirection:"column"},ampmLandscape:{margin:"4px 0 auto",flexDirection:"row",justifyContent:"space-around",flexBasis:"100%"},ampmSelectionWithSeconds:{marginLeft:15,marginRight:10},ampmLabel:{fontSize:18}},{name:"MuiPickersTimePickerToolbar"});function Ae(t,e,r){var a=I(),i=Ee(t,a),o=l.useCallback(function(c){var s=Se(t,c,!!e,a);r(s,!1)},[e,t,r,a]);return{meridiemMode:i,handleMeridiemChange:o}}var Be=[0,1,2,3,4,5,6,7,8,9,10],Ue=["auto",!0,1,2,3,4,5,6,7,8,9,10,11,12];function Ke(t,e,r){var a={};Ue.forEach(function(i){var o="grid-".concat(r,"-").concat(i);if(i===!0){a[o]={flexBasis:0,flexGrow:1,maxWidth:"100%"};return}if(i==="auto"){a[o]={flexBasis:"auto",flexGrow:0,maxWidth:"none"};return}var c="".concat(Math.round(i/12*1e8)/1e6,"%");a[o]={flexBasis:c,flexGrow:0,maxWidth:c}}),r==="xs"?N(t,a):t[e.breakpoints.up(r)]=a}function D(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=parseFloat(t);return"".concat(r/e).concat(String(t).replace(String(r),"")||"px")}function Ye(t,e){var r={};return Be.forEach(function(a){var i=t.spacing(a);i!==0&&(r["spacing-".concat(e,"-").concat(a)]={margin:"-".concat(D(i,2)),width:"calc(100% + ".concat(D(i),")"),"& > $item":{padding:D(i,2)}})}),r}var Ze=function(e){return N({root:{},container:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",width:"100%"},item:{boxSizing:"border-box",margin:"0"},zeroMinWidth:{minWidth:0},"direction-xs-column":{flexDirection:"column"},"direction-xs-column-reverse":{flexDirection:"column-reverse"},"direction-xs-row-reverse":{flexDirection:"row-reverse"},"wrap-xs-nowrap":{flexWrap:"nowrap"},"wrap-xs-wrap-reverse":{flexWrap:"wrap-reverse"},"align-items-xs-center":{alignItems:"center"},"align-items-xs-flex-start":{alignItems:"flex-start"},"align-items-xs-flex-end":{alignItems:"flex-end"},"align-items-xs-baseline":{alignItems:"baseline"},"align-content-xs-center":{alignContent:"center"},"align-content-xs-flex-start":{alignContent:"flex-start"},"align-content-xs-flex-end":{alignContent:"flex-end"},"align-content-xs-space-between":{alignContent:"space-between"},"align-content-xs-space-around":{alignContent:"space-around"},"justify-content-xs-center":{justifyContent:"center"},"justify-content-xs-flex-end":{justifyContent:"flex-end"},"justify-content-xs-space-between":{justifyContent:"space-between"},"justify-content-xs-space-around":{justifyContent:"space-around"},"justify-content-xs-space-evenly":{justifyContent:"space-evenly"}},Ye(e,"xs"),e.breakpoints.keys.reduce(function(r,a){return Ke(r,e,a),r},{}))},Je=l.forwardRef(function(e,r){var a=e.alignContent,i=a===void 0?"stretch":a,o=e.alignItems,c=o===void 0?"stretch":o,s=e.classes,m=e.className,x=e.component,u=x===void 0?"div":x,h=e.container,p=h===void 0?!1:h,b=e.direction,j=b===void 0?"row":b,v=e.item,C=v===void 0?!1:v,w=e.justify,g=e.justifyContent,$=g===void 0?"flex-start":g,P=e.lg,k=P===void 0?!1:P,O=e.md,L=O===void 0?!1:O,R=e.sm,W=R===void 0?!1:R,H=e.spacing,z=H===void 0?0:H,F=e.wrap,V=F===void 0?"wrap":F,G=e.xl,A=G===void 0?!1:G,B=e.xs,U=B===void 0?!1:B,K=e.zeroMinWidth,fe=K===void 0?!1:K,pe=ve(e,["alignContent","alignItems","classes","className","component","container","direction","item","justify","justifyContent","lg","md","sm","spacing","wrap","xl","xs","zeroMinWidth"]),xe=ye(s.root,m,p&&[s.container,z!==0&&s["spacing-xs-".concat(String(z))]],C&&s.item,fe&&s.zeroMinWidth,j!=="row"&&s["direction-xs-".concat(String(j))],V!=="wrap"&&s["wrap-xs-".concat(String(V))],c!=="stretch"&&s["align-items-xs-".concat(String(c))],i!=="stretch"&&s["align-content-xs-".concat(String(i))],(w||$)!=="flex-start"&&s["justify-content-xs-".concat(String(w||$))],U!==!1&&s["grid-xs-".concat(String(U))],W!==!1&&s["grid-sm-".concat(String(W))],L!==!1&&s["grid-md-".concat(String(L))],k!==!1&&s["grid-lg-".concat(String(k))],A!==!1&&s["grid-xl-".concat(String(A))]);return l.createElement(u,N({className:xe,ref:r},pe))}),M=he(Ze,{name:"MuiGrid"})(Je),Qe=function(e){return y.createElement(ee,e,y.createElement("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),y.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),y.createElement("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"}))},Xe=function(e){return y.createElement(ee,e,y.createElement("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),y.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))},Q=function(e){return e==="date"||e==="year"?"date":"time"},qe=function(e){return e==="date"?"date":"hours"},et=_(function(t){var e=t.palette.type==="light"?t.palette.primary.main:t.palette.background.default;return{tabs:{color:t.palette.getContrastText(e),backgroundColor:e}}},{name:"MuiPickerDTTabs"}),se=function(e){var r=e.view,a=e.onChange,i=e.dateRangeIcon,o=e.timeIcon,c=et(),s=te(),m=s.palette.type==="light"?"secondary":"primary",x=function(h,p){p!==Q(r)&&a(qe(p))};return l.createElement(je,null,l.createElement(ze,{variant:"fullWidth",value:Q(r),onChange:x,className:c.tabs,indicatorColor:m},l.createElement(J,{value:"date",icon:l.createElement(l.Fragment,null,i)}),l.createElement(J,{value:"time",icon:l.createElement(l.Fragment,null,o)})))};se.defaultProps={dateRangeIcon:l.createElement(Xe,null),timeIcon:l.createElement(Qe,null)};var tt=_(function(t){return{toolbar:{paddingLeft:16,paddingRight:16,justifyContent:"space-around"},separator:{margin:"0 4px 0 2px",cursor:"default"}}},{name:"MuiPickerDTToolbar"}),oe=function(e){var r=e.date,a=e.openView,i=e.setOpenView,o=e.ampm,c=e.hideTabs,s=e.dateRangeIcon,m=e.timeIcon,x=e.onChange,u=I(),h=tt(),p=!c&&typeof window<"u"&&window.innerHeight>667,b=Ae(r,o,x),j=b.meridiemMode,v=b.handleMeridiemChange,C=te(),w=C.direction==="rtl";return l.createElement(l.Fragment,null,l.createElement(Pe,{isLandscape:!1,className:h.toolbar},l.createElement(M,{container:!0,justify:"center",wrap:"nowrap"},l.createElement(M,{item:!0,container:!0,xs:5,justify:"flex-start",direction:"column"},l.createElement("div",null,l.createElement(T,{variant:"subtitle1",onClick:function(){return i("year")},selected:a==="year",label:u.getYearText(r)})),l.createElement("div",null,l.createElement(T,{variant:"h4",onClick:function(){return i("date")},selected:a==="date",label:u.getDateTimePickerHeaderText(r)}))),l.createElement(M,{item:!0,container:!0,xs:6,justify:"center",alignItems:"flex-end",direction:w?"row-reverse":"row"},l.createElement(T,{variant:"h3",onClick:function(){return i("hours")},selected:a==="hours",label:u.getHourText(r,o)}),l.createElement(ke,{variant:"h3",label:":",className:h.separator}),l.createElement(T,{variant:"h3",onClick:function(){return i("minutes")},selected:a==="minutes",label:u.getMinuteText(r)})),o&&l.createElement(M,{item:!0,container:!0,xs:1,direction:"column",justify:"flex-end"},l.createElement(T,{variant:"subtitle1",selected:j==="am",label:u.getMeridiemText("am"),onClick:function(){return v("am")}}),l.createElement(T,{variant:"subtitle1",selected:j==="pm",label:u.getMeridiemText("pm"),onClick:function(){return v("pm")}})))),p&&l.createElement(se,{dateRangeIcon:s,timeIcon:m,view:a,onChange:i}))};function X(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,a)}return r}function rt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};
3e%2?X(r,!0).forEach(function(a){be(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):X(r).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}var le=rt({},Le,{wider:!0,orientation:"portrait",openTo:"date",views:["year","date","hours","minutes"]});function ce(t){var e=I();if(t.orientation!=="portrait")throw new Error("We are not supporting custom orientation for DateTimePicker yet :(");return{getDefaultFormat:function(){return Oe(t.format,t.ampm,{"12h":e.dateTime12hFormat,"24h":e.dateTime24hFormat})}}}var de=ae({useOptions:ce,Input:Ne,useState:Ie,DefaultToolbarComponent:oe}),at=ae({useOptions:ce,Input:_e,useState:$e,DefaultToolbarComponent:oe,getCustomProps:function(e){return{refuse:e.ampm?/[^\dap]+/gi:/[^\d]+/gi}}});de.defaultProps=le;at.defaultProps=le;function q({...t}){return n.jsx(de,{placeholder:"Selecione uma data",minDate:f().subtract(7,"day").startOf("day").toDate(),maxDate:f().endOf("day").toDate(),InputProps:{className:"bg-white text-gray-600"},InputLabelProps:{className:"text-gray-600"},format:"DD/MM/YYYY HH:mm",inputVariant:"outlined",cancelLabel:"Cancelar",variant:"dialog",color:"primary",ampm:!1,fullWidth:!0,...t})}const E=we(t=>({filters:{startDate:f().startOf("day").toDate(),endDate:f().endOf("day").toDate()},updateFilter:(e,r)=>t(a=>({...a,filters:{...a.filters,[e]:r}}))}));function me(t){return Y(t,(e,r)=>Array.isArray(e)?e.map(a=>`${r}[]=${a}`).join("&"):typeof e=="object"?Y(e,(a,i)=>Array.isArray(a)?a.map(o=>`${r}[${i}][]=${o}`).join("&"):`${r}[${i}]=${a}`).join("&"):!e&&e!==0||!r?null:`${r}=${e||e===0?e:""}`,"").filter(Boolean).join("&")}function nt(t,e){if(!t||!e)return null;const r=me({start_date:f(e.startDate).format(),end_date:f(e.endDate).format()});return`/api/menu/logistics/orders/${t}/history_summary?${r}`}function it(t){const e=ie(s=>{var m;return(m=s.deliveryMan)==null?void 0:m.uid}),{data:r,error:a,isLoading:i,isValidating:o,mutate:c}=Ce(nt(e,t),ne,{dedupingInterval:1e4});return{data:r,isLoading:i,isValidating:o,isError:a,mutate:c}}function st(){const t=E(s=>s.filters),e=E(s=>s.updateFilter),{data:r,isLoading:a,isValidating:i,isError:o}=it(t),c=y.useCallback(s=>a||i?n.jsx("div",{className:"h-7 w-20 animate-pulse rounded-md bg-gray-200"}):o?n.jsx("div",{className:"text-xl font-medium text-red-500",children:"Erro!"}):n.jsx("div",{className:"text-xl font-medium text-green-500",children:s}),[o,a,i]);return n.jsxs("div",{className:"space-y-4 px-3 py-5",children:[n.jsxs("div",{className:"space-y-4 text-gray-600",children:[n.jsx("div",{children:"Informe abaixo o perÃodo que deseja consultar"}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsx(q,{label:"InÃcio do perÃodo",value:t.startDate,onChange:s=>e("startDate",s)}),n.jsx(q,{label:"Fim do perÃodo",value:t.endDate,onChange:s=>e("endDate",s)})]})]}),n.jsx("div",{className:"mt-3 border-t border-dashed border-gray-300"}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsxs("div",{className:"flex-1 rounded-md border border-gray-300 bg-white p-3 text-gray-700",children:[c((r==null?void 0:r.total_orders)||0),n.jsx("span",{className:"text-sm text-gray-600",children:"Entregas no perÃodo"})]}),n.jsxs("div",{className:"flex-1 rounded-md border border-gray-300 bg-white p-3 text-gray-700",children:[c(re.formatMonetaryValue(r==null?void 0:r.total_delivery_man_fee)),n.jsx("span",{className:"text-sm text-gray-600",children:"Taxas no perÃodo"})]})]})]})}function ue({order:t}){const e=f(t.created_at).format("DD/MM [à s] HH:mm");return t?n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsx("div",{className:"rounded-md border border-solid border-gray-300 p-2 text-lg font-medium leading-none",children:t.order_number.toString().slice(-4)}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm font-medium leading-tight",children:t.client.name}),n.jsx("div",{className:"text-xs font-light",children:`Feito em ${e} ⢠#${t.id}`})]})]}):null}ue.propTypes={order:d.shape({id:d.number,order_number:d.number,created_at:d.string,client:d.shape({name:d.string})}).isRequired};function ge({order:t}){if(!t)return null;const e=t.delivery_address,r=e.house_number||"S/N",a=`${e==null?void 0:e.street}, ${r} - ${e==null?void 0:e.neighborhood}, ${e==null?void 0:e.city}`;return n.jsxs("div",{className:"space-y-2.5 rounded-md border border-divider bg-white p-3 text-gray-700",children:[n.jsx(ue,{order:t}),n.jsx("div",{className:"text-sm font-light",children:a}),n.jsxs("div",{className:"text-sm font-light",children:["Taxa do entregador:"," ",n.jsx("strong",{className:"font-medium",children:re.formatMonetaryValue(t.delivery_man_fee)})]}),n.jsxs("div",{className:"flex space-x-3",children:[t.delivery_route&&n.jsxs(Z,{color:"gray",children:["Rota ",t.delivery_route.name]}),n.jsx(Fe,{status:t.status}),t.order_delivery_date&&n.jsxs(Z,{color:"green",children:["Entregue em ",f(t.order_delivery_date).format("DD/MM [à s] HH:mm")]})]})]})}ge.propTypes={order:d.shape({order_number:d.number,delivery_man_fee:d.number,created_at:d.string,
3status:d.string,order_delivery_date:d.string,delivery_route:{id:d.number,name:d.string,orders_count:d.number,created_at:d.string},delivery_address:d.shape({street:d.string,house_number:d.string,neighborhood:d.string,city:d.string})}).isRequired};function ot(){return n.jsxs("div",{className:"space-y-2 rounded-md border border-divider bg-white p-3 text-gray-700",children:[n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsx("div",{className:"h-10 w-10 rounded-md bg-gray-200"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx("div",{className:"h-5 w-48 animate-pulse rounded-md bg-gray-200"}),n.jsx("div",{className:"h-4 w-40 animate-pulse rounded-md bg-gray-200"})]})]}),n.jsx("div",{className:"h-5 w-5/6 animate-pulse rounded-md bg-gray-200"}),n.jsx("div",{className:"h-5 w-40 animate-pulse rounded-md bg-gray-200"}),n.jsx("div",{className:"h-5 w-28 animate-pulse rounded-md bg-gray-200"})]})}const S=15,lt=(t,e)=>(r,a)=>{if(a&&!a.length)return null;const i=me({start_date:f(e.startDate).format(),end_date:f(e.endDate).format()}),o=`/api/menu/logistics/orders/${t}/order_history?${i}`;return r===0?`${o}&limit=${S}`:`${o}&cursor=${a[a.length-1].id}&limit=${S}`};function ct(t){var v,C;const e=ie(w=>{var g;return(g=w.deliveryMan)==null?void 0:g.uid}),{data:r,error:a,mutate:i,size:o,setSize:c,isValidating:s}=Te(e&&t?lt(e,t):null,ne,{dedupingInterval:12e4,revalidateFirstPage:!1,keepPreviousData:!0}),m=l.useCallback(()=>c(o+1),[c,o]),x=l.useMemo(()=>{try{return r?[].concat(...r):[]}catch{return[]}},[r]),u=e&&t&&!r&&!a,h=u||o>0&&r&&typeof r[o-1]>"u",p=((v=r==null?void 0:r[0])==null?void 0:v.length)===0,b=p||r&&((C=r[r.length-1])==null?void 0:C.length)<S,j=s&&r&&r.length===o;return{orders:x,isLoading:u,isError:a,isLoadingMore:h,isEmpty:p,isReachingEnd:b,isRefreshing:j,loadMore:m,refresh:i}}function dt(){const t=E(m=>m.filters),{orders:e,isEmpty:r,isError:a,isLoading:i,isReachingEnd:o,isLoadingMore:c,loadMore:s}=ct(t);return i?n.jsx("div",{className:"flex-1 space-y-4 px-3 pb-40",children:[1,2,3,4].map(m=>n.jsx(ot,{},m))}):r?n.jsx(Ve,{title:"Nenhuma entrega encontrada"}):a?n.jsx(Ge,{title:"Erro ao carregar as entregas"}):n.jsxs("div",{className:"flex-1 space-y-4 px-3 pb-40",children:[e==null?void 0:e.map(m=>n.jsx(ge,{order:m},m.id)),n.jsxs("div",{className:"pt-3",children:[(e==null?void 0:e.length)>0&&!o&&n.jsx(Me,{onClick:s,disabled:c,className:"text-gray-500",fullWidth:!0,children:c?n.jsx(De,{color:"primary",size:24}):"Carregar mais entregas"}),o&&n.jsx("div",{className:"text-center text-gray-500",children:"Todas as entregas foram carregadas"})]})]})}function ht(){return n.jsx(Re,{locale:He,utils:We,children:n.jsxs("div",{className:"overflow-auto",children:[n.jsx(st,{}),n.jsx(dt,{})]})})}export{ht as default}; 4 5//# debugId=35f3bf5e-42db-5ce9-bd77-009dbaeaeae6
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.