def remove(table, id_):
    """
    Remove a record with a given id from the table.

    Args:
        table (list): table to remove a record from
        id_ (str): id of a record to be removed

    Returns:
        list: Table without specified record.
    """
    return common.delete_item(id_, table)
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    list_options = [
        "show table", "add", "remove", "update", "get lowest price item id",
        "get items sold between"
    ]
    exit_message = "Back to main menu"
    message = "There is no such option"
    title = "sales"
    ui.print_menu(title, list_options, exit_message)
    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]

    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_4,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_4,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_lowest_price_item_id(table)
    elif choice == '6':
        get_items_sold_between(table, month_from, day_from, year_from,
                               month_to, day_to, year_to)
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
Exemple #3
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    title = "HR"
    list_options = [
        "show table", "add", "remove", "update", "get_the oldest person",
        "get the person closest to the average"
    ]
    exit_message = "Back to main menu"
    ui.print_menu(title, list_options, exit_message)
    message = "There is no such option"

    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]
    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_1,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_1,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_oldest_person
    elif choice == '6':
        get_persons_closest_to_average
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    special_features = [
        "show table", "add record", "remove record", "update",
        "which year max", "avg amount"
    ]
    ui.print_menu("Accounting", special_features, "Back to main menu")
    message = "There is no such option"

    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]
    if choice == '1':
        show_table(table)
    elif choice == '2':
        #table = add(table)
        data_manager.write_table_to_file(FILE_NAME,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        which_yearmax(table, id_)
    elif choice == '6':
        avg_amount(table, year)
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    special_features = [
        "show table", "add record", "remove record", "update",
        "get longest name id", "get subscribed emails"
    ]
    ui.print_menu("CRM", special_features, "Back to main menu")
    message = "There is no such option"
    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]

    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_2,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_2,
                                         common.delete_item(id_, table))
    elif choice == "4":
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_longest_name_id()
    elif choice == '6':
        get_subscribed_emails()
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    special_features = [
        "show table", "add record", "remove record", "update",
        "get counts by manufacturers", "get average by manufacturers"
    ]
    ui.print_menu("Store", special_features, "Back to main menu")
    message = "There is no such option"

    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]
    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_5,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_5,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_counts_by_manufacturers()
    elif choice == '6':
        get_average_by_manufacturer()
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)