11import  *  as  Common  from  "@frontend/common" ; 
2- import  {  Button ,  CircularProgress ,  Divider ,  Stack ,  Typography  }  from  "@mui/material" ; 
2+ import  { 
3+   Button , 
4+   CircularProgress , 
5+   Divider , 
6+   Stack , 
7+   Table , 
8+   TableBody , 
9+   TableCell , 
10+   TableHead , 
11+   TableRow , 
12+   Typography , 
13+ }  from  "@mui/material" ; 
314import  {  ErrorBoundary ,  Suspense  }  from  "@suspensive/react" ; 
415import  *  as  React  from  "react" ; 
516import  *  as  R  from  "remeda" ; 
@@ -9,7 +20,7 @@ import ShopSchemas from "../../schemas";
920import  ShopUtils  from  "../../utils" ; 
1021import  CommonComponents  from  "../common" ; 
1122
12- const  PaymentHistoryStatusTranslated : { 
23+ const  PaymentHistoryStatusKo : { 
1324  [ k  in  ShopSchemas . PaymentHistoryStatus ] : string ; 
1425}  =  { 
1526  pending : "결제 대기중" , 
@@ -18,7 +29,17 @@ const PaymentHistoryStatusTranslated: {
1829  refunded : "환불됨" , 
1930} ; 
2031
32+ const  PaymentHistoryStatusEn : { 
33+   [ k  in  ShopSchemas . PaymentHistoryStatus ] : string ; 
34+ }  =  { 
35+   pending : "Pending" , 
36+   completed : "Completed" , 
37+   partial_refunded : "Partially refunded" , 
38+   refunded : "Refunded" , 
39+ } ; 
40+ 
2141type  OrderProductRelationItemProps  =  { 
42+   language : "ko"  |  "en" ; 
2243  order : ShopSchemas . Order ; 
2344  prodRel : ShopSchemas . OrderProductItem ; 
2445  isPending : boolean ; 
@@ -27,6 +48,7 @@ type OrderProductRelationItemProps = {
2748} ; 
2849
2950const  OrderProductRelationItem : React . FC < OrderProductRelationItemProps >  =  ( { 
51+   language, 
3052  order, 
3153  prodRel, 
3254  isPending, 
@@ -47,11 +69,15 @@ const OrderProductRelationItem: React.FC<OrderProductRelationItemProps> = ({
4769  const  hasPatchableOption  =  Object . entries ( currentCustomOptionValues ) . length  >  0 ; 
4870  const  patchOptionBtnDisabled  =  isPending  ||  ! hasPatchableOption ; 
4971
72+   const  refundOneProductStr  =  language  ===  "ko"  ? "단일 상품 환불"  : "Refund one item" ; 
73+   const  refundedStr  =  language  ===  "ko"  ? "환불됨"  : "Refunded" ; 
74+   const  modifyOptionStr  =  language  ===  "ko"  ? "옵션 수정"  : "Modify options" ; 
75+ 
5076  const  refundBtnDisabled  =  isPending  ||  ! R . isNullish ( prodRel . not_refundable_reason ) ; 
5177  const  refundBtnText  =  R . isNullish ( prodRel . not_refundable_reason ) 
52-     ? "단일 상품 환불" 
78+     ? refundOneProductStr 
5379    : prodRel . status  ===  "refunded" 
54-       ? "환불됨" 
80+       ? refundedStr 
5581      : prodRel . not_refundable_reason ; 
5682
5783  const  refundOneItem  =  ( )  => 
@@ -83,7 +109,7 @@ const OrderProductRelationItem: React.FC<OrderProductRelationItemProps> = ({
83109  const  actionButtons  =  ( 
84110    < > 
85111      < Button  variant = "contained"  fullWidth  onClick = { patchOneItemOptions }  disabled = { patchOptionBtnDisabled } > 
86-         옵션 수정 
112+         { modifyOptionStr } 
87113      </ Button > 
88114      < Button  variant = "contained"  fullWidth  onClick = { refundOneItem }  disabled = { refundBtnDisabled } > 
89115        { refundBtnText } 
@@ -92,7 +118,11 @@ const OrderProductRelationItem: React.FC<OrderProductRelationItemProps> = ({
92118  ) ; 
93119
94120  return  ( 
95-     < Common . Components . MDX . PrimaryStyledDetails  key = { prodRel . id }  summary = { prodRel . product . name }  actions = { actionButtons } > 
121+     < Common . Components . MDX . PrimaryStyledDetails 
122+       key = { prodRel . id } 
123+       summary = { < Typography  variant = "h6" > { prodRel . product . name } </ Typography > } 
124+       actions = { actionButtons } 
125+     > 
96126      < form 
97127        ref = { formRef } 
98128        onSubmit = { ( e )  =>  { 
@@ -115,7 +145,7 @@ const OrderProductRelationItem: React.FC<OrderProductRelationItemProps> = ({
115145} ; 
116146
117147const  OrderItem : React . FC < {  order : ShopSchemas . Order ;  disabled ?: boolean  } >  =  ( {  order,  disabled } )  =>  { 
118-   const  {  shopApiDomain }  =  ShopHooks . useShopContext ( ) ; 
148+   const  {  language ,   shopApiDomain }  =  ShopHooks . useShopContext ( ) ; 
119149  const  shopAPIClient  =  ShopHooks . useShopClient ( ) ; 
120150  const  orderRefundMutation  =  ShopHooks . useOrderRefundMutation ( shopAPIClient ) ; 
121151  const  oneItemRefundMutation  =  ShopHooks . useOneItemRefundMutation ( shopAPIClient ) ; 
@@ -124,6 +154,14 @@ const OrderItem: React.FC<{ order: ShopSchemas.Order; disabled?: boolean }> = ({
124154  const  refundOrder  =  ( )  =>  orderRefundMutation . mutate ( {  order_id : order . id  } ) ; 
125155  const  openReceipt  =  ( )  =>  window . open ( `${ shopApiDomain } ${ order . id }  ,  "_blank" ) ; 
126156
157+   const  PaymentHistoryStatus  =  language  ===  "ko"  ? PaymentHistoryStatusKo  : PaymentHistoryStatusEn ; 
158+   const  refundFullOrderStr  =  language  ===  "ko"  ? "주문 전체 환불"  : "Refund full order" ; 
159+   const  orderFullyRefundedStr  =  language  ===  "ko"  ? "주문 전체 환불됨"  : "Order fully refunded" ; 
160+   const  receiptStr  =  language  ===  "ko"  ? "영수증"  : "Receipt" ; 
161+   const  orderedPriceStr  =  language  ===  "ko"  ? "주문 결제 금액"  : "Ordered Price" ; 
162+   const  statusStr  =  language  ===  "ko"  ? "상태"  : "Status" ; 
163+   const  productsInOrderStr  =  language  ===  "ko"  ? "주문 상품 목록"  : "Products in Order" ; 
164+ 
127165  const  isPending  = 
128166    disabled  || 
129167    orderRefundMutation . isPending  || 
@@ -132,38 +170,77 @@ const OrderItem: React.FC<{ order: ShopSchemas.Order; disabled?: boolean }> = ({
132170  const  refundBtnDisabled  =  isPending  ||  ! R . isNullish ( order . not_fully_refundable_reason ) ; 
133171  const  receipyBtnDisabled  =  isPending  ||  order . current_status  ===  "pending" ; 
134172  const  btnText  =  R . isNullish ( order . not_fully_refundable_reason ) 
135-     ? "주문 전체 환불" 
173+     ? refundFullOrderStr 
136174    : order . current_status  ===  "refunded" 
137-       ? "주문 전체 환불됨" 
175+       ? orderFullyRefundedStr 
138176      : order . not_fully_refundable_reason ; 
177+   const  orderInfoStr  =  language  ===  "ko"  ? "주문 정보"  : "Order Information" ; 
178+   const  orderCustomerInfoStr  =  language  ===  "ko"  ? "주문 고객 정보"  : "Order Customer Information" ; 
179+   const  customerNameStr  =  language  ===  "ko"  ? "고객명"  : "Customer Name" ; 
180+   const  customerOrganizationStr  =  language  ===  "ko"  ? "고객 소속"  : "Customer Organization" ; 
181+   const  customerEmailStr  =  language  ===  "ko"  ? "고객 이메일"  : "Customer Email" ; 
182+   const  customerPhoneStr  =  language  ===  "ko"  ? "고객 연락처"  : "Customer Phone" ; 
139183
140184  const  actionButtons  =  ( 
141185    < > 
142-       < Button  variant = "contained"  fullWidth  onClick = { openReceipt }  disabled = { receipyBtnDisabled } > 
143-         영수증
144-       </ Button > 
145-       < Button  variant = "contained"  fullWidth  onClick = { refundOrder }  disabled = { refundBtnDisabled } > 
146-         { btnText } 
147-       </ Button > 
186+       < Button  variant = "contained"  fullWidth  onClick = { openReceipt }  disabled = { receipyBtnDisabled }  children = { receiptStr }  /> 
187+       < Button  variant = "contained"  fullWidth  onClick = { refundOrder }  disabled = { refundBtnDisabled }  children = { btnText }  /> 
148188    </ > 
149189  ) ; 
150190
151191  return  ( 
152192    < Common . Components . MDX . PrimaryStyledDetails  summary = { order . name }  actions = { actionButtons } > 
153-       < Divider  /> 
154-       < br  /> 
155-       < Typography  variant = "body1" > 
156-         주문 결제 금액 : < CommonComponents . PriceDisplay  price = { order . current_paid_price }  /> 
157-       </ Typography > 
158-       < Typography  variant = "body1" > 상태: { PaymentHistoryStatusTranslated [ order . current_status ] } </ Typography > 
159-       < br  /> 
160-       < Divider  /> 
193+       < Table > 
194+         < TableHead > 
195+           < TableRow > 
196+             < TableCell  align = "center"  sx = { {  width : "30%"  } }  /> 
197+             < TableCell  align = "left"  sx = { {  width : "70%"  } }  /> 
198+           </ TableRow > 
199+         </ TableHead > 
200+         < TableBody > 
201+           < TableRow > 
202+             < TableCell  colSpan = { 2 }  align = "center"  sx = { {  fontWeight : "bold"  } }  children = { orderInfoStr }  /> 
203+           </ TableRow > 
204+           < TableRow > 
205+             < TableCell  children = { orderedPriceStr }  /> 
206+             < TableCell  children = { < CommonComponents . PriceDisplay  price = { order . first_paid_price }  /> }  /> 
207+           </ TableRow > 
208+           < TableRow > 
209+             < TableCell  children = { statusStr }  /> 
210+             < TableCell  children = { PaymentHistoryStatus [ order . current_status ] }  /> 
211+           </ TableRow > 
212+           { order . customer_info  &&  ( 
213+             < > 
214+               < TableRow > 
215+                 < TableCell  colSpan = { 2 }  align = "center"  sx = { {  fontWeight : "bold"  } }  children = { orderCustomerInfoStr }  /> 
216+               </ TableRow > 
217+               < TableRow > 
218+                 < TableCell  children = { customerNameStr }  /> 
219+                 < TableCell  children = { order . customer_info . name }  /> 
220+               </ TableRow > 
221+               < TableRow > 
222+                 < TableCell  children = { customerOrganizationStr }  /> 
223+                 < TableCell  children = { order . customer_info . organization  ||  "N/A" }  /> 
224+               </ TableRow > 
225+               < TableRow > 
226+                 < TableCell  children = { customerEmailStr }  /> 
227+                 < TableCell  children = { order . customer_info . email }  /> 
228+               </ TableRow > 
229+               < TableRow > 
230+                 < TableCell  children = { customerPhoneStr }  /> 
231+                 < TableCell  children = { order . customer_info . phone }  /> 
232+               </ TableRow > 
233+             </ > 
234+           ) } 
235+         </ TableBody > 
236+       </ Table > 
161237      < br  /> 
162-       < Typography  variant = "body1"  > 주문 상품 목록 </ Typography > 
238+       < Typography  variant = "h6"  > { productsInOrderStr } </ Typography > 
163239      < br  /> 
164240      { order . products . map ( ( prodRel )  =>  ( 
165241        < OrderProductRelationItem 
166242          key = { prodRel . id } 
243+           language = { language } 
167244          order = { order } 
168245          prodRel = { prodRel } 
169246          isPending = { isPending } 
0 commit comments