import{j as n,az as m,n as v,a8 as x,aE as u,aC as t,aD as e,T as s,c as p,aL as C,t as $,ai as w,aB as N,C as W,W as M,af as T,ar as D,bH as y,bC as A}from"../index.Crez7j-Y.bundle.js";import{u as G,a as H,b as O}from"./useFetchMemberCart.NM8yfOgH.bundle.js";import{s as R,P as k}from"./PrintButton.E4T5dhQS.bundle.js";const b={"& td, th":{height:33,p:0,borderRight:"1px solid ".concat(x),borderBottom:"1px solid ".concat(x),lineHeight:"12px"}};function E(a){const{mallInfo:r}=a,l=r==null?void 0:r.serviceBasicInfo.representativeName,i=r==null?void 0:r.serviceBasicInfo.businessRegistrationNo,c=r==null?void 0:r.serviceBasicInfo.address,d=r==null?void 0:r.serviceBasicInfo.representPhoneNo,o=r==null?void 0:r.serviceBasicInfo.faxNo;return n.jsxs(m,{sx:{...b,"& th":{backgroundColor:v},border:"2px solid ".concat(x)},children:[n.jsxs("colgroup",{children:[n.jsx("col",{width:"10%"}),n.jsx("col",{width:"60%"}),n.jsx("col",{width:"30%"})]}),n.jsx(u,{children:n.jsxs(t,{children:[n.jsx(e,{component:"th",width:"10%",align:"center",children:n.jsx(s,{variant:"small",children:"공급자"})}),n.jsx(e,{children:n.jsx(m,{sx:{...b,"& td:last-child, & th:last-child":{borderRight:"none"},"& tr:last-child td, & tr:last-child th":{borderBottom:"none"}},children:n.jsxs(u,{children:[n.jsxs(t,{children:[n.jsx(e,{component:"th",align:"center",children:n.jsxs(s,{variant:"small",children:[" ","등록번호"]})}),n.jsx(e,{align:"center",colSpan:3,children:n.jsx(s,{variant:"small",children:i})})]}),n.jsxs(t,{children:[n.jsx(e,{component:"th",align:"center",width:"25%",children:n.jsxs(s,{variant:"small",children:["상  호",n.jsx("br",{}),"(법인명)"]})}),n.jsx(e,{align:"center",width:"25%",children:n.jsx(s,{variant:"small",children:"(주)인바디"})}),n.jsx(e,{component:"th",align:"center",width:"25%",children:n.jsx(s,{variant:"small",children:"성  명"})}),n.jsxs(e,{align:"center",width:"25%",sx:{position:"relative"},children:[n.jsx("img",{src:R,alt:"inbody-stamp",width:60,height:60,style:{position:"absolute",top:"-15px",right:"-20px",zIndex:-1}}),n.jsx(s,{variant:"small",children:l})]})]}),n.jsxs(t,{children:[n.jsx(e,{component:"th",align:"center",children:n.jsxs(s,{variant:"small",children:["사업장",n.jsx("br",{}),"소재지"]})}),n.jsx(e,{align:"center",colSpan:3,children:n.jsx(s,{variant:"small",children:"".concat(c," (주)인바디")})})]}),n.jsxs(t,{children:[n.jsx(e,{component:"th",align:"center",children:n.jsx(s,{variant:"small",component:"p",children:"업 태"})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:"제조"})}),n.jsx(e,{component:"th",align:"center",children:n.jsx(s,{variant:"small",children:"종  목"})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:"의료기기"})})]}),n.jsxs(t,{children:[n.jsx(e,{component:"th",align:"center",children:n.jsx(s,{variant:"small",component:"p",children:"연락처"})}),n.jsx(e,{align:"center",colSpan:3,children:n.jsx(s,{variant:"small",children:d})})]}),n.jsxs(t,{children:[n.jsx(e,{component:"th",align:"center",children:n.jsx(s,{variant:"small",component:"p",children:"팩스번호"})}),n.jsx(e,{align:"center",colSpan:3,children:n.jsx(s,{variant:"small",children:o==null?void 0:o.replace(/^(\d{2})(\d{4})(\d{4})$/,"$1-$2-$3")})})]})]})})}),n.jsx(e,{rowSpan:6,width:"30%",align:"center",children:n.jsxs(p,{display:"flex",flexDirection:"column",alignItems:"center",gap:1,children:[n.jsx(s,{variant:"small",fontWeight:500,sx:{textDecoration:"underline"},children:"견적일: ".concat(C().format("YYYY년 MM월 DD일"))}),n.jsx($,{variant:"standard",sx:{"& input":{textAlign:"center"},"& input::placeholder":{textAlign:"center"}}}),n.jsx(s,{variant:"body",fontWeight:400,sx:{textDecoration:"underline",minHeight:30,textUnderlineOffset:8},children:"귀하"}),n.jsx(s,{variant:"small",children:"아래와 같이 견적합니다."})]})})]})})]})}function F(){return n.jsxs(p,{p:3,sx:{"@media print":{display:"none"}},children:[n.jsx(s,{variant:"small",component:"p",children:"※ 견적서 인쇄시 직인(도장이미지)도 인쇄되려면 아래와 같이 설정되어 있어야 가능합니다."}),n.jsx(s,{variant:"small",component:"p",pl:4,children:"1) 크롬 : 인쇄 화면 좌측의 [옵션] 에서 [배경그래픽] 체크"}),n.jsx(s,{variant:"small",component:"p",pl:4,children:"2) 파이어폭스 : 브라우저의 [파일]-[페이지 설정]-[용지 및 배경]-[설정]에서 [배경 인쇄(색상 및 이미지)] 체크"})]})}function L({orderProducts:a,totalPrePaidPrice:r}){const{formatPriceWithCommas:l,getPriceWithoutTax:i,getTax:c}=w(),d=r!=null?r:0,o=a.flatMap(h=>h.orderProductOptions.map(j=>({orderProduct:h,orderOption:j})));return n.jsxs(m,{sx:{"& td, th":{p:0,borderRight:"1px solid ".concat(x),borderBottom:"1px solid ".concat(x),lineHeight:1.3},"& th":{backgroundColor:v,height:30},border:"2px solid ".concat(x),borderTop:"none"},children:[n.jsx(N,{children:n.jsxs(t,{children:[n.jsx(e,{width:"10%",align:"center",children:n.jsx(s,{variant:"small",children:"번호"})}),n.jsx(e,{width:"40%",align:"center",children:n.jsx(s,{variant:"small",children:"품명"})}),n.jsx(e,{width:"10%",align:"center",children:n.jsx(s,{variant:"small",children:"수량"})}),n.jsx(e,{width:"15%",align:"center",children:n.jsx(s,{variant:"small",children:"단가"})}),n.jsx(e,{width:"15%",align:"center",children:n.jsx(s,{variant:"small",children:"공급가액"})}),n.jsx(e,{width:"10%",align:"center",children:n.jsx(s,{variant:"small",children:"세액"})})]})}),n.jsxs(u,{children:[o.map(({orderProduct:h,orderOption:j},S)=>{const g=j.price.salePrice-j.price.immediateDiscountAmt,f=Math.round(g/1.1),B=g-f;return n.jsxs(t,{children:[n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:S+1})}),n.jsx(e,{children:n.jsxs(p,{children:[n.jsx(s,{variant:"small",component:"p",children:h.productName}),n.jsx(s,{variant:"small",component:"p",color:W,children:j.optionTitle})]})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:j.orderCnt})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:l(g,"WON")})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:l(f,"WON")})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:l(B,"WON")})})]},j.cartNo)}),n.jsxs(t,{children:[n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:o.length+1})}),n.jsx(e,{colSpan:2,align:"center",children:n.jsx(s,{variant:"small",children:"배송비"})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:l(d,"WON")})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:l(i(d),"WON")})}),n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:l(c(d),"WON")})})]}),n.jsx(t,{children:n.jsx(e,{colSpan:6,align:"center",children:n.jsx(s,{variant:"small",children:"*** 이 하 여 백 ***"})})}),n.jsx(t,{sx:{"& td":{height:20}},children:n.jsx(e,{colSpan:6})}),n.jsx(t,{sx:{"& td":{height:20}},children:n.jsx(e,{colSpan:6})}),n.jsx(t,{sx:{"& td":{height:20}},children:n.jsx(e,{colSpan:6})}),n.jsx(t,{sx:{"& td":{height:20}},children:n.jsx(e,{colSpan:6})}),n.jsx(t,{sx:{"& td":{height:20}},children:n.jsx(e,{colSpan:6})})]})]})}function I({cartTotalPrice:a,totalPrePaidPrice:r}){const{formatPriceWithCommas:l}=w();return n.jsx(m,{sx:{"& td, th":{p:0,borderRight:"1px solid ".concat(x),borderBottom:"1px solid ".concat(x),lineHeight:1.3},"& th":{backgroundColor:v,height:30},border:"2px solid ".concat(x),borderTop:"none"},children:n.jsxs(N,{children:[n.jsxs(t,{children:[n.jsx(e,{align:"center",width:"50%",children:n.jsx(s,{variant:"small",children:"합  계"})}),n.jsx(e,{align:"center",width:"50%",children:n.jsx(s,{variant:"small",children:l(a!=null?a:0,"WON")})})]}),n.jsxs(t,{children:[n.jsx(e,{align:"center",children:n.jsx(s,{variant:"small",children:"입금계좌"})}),n.jsx(e,{align:"center"})]})]})})}function K(){var c;const[a]=M(),r=T(D,d=>d.isLogin),i=((c=a.get("cartNo"))!=null?c:"").split(",").map(Number);return n.jsx(n.Fragment,{children:r?n.jsx(Y,{cartItemNos:i}):n.jsx(z,{cartItemNos:i})})}function Y({cartItemNos:a}){const{data:r}=G(),{data:l}=y(),i=r?r.deliveryGroups.flatMap(d=>d.orderProducts.flatMap(o=>({...o,orderProductOptions:o.orderProductOptions.filter(h=>a.includes(h.cartNo))}))):[],{data:c}=H(a);return n.jsx(P,{orderProducts:i,mallInfo:l,cartTotalPrice:c==null?void 0:c.totalAmt,totalPrePaidPrice:c==null?void 0:c.totalPrePaidDeliveryAmt})}function z({cartItemNos:a}){var o;const{validGuestCartItemList:r}=A(),l=r.filter(h=>a.includes(h.cartNo)),{data:i}=O(l),{data:c}=y(),d=(o=i==null?void 0:i.deliveryGroups.flatMap(h=>h.orderProducts))!=null?o:[];return n.jsx(P,{orderProducts:d,mallInfo:c,cartTotalPrice:i==null?void 0:i.price.totalAmt,totalPrePaidPrice:i==null?void 0:i.price.totalPrePaidDeliveryAmt})}function P({orderProducts:a,mallInfo:r,cartTotalPrice:l,totalPrePaidPrice:i}){return n.jsxs(p,{component:"main",display:"flex",flexDirection:"column",p:"0 30px 10px 30px",children:[n.jsx(p,{component:"header",children:n.jsx(k,{})}),n.jsxs(p,{component:"section",width:600,mx:"auto",children:[n.jsx(E,{mallInfo:r}),n.jsx(L,{orderProducts:a,totalPrePaidPrice:i}),n.jsx(I,{cartTotalPrice:l,totalPrePaidPrice:i})]}),n.jsx(p,{component:"footer",children:n.jsx(F,{})})]})}export{K as default};