Esempio n. 1
0
def add_product():
    insert_dict = {}
    for column in pc.get_columns():
        if column != "_id" and column != "id":
            # hook up associates
            # hook up storage info
            # empty orders []
            if column == 'associate':
                value = choose_associate()
            elif column == 'storage_info':
                value = {}
                value["shop_id"] = choose_shop()
                value["product_amount"] = input('product amount: ')
                value["min_amount"] = input('minimum amount: ')
                value["reorder_amount"] = input('re-order amount: ')
                value["internal_order"] = []
            elif column == 'orders':
                value = []
            else:
                value = input(f'{column}: ')

            insert_dict[column] = value
    divider()

    product = pc.add_product(insert_dict)
    if product is not None:
        print_tablerow(product)
Esempio n. 2
0
def add_order():
    insert_dict = {}
    for column in oc.get_columns():
        if column != "_id" and column != "id":
            if column == "customer_info":
                value = {}
                value["first_name"] = input('first_name : ')
                value["last_name"] = input('last_name: ')
                value["address"] = input('address: ')
                value["phone"] = input('phone: ')
            elif column == "products":
                running = True
                value = []
                while running:
                    dict_values = {
                        "product_name": input('product_name: '),
                        "retail_price": int(input('retail_price: ')),
                    }
                    value.append(dict_values)
                    print('Do you want to add more products?\n'
                          '1: Yes\n'
                          '2: No')
                    if int(f_input()) == 1:
                        continue
                    else:
                        running = False
            else:
                value = input(f'{column}: ')

            insert_dict[column] = value
    divider()

    order = oc.add_order(insert_dict)
    if order is not None:
        print_tablerow(order)
Esempio n. 3
0
def get_car_by_id():
    print("Enter a id")
    c_id = f_input()
    car = cc.get_car_by_id(c_id)
    if car:
        print_tablerow(car)
    else:
        print("not found")
Esempio n. 4
0
def add_car():
    insert_dict = {}
    for column in cc.get_columns():
        if column != "_id":
            insert_dict[column] = input(f'{column}: ')

    car = cc.add_car(insert_dict)
    if car:
        print_tablerow(car)
        divider()
        return car
Esempio n. 5
0
def add_customer():
    insert_dict = {}
    for column in cc.get_columns():
        if column != "_id" and column != "id":
            if column == "cars":
                value = choose_cars()
            elif column == "address_info":
                value = {}
                value["address_line_one"] = input('address_line_one: ')
                value["address_line_two"] = input('address_line_two: ')
                value["zip_code"] = input('zip_code: ')
                value["country"] = input('country: ')
            elif column == "orders":
                value = []
            else:
                value = input(f'{column}: ')

            insert_dict[column] = value
    divider()

    customer = cc.add_customer(insert_dict)
    if customer is not None:
        print_tablerow(customer)
Esempio n. 6
0
def update_order_column(column, order):
    print("Enter new value: ")
    value = f_input()
    oc.update_order_column(order, column, value)
    print_tablerow(order)
Esempio n. 7
0
def get_order_by_id():
    print("Enter an order Id")
    o_id = f_input()
    order = oc.get_order_by_id(o_id)
    print_tablerow(order)
Esempio n. 8
0
def update_car_column(column, car):
    print("Enter new value: ")
    value = f_input()
    cc.update_car_column(car, column, value)
    print_tablerow(car)
Esempio n. 9
0
def update_employee_column(column, employee):
    print("Enter new value: ")
    value = f_input()
    ec.update_employee_column(employee, column, value)
    print_tablerow(employee)
Esempio n. 10
0
def get_employee_by_id():
    print("Enter an employee id")
    e_id = f_input()
    employee = ec.get_employee_by_id(e_id)
    print_tablerow(employee)
Esempio n. 11
0
def get_customer_by_id():
    print("Enter a Customer Id")
    c_id = f_input()
    customer = cc.get_customer_by_id(c_id)
    print_tablerow(customer)
Esempio n. 12
0
def update_shop_column(column, shop):
    print("Enter new value: ")
    value = f_input()
    sc.update_shop_column(shop, column, value)
    print_tablerow(shop)
Esempio n. 13
0
def get_shop_by_id():
    print("Enter a shop id")
    s_id = f_input()
    shop = sc.get_shop_by_id(s_id)
    print_tablerow(shop)
Esempio n. 14
0
def update_product_column(column, product):
    print("Enter new value: ")
    value = f_input()
    pc.update_product_column(product, column, value)
    print_tablerow(product)
Esempio n. 15
0
def get_product_by_id():
    print("Enter a Product Id")
    p_id = f_input()
    product = pc.get_product_by_id(p_id)
    print_tablerow(product)
    divider()