bug fixes

This commit is contained in:
Artyom Ashirov 2024-11-25 16:22:28 +03:00
parent 5d4f56e265
commit 64e6397570
2 changed files with 13 additions and 3 deletions

View File

@ -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}

View File

@ -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)}