Пример #1
0
def updateOrderProduct():
    total_price = 0
    order_number = random.randint(0,999999)
    order = getOrderByCartStatus(session['user_id'])
    for i in OrderProduct.listOrderProductById(order.id):
        total_price += i.price*i.quantity
    Order.updateOrderStatus(order.id, OrderStatus.getNameStatus('Created').id, total_price, order_number)
    return make_response(jsonify({'message':'success'}),200)
Пример #2
0
RegionDao.createNewRegion("North")
RegionDao.createNewRegion("West")
RegionDao.createNewRegion("South")
RegionDao.createNewRegion("East")

UserDao.createNewUser('Max', '1111','Maxim','Sidorov', '*****@*****.**',1,2)
UserDao.createNewUser('Nikol', '1111','Nikolay','Lobanov', '*****@*****.**', 4,1)
UserDao.createNewUser('Vanya', '1111','Ivan','Ivanov', '*****@*****.**', 2,1)
UserDao.createNewUser('Andrew', '1111','Andrew','Petrov', '*****@*****.**', 3,4)
UserDao.createNewUser('Katya', '1111','Ekaterina','Ivanova', '*****@*****.**', 4,3)
UserDao.createNewUser('Roma', '1111','Roman','Melnishin', '*****@*****.**', 2,1)
UserDao.createNewUser('Den', '1111','Dennis','Popov', '*****@*****.**', 3,1)
UserDao.createNewUser('Max90', '1111','Maxim','Smirnov', '*****@*****.**', 4,4)
UserDao.createNewUser('Yaroslav', '1111','Yaroslav','Lobanov', '*****@*****.**', 4,2)
UserDao.createNewUser('Seriy', '1111','Sergey','Lobanov', '*****@*****.**', 1,2)
UserDao.createNewUser('Dona', '1111','Donna','Popova', '*****@*****.**', 3,1)



DeliveryType.add_delivery('Courier')
DeliveryType.add_delivery('Express-mail')
DeliveryType.add_delivery('Himself')

OrderStatus.add_status('Ordered')
OrderStatus.add_status('Delivered')
OrderStatus.add_status('Created')
OrderStatus.add_status('Pending')
OrderStatus.add_status('Cart')

Пример #3
0
def addOrderWithStatusCart(user_id):
    if Order.getOrderByStatus(user_id) is None:
        Order.add_order(user_id,date.today(), OrderStatus.getNameStatus('Cart').id)
Пример #4
0
def list_status():
        s_list = OrderStatus.get_all_order_status()
        return s_list
Пример #5
0
def page_order():
    user_id = session['user_id']
    filter = ({'name': request.args.get('name_input'),
                   'order_option': request.args.get('order_option'),
                   'status_option': request.args.get('status_option')})
    records_per_page = int(request.args.get('table_size'))
    page = int(request.args.get('page'))
    sort_by = request.args.get('sort_by')
    order_sort_by = request.args.get('order_sort_by')
    prods, records_amount = Order.pagerByFilterByMerchandiser(user_id, page, records_per_page, sort_by, order_sort_by, filter)
    orders_list = []
    for i in prods:
        orders_list.append({'order_id': str(i.id), 'order_number': str(i.order_number), 'orderStatus': OrderStatus.get_status(i.status_id).name,'total_price': str(i.total_price),
                            'user':i.user.first_name+' '+i.user.last_name,
                            'role': i.assignee.role.name})
    return make_response(jsonify(orders=orders_list, records_amount=records_amount,
                                 records_per_page=records_per_page), 200)

# add @filter@