@@ -4,7 +4,7 @@ import { useState, SetStateAction, useContext, useEffect, useRef } from "react";
4
4
import { useTranslations , useLocale } from "next-intl" ;
5
5
import { Button } from "../Forms/Buttons/Buttons" ;
6
6
import { TextArea , Input , FileInput , Select } from "../Forms/Inputs/Inputs" ;
7
- import { Notification } from "../confirm" ;
7
+ import { ConfirmDialogX , Notification } from "../confirm" ;
8
8
import { ISeller , SellerItem , StockLevelType } from "@/constants/types" ;
9
9
import { addOrUpdateSellerItem , deleteSellerItem , fetchSellerItems } from "@/services/sellerApi" ;
10
10
import removeUrls from "@/utils/sanitize" ;
@@ -200,6 +200,7 @@ export const ShopItem: React.FC<{
200
200
const [ previewImage , setPreviewImage ] = useState < string > (
201
201
formData ?. image || '' ,
202
202
) ;
203
+ const [ showPopup , setShowPopup ] = useState ( false ) ;
203
204
const [ showDialog , setShowDialog ] = useState < boolean > ( false ) ;
204
205
const [ file , setFile ] = useState < File | null > ( null ) ;
205
206
const { reload, setReload, showAlert } = useContext ( AppContext ) ;
@@ -300,7 +301,7 @@ export const ShopItem: React.FC<{
300
301
const resp = await deleteSellerItem ( item_id ) ;
301
302
if ( resp ) {
302
303
setReload ( true ) ;
303
- setShowDialog ( true ) ;
304
+ // setShowDialog(true);
304
305
setIsAddItemEnabled ( false ) ;
305
306
showAlert ( t ( 'SCREEN.SELLER_REGISTRATION.VALIDATION.SUCCESSFUL_SELLER_ITEM_DELETED' ) ) ;
306
307
}
@@ -418,7 +419,7 @@ export const ShopItem: React.FC<{
418
419
padding : '5px 8px' ,
419
420
width : "100%"
420
421
} }
421
- onClick = { ( ) => handleDelete ( formData . _id ) }
422
+ onClick = { ( ) => setShowPopup ( true ) }
422
423
/>
423
424
< Button
424
425
label = { t ( 'SHARED.SAVE' ) }
@@ -461,6 +462,13 @@ export const ShopItem: React.FC<{
461
462
</ div >
462
463
</ div >
463
464
</ div >
465
+ { showPopup && (
466
+ < ConfirmDialogX
467
+ toggle = { ( ) => setShowPopup ( false ) }
468
+ handleClicked = { ( ) => handleDelete ( formData . _id ) }
469
+ message = { t ( 'SHARED.MAP_CENTER.VALIDATION.MAP_CENTER_SUCCESS_MESSAGE' ) }
470
+ />
471
+ ) }
464
472
</ >
465
473
) ;
466
474
} ;
0 commit comments