summaryrefslogtreecommitdiff
path: root/app/modules/forms.py.bkp
blob: f0f6bfb9886bf2263afdb0713896d37c3a5bf3ad (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# -*- mode: python; -*-

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


class LoginForm(FlaskForm):
    username = StringField("Username", validators=[InputRequired()])
    password = PasswordField("Password", validators=[InputRequired()])
    remember = BooleanField("Remember")
    submit = SubmitField("Login")


class RegisterForm(LoginForm):
    name_first = StringField("First name")
    name_last = StringField("Last name")
    email = StringField("E-mail address")
    phone_mobile = StringField("Phone number (mobile)")
    phone_alternative = StringField("Phone number (alternative)")
    submit = SubmitField("Register")


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 AddFertilog(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 AddFertitarget(AddFertilog):
    targeted_log =  SelectField(
        "Log to target",
        choices=[("value1", "Last"), ("value2", "Named")],
        validators=[InputRequired()],
    )
    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):
    invoice_id_alt = StringField("Alternative invoice ID")
    customer_id = StringField("Customer ID")
    customer_reference = StringField("Customer reference")
    date_billed = StringField("Date billed")
    date_due = StringField("Date due")
    amount_net = FloatField("Amount without tax", default=0)
    amount_gross = FloatField("Amount with tax", default=0)
    amount_tax = FloatField("Amount of tax", default=0)
    submit = SubmitField("Add new Invoice")
Copyright 2019--2024 Marius PETER