import{r as a,P as Y,O as f,c as J,U as ce,I as ie,j as l,a as ue}from"./app-BZJf8lgN.js";import{C as Z,u as q,I as me,R as pe}from"./button.esm-D_cwsnQR.js";import{u as z,c as ge}from"./hooks.esm-UVLztt_0.js";import{D as de,C as F}from"./column.esm-BrHEUUD7.js";import{C as fe}from"./csstransition.esm-BNRxTMOa.js";import{P as ve}from"./index.esm-Ckth6fI3.js";import{L as he}from"./layout-DZ5xjWdd.js";import"./inputtext.esm-B1lZn37a.js";import"./index.esm-mvXJc0W-.js";import"./dropdown.esm-HqLoOpxI.js";import"./overlayservice.esm-B-BnP5c1.js";import"./index.esm-hRnQzR_k.js";import"./index.esm-CygY3Qsw.js";import"./CSSTransition-DBuKQJwM.js";var ye={root:"p-card p-component",header:"p-card-header",title:"p-card-title",subTitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer",body:"p-card-body"},xe=`
@layer primereact {
    .p-card-header img {
        width: 100%;
    }
}
`,D=Z.extend({defaultProps:{__TYPE:"Card",id:null,header:null,footer:null,title:null,subTitle:null,style:null,className:null,children:void 0},css:{classes:ye,styles:xe}}),W=a.forwardRef(function(e,r){var n=z(),o=a.useContext(Y),t=D.getProps(e,o),v=a.useRef(r),p=D.setMetaData({props:t}),s=p.ptm,i=p.cx,h=p.isUnstyled;q(D.css.styles,h,{name:"card"});var y=function(){var j=n({className:i("header")},s("header"));return t.header?a.createElement("div",j,f.getJSXElement(t.header,t)):null},N=function(){var j=n({className:i("title")},s("title")),I=t.title&&a.createElement("div",j,f.getJSXElement(t.title,t)),P=n({className:i("subTitle")},s("subTitle")),u=t.subTitle&&a.createElement("div",P,f.getJSXElement(t.subTitle,t)),m=n({className:i("content")},s("content")),O=t.children&&a.createElement("div",m,t.children),S=n({className:i("footer")},s("footer")),R=t.footer&&a.createElement("div",S,f.getJSXElement(t.footer,t)),w=n({className:i("body")},s("body"));return a.createElement("div",w,I,u,O,R)};a.useEffect(function(){f.combinedRefs(v,r)},[v,r]);var E=n({id:t.id,ref:v,style:t.style,className:J(t.className,i("root"))},D.getOtherProps(t),s("root")),_=y(),C=N();return a.createElement("div",E,_,C)});W.displayName="Card";function M(){return M=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},M.apply(null,arguments)}var G=a.memo(a.forwardRef(function(e,r){var n=me.getPTI(e);return a.createElement("svg",M({ref:r,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),a.createElement("path",{d:"M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z",fill:"currentColor"}))}));G.displayName="MinusIcon";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},B.apply(null,arguments)}function be(e){if(Array.isArray(e))return e}function Ee(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var o,t,v,p,s=[],i=!0,h=!1;try{if(v=(n=n.call(e)).next,r!==0)for(;!(i=(o=v.call(n)).done)&&(s.push(o.value),s.length!==r);i=!0);}catch(y){h=!0,t=y}finally{try{if(!i&&n.return!=null&&(p=n.return(),Object(p)!==p))return}finally{if(h)throw t}}return s}}function k(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,o=Array(r);n<r;n++)o[n]=e[n];return o}function je(e,r){if(e){if(typeof e=="string")return k(e,r);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,r):void 0}}function Ne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(e,r){return be(e)||Ee(e,r)||je(e,r)||Ne()}var $=Z.extend({defaultProps:{__TYPE:"Panel",id:null,header:null,headerTemplate:null,footer:null,footerTemplate:null,toggleable:null,style:null,className:null,collapsed:null,expandIcon:null,collapseIcon:null,icons:null,transitionOptions:null,onExpand:null,onCollapse:null,onToggle:null,children:void 0},css:{classes:{root:function(r){var n=r.props;return J("p-panel p-component",{"p-panel-toggleable":n.toggleable})},header:"p-panel-header",title:"p-panel-title",icons:"p-panel-icons",toggler:"p-panel-header-icon p-panel-toggler p-link",togglerIcon:"p-panel-header-icon p-panel-toggler p-link",toggleableContent:"p-toggleable-content",content:"p-panel-content",footer:"p-panel-footer",transition:"p-toggleable-content"},styles:`
        @layer primereact {
            .p-panel-header {
              display: flex;
              justify-content: space-between;
              align-items: center;
            }
            
            .p-panel-title {
              line-height: 1;
            }
            
            .p-panel-header-icon {
              display: inline-flex;
              justify-content: center;
              align-items: center;
              cursor: pointer;
              text-decoration: none;
              overflow: hidden;
              position: relative;
            }
        }
        `}}),H=a.forwardRef(function(e,r){var n=z(),o=a.useContext(Y),t=$.getProps(e,o),v=a.useState(t.id),p=L(v,2),s=p[0],i=p[1],h=a.useState(t.collapsed),y=L(h,2),N=y[0],E=y[1],_=a.useRef(null),C=a.useRef(null),g=t.toggleable?t.onToggle?t.collapsed:N:!1,j=s+"_header",I=s+"_content",P=$.setMetaData({props:t,state:{id:s,collapsed:g}}),u=P.ptm,m=P.cx,O=P.isUnstyled;q($.css.styles,O,{name:"panel"});var S=function(c){t.toggleable&&(g?R(c):w(c),c&&(t.onToggle&&t.onToggle({originalEvent:c,value:!g}),c.preventDefault()))},R=function(c){t.onToggle||E(!1),t.onExpand&&c&&t.onExpand(c)},w=function(c){t.onToggle||E(!0),t.onCollapse&&c&&t.onCollapse(c)};a.useImperativeHandle(r,function(){return{props:t,toggle:S,expand:R,collapse:w,getElement:function(){return _.current},getContent:function(){return C.current}}}),ge(function(){s||i(ce())});var K=function(){if(t.toggleable){var c=s+"_label",b=n({className:m("toggler"),onClick:S,id:c,"aria-controls":I,"aria-expanded":!g,type:"button",role:"button","aria-label":t.header},u("toggler")),d=n(u("togglericon")),T=g?t.expandIcon||a.createElement(ve,d):t.collapseIcon||a.createElement(G,d),A=ie.getJSXIcon(T,d,{props:t,collapsed:g});return a.createElement("button",b,A,a.createElement(pe,null))}return null},Q=function(){var c=f.getJSXElement(t.header,t),b=f.getJSXElement(t.icons,t),d=K(),T=n({id:j,className:m("title")},u("title")),A=a.createElement("span",T,c),le=n({className:m("icons")},u("icons")),X=a.createElement("div",le,b,d),oe=n({className:m("header")},u("header")),U=a.createElement("div",oe,A,X);if(t.headerTemplate){var se={className:"p-panel-header",titleClassName:"p-panel-title",iconsClassName:"p-panel-icons",togglerClassName:"p-panel-header-icon p-panel-toggler p-link",onTogglerClick:S,titleElement:A,iconsElement:X,togglerElement:d,element:U,id:s+"_header",props:t,collapsed:g};return f.getJSXElement(t.headerTemplate,se)}else if(t.header||t.toggleable)return U;return null},V=function(){var c=f.getJSXElement(t.footer,t),b=n({className:m("footer")},u("footer")),d=a.createElement("div",b,c);if(t.footerTemplate){var T={className:m("footer"),element:d,props:t};return f.getJSXElement(t.footerTemplate,T)}else if(t.footer)return d;return null},ee=function(){var c=n({ref:C,className:m("toggleableContent"),"aria-hidden":g,role:"region",id:I,"aria-labelledby":j},u("toggleablecontent")),b=n({className:m("content")},u("content")),d=n({classNames:m("transition"),timeout:{enter:1e3,exit:450},in:!g,unmountOnExit:!0,options:t.transitionOptions},u("transition"));return a.createElement(fe,B({nodeRef:C},d),a.createElement("div",c,a.createElement("div",b,t.children)))},te=n({id:s,ref:_,style:t.style,className:J(t.className,m("root"))},$.getOtherProps(t),u("root")),ne=Q(),re=ee(),ae=V();return a.createElement("div",te,ne,re,ae)});H.displayName="Panel";const He=({pedido:e})=>{const r=n=>{if(!n)return"Fecha no disponible";try{const o=new Date(n);if(isNaN(o.getTime()))return"Fecha inválida";const t={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"America/Argentina/Buenos_Aires"},v=o.toLocaleDateString("es-AR",t),p=o.toLocaleTimeString("es-AR",t),s=String(o.getDate()).padStart(2,"0"),i=String(o.getMonth()+1).padStart(2,"0"),h=o.getFullYear(),y=String(o.getHours()).padStart(2,"0"),N=String(o.getMinutes()).padStart(2,"0"),E=String(o.getSeconds()).padStart(2,"0");return`${s}/${i}/${h} ${y}:${N}:${E}`}catch(o){return console.error("Error formatting date:",o),"Error al formatear fecha"}};return l.jsxs(he,{children:[l.jsx(ue,{title:`Detalles Pedido #${(e==null?void 0:e.id)||""}`}),l.jsx("div",{className:"grid",children:l.jsx("div",{className:"col-md-12 w-full",children:l.jsxs(W,{title:`Detalles del Pedido #${e==null?void 0:e.id}`,children:[l.jsx(H,{header:"Datos de Facturación",className:"mb-4",children:l.jsxs("div",{className:"p-grid p-dir-col",children:[l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Nombre y Apellido:"})," ",e==null?void 0:e.cliente.nombre]})}),l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Fecha del Pedido:"})," ",r(e==null?void 0:e.created_at)]})}),l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Razón Social:"})," ",(e==null?void 0:e.cliente.empresa)??"-"]})}),l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Email:"})," ",e==null?void 0:e.cliente.email]})}),l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Teléfono:"})," ",e==null?void 0:e.cliente.telefono]})}),l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Domicilio:"})," ",e==null?void 0:e.cliente.domicilio,", ",e==null?void 0:e.cliente.ciudad,", ",e==null?void 0:e.cliente.provincia]})}),l.jsx("div",{className:"p-col",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Envío:"})," ",e==null?void 0:e.metodo_envio]})})]})}),l.jsx(H,{header:"Productos",className:"mb-4",children:l.jsxs(de,{value:e==null?void 0:e.items,emptyMessage:"No hay productos en este pedido.",children:[l.jsx(F,{field:"producto.titulo",header:"Producto"}),l.jsx(F,{field:"cantidad",header:"Cantidad"})]})})]})})})]})};export{He as default};
//# sourceMappingURL=Pedido-DRvjFoTN.js.map
