Init commit
This commit is contained in:
2
keyboard/__init__.py
Normal file
2
keyboard/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import default
|
||||
from . import inline
|
0
keyboard/default/__init__.py
Normal file
0
keyboard/default/__init__.py
Normal file
0
keyboard/default/admin/__init__.py
Normal file
0
keyboard/default/admin/__init__.py
Normal file
41
keyboard/default/admin/main_menu.py
Normal file
41
keyboard/default/admin/main_menu.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from aiogram.types.reply_keyboard import ReplyKeyboardMarkup, KeyboardButton
|
||||
|
||||
from load import messages
|
||||
from utils.json import permission
|
||||
|
||||
|
||||
def main_menu():
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
|
||||
markup.add(KeyboardButton(messages.add_post), KeyboardButton(messages.delete_post))
|
||||
admin_control = []
|
||||
if permission.can_admin_add_admins:
|
||||
admin_control.append(KeyboardButton(messages.add_admin))
|
||||
if permission.can_admin_del_admins:
|
||||
admin_control.append(KeyboardButton(messages.del_admin))
|
||||
if admin_control:
|
||||
markup.add(*admin_control)
|
||||
markup.add(KeyboardButton(messages.back))
|
||||
|
||||
return markup
|
||||
|
||||
|
||||
def base_menu(cancel=True, skip=False):
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
if cancel:
|
||||
markup.row(KeyboardButton(messages.cancel_message))
|
||||
if skip:
|
||||
markup.row(KeyboardButton(messages.skip_message))
|
||||
return markup
|
||||
|
||||
|
||||
continue_btn = ReplyKeyboardMarkup(
|
||||
[[KeyboardButton(messages.continue_),
|
||||
KeyboardButton(messages.cancel_message)]],
|
||||
resize_keyboard=True
|
||||
)
|
||||
all_right = ReplyKeyboardMarkup(
|
||||
[[KeyboardButton(messages.all_right_message),
|
||||
KeyboardButton(messages.cancel_message)]],
|
||||
resize_keyboard=True
|
||||
)
|
16
keyboard/default/checkout.py
Normal file
16
keyboard/default/checkout.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from aiogram.types.reply_keyboard import ReplyKeyboardMarkup, KeyboardButton
|
||||
|
||||
from load import messages
|
||||
|
||||
def checkout_btn() -> ReplyKeyboardMarkup:
|
||||
return ReplyKeyboardMarkup([[
|
||||
KeyboardButton(messages.all_right_message),
|
||||
KeyboardButton(messages.cancel_message)
|
||||
]], resize_keyboard=True)
|
||||
|
||||
def confirm_all_info():
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
markup.add(KeyboardButton(messages.all_right_message))
|
||||
markup.row(KeyboardButton(messages.save_and_continue))
|
||||
markup.row(KeyboardButton(messages.cancel_message))
|
||||
return markup
|
41
keyboard/default/main_menu.py
Normal file
41
keyboard/default/main_menu.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from aiogram.types.reply_keyboard import ReplyKeyboardMarkup, KeyboardButton
|
||||
|
||||
from load import messages
|
||||
|
||||
|
||||
def main_menu(admin=False, operator=False):
|
||||
markup = ReplyKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
KeyboardButton(messages.catalog), # Go to catalog
|
||||
KeyboardButton(messages.cart) # Go to cart
|
||||
]
|
||||
],
|
||||
resize_keyboard=True
|
||||
).add(KeyboardButton(messages.info))
|
||||
if admin == True:
|
||||
markup.add(KeyboardButton(messages.admin_panel))
|
||||
|
||||
if operator == True:
|
||||
markup.add(KeyboardButton(messages.operator_panel))
|
||||
|
||||
return markup
|
||||
|
||||
|
||||
def cart_btn(is_empty=True):
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
if not is_empty:
|
||||
markup.add(KeyboardButton(messages.checkout))
|
||||
markup.add(KeyboardButton(messages.clean_cart))
|
||||
markup.add(KeyboardButton(messages.back))
|
||||
return markup
|
||||
|
||||
back_to_main_menu = ReplyKeyboardMarkup(keyboard=[[KeyboardButton(messages.back)]],resize_keyboard=True)
|
||||
cancel_btn = ReplyKeyboardMarkup([[KeyboardButton(messages.cancel_message)]], resize_keyboard=True)
|
||||
get_phone_number = ReplyKeyboardMarkup(
|
||||
keyboard=[
|
||||
[KeyboardButton(messages.contact, request_contact=True)]
|
||||
],
|
||||
resize_keyboard=True
|
||||
).row(KeyboardButton(messages.cancel_message))
|
||||
continue_btn = ReplyKeyboardMarkup([[KeyboardButton(messages.continue_)]], resize_keyboard=True)
|
10
keyboard/default/ordering.py
Normal file
10
keyboard/default/ordering.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from aiogram.types.reply_keyboard import ReplyKeyboardMarkup, KeyboardButton
|
||||
|
||||
from load import messages
|
||||
|
||||
def load_info(data:bool = False):
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
if data:
|
||||
markup.row(KeyboardButton(messages.load_data))
|
||||
markup.row(KeyboardButton(messages.rewrite_data))
|
||||
return markup
|
0
keyboard/inline/__init__.py
Normal file
0
keyboard/inline/__init__.py
Normal file
26
keyboard/inline/admin/catalog.py
Normal file
26
keyboard/inline/admin/catalog.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
|
||||
from load import messages
|
||||
|
||||
|
||||
def item_list(item=0, items:int=1, user_count:int=1) -> InlineKeyboardMarkup:
|
||||
markup = InlineKeyboardMarkup()
|
||||
default = [
|
||||
InlineKeyboardButton(user_count, callback_data='null')
|
||||
]
|
||||
back = ['⬅️', f"adm_prev|{item-1}|{user_count-1}"]
|
||||
next = ['➡️', f"adm_next|{item+1}|{user_count+1}"]
|
||||
|
||||
|
||||
if items < 1 or item >= items:
|
||||
next = [" ", "null"]
|
||||
|
||||
if item == 0:
|
||||
back = [" ", "null"]
|
||||
|
||||
|
||||
default.append(InlineKeyboardButton(next[0], callback_data=next[1]))
|
||||
|
||||
markup.add(InlineKeyboardButton(back[0], callback_data=back[1]), *default)
|
||||
markup.row(InlineKeyboardButton(messages.delete_post, callback_data=f"delete_post|{item}"))
|
||||
return markup
|
24
keyboard/inline/admin/user.py
Normal file
24
keyboard/inline/admin/user.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from aiogram.types.inline_keyboard import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from load import messages
|
||||
|
||||
def item_list(item=0, items:int=1, user_count:int=1) -> InlineKeyboardMarkup:
|
||||
markup = InlineKeyboardMarkup()
|
||||
default = [
|
||||
InlineKeyboardButton(user_count, callback_data='null')
|
||||
]
|
||||
back = ['⬅️', f"admin_prev|{item-1}|{user_count-1}"]
|
||||
next = ['➡️', f"admin_next|{item+1}|{user_count+1}"]
|
||||
|
||||
|
||||
if items < 1 or item >= items:
|
||||
next = [" ", "null"]
|
||||
|
||||
if item == 0:
|
||||
back = [" ", "null"]
|
||||
|
||||
|
||||
default.append(InlineKeyboardButton(next[0], callback_data=next[1]))
|
||||
|
||||
markup.add(InlineKeyboardButton(back[0], callback_data=back[1]), *default)
|
||||
markup.row(InlineKeyboardButton(messages.del_admin, callback_data=f"delete_admin|{item}"))
|
||||
return markup
|
24
keyboard/inline/cart.py
Normal file
24
keyboard/inline/cart.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
|
||||
from load import messages
|
||||
|
||||
def cart_list(item=0, items:int=1) -> InlineKeyboardMarkup:
|
||||
markup = InlineKeyboardMarkup()
|
||||
default = [
|
||||
InlineKeyboardButton(item+1, callback_data='null')
|
||||
]
|
||||
back = ['⬅️', f"cart_prev|{item-1}"]
|
||||
next = ['➡️', f"cart_next|{item+1}"]
|
||||
|
||||
|
||||
if items < 1 or item >= items:
|
||||
next = [" ", "null"]
|
||||
|
||||
if item <= 0:
|
||||
back = [" ", "null"]
|
||||
|
||||
default.append(InlineKeyboardButton(next[0], callback_data=next[1]))
|
||||
|
||||
markup.add(InlineKeyboardButton(back[0], callback_data=back[1]), *default)
|
||||
markup.row(InlineKeyboardButton(messages.delete, callback_data=f"del_from_cart|{item}"))
|
||||
return markup
|
25
keyboard/inline/catalog.py
Normal file
25
keyboard/inline/catalog.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
|
||||
from load import messages
|
||||
|
||||
|
||||
def item_list(item=0, items:int=1, user_count:int=1) -> InlineKeyboardMarkup:
|
||||
markup = InlineKeyboardMarkup()
|
||||
default = [
|
||||
InlineKeyboardButton(user_count, callback_data='null')
|
||||
]
|
||||
back = ['⬅️', f"prev|{item-1}|{user_count-1}"]
|
||||
next = ['➡️', f"next|{item+1}|{user_count+1}"]
|
||||
|
||||
|
||||
if items < 1 or item >= items:
|
||||
next = [" ", "null"]
|
||||
|
||||
if item == 0:
|
||||
back = [" ", "null"]
|
||||
|
||||
default.append(InlineKeyboardButton(next[0], callback_data=next[1]))
|
||||
|
||||
markup.add(InlineKeyboardButton(back[0], callback_data=back[1]), *default)
|
||||
markup.row(InlineKeyboardButton(messages.add_to_cart, callback_data=f"add_to_cart|{item}"))
|
||||
return markup
|
22
keyboard/inline/checkout.py
Normal file
22
keyboard/inline/checkout.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
|
||||
|
||||
def cart_list(item=0, items:int=1) -> InlineKeyboardMarkup:
|
||||
markup = InlineKeyboardMarkup()
|
||||
default = [
|
||||
InlineKeyboardButton(item+1, callback_data='null')
|
||||
]
|
||||
back = ['⬅️', f"cart_prev|{item-1}"]
|
||||
next = ['➡️', f"cart_next|{item+1}"]
|
||||
|
||||
|
||||
if items < 1 or item >= items:
|
||||
next = [" ", "null"]
|
||||
|
||||
if item <= 0:
|
||||
back = [" ", "null"]
|
||||
|
||||
default.append(InlineKeyboardButton(next[0], callback_data=next[1]))
|
||||
|
||||
markup.add(InlineKeyboardButton(back[0], callback_data=back[1]), *default)
|
||||
return markup
|
Reference in New Issue
Block a user