import{M as L}from"./MyOrderAPIs.DZkd5slp.bundle.js";import{u as A,Q as D,a as y,j as e,ai as b,aC as m,aD as l,T as s,aL as g,L as f,U as N,c as d,m as j,k as S,d as u,n as v,cy as $,a9 as O,bz as k,az as E,aB as Y,aE as W,b as p,C as B,aM as R,a8 as F}from"../index.Crez7j-Y.bundle.js";import{P,N as T,C as U}from"./NextActionButton.CZP6ZWPo.bundle.js";import{E as C}from"./EmptyContent.BRQ9JwMr.bundle.js";const K=(r,t)=>{const{getOrderListAPI:c}=L();return A({queryKey:D.getOrderList(r),queryFn:()=>c(r,!0),refetchOnWindowFocus:!1,...t})};function w(r){const{isDesktop:t,isMobile:c}=y();return e.jsxs(e.Fragment,{children:[t&&e.jsx(_,{...r}),c&&e.jsx(G,{...r})]})}function _(r){const{orderOption:t,isFirstRow:c,rowSpan:n,orderNo:i,orderYmdt:x,escrow:a}=r,{formatPriceWithCommas:o}=b();return e.jsxs(m,{children:[c&&e.jsxs(l,{rowSpan:n,align:"center",children:[e.jsx(s,{variant:"body",component:"p",fontWeight:500,children:g(x).format("YYYY-MM-DD")}),e.jsx(f,{variant:"small",href:"".concat(N.ORDER_DETAIL,"?orderNo=").concat(i),children:i})]}),e.jsx(l,{children:e.jsxs(d,{display:"flex",gap:1,children:[e.jsx("img",{src:"".concat(t.imageUrl,"?").concat(j.주문목록,"x").concat(j.주문목록),alt:t.optionName,width:j.주문목록,height:j.주문목록,style:{border:"1px solid ".concat(S)}}),e.jsxs(d,{display:"flex",flexDirection:"column",justifyContent:"center",gap:1,children:[e.jsx(s,{variant:"body",fontWeight:500,children:t.productName}),e.jsx(s,{variant:"small",children:"".concat(t.optionName," : ").concat(t.optionValue)}),t.inputs.map(h=>e.jsx(s,{variant:"body",children:h.inputValue}))]})]})}),e.jsx(l,{align:"center",children:e.jsx(s,{variant:"body",children:t.orderCnt})}),e.jsx(l,{align:"center",children:e.jsx(s,{variant:"body",component:"span",children:o(t.price.buyAmt,"WON")})}),e.jsx(l,{align:"center",children:e.jsx(d,{display:"flex",flexDirection:"column",gap:1,p:1,children:e.jsx(P,{claimNo:t.claimNo,claimStatusType:t.claimStatusType,claimStatusTypeLabel:t.claimStatusTypeLabel,nextActions:t.nextActions,orderOptionNo:t.orderOptionNo,orderStatusType:t.orderStatusType,orderStatusTypeLabel:t.orderStatusTypeLabel})})}),e.jsx(l,{align:"center",children:e.jsx(d,{display:"flex",flexDirection:"column",gap:1,p:1,children:e.jsx(T,{orderOptionNo:t.orderOptionNo,nextActions:t.nextActions,orderStatusType:t.orderStatusType,claimStatusTypeLabel:t.claimStatusTypeLabel,claimNo:t.claimNo,orderNo:t.orderNo,escrow:a})})})]})}function G(r){const{orderOption:t,escrow:c,onOpenClaimStatusModal:n}=r,{formatPriceWithCommas:i}=b(),x=u.useCallback(()=>{n==null||n(t.claimStatusTypeLabel||"",t.claimNo||0)},[n]),a=k.주문목록;return e.jsxs(d,{children:[e.jsxs(d,{py:1,px:2,my:2,bgcolor:v,display:"flex",justifyContent:"space-between",children:[e.jsx(d,{children:e.jsx(s,{variant:"subtitle1",color:$,children:t.claimStatusTypeLabel||t.orderStatusTypeLabel})}),t.claimStatusTypeLabel&&e.jsx(O,{variant:"text",color:"black",disableRipple:!0,onClick:x,sx:{p:0},children:e.jsx(s,{variant:"button",children:"상세보기"})})]}),e.jsxs(d,{display:"flex",mb:2,children:[e.jsx("img",{src:"".concat(t.imageUrl,"?").concat(a,"x").concat(a),style:{border:"1px solid ".concat(S)},alt:t.optionName,width:a,height:a}),e.jsxs(d,{display:"flex",flexDirection:"column",justifyContent:"center",px:1,children:[e.jsx(s,{variant:"subtitle1",children:t.productName}),e.jsx(s,{variant:"body",children:t.optionValue}),t.inputs.map(o=>e.jsx(s,{variant:"body",children:o.inputValue})),e.jsx(s,{variant:"subtitle1",children:i(t.price.buyAmt,"WON")+" / ".concat(t.orderCnt,"개")})]})]}),e.jsx(T,{orderOptionNo:t.orderOptionNo,nextActions:t.nextActions,orderStatusType:t.orderStatusType,claimStatusTypeLabel:t.claimStatusTypeLabel,claimNo:t.claimNo,orderNo:t.orderNo,escrow:c})]})}function Z(r){const{isDesktop:t,isMobile:c}=y(),[n,i]=u.useState({openModal:!1,claimStatusTypeLabel:"",claimNo:0}),x=u.useCallback(()=>i({openModal:!1,claimStatusTypeLabel:"",claimNo:0}),[]),a=u.useCallback((o,h)=>{i({openModal:!0,claimNo:h,claimStatusTypeLabel:o})},[]);return e.jsxs(e.Fragment,{children:[t&&e.jsx(z,{...r}),c&&e.jsx(V,{...r,modalState:n,onCloseClaimStatusModal:x,onOpenClaimStatusModal:a})]})}function z(r){var n;const{myOrderList:t,isPending:c}=r;return e.jsxs(d,{mt:3,children:[e.jsx(s,{variant:"subtitle1",pb:1,children:"총 ".concat((n=t==null?void 0:t.totalCount)!=null?n:0,"건")}),e.jsxs(E,{size:"small",sx:{"& th":{py:1,px:0,bgcolor:v},"& td":{px:0}},children:[e.jsx(Y,{children:e.jsxs(m,{children:[e.jsx(l,{width:160,align:"center",children:e.jsx(s,{variant:"body",fontWeight:500,children:"주문일자(주문번호)"})}),e.jsx(l,{width:350,align:"center",children:e.jsx(s,{variant:"body",fontWeight:500,children:"상품정보"})}),e.jsx(l,{width:70,align:"center",children:e.jsx(s,{variant:"body",fontWeight:500,children:"수량"})}),e.jsx(l,{width:100,align:"center",children:e.jsx(s,{variant:"body",fontWeight:500,children:"상품 금액"})}),e.jsx(l,{width:100,align:"center",children:e.jsx(s,{variant:"body",fontWeight:500,children:"진행상태"})}),e.jsx(l,{width:100,align:"center",children:e.jsx(s,{variant:"body",fontWeight:500,children:"접수"})})]})}),e.jsxs(W,{children:[t&&t.totalCount===0&&e.jsx(m,{children:e.jsx(l,{colSpan:6,children:e.jsx(C,{text:"주문 내역이 없습니다.",height:"40dvh"})})}),c&&Array.from({length:5}).map((i,x)=>e.jsx(m,{children:Array.from({length:6}).map((a,o)=>e.jsx(l,{children:e.jsx(p,{sx:{height:100,width:"70%",margin:"auto"}})},o*10))},x)),t==null?void 0:t.items.map(i=>e.jsx(u.Fragment,{children:i.orderOptions.map((x,a,o)=>e.jsx(w,{orderOption:x,isFirstRow:a===0,rowSpan:o.length,orderNo:i.orderNo,orderYmdt:i.orderYmdt,escrow:i.escrow},x.orderOptionNo))},i.orderNo))]})]})]})}function V(r){const{myOrderList:t,isPending:c,modalState:n,onCloseClaimStatusModal:i,onOpenClaimStatusModal:x}=r;return c?e.jsx(e.Fragment,{children:Array.from({length:3}).map((a,o)=>e.jsxs(d,{display:"flex",gap:2,mb:2,children:[e.jsx(p,{variant:"rectangular",sx:{height:100,flex:1}}),e.jsxs(d,{flex:2,children:[e.jsx(p,{variant:"text"}),e.jsx(p,{variant:"text"}),e.jsx(p,{variant:"text"}),e.jsx(p,{variant:"text"})]})]},o))}):(t==null?void 0:t.totalCount)===0?e.jsx(C,{text:"주문 내역이 없습니다.",height:"40vh"}):e.jsxs(e.Fragment,{children:[t==null?void 0:t.items.map(a=>e.jsxs(d,{py:2,children:[e.jsxs(f,{href:"".concat(N.ORDER_DETAIL,"?orderNo=").concat(a.orderNo),variant:"subtitle1",color:B,children:["주문번호 : "," ",a.orderNo]}),e.jsxs(s,{variant:"subtitle1",children:["주문날짜 : ",g(a.orderYmdt).format("YYYY-MM-DD")," "]}),e.jsx(R,{sx:{border:"1px solid ".concat(F),my:1}}),a.orderOptions.map((o,h,M)=>e.jsx(w,{orderOption:o,isFirstRow:h===0,rowSpan:M.length,orderNo:a.orderNo,orderYmdt:a.orderYmdt,escrow:a.escrow,onOpenClaimStatusModal:x},o.orderOptionNo))]},a.orderNo)),e.jsx(U,{title:n.claimStatusTypeLabel+" 상세 내역",claimNo:n.claimNo,open:n.openModal,onClose:i})]})}export{Z as P,K as u};