PageSourceSearch

https://imfood-landing.vercel.app/_next/static/chunks/pages/mypage-8460cdeece4e32fc.js

js imfood-landing.vercel.app collected 2026-10-03 07:06:56 UTC 22,249 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[587],{3847:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mypage",function(){return l(5339)}])},4441:function(e,t,l){"use strict";l.d(t,{c:function(){return n}});var r=l(2676),i=l(32);let n=()=>(0,r.jsx)(i.Z,{sx:{height:{xs:70,md:85},backgroundColor:"transparent"}})},5339:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return ec}});var r=l(2676),i=l(2036),n=l(6219),a=l(5271),s=l(4636),o=l(5122),d=l(5392),c=l(32),u=l(8061),x=l(4441),h=l(9984),m=l(1831),f=l(6483),p=l.n(f),g=l(3348),v=l(7574),j=l(2098),Z=l(3214),b=l(6937),y=l(8780);let S=e=>{let{open:t}=e;return t?(0,r.jsx)(c.Z,{sx:{position:"absolute",inset:0,backgroundColor:"rgba(255, 255, 255, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,borderRadius:"inherit"},children:(0,r.jsx)(y.Z,{size:36,sx:{color:"#54B4BF"}})}):null};var C=l(8071);let w=(e,t)=>{var l;let r=null==e?void 0:null===(l=e.response)||void 0===l?void 0:l.data;if("string"==typeof r&&r.trim())return r.trim();if(r&&"object"==typeof r){let e=r.message;if("string"==typeof e&&e.trim())return e.trim()}return t};var k=l(9568);let z=e=>{let{sites:t,value:l,onChange:i,label:n="납품지",helperText:o,size:d="medium",disabled:u=!1,sx:x}=e,h=e=>t.find(t=>t.siteName===e);return(0,r.jsx)(k.Z,{freeSolo:!0,fullWidth:!0,disabled:u,options:t.map(e=>e.siteName),value:l,inputValue:l,onChange:(e,t)=>
1i(null!=t?t:""),onInputChange:(e,t)=>i(t),renderOption:(e,t)=>{var l;let i=h(t);return(0,a.createElement)(c.Z,{component:"li",...e,key:null!==(l=null==i?void 0:i.id)&&void 0!==l?l:t},(0,r.jsxs)(c.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(s.Z,{sx:{fontSize:14},children:t}),(null==i?void 0:i.address)&&(0,r.jsx)(s.Z,{sx:{fontSize:12,color:"#888888"},children:i.address})]}))},renderInput:e=>(0,r.jsx)(Z.Z,{...e,label:n,size:d,helperText:o}),sx:x})},D=e=>{let{open:t,onClose:l,fetchOrderList:i,id:n,productList:d,deliverySites:x,order:h}=e,[m,f]=(0,a.useState)(""),[y,k]=(0,a.useState)(""),[D,N]=(0,a.useState)(""),[P,Y]=(0,a.useState)(""),[W,E]=(0,a.useState)(""),[M,B]=(0,a.useState)(!1),{showToast:H}=(0,C.p)();(0,a.useEffect)(()=>{var e,t;f(h.productName),k(String(h.quantity)),N(h.deliveryDate),Y(null!==(e=h.deliveryPlace)&&void 0!==e?e:""),E(null!==(t=h.memo)&&void 0!==t?t:"")},[h]);let F=async()=>{B(!0);try{await b.Z.patch("/order/".concat(n),{quantity:y,deliveryDate:D,deliveryPlace:P.trim(),memo:W}),i(),l(),H("발주가 수정되었습니다.")}catch(e){console.error("Error patching order:",e),H(w(e,"발주 수정에 실패했습니다."),"error")}finally{B(!1)}};return(0,r.jsx)(g.Z,{open:t,onClose:M?void 0:l,children:(0,r.jsxs)(c.Z,{sx:{position:"relative",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:320,bgcolor:"background.paper",borderRadius:2,boxShadow:24,p:4},children:[(0,r.jsx)(S,{open:M}),(0,r.jsx)(s.Z,{variant:"h6",component:"h2",sx:{mb:3,textAlign:"center",fontWeight:"bold"},children:"발주 수정"}),(0,r.jsx)(v.Z,{disabled:!0,value:m,onChange:e=>f(e.target.value),fullWidth:!0,sx:{mb:2},children:d.map(e=>(0,r.jsx)(j.Z,{value:e.productName,children:e.productName},e.productName))}),(0,r.jsx)(Z.Z,{label:"수량",type:"number",value:y,onChange:e=>{k(e.target.value)},fullWidth:!0,sx:{mb:2}}),(0,r.jsx)(u.M,{label:"납기일",disabled:!0,value:D?p()(D):null,onChange:e=>N(e?p()(e).format("YYYY-MM-DDTHH:mm"):""),slotProps:{textField:{fullWidth:!0,sx:{mb:2}}}}),(0,r.jsx)(z,{sites:x,value:P,onChange:Y,sx:{mb:2}}),(0,r.jsx)(Z.Z,{label:"메모",value:W,onChange:e=>E(e.target.value),fullWidth:!0,sx:{mb:2}}),(0,r.jsx)(o.Z,{variant:"contained",sx:{backgroundColor:"#54B4BF"},fullWidth:!0,onClick:F,disabled:!y||!D||M,children:"수정"})]})})};var N=l(7737);let P=e=>{let{open:t,onClose:l,handleDelete:i,loading:n=!1}=e;return(0,r.jsx)(g.Z,{open:t,onClose:n?void 0:l,children:(0,r.jsxs)(c.Z,{sx:{position:"relative",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:320,bgcolor:"background.paper",borderRadius:2,boxShadow:24,p:4,outline:"none"},children:[(0,r.jsx)(S,{open:n}),(0,r.jsx)(s.Z,{variant:"h6",sx:{fontWeight:"bold"},gutterBottom:!0,children:"삭제 확인"}),(0,r.jsx)(s.Z,{mb:3,children:"정말로 삭제하시겠습니까?"}),(0,r.jsxs)(N.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",width:"100%"},direction:"row",spacing:2,children:[(0,r.jsx)(o.Z,{variant:"contained",color:"error",onClick:i,disabled:n,children:"삭제"}),(0,r.jsx)(o.Z,{onClick:l,disabled:n,children:"취소"})]})]})})},Y=e=>!0===e.isDelivered,W=e=>{let{delivered:t}=e;return(0,r.jsx)(m.Z,{label:t?"출고완료":"접수",size:"small",sx:{backgroundColor:t?"#E3F5EA":"#EEEEEE",color:t?"#1B7F4B":"#616161",fontWeight:700}})},E=e=>{var t,l;let{order:i,fetchOrderList:n,productList:d,deliverySites:u,onReorder:x}=e,[h,m]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),{showToast:Z}=(0,C.p)(),y=Y(i);async function S(){j(!0);try{await b.Z.delete("/order/".concat(i.id))&&(n(),Z("발주가 삭제되었습니다."))}catch(e){console.error("error: ",e),Z(w(e,"발주 삭제에 실패했습니다."),"error")}finally{j(!1),g(!1)}}return(0,r.jsxs)(M,{children:[(0,r.jsxs)(B,{children:[(0,r.jsxs)(c.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(s.Z,{sx:{fontSize:18,fontWeight:700},children:i.productName}),(0,r.jsx)(W,{delivered:y})]}),(0,r.jsx)(s.Z,{sx:{fontSize:16,fontWeight:700},children:i.quantity})]}),(0,r.jsxs)(H,{children:[(0,r.jsxs)(c.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(s.Z,{sx:{fontSize:12,fontWeight:500,color:"#888888"},children:"주문일자: "+p()(i.orderDate).format("YYYY-MM-DD HH:mm")}
1),(0,r.jsx)(s.Z,{sx:{fontSize:12,fontWeight:500,color:"#888888"},children:"납기일자: "+p()(i.deliveryDate).format("YYYY-MM-DD")}),(0,r.jsx)(s.Z,{sx:{fontSize:12,fontWeight:500,color:"#888888"},children:"납품지: "+(null!==(t=i.deliveryPlace)&&void 0!==t?t:"-")}),(0,r.jsx)(s.Z,{sx:{fontSize:12,fontWeight:500,color:"#888888"},children:"메모: "+(null!==(l=i.memo)&&void 0!==l?l:"-")})]}),(0,r.jsxs)(c.Z,{sx:{display:"flex",gap:1,flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,r.jsx)(o.Z,{variant:"outlined",sx:{color:"#54b5c0",borderColor:"#54b5c0",borderRadius:"0px"},onClick:()=>x(i),children:"재발주"}),!y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{variant:"contained",sx:{backgroundColor:"#54b5c0",borderRadius:"0px","&:hover":{backgroundColor:"#54b5c0"}},onClick:()=>m(!0),children:"수정"}),(0,r.jsx)(o.Z,{onClick:()=>g(!0),sx:{color:"red",borderRadius:"0px","&:hover":{backgroundColor:"red",color:"white"}},children:"삭제"})]})]})]}),(0,r.jsx)(D,{productList:d,deliverySites:u,open:h,onClose:()=>m(!1),fetchOrderList:n,id:i.id,order:i}),(0,r.jsx)(P,{open:f,onClose:()=>g(!1),handleDelete:S,loading:v})]})},M=(0,d.ZP)(c.Z)({display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",boxShadow:"0px 0px 10px 0px rgba(0, 0, 0, 0.1)",borderRadius:10,width:"100%"}),B=(0,d.ZP)(c.Z)({width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:10}),H=(0,d.ZP)(c.Z)({marginTop:10,width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"}),F=e=>{let{orderList:t,fetchOrderList:l,productList:i,deliverySites:n,onReorder:a}=e;return 0===t.length?(0,r.jsxs)(q,{children:[(0,r.jsx)(h.Z,{sx:{fontSize:64,color:"text.secondary",mb:2}}),(0,r.jsx)(s.Z,{variant:"h6",color:"text.secondary",sx:{fontWeight:500,textAlign:"center"},children:"발주 내역이 없습니다"})]}):(0,r.jsx)(I,{children:t.map(e=>(0,r.jsx)(E,{order:e,fetchOrderList:l,productList:i,deliverySites:n,onReorder:a},e.id))})},I=(0,d.ZP)(c.Z)({width:"90%",display:"flex",flexDirection:"column",gap:10,marginBottom:20}),q=(0,d.ZP)(c.Z)({width:"90%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"60px 20px",marginBottom:20});var T=l(3268),_=l(9446),R=l(6677),L=l(487),A=l(1686),O=l(4605),X=l(4809);let V="/delivery-site",G=async()=>(await b.Z.get(V)).data,J=async e=>(await b.Z.post(V,e)).data,K=async(e,t)=>(await b.Z.patch("".concat(V,"/").concat(e),t)).data,Q=async e=>{await b.Z.delete("".concat(V,"/").concat(e))},U=e=>{var t,l;return null!==(l=null===(t=e.find(e=>e.defaultSite))||void 0===t?void 0:t.siteName)&&void 0!==l?l:""},$=(e,t,l)=>({id:e,productName:t,quantity:"",deliveryPlace:l,memo:""}),ee=e=>{let t=new Set;for(let l of e){let e="".concat(l.productName,"//").concat(l.deliveryPlace.trim());if(t.has(e))return"".concat(l.productName," (").concat(l.deliveryPlace,")");t.add(e)}return""},et=e=>{let{open:t,onClose:l,productList:i,deliverySites:n,loading:d=!1,initialDraft:x=null,onManageSites:h,onSubmit:m}=e,f=(0,a.useRef)(0),b=()=>(f.current+=1,f.current),[y,C]=(0,a.useState)(0),[w,k]=(0,a.useState)(""),[D,P]=(0,a.useState)(""),[Y,W]=(0,a.useState)([]),[E,M]=(0,a.useState)({}),[B,H]=(0,a.useState)("");(0,a.useEffect)(()=>{var e,l;if(!t)return;let r=(null==x?void 0:x.deliveryPlace)||U(n);C(0),k(""),P(r),M({}),H(""),W([x?{...x,id:b(),deliveryPlace:r}:$(b(),null!==(l=null===(e=i[0])||void 0===e?void 0:e.productName)&&void 0!==l?l:"",r)])},[t]),(0,a.useEffect)(()=>{if(!t||D)return;let e=U(n);e&&(P(e),W(t=>t.map(t=>t.deliveryPlace?t:{...t,deliveryPlace:e})))},[t,n,D]),(0,a.useEffect)(()=>{var e;if(!t)return;let l=null===(e=i[0])||void 0===e?void 0:e.productName;l&&W(e=>e.map(e=>e.productName?e:{...e,productName:l}))},[t,i]);let F=(e,t,l)=>W(r=>r.map(r=>r.id===e?{...r,[t]:l}:r)),I=e=>W(t=>t.filter(t=>t.id!==e)),q=Y.filter(e=>{var t;return!(null===(t=E[e.id])||void 0===t?void 0:t.ok)}),V=q.length!==Y.length,G=!!w,J=q.length>0&&q.every(e=>e.productName&&Number(e.quantity)>0&&e.deliveryPlace.trim()),K=async()=>{let e=ee(q);if(e){H("같은 품목\xb7납품지가 중복되었습니다: ".concat(e));return}H("");let t=await m({deliveryDate:w?p()(w).format("YYYY-MM-DDTHH:mm"):p()().format("YYYY-MM-DDTHH:mm"),products:q.map(e=>({id:e.id,productName:e.productName,quantity:e.quantity,deliveryPlace:e.deliveryPlace.trim(),memo:e.memo}))});M(e=>t.reduce((e,t)=>
1({...e,[t.id]:t}),e))};return(0,r.jsx)(g.Z,{open:t,onClose:d?void 0:l,children:(0,r.jsxs)(c.Z,{sx:{position:"relative",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"90%",maxWidth:380,maxHeight:"85vh",bgcolor:"background.paper",borderRadius:2,boxShadow:24,p:2,display:"flex",flexDirection:"column"},children:[(0,r.jsx)(S,{open:d}),(0,r.jsx)(s.Z,{variant:"h6",component:"h2",sx:{mb:2,textAlign:"center",fontWeight:"bold",fontSize:"1.1rem"},children:x?"재발주":"발주 등록"}),(0,r.jsxs)(T.Z,{activeStep:y,sx:{mb:3},alternativeLabel:!0,children:[(0,r.jsx)(_.Z,{children:(0,r.jsx)(R.Z,{sx:{"& .MuiStepLabel-label":{fontSize:"0.8rem"}},children:"납기일\xb7납품지"})}),(0,r.jsx)(_.Z,{children:(0,r.jsx)(R.Z,{sx:{"& .MuiStepLabel-label":{fontSize:"0.8rem"}},children:"품목 선택"})})]}),0===y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.M,{label:"납기일",value:w?p()(w):null,onChange:e=>k(e?p()(e).format("YYYY-MM-DDTHH:mm"):""),minDate:p()(),slotProps:{textField:{fullWidth:!0,sx:{mb:2},size:"small"}}}),(0,r.jsx)(z,{sites:n,value:D,onChange:e=>{P(e),W(t=>t.map(t=>{var l;return(null===(l=E[t.id])||void 0===l?void 0:l.ok)?t:{...t,deliveryPlace:e}}))},label:"납품지 (일괄 적용)",size:"small",helperText:n.length>0?"선택하면 모든 품목에 적용됩니다. 품목별로 바꿀 수도 있습니다.":"저장해 둔 납품지가 없습니다. 직접 입력하거나 납품지를 저장해 보세요.",sx:{mb:1}}),(0,r.jsx)(o.Z,{onClick:h,size:"small",sx:{mb:2},children:"납품지 관리"}),(0,r.jsx)(o.Z,{fullWidth:!0,variant:"contained",sx:{backgroundColor:"#54B4BF"},disabled:!G,onClick:()=>C(1),size:"small",children:"다음"})]}):(0,r.jsx)(c.Z,{sx:{flex:1,overflow:"auto",mb:2},children:Y.map(e=>{let t=E[e.id],l=(null==t?void 0:t.ok)===!0;return(0,r.jsxs)(N.Z,{spacing:1,sx:{mb:2},children:[(0,r.jsx)(v.Z,{value:e.productName,onChange:t=>F(e.id,"productName",t.target.value),disabled:l,fullWidth:!0,size:"small",children:i.map(e=>(0,r.jsx)(j.Z,{value:e.productName,children:e.productName},e.productName))}),(0,r.jsx)(z,{sites:n,value:e.deliveryPlace,onChange:t=>F(e.id,"deliveryPlace",t),size:"small",disabled:l}),(0,r.jsx)(Z.Z,{label:"메모",value:e.memo,onChange:t=>F(e.id,"memo",t.target.value),disabled:l,fullWidth:!0,size:"small"}),(0,r.jsxs)(N.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(Z.Z,{type:"number",label:"수량",value:e.quantity,onChange:t=>F(e.id,"quantity",t.target.value),disabled:l,fullWidth:!0,size:"small"}),Y.length>1&&!l&&(0,r.jsx)(L.Z,{onClick:()=>I(e.id),color:"error",size:"small",children:(0,r.jsx)(X.Z,{})})]}),t&&(0,r.jsx)(A.Z,{severity:t.ok?"success":"error",sx:{fontSize:12,py:0},children:t.ok?"등록 완료":t.message})]},e.id)})}),1===y&&(0,r.jsxs)(r.Fragment,{children:[B&&(0,r.jsx)(A.Z,{severity:"warning",sx:{mb:1,fontSize:12,py:0},children:B}),(0,r.jsx)(o.Z,{startIcon:(0,r.jsx)(O.Z,{}),onClick:()=>W(e=>{var t,l;return[...e,$(b(),null!==(l=null===(t=i[0])||void 0===t?void 0:t.productName)&&void 0!==l?l:"",D)]}),sx:{mb:2},fullWidth:!0,size:"small",children:"상품 추가"}),(0,r.jsxs)(N.Z,{direction:"row",spacing:1,children:[(0,r.jsx)(o.Z,{variant:"outlined",onClick:()=>C(0),sx:{flex:1},size:"small",disabled:d,children:"이전"}),(0,r.jsx)(o.Z,{variant:"contained",sx:{backgroundColor:"#54B4BF",flex:1},disabled:!J||d,onClick:K,size:"small",children:V?"실패한 품목 다시 등록":"등록"})]})]})]})})};var el=l(3094),er=l(4435),ei=l(6490);let en={siteName:"",address:"",contactPhone:"",unloadingHours:"",remark:"",defaultSite:!1},ea=e=>{var t,l,r,i;return e?{siteName:e.siteName,address:null!==(t=e.address)&&void 0!==t?t:"",contactPhone:null!==(l=e.contactPhone)&&void 0!==l?l:"",unloadingHours:null!==(r=e.unloadingHours)&&void 0!==r?r:"",remark:null!==(i=e.remark)&&void 0!==i?i:"",defaultSite:e.defaultSite}:en},es=e=>{let{site:t,saving:l,onCancel:i,onSubmit:n}=e,[s,d]=(0,a.useState)(ea(t));(0,a.useEffect)(()=>{d(ea(t))},[t]);let u=(e,t)=>d(l=>({...l,[e]:t}));return(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(Z.Z,{label:"납품지 이름",required:!0,value:s.siteName,onChange:e=>u("siteName",e.target.value),helperText:"납품지 이름은 일미푸드 출고 서류에 그대로 표기됩니다. (예: 오뚜기(칠서))",fullWidth:!0,size:"small",sx:{mb:2}}),(0,r.jsx)(Z.Z,{label:"하차지 주소",value:s.address,onChange:e=>u("address",e.target.value),fullWidth:!0,size:"small",sx:{mb:2}}),(0,r.jsx)(Z.Z,{label:"하차지 연락처",value:s.contactPhone,onChange:e=>u("contactPhone",e.target.value),fullWidth:!0,size:"small",sx:{mb:2}}),(0,r.jsx)(Z.Z,{label:"하차 가능 시간",value:s.unloadingHours,onChange:e=>u("unloadingHours",e.target.value),helperText:"예: 9-16시, ~16ì‹
1œê¹Œì§€",fullWidth:!0,size:"small",sx:{mb:2}}),(0,r.jsx)(Z.Z,{label:"비고",value:s.remark,onChange:e=>u("remark",e.target.value),fullWidth:!0,size:"small",sx:{mb:1}}),(0,r.jsx)(er.Z,{control:(0,r.jsx)(ei.Z,{checked:s.defaultSite,onChange:e=>u("defaultSite",e.target.checked)}),label:"발주할 때 기본으로 선택",sx:{mb:1}}),(0,r.jsxs)(N.Z,{direction:"row",spacing:1,children:[(0,r.jsx)(o.Z,{variant:"outlined",onClick:i,disabled:l,sx:{flex:1},size:"small",children:"취소"}),(0,r.jsx)(o.Z,{variant:"contained",onClick:()=>n({siteName:s.siteName.trim(),address:s.address.trim(),contactPhone:s.contactPhone.trim(),unloadingHours:s.unloadingHours.trim(),remark:s.remark.trim(),defaultSite:s.defaultSite}),disabled:!s.siteName.trim()||l,sx:{backgroundColor:"#54B4BF",flex:1},size:"small",children:"저장"})]})]})},eo=e=>{let{open:t,onClose:l,sites:i,loading:n,onChanged:d}=e,{showToast:u}=(0,C.p)(),[x,h]=(0,a.useState)(null),[f,p]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),[Z,b]=(0,a.useState)(null),[y,k]=(0,a.useState)("");(0,a.useEffect)(()=>{t&&(h(null),p(!1),b(null),k(""))},[t]);let z=()=>{p(!1),h(null)},D=async e=>{j(!0),k("");try{x?await K(x.id,e):await J(e),await d(),z(),u("납품지가 저장되었습니다.")}catch(e){k(w(e,"납품지 저장에 실패했습니다."))}finally{j(!1)}},P=async e=>{j(!0),k("");try{await Q(e),await d(),b(null),u("납품지가 삭제되었습니다.")}catch(e){k(w(e,"납품지 삭제에 실패했습니다."))}finally{j(!1)}};return(0,r.jsx)(g.Z,{open:t,onClose:v?void 0:l,children:(0,r.jsxs)(c.Z,{sx:{position:"relative",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"90%",maxWidth:460,maxHeight:"85vh",bgcolor:"background.paper",borderRadius:2,boxShadow:24,p:3,display:"flex",flexDirection:"column"},children:[(0,r.jsx)(S,{open:v||n}),(0,r.jsx)(s.Z,{variant:"h6",component:"h2",sx:{mb:2,textAlign:"center",fontWeight:"bold"},children:"납품지 관리"}),y&&(0,r.jsx)(A.Z,{severity:"error",sx:{mb:2},onClose:()=>k(""),children:y}),(0,r.jsx)(c.Z,{sx:{flex:1,overflowY:"auto"},children:f?(0,r.jsx)(es,{site:x,saving:v,onCancel:z,onSubmit:D}):0===i.length?(0,r.jsx)(s.Z,{sx:{fontSize:14,color:"#888888",textAlign:"center",py:4},children:"자주 쓰는 납품지를 저장해 두면 발주할 때 선택만 하면 됩니다."}):i.map(e=>(0,r.jsxs)(c.Z,{children:[(0,r.jsxs)(N.Z,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",sx:{py:1.5,gap:1},children:[(0,r.jsxs)(c.Z,{sx:{minWidth:0},children:[(0,r.jsxs)(N.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(s.Z,{sx:{fontSize:16,fontWeight:700},children:e.siteName}),e.defaultSite&&(0,r.jsx)(m.Z,{label:"기본",size:"small",sx:{backgroundColor:"#E1F4F6",color:"#2E8B96",fontWeight:700}})]}),e.address&&(0,r.jsx)(s.Z,{sx:{fontSize:12,color:"#888888"},children:e.address}),e.contactPhone&&(0,r.jsx)(s.Z,{sx:{fontSize:12,color:"#888888"},children:"연락처: "+e.contactPhone}),e.unloadingHours&&(0,r.jsx)(s.Z,{sx:{fontSize:12,color:"#888888"},children:"하차 가능 시간: "+e.unloadingHours}),e.remark&&(0,r.jsx)(s.Z,{sx:{fontSize:12,color:"#888888"},children:"비고: "+e.remark})]}),Z===e.id?(0,r.jsxs)(N.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(s.Z,{sx:{fontSize:12,color:"#888888"},children:"삭제할까요?"}),(0,r.jsx)(o.Z,{size:"small",color:"error",variant:"contained",disabled:v,onClick:()=>P(e.id),children:"삭제"}),(0,r.jsx)(o.Z,{size:"small",disabled:v,onClick:()=>b(null),children:"취소"})]}):(0,r.jsxs)(N.Z,{direction:"row",spacing:1,children:[(0,r.jsx)(o.Z,{size:"small",onClick:()=>{k(""),h(e),p(!0)},children:"수정"}),(0,r.jsx)(o.Z,{size:"small",sx:{color:"red"},onClick:()=>{k(""),b(e.id)},children:"삭제"})]})]}),(0,r.jsx)(el.Z,{})]},e.id))}),!f&&(0,r.jsxs)(N.Z,{sx:{pt:2},spacing:1,children:[(0,r.jsx)(o.Z,{startIcon:(0,r.jsx)(O.Z,{}),onClick:()=>{k(""),h(null),p(!0)},fullWidth:!0,size:"small",children:"납품지 추가"}),(0,r.jsx)(o.Z,{onClick:l,fullWidth:!0,size:"small",variant:"outlined",children:"닫기"})]})]})})},ed=()=>{let[e,t]=(0,a.useState)([]),[l,r]=(0,a.useState)(!1),i=(0,a.useCallback)(async()=>{r(!0);try{t(await G())}catch(e){console.error("Error fetching delivery sites:",e),t([])}finally{r(!1)}},[]);return(0,a.useEffect)(()=>{i()},[i]),{sites:e,loading:l,refresh:i}};var ec=()=>{let{showToast:e}=(0,C.p)(),[t,l]=(0,a.useState)(!1),[d,c]=(0,a.useState)(!1),[h,m]=(0,a.useState)(null),[f,g]=(0,a.useState)(!1),[v,j]=(0,a.useState)([]),[Z,y]=(0,a.useState)([]),[S,k]=(0,a.useState)(p()().subtract(1,"day").format("YYYY-MM-DD")),[z,D]=(0,a.useState)(p()().add(2,"week").format("YYYY-MM-DD")),{sites:N,loading:P,refresh:Y}=ed(),W=async()=>{try{let e=await b.Z.get("/available-products");j(e.data)}catch(e){window.location.href="/login",console.error("Error fetching products:",e)}},E=async()=>{try{let e=[...(await b.Z.get("/order?startDate=".concat(S,"&endDate=").concat(z))).data].sort((e,t)=>
1new Date(e.deliveryDate).getTime()-new Date(t.deliveryDate).getTime());y(e)}catch(e){console.error("Error fetching orders:",e)}},M=async t=>{g(!0);let r=[];try{for(let e of t.products)try{await b.Z.post("/order",{productName:e.productName,quantity:e.quantity,deliveryDate:t.deliveryDate,deliveryPlace:e.deliveryPlace,memo:e.memo}),r.push({id:e.id,ok:!0})}catch(t){console.error("Error posting order:",t),r.push({id:e.id,ok:!1,message:w(t,"발주 등록에 실패했습니다.")})}}finally{g(!1)}await E();let i=r.filter(e=>!e.ok).length;return 0===i?(l(!1),e("발주가 등록되었습니다.")):e("".concat(r.length,"건 중 ").concat(i,"건 등록에 실패했습니다. 실패한 품목만 다시 등록해 주세요."),"error"),r},B=e=>{m(e),l(!0)};return(0,a.useEffect)(()=>{W()},[]),(0,a.useEffect)(()=>{E()},[S,z]),(0,r.jsx)(i._,{dateAdapter:n.y,children:(0,r.jsxs)(eu,{children:[(0,r.jsx)(x.c,{}),(0,r.jsxs)(ex,{children:[(0,r.jsx)(s.Z,{sx:{fontSize:28,fontWeight:700,alignSelf:"flex-start"},children:"발주 내역"}),(0,r.jsxs)("div",{style:{display:"flex",gap:10},children:[(0,r.jsx)(o.Z,{variant:"outlined",sx:{alignSelf:"flex-end",color:"#54B4BF",borderColor:"#54B4BF"},onClick:()=>c(!0),children:"납품지 관리"}),(0,r.jsx)(o.Z,{variant:"contained",sx:{alignSelf:"flex-end",backgroundColor:"#54B4BF"},onClick:()=>B(null),children:"발주하기"})]})]}),(0,r.jsxs)(eh,{children:[(0,r.jsx)(u.M,{label:"시작 날짜",value:p()(S),onChange:e=>{e&&k(p()(e).format("YYYY-MM-DD"))},slotProps:{textField:{fullWidth:!0}}}),(0,r.jsx)(u.M,{label:"종료 날짜",value:p()(z),onChange:e=>{e&&D(p()(e).format("YYYY-MM-DD"))},slotProps:{textField:{fullWidth:!0}}})]}),(0,r.jsx)(F,{orderList:Z,fetchOrderList:E,productList:v,deliverySites:N,onReorder:e=>{var t,l;return B({productName:e.productName,quantity:String(e.quantity),deliveryPlace:null!==(t=e.deliveryPlace)&&void 0!==t?t:"",memo:null!==(l=e.memo)&&void 0!==l?l:""})}}),(0,r.jsx)(et,{open:t,onClose:()=>l(!1),productList:v,deliverySites:N,loading:f,initialDraft:h,onManageSites:()=>c(!0),onSubmit:M}),(0,r.jsx)(eo,{open:d,onClose:()=>c(!1),sites:N,loading:P,onChanged:Y})]})})};let eu=(0,d.ZP)(c.Z)({minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center"}),ex=(0,d.ZP)(c.Z)({display:"flex",width:"90%",flexDirection:"row",alignItems:"flex-start",marginBottom:20,justifyContent:"space-between"}),eh=(0,d.ZP)(c.Z)({display:"flex",gap:"16px",width:"90%",marginBottom:"20px"})}},function(e){e.O(0,[214,478,888,774,179],function(){return e(e.s=3847)}),_N_E=e.O()}]);

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.