1"use strict";(globalThis.webpackChunkclient=globalThis.webpackChunkclient||[]).push([[7467],{4845(e,t,n){n.d(t,{h:()=>i});n(65043);var o=n(12097),d=n(41987),r=n(70579);const a=(0,d.A)({root:{margin:"3px, 0px, 2px"}}),i=e=>{let{children:t,...n}=e;const d=a();return(0,r.jsx)(o.A,{type:"submit",fullWidth:!0,variant:"contained",color:"success",className:d.root,...n,children:t})}},27467(e,t,n){n.r(t),n.d(t,{default:()=>j});n(65043);var o=n(22166),d=(n(69622),n(47874)),r=n(71673),a=n(30064),i=n.n(a),s=n(87443),c=n(34375),l=n(81341),p=n(28259),h=n(10756),g=n(86172),u=n(94799),m=n(53089),x=(n(4845),n(70579));const j=()=>{const e=(0,o.wA)(),t=(0,o.d4)(e=>e.Order.orderAdmin),n=(0,o.d4)(e=>e.User.configsAdmin);if(!localStorage.getItem("userInfo"))return(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(d.N_,{to:"/loginadmin",children:(0,x.jsx)("h5",{children:"Debe estar logueado"})})});if(!t[0])return(0,x.jsx)(x.Fragment,{children:" Cargando... "});if("pending"===t[0].status)var a=new Date(t[0].createdAt);else a=new Date(t[0].updatedAt);var j=a;return(0,x.jsxs)(m.A,{spacing:2,direction:"column",alignItems:"center",children:[(0,x.jsx)(m.A,{item:!0,bgcolor:"lightgreen",children:(0,x.jsxs)("h5",{children:["Pedido ",t[0].id?t[0].id:"Tomando pedido..."," - ","pending"===t[0].status?"Pendiente":"Completo y entregado",(0,x.jsx)("br",{}),"pending"===t[0].status?"Ingreso "+j.toLocaleString():"Entregado "+j.toLocaleString()]})}),(0,x.jsxs)(m.A,{item:!0,children:[(0,x.jsx)("div",{children:t[0].client?"Cliente: "+t[0].client:"No hay pedido"}),(0,x.jsx)("div",{children:t[0].address?"Direcci\xf3n: "+t[0].address:"Sin direcci\xf3n"}),(0,x.jsx)("div",{children:t[0].cellphone?"Tel\xe9fono: "+t[0].cellphone:"Sin tel\xe9fono"})]}),(0,x.jsx)(m.A,{item:!0,children:(0,x.jsx)(p.A,{component:u.A,style:{marginTop:"20px",marginBottom:"20px"},children:(0,x.jsxs)(s.A,{children:[(0,x.jsx)(h.A,{bgcolor:"lightgreen",children:(0,x.jsxs)(g.A,{children:[(0,x.jsx)(l.A,{padding:"none",align:"center",width:1,children:"Cant."}),(0,x.jsx)(l.A,{padding:"none",align:"center",width:1}),(0,x.jsx)(l.A,{padding:"checkbox",align:"center",width:5,children:"Producto"}),(0,x.jsx)(l.A,{padding:"checkbox",align:"center",width:.5,children:"PU"}),(0,x.jsx)(l.A,{padding:"checkbox",align:"center",width:.5,children:"$"})]})}),(0,x.jsx)(c.A,{children:t[0].orderlines.map(e=>(0,x.jsxs)(g.A,{children:[(0,x.jsxs)(l.A,{scope:"row",padding:"none",align:"center",width:1,children:[Number.isInteger(e.quantity)?e.quantity:e.quantity.toFixed(3).replace(".",",")," "]}),(0,x.jsx)(l.A,{padding:"none",width:1,children:(0,x.jsx)("img",{className:"imageProduct",src:e.product?e.product.image:"https://res.cloudinary.com/dyejl1qrj/image/upload/v1638913622/motodelivery_r6mjqv.png"})}),(0,x.jsx)(l.A,{padding:"none",width:5,children:e.product?e.product.name:"Envio a domicilio"}),(0,x.jsx)(l.A,{padding:"none",align:"right",width:.5,children:Number(e.product?e.product.price:e.price).toFixed(2).replace(".",",")}),(0,x.jsx)(l.A,{padding:"none",align:"right",width:.5,children:(0,x.jsx)("b",{children:Number(e.subtotal).toFixed(2).replace(".",",")})})]},e.id))})]})})}),(0,x.jsxs)(m.A,{item:!0,children:[(0,x.jsx)("div",{className:"importePedido",children:t[0].subtotal?"Importe AR$: "+t[0].subtotal.toFixed(2).replace(".",","):0}),"pending"===t[0].status?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{children:!0===t[0].delivery?"Enviar a domicilio":"Retira en comercio"}),(0,x.jsx)("div",{children:!0===t[0].payd?"Pedido pagado"+t[0].payd_idml:"Paga al recibir pedido"})]}):(0,x.jsx)(x.Fragment,{children:" "})]}),(0,x.jsxs)(m.A,{item:!0,children:["pending"===t[0].status?(0,x.jsxs)("button",{className:"btn btn-primary",onClick:async n=>{n.preventDefault();const o={id:t[0].id,status:"preparing"};await e((0,r.Wf)(o)),window.history.go(-1)},children:[" ","Preparar"," "]}):"",(0,x.jsxs)("button",{className:"btn btn-secondary",onClick:()=>window.print(),children:[" ","Imprimir"," "]}),"pending"===t[0].status?(0,x.jsxs)("button",{className:"btn btn-info",onClick:o=>{o.preventDefault(),i().fire({title:"Realmente desea rechazar/anular pedido?",showDenyButton:!0,showCancelButton:!1,confirmButtonText:"S\xed",icon:"question"}).then(o=>{if(o.isConfirmed){const o={id:t[0].id,status:"rejected"};e((0,r.Wf)(o)),"true"===localStorage.getItem("orderPrepared")?i().fire({title:"El pedido ha sido rechazado",showDenyButton:!1,showCancelButton:!1,confirmButtonText:"Aceptar",icon:"success"}).then(e=>
1{e.isConfirmed&&(window.open("https://api.whatsapp.com/send?phone=54"+t[0].cellphone+"&text="+n.messagewareject),window.history.go(-1))}):i().fire({title:localStorage.getItem("orderPrepared"),showDenyButton:!1,showCancelButton:!1,confirmButtonText:"Aceptar",icon:"error"})}})},children:[" ","Rechazar"," "]}):"",(0,x.jsxs)("button",{className:"btn btn-link",onClick:()=>{window.history.go(-1)},children:[" ","Volver"," "]})]})]})}},69622(){},71673(e,t,n){n.d(t,{Oc:()=>i,Vd:()=>r,Wf:()=>c,o8:()=>l,r$:()=>a,t$:()=>s,ui:()=>p});var o=n(86213),d=n(31811);const r=e=>async t=>{try{const{data:n}=await o.A.get(`${d.dJ}orders`,{headers:{"x-access-token":e.token}});t({type:"GET_ALL_ORDERS",payload:n})}catch(a){var n,r;const e=(null===(n=a.response)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.message)||a.message;alert(e)}},a=(e,t)=>async n=>{try{const{data:r}=await o.A.get(`${d.dJ}orders/`+e,{headers:{"x-access-token":t.token}});n({type:"GET_ORDER_ADMIN",payload:r})}catch(i){var r,a;const e=(null===(r=i.response)||void 0===r||null===(a=r.data)||void 0===a?void 0:a.message)||i.message;alert(e)}};function i(e){return t=>o.A.post(`${d.dJ}orders/add`,e,{headers:{"x-access-token":e.token}}).then(e=>{t({type:"ADD_ORDER",payload:e.data.order.id}),localStorage.setItem("orderId",e.data.order.id)})}const s=(e,t)=>async n=>{try{const{data:r}=await o.A.get(`${d.dJ}orders/`+e,{headers:{"x-access-token":t}});n({type:"GET_ORDER",payload:r})}catch(i){var r,a;const e=(null===(r=i.response)||void 0===r||null===(a=r.data)||void 0===a?void 0:a.message)||i.message;alert(e)}},c=(e,t)=>async n=>{try{console.log("odere",e,"token",t);const{data:r}=await o.A.put(`${d.dJ}orders/updstatus`,e,{headers:{"x-access-token":t}});n({type:"PREP_ORDER_ADMIN",payload:r}),localStorage.setItem("orderPrepared",!0)}catch(i){var r,a;const e=(null===(r=i.response)||void 0===r||null===(a=r.data)||void 0===a?void 0:a.message)||i.message;localStorage.setItem("orderPrepared",e),console.log(e)}};function l(e){return t=>o.A.delete(`${d.dJ}orders/delete/${e}`).then(n=>{t({type:"DELETE_ORDER_GUEST",payload:e}),localStorage.setItem("orderDeleted",!0)}).catch(e=>{var t,n;const o=(null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.message)||e.message;localStorage.setItem("orderDeleted",o)})}function p(e,t){console.log("ORDERS",t);let n=[...t];return n.sort(function(t,n){var o=t.updatedAt,d=n.updatedAt;return"Update-A-Z"===e?o<d?-1:o>d?1:0:"Update-Z-A"===e?o<d?1:o>d?-1:0:void 0}),function(e){e({type:"SORT_ORDER_ADMIN",payload:n})}}}}]); 2//# sourceMappingURL=7467.101d09fa.chunk.js.map
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.