summaryrefslogtreecommitdiff
path: root/app/forms.py
blob: 302db586081e431641d01d14a9779e068b62dcf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""
Form classes must be named 'Add{Item}', Item referring to the
model concerned.
"""

from flask_wtf import FlaskForm
from wtforms import (
    SubmitField,
    SelectField,
    RadioField,
    HiddenField,
    StringField,
    PasswordField,
    IntegerField,
    FloatField,
    DateTimeField,
)
from wtforms.validators import InputRequired, Length, NumberRange


class AddCustomer(FlaskForm):
    name = StringField("Customer name", validators=[InputRequired()])
    name_alternative = StringField("Alternative name")
    # date_time_created = DateTimeField("Creation date")
    code_customer = StringField("Customer code")
    code_accounting = StringField("Accounting code")
    address = StringField("Address")
    postal_code = StringField("Postal Code")
    city = StringField("City")
    country = StringField("Country")
    phone = StringField("Phone")
    website = StringField("Website")
    email = StringField("E-mail")
    professional_id_1 = StringField("Professional ID 1")
    professional_id_2 = StringField("Professional ID 2")
    tax_id = StringField("Tax ID")
    payment_terms = StringField("Payment Terms", default="Tu vas payer sale chien!")
    submit = SubmitField("Add/Update Product")


class AddProduct(FlaskForm):
    name = StringField("Product name", validators=[InputRequired()])
    code_accounting = StringField("Accounting code", default=0)
    unit_weight = FloatField("Unit weight", default=0)
    price_net = FloatField("Price (net)", default=0)
    price_gross = FloatField("Price (gross)", default=0)
    tax_rate = FloatField("Tax rate", default=0)
    submit = SubmitField("Add/Update Product")


class AddLog(FlaskForm):
    target = SelectField(
        "Type",
        choices=[("False", "Log"), ("True", "Target")],
        validators=[InputRequired()],
    )
    nno3 = FloatField("NNO3", default=0)
    p = FloatField("P", default=0)
    k = FloatField("K", default=0)
    ca = FloatField("Ca", default=0)
    mg = FloatField("Mg", default=0)
    s = FloatField("S", default=0)
    na = FloatField("Na", default=0)
    cl = FloatField("Cl", default=0)
    fe = FloatField("Fe", default=0)
    zn = FloatField("Zn", default=0)
    b = FloatField("B", default=0)
    mn = FloatField("Mn", default=0)
    cu = FloatField("Cu", default=0)
    mo = FloatField("Mo", default=0)
    si = FloatField("Si", default=0)
    nnh4 = FloatField("NNH4", default=0)
    submit = SubmitField("Add/Update Log")


class AddOrder(FlaskForm):  # TODO
    name = StringField("Product name", validators=[InputRequired()])
    code_accounting = StringField("Accounting code", default=0)
    unit_weight = FloatField("Unit weight", default=0)
    price_net = FloatField("Price (net)", default=0)
    price_gross = FloatField("Price (gross)", default=0)
    tax_rate = FloatField("Tax rate", default=0)
    submit = SubmitField("Add/Update Product")


class AddInvoice(FlaskForm):
    name = StringField("Product name", validators=[InputRequired()])
    code_accounting = StringField("Accounting code", default=0)
    unit_weight = FloatField("Unit weight", default=0)
    price_net = FloatField("Price (net)", default=0)
    price_gross = FloatField("Price (gross)", default=0)
    tax_rate = FloatField("Tax rate", default=0)
    submit = SubmitField("Add/Update Product")
Copyright 2019--2024 Marius PETER