@@ -28,6 +28,7 @@ import { ErrorFallback } from "@apps/pyconkr-admin/components/elements/error_fal
2828import { ORDER_PRODUCT_STATUS_LABEL , PAYMENT_STATUS_LABEL } from "@apps/pyconkr-admin/components/pages/shop/_common/status_labels" ;
2929import { addErrorSnackbar , addSnackbar } from "@apps/pyconkr-admin/utils/snackbar" ;
3030
31+ import { OrderNotificationDialog } from "./notification_dialog" ;
3132import { RefundDialog } from "./refund_dialog" ;
3233import { OrderAdmin , SimpleCustomerInfo , SimpleOrderProductRelation } from "./types" ;
3334
@@ -94,6 +95,7 @@ const CustomerInfoTab: FC<{ order: OrderAdmin }> = ({ order }) => {
9495const OrderProductRow : FC < { order : OrderAdmin ; relation : SimpleOrderProductRelation } > = ( { order, relation } ) => {
9596 const status = ORDER_PRODUCT_STATUS_LABEL [ relation . status ] ;
9697 const [ refundOpen , setRefundOpen ] = useState ( false ) ;
98+ const [ notifyOpen , setNotifyOpen ] = useState ( false ) ;
9799 const canRefund = canRefundProduct ( relation ) ;
98100 return (
99101 < >
@@ -108,16 +110,21 @@ const OrderProductRow: FC<{ order: OrderAdmin; relation: SimpleOrderProductRelat
108110 < TableCell align = "right" > { formatPrice ( relation . price ) } </ TableCell >
109111 < TableCell align = "right" > { relation . donation_price > 0 ? formatPrice ( relation . donation_price ) : "—" } </ TableCell >
110112 < TableCell align = "right" >
111- < Button
112- size = "small"
113- variant = "outlined"
114- color = "error"
115- startIcon = { < CurrencyExchange /> }
116- onClick = { ( ) => setRefundOpen ( true ) }
117- disabled = { ! canRefund }
118- >
119- 환불
120- </ Button >
113+ < Stack direction = "row" spacing = { 1 } justifyContent = "flex-end" >
114+ < Button size = "small" variant = "outlined" startIcon = { < NotificationsActive /> } onClick = { ( ) => setNotifyOpen ( true ) } >
115+ 알림
116+ </ Button >
117+ < Button
118+ size = "small"
119+ variant = "outlined"
120+ color = "error"
121+ startIcon = { < CurrencyExchange /> }
122+ onClick = { ( ) => setRefundOpen ( true ) }
123+ disabled = { ! canRefund }
124+ >
125+ 환불
126+ </ Button >
127+ </ Stack >
121128 </ TableCell >
122129 </ TableRow >
123130 < TableRow >
@@ -197,6 +204,7 @@ const OrderProductRow: FC<{ order: OrderAdmin; relation: SimpleOrderProductRelat
197204 </ TableCell >
198205 </ TableRow >
199206 < RefundDialog open = { refundOpen } onClose = { ( ) => setRefundOpen ( false ) } order = { order } kind = "product" relation = { relation } />
207+ { notifyOpen && < OrderNotificationDialog scope = { { kind : "orderProduct" , orderProductId : relation . id } } onClose = { ( ) => setNotifyOpen ( false ) } /> }
200208 </ >
201209 ) ;
202210} ;
@@ -289,6 +297,7 @@ const InnerOrderEditor: FC = ErrorBoundary.with(
289297 const client = useBackendAdminClient ( ) ;
290298 const [ tab , setTab ] = useState ( 0 ) ;
291299 const [ refundOpen , setRefundOpen ] = useState ( false ) ;
300+ const [ notifyOpen , setNotifyOpen ] = useState ( false ) ;
292301
293302 const orderQuery = useRetrieveQuery < OrderAdmin > ( client , "shop" , "order" , id ?? "" ) ;
294303 const order = orderQuery . data ;
@@ -308,13 +317,6 @@ const InnerOrderEditor: FC = ErrorBoundary.with(
308317 const status = PAYMENT_STATUS_LABEL [ order . current_status ] ?? { label : order . current_status , color : "default" as const } ;
309318 const canRefund = canRefundOrder ( order ) ;
310319
311- const onNotify = ( ) => {
312- navigate ( {
313- pathname : "/notification/notification/create" ,
314- search : `?order_id=${ order . id } ` ,
315- } ) ;
316- } ;
317-
318320 return (
319321 < Stack sx = { { flexGrow : 1 , width : "100%" , minHeight : "100%" } } spacing = { 3 } >
320322 < Stack direction = "row" justifyContent = "space-between" alignItems = "flex-start" flexWrap = "wrap" gap = { 2 } >
@@ -341,7 +343,7 @@ const InnerOrderEditor: FC = ErrorBoundary.with(
341343 </ Stack >
342344
343345 < Stack direction = "row" spacing = { 1 } >
344- < Button variant = "outlined" startIcon = { < NotificationsActive /> } onClick = { onNotify } >
346+ < Button variant = "outlined" startIcon = { < NotificationsActive /> } onClick = { ( ) => setNotifyOpen ( true ) } >
345347 알림 발송
346348 </ Button >
347349 < Button variant = "contained" color = "error" startIcon = { < CurrencyExchange /> } onClick = { ( ) => setRefundOpen ( true ) } disabled = { ! canRefund } >
@@ -400,6 +402,7 @@ const InnerOrderEditor: FC = ErrorBoundary.with(
400402 </ Box >
401403
402404 < RefundDialog open = { refundOpen } onClose = { ( ) => setRefundOpen ( false ) } order = { order } kind = "order" />
405+ { notifyOpen && < OrderNotificationDialog scope = { { kind : "order" , orderId : order . id } } onClose = { ( ) => setNotifyOpen ( false ) } /> }
403406 </ Stack >
404407 ) ;
405408 } )
0 commit comments