diff --git a/src/handlers/adminHandlers/adminProductHandler.js b/src/handlers/adminHandlers/adminProductHandler.js index 3cb6073..51012d1 100644 --- a/src/handlers/adminHandlers/adminProductHandler.js +++ b/src/handlers/adminHandlers/adminProductHandler.js @@ -137,6 +137,8 @@ export default class AdminProductHandler { const messageId = callbackQuery.message.message_id; const [country, city, district] = callbackQuery.data.replace('prod_district_', '').split('_'); + userStates.delete(chatId); + try { const location = await LocationService.getLocation(country, city, district); @@ -232,6 +234,8 @@ export default class AdminProductHandler { userStates.set(chatId, {action: `add_category_${locationId}`}); + const location = await LocationService.getLocationById(locationId); + await bot.editMessageText( 'Please enter the name for the new category:', { @@ -239,7 +243,7 @@ export default class AdminProductHandler { message_id: callbackQuery.message.message_id, reply_markup: { inline_keyboard: [[ - {text: '❌ Cancel', callback_data: `prod_district_${locationId}`} + {text: '❌ Cancel', callback_data: `prod_district_${location.country}_${location.city}_${location.district}`} ]] } } @@ -760,6 +764,12 @@ export default class AdminProductHandler { throw new Error('Product not found'); } + const location = await LocationService.getLocationById(product.location_id); + + if (!location) { + throw new Error('Location not found'); + } + const message = ` 📦 Product Details: @@ -767,7 +777,7 @@ Name: ${product.name} Price: $${product.price} Description: ${product.description} Stock: ${product.quantity_in_stock} -Location: ${product.country}, ${product.city}, ${product.district} +Location: ${location.country}, ${location.city}, ${location.district} Category: ${product.category_name} Subcategory: ${product.subcategory_name} diff --git a/src/handlers/adminHandlers/adminUserHandler.js b/src/handlers/adminHandlers/adminUserHandler.js index 5c8e834..9f11876 100644 --- a/src/handlers/adminHandlers/adminUserHandler.js +++ b/src/handlers/adminHandlers/adminUserHandler.js @@ -175,7 +175,7 @@ ID: ${telegramId} 📊 Activity: - Total Purchases: ${detailedUser.purchase_count} - Total Spent: $${detailedUser.total_spent || 0} - - Active Wallets: ${detailedUser.wallet_count} + - Active Wallets: ${detailedUser.crypto_wallet_count} - Bonus Balance: $${user.bonus_balance || 0} - Total Balance: $${(user.total_balance || 0) + (user.bonus_balance || 0)}