Exemplo n.º 1
0
def order(id):
    order = Order.query.filter_by(id=id).first()
    if not order:
        flash(gettext('Data not found.'))
        return redirect(url_for('orders'))
    form = EditDateTimeForm()
    if order:
        products = order.products

    if form.validate_on_submit():
        if form.datetime.data:
            order.created_dt = form.datetime.data
            db.session.add(order)
            db.session.commit()
            flash(gettext("Date and time of order was successfully changed."))

    form.datetime.data = order.created_dt
    return render_template('orders/order.html',
                            title=gettext("Order details"),
                            order=order,
                            form=form,
                            products=products)
Exemplo n.º 2
0
def delivery(id):
    delivery = Delivery.query.filter_by(id=id).first()
    if not delivery:
        flash(gettext('Data not found.'))
        return redirect(url_for('deliveries'))
    form = EditDateTimeForm()
    if delivery:
        products = delivery.products

    if form.validate_on_submit():
        if form.datetime.data:
            delivery.created_dt = form.datetime.data
            db.session.add(delivery)
            db.session.commit()
            flash(gettext("Date and time of delivery was successfully changed."))

    form.datetime.data = delivery.created_dt
    return render_template('deliveries/delivery.html',
                            title=gettext("Delivery details"),
                            delivery=delivery,
                            form=form,
                            products=products)
Exemplo n.º 3
0
def supply(id):
    supply = Supply.query.filter_by(id=id).first()
    if not supply:
        flash(gettext('Data not found.'))
        return redirect(url_for('supplies'))
    form = EditDateTimeForm()
    if supply:
        products = supply.products

    if form.validate_on_submit():
        if form.datetime.data:
            supply.created_dt = form.datetime.data
            db.session.add(supply)
            db.session.commit()
            flash(gettext("Date and time of supply was successfully changed."))

    form.datetime.data = supply.created_dt
    return render_template('supplies/supply.html',
                            title=gettext("Supply details"),
                            supply=supply,
                            form=form,
                            CUSTOMER_TYPES=CUSTOMER_TYPES,
                            products=products)
Exemplo n.º 4
0
def request_detail(id=0):
    req = Request.query.filter_by(id=id).first()
    if not req:
        flash(gettext('Data not found.'))
        return redirect(url_for('requests'))
    form = EditDateTimeForm()
    if req:
        products = req.products

    if form.validate_on_submit():
        if form.datetime.data:
            req.created_dt = form.datetime.data
            db.session.add(req)
            db.session.commit()
            flash(gettext("Date and time of request was successfully changed."))

    form.datetime.data = req.created_dt
    return render_template('requests/request.html',
                            title=gettext("Order from customer details"),
                            req=req,
                            form=form,
                            CUSTOMER_TYPES=CUSTOMER_TYPES,
                            products=products)