def staff_login_menu(): ''' Show login menu for staff ''' print(''' --------- Staff Login --------- [1] -- Login -- [x] -- Go Back -- ''') return get_opt('1x')
def member_login_menu(): ''' Show login menu for member ''' print(''' --------- Member Login --------- [1] -- Login -- [2] -- Register -- [x] -- Go Back -- ''') return get_opt('12x')
def menu(): ''' Dispaly main menu ''' print(''' --------- Main Menu --------- [1] -- Member -- [2] -- Clerk -- [3] -- Manager -- [x] -- Quit -- ''') return get_opt('123x')
def member_purchase_items_menu(): ''' Display menu for purchasing items ''' print( ''' --------- Member Panel - Purchase Items --------- [1] -- List Item by Item Name -- [2] -- List All Items -- [x] -- Go Back -- ''' ) return get_opt('12x')
def member_panel_menu(): ''' Display member panel menu ''' print(''' --------- Member Panel --------- [0] -- Account Info -- [1] -- Recharge Card -- [2] -- Purchase Items -- [3] -- Transactions -- [4] -- Return Card [x] -- Logout -- ''') return get_opt('01234x')
def member_purchase_items(member): ''' Purchase items ''' opt = member_purchase_items_menu() print() if opt == '1': item_name = inp_item_name() print() item = qry_item(item_name) if not item: print('\tNo such item') return items = [item] elif opt == '2': items = qry_all_items() if not items: print('\tNo items available') return else: return card_no, _, _, _, _, _, _, balance = member while True: options = [] for i, item in enumerate(items): options.append(str(i + 1)) ind = '[{}]'.format(i + 1) item_name, item_descr, item_price = item print('\t{} Name: {}'.format(ind, item_name)) print('\t{} Descr: {}'.format(len(ind) * ' ', item_descr)) print('\t{} Price: {}\n'.format(len(ind) * ' ', item_price)) print('\t[x] -- Go Back --\n') options += ['x'] opt = get_opt(options) if opt == 'x': break item_name, _, item_price = items[int(opt) - 1] if item_price > balance: print('\tYour balance is not enough') else: balance -= item_price add_transaction(card_no, item_name, item_price) upd_member_balance(card_no, balance) member[6] = balance print('\tYour have purchased {} at {}'.format(item_name, item_price)) print('\tYour balance: {}'.format(balance)) input('\nPress enter to continue...') print()
def clerk_panel_menu(): ''' Display clerk panel menu ''' print(''' --------- Clerk Panel --------- [0] -- Account Info -- [1] -- List Member by Card No. -- [2] -- List Member by Phone No. -- [3] -- List All Members -- [4] -- List Transactions by Card NO. -- [5] -- List Transactions by Item Name -- [6] -- List Transactions by Date -- [7] -- List All Transactions -- [8] -- List Item by Name -- [9] -- List All Items -- [x] -- Logout -- ''') return get_opt('0123456789x')
def manager_panel_menu(): ''' Display manager panel menu ''' print(''' --------- Manager Panel --------- [0] -- Account Info -- [1] -- List Member by Card No. -- [2] -- List Member by Phone No. -- [3] -- List All Members -- [4] -- List Transactions by Card NO. -- [5] -- List Transactions by Item Name -- [6] -- List Transactions by Date -- [7] -- List All Transactions -- [8] -- Add Item -- [9] -- Manage Items -- [10] -- Add Clerk -- [11] -- Manage Clerks -- [x] -- Logout -- ''') return get_opt( ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', 'x'))