def run():
    options = [
        "Display data as a table", "Add new data", "Remove data", "Update",
        "What is the id of the customer with the longest name?",
        "Which customers has subscribed to the newsletter?"
    ]
    choice = None
    while choice != "0":
        terminal_view.print_menu("CRM menu ", options, "Go back to main menu")
        inputs = terminal_view.get_inputs(["Please enter a number: "], "")
        choice = inputs[0]
        table_titles = ["id", "name", "email", "subscribed"]
        #reading data from file
        data_table = data_manager.get_table_from_file(
            "model/crm/customers.csv")
        if choice == "1":
            terminal_view.print_table(data_table, table_titles)
        elif choice == "2":
            table_titles.pop(0)
            crm.add(data_table, table_titles)
        elif choice == "3":
            crm.remove(data_table, get_user_id("remove"))
        elif choice == "4":
            crm.update(data_table, get_user_id("update"),
                       common.get_user_record(table_titles[1:]))
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 2
0
def run():
    options = [
        "Display data as a table", "Add new data", "Remove data", "Update",
        "What is the id of the item that was sold for the lowest price?",
        "Which items are sold between two given dates?"
    ]
    choice = None
    while choice != "0":
        terminal_view.print_menu("Sales menu ", options,
                                 "Go back to main menu")
        inputs = terminal_view.get_inputs(["Please enter a number: "], "")
        choice = inputs[0]
        table_titles = ["id", "title", "price", "month", "day", "year"]
        #reading data from file
        data_table = data_manager.get_table_from_file("model/sales/sales.csv")
        if choice == "1":
            terminal_view.print_table(data_table, table_titles)
        elif choice == "2":
            table_titles.pop(0)
            sales.add(data_table, table_titles)
        elif choice == "3":
            sales.remove(data_table, get_user_id("remove"))
        elif choice == "4":
            sales.update(data_table, get_user_id("update"),
                         common.get_user_record(table_titles[1:]))
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 3
0
def run():
    options = ["Display data as a table",
               "Add new data",
               "Remove data",
               "Update",
               "Get amount of games by each manufactor",
               "Get amount of games by manufacture"]
    table_titles = ["id", "title", "manufacturer", "price", "in_stock"]
    choice = None
    while choice != "0":
        terminal_view.print_menu("Store manager menu ", options, "Go back to main menu")
        inputs = terminal_view.get_inputs(["Please enter a number: "], "")
        choice = inputs[0]
        #reading data from file
        data_table = data_manager.get_table_from_file("model/store/games.csv")
        if choice == "1":
            terminal_view.print_table(data_table, table_titles)
        elif choice == "2":
            table_titles.pop(0)
            store.add(data_table, table_titles)
        elif choice == "3":
            store.remove(data_table, get_user_id("remove"))
        elif choice == "4":
            store.update(data_table, get_user_id("update"), common.get_user_record(table_titles[1:]))
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
def run():
    options = ["Display data as a table",
               "Add new data",
               "Remove data",
               "Update",
               "Which year has the highest profit?",
               "What is the average (per item) profit in a given year?"]
    table_titles = ["id", "month of the transaction", "day of the transaction", "year", "type", "amount"]
    choice = None
    while choice != "0":
        terminal_view.print_menu("Accounting menu ", options, "Go back to main menu")
        inputs = terminal_view.get_inputs(["Please enter a number: "], "")
        choice = inputs[0]
        #reading data from file
        data_table = data_manager.get_table_from_file("model/accounting/items.csv")
        if choice == "1":
            terminal_view.print_table(data_table, table_titles)
        elif choice == "2":
            table_titles.pop(0)
            accounting.add(data_table, table_titles)
        elif choice == "3":
            accounting.remove(data_table, get_user_id("remove"))
        elif choice == "4":
            accounting.update(data_table, get_user_id("update"), common.get_user_record(table_titles[1:]))
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
def run():
    options = [
        "Display data as a table", "Add new data", "Remove data", "Update",
        "Who is the oldest person?", "Who is the closest to the average age?"
    ]
    choice = None
    while choice != "0":
        terminal_view.print_menu("Human resources menu ", options,
                                 "Go back to main menu")
        inputs = terminal_view.get_inputs(["Please enter a number: "], "")
        choice = inputs[0]
        table_titles = ["id", "name", "year of birth"]
        #reading data from file
        data_table = data_manager.get_table_from_file("model/hr/persons.csv")
        if choice == "1":
            terminal_view.print_table(data_table, table_titles)
        elif choice == "2":
            table_titles.pop(0)
            hr.add(data_table, table_titles)
        elif choice == "3":
            hr.remove(data_table, get_user_id("remove"))
        elif choice == "4":
            hr.update(data_table, get_user_id("update"),
                      common.get_user_record(table_titles[1:]))
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 6
0
def run():
    options = [
        "Display data as a table", "Add new data", "Remove data", "Update",
        "Which items have not exceeded their durability yet?",
        "What are the average durability times for each manufacturer?"
    ]
    choice = None
    while choice != "0":
        terminal_view.print_menu("Inventory menu ", options,
                                 "Go back to main menu")
        inputs = terminal_view.get_inputs(["Please enter a number: "], "")
        choice = inputs[0]
        table_titles = [
            "id", "name", "manufacturer", "Year of purchase", "durability"
        ]
        #reading data from file
        data_table = data_manager.get_table_from_file(
            "model/inventory/inventory.csv")
        if choice == "1":
            terminal_view.print_table(data_table, table_titles)
        elif choice == "2":
            table_titles.pop(0)
            inventory.add(data_table, table_titles)
        elif choice == "3":
            inventory.remove(data_table, get_user_id("remove"))
        elif choice == "4":
            inventory.update(data_table, get_user_id("update"),
                             common.get_user_record(table_titles[1:]))
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
def basic_submenu():
    title = "Store manager\n"

    options = [
        "(1) View table", "(2) Add to table", "(3) Remove from table",
        "(4) Update table", "(6) Return to main menu"
    ]
    argument = None
    choice = None
    while argument != "0":
        choice = terminal_view.get_choice(options)
        if choice == "1":
            store.show(table)
        elif choice == "2":
            store.add(table, record)
        elif choice == "3":
            store.remove(table, id_)
        elif choice == "4":
            store.update(table, id_, record)
        elif choice == "6":
            os.system('cls||clear')
            root_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 8
0
def main():
    root_controller.run()
Ejemplo n.º 9
0
def main():
    return root_controller.run()