Exemplo n.º 1
0
 def print_products_paginate(products, page, last_page):
     print('')
     if len(products) == 0:
         print('Oops, shop is empty')
         return False
     print('Item ID  Name          Price     Quantity')
     print('___________________________________________')
     for index, product in enumerate(products):
         print('{}.'.format(index + 1), end=" ")
         print((6 - len(str(index + 1))) * ' ', end=" ")
         if len(product.name) > 8:
             print('{}..'.format(product.name[0:8]), end=" ")
             print('  ', end=" ")
         else:
             print(product.name, end=" ")
             print((12 - len(product.name)) * ' ', end=" ")
         print('{}$'.format(product.price), end=" ")
         print((7 - len(str(product.price))) * ' ', end=" ")
         print('{} pieces'.format(product.quantity), end=" ")
         print('')
     print('_______________')
     if not page == 1:
         print('8. Previous', end="   ")
     if not page == last_page:
         print('9. Back', end="   ")
         print('10. Next')
     else:
         print('9. Back')
     index = HelperFuncs().input_int('What you want to buy? ', 1, 10)
     return index
Exemplo n.º 2
0
 def print_main_menu():
     print('')
     print('1. Go to shopping')
     print('2. Admin')
     print('3. Quit')
     print('_______________')
     sel = HelperFuncs().input_int('Select what you want: ', 1, 3)
     return sel
Exemplo n.º 3
0
 def print_accountancy_menu():
     print('')
     print('1. Show sold products')
     print('2. Show profit')
     print('3. Show tatal salary')
     print('4. Back')
     print('5. Home')
     print('_______________')
     sel = HelperFuncs().input_int('what do you want to see? ', 1, 5)
     return sel
Exemplo n.º 4
0
 def print_workers_edit_menu():
     print('')
     print('1. Add worker')
     print('2. Edit worker salary')
     print('3. Lay off worker')
     print('4. Back')
     print('5. Home')
     print('_______________')
     sel = HelperFuncs().input_int('What do you want to do? ', 1, 5)
     return sel
Exemplo n.º 5
0
 def print_admin_menu():
     print('')
     print('1. Accountancy')
     print('2. Edit Products')
     print('3. Edit Staff')
     print('4. Add Admin')
     print('5. Back')
     print('_______________')
     sel = HelperFuncs().input_int('Choose an action: ', 1, 5)
     return sel
Exemplo n.º 6
0
 def print_product_edit_menu():
     print('')
     print('1. Add product')
     print('2. Edit product')
     print('3. Remove product')
     print('4. Back')
     print('5. Home')
     print('_______________')
     sel = HelperFuncs().input_int('What do you want to do? ', 1, 5)
     print('')
     return sel
Exemplo n.º 7
0
 def ask_quantity():
     quantity = HelperFuncs().input_int('How many pieces you want? ', 1, 1000)
     return quantity
Exemplo n.º 8
0
 def enter_worker_new_salary():
     salary = HelperFuncs().input_int('Enter worker new salary: ', 1, 1000)
     return int(salary)
Exemplo n.º 9
0
 def enter_worker_id(max_id):
     id = HelperFuncs().input_int('Enter worker id: ', 1, max_id)
     return int(id)
Exemplo n.º 10
0
 def enter_worker():
     name = HelperFuncs().check_string('Enter worker name: ', 'name', 3, 10)
     age = HelperFuncs().input_int('Enter worker age: ', 0, 10000)
     salary = HelperFuncs().input_int('Enter worker salary: ', 0, 1000)
     return {'name': name, 'age': age, 'salary': salary}
Exemplo n.º 11
0
 def enter_product_id(max_id):
     id = HelperFuncs().input_int('Enter product id: ', 1, max_id)
     return int(id)
Exemplo n.º 12
0
 def enter_product():
     name = HelperFuncs().check_string('Enter product name: ', 'name', 3, 10)
     price = HelperFuncs().input_float('Enter product price: ', 0, 10000)
     quantity = HelperFuncs().input_int('Enter product quantity: ', 0, 1000)
     return {'name': name, 'price': price, 'quantity': quantity}
Exemplo n.º 13
0
 def print_admin_register():
     login = HelperFuncs().check_string("Login: "******"Password: ", 'password', 4, 10)
     return {'login': login, 'password': password}