|
|
|
@ -5,8 +5,12 @@
|
|
|
|
|
|
|
|
|
|
from bot_sys import bot_bd, keyboard, user_access, bd_table |
|
|
|
|
from bot_modules import mod_table_operate, mod_simple_message, orders, access_utils |
|
|
|
|
from bot_modules import users, user_message |
|
|
|
|
from template import bd_item_select, bd_item_view, bd_item |
|
|
|
|
|
|
|
|
|
from enum import Enum |
|
|
|
|
from enum import auto |
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------- |
|
|
|
|
# БД |
|
|
|
|
module_name = 'all_orders' |
|
|
|
@ -18,6 +22,10 @@ init_access = f'{user_access.user_access_group_new}=-'
|
|
|
|
|
# --------------------------------------------------------- |
|
|
|
|
# Сообщения и кнопки |
|
|
|
|
|
|
|
|
|
class ButtonNames(Enum): |
|
|
|
|
SHOW_USER_INFO = auto() |
|
|
|
|
SEND_USER_MESSAGE = auto() |
|
|
|
|
|
|
|
|
|
button_names = {} |
|
|
|
|
button_names.update(orders.button_names) |
|
|
|
|
button_names.pop(mod_table_operate.ButtonNames.ADD) |
|
|
|
@ -26,6 +34,8 @@ cur_button_names = {
|
|
|
|
|
mod_simple_message.ButtonNames.START: "🛒 Все заказы", |
|
|
|
|
mod_table_operate.ButtonNames.LIST: "📃 Список текущих заказов", |
|
|
|
|
orders.ButtonNames.LIST_ALL: "📃 Список всех заказов", |
|
|
|
|
ButtonNames.SHOW_USER_INFO: "👤 Информация о пользователе", |
|
|
|
|
ButtonNames.SEND_USER_MESSAGE: "📨 Отправить сообщение пользователю", |
|
|
|
|
mod_table_operate.ButtonNames.EDIT: "🛠 Редактировать заказ", |
|
|
|
|
mod_table_operate.EditButton(bd_table.TableFieldDestiny.PHOTO_PAY): "☐ Загрузить чек по оплате заказа", |
|
|
|
|
mod_table_operate.EditButton(bd_table.TableFieldDestiny.PHOTO): "☐ Изменить изображение в заказе", |
|
|
|
@ -161,3 +171,29 @@ class ModuleAllOrders(orders.ModuleOrders):
|
|
|
|
|
None |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
def GetViewItemInlineKeyboard(self, a_Message, a_UserGroups, a_ItemID): |
|
|
|
|
table_name = self.m_Table.GetName() |
|
|
|
|
key_name = self.GetKeyFieldName() |
|
|
|
|
cur_item = mod_table_operate.GetCurItem(self.m_Bot, table_name, key_name, a_ItemID) |
|
|
|
|
|
|
|
|
|
user_id = None |
|
|
|
|
user_id_field_index = self.m_Table.GetFieldIDByDestiny(bd_table.TableFieldDestiny.USER_ID) |
|
|
|
|
if user_id_field_index and cur_item and cur_item[user_id_field_index]: |
|
|
|
|
user_id = cur_item[user_id_field_index] |
|
|
|
|
|
|
|
|
|
if not user_id: |
|
|
|
|
return None |
|
|
|
|
cur_buttons = [] |
|
|
|
|
users_mod = self.GetModule(users.module_name) |
|
|
|
|
if users_mod: |
|
|
|
|
cur_buttons += [ |
|
|
|
|
keyboard.InlineButtonWithAccess(self.GetButton(ButtonNames.SHOW_USER_INFO), users_mod.GetShowPrefix(), user_id, users_mod.GetAccess(), user_access.AccessMode.VIEW), |
|
|
|
|
] |
|
|
|
|
user_message_mod = self.GetModule(user_message.module_name) |
|
|
|
|
if user_message_mod: |
|
|
|
|
cur_buttons += [ |
|
|
|
|
keyboard.InlineButtonWithAccess(self.GetButton(ButtonNames.SEND_USER_MESSAGE), user_message_mod.GetAddPrefix(), user_id, user_message_mod.GetAccess(), user_access.AccessMode.ADD), |
|
|
|
|
] |
|
|
|
|
if len(cur_buttons) == 0: |
|
|
|
|
return None |
|
|
|
|
return keyboard.MakeInlineKeyboardButtons(self.m_Bot, cur_buttons, a_UserGroups) |
|
|
|
|