summaryrefslogtreecommitdiff
path: root/app/modules/customers
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2022-05-15 13:17:35 +0200
committerMarius Peter <marius.peter@tutanota.com>2022-05-15 13:17:35 +0200
commite084f90c19e779592f6e3f14eb8f70a7287f0dad (patch)
tree1215177356105452c39a916fd050f79c9721f523 /app/modules/customers
parent1dad22d3e45d6506c8624e3a7111240fcc4ab786 (diff)
Modularization.
Diffstat (limited to 'app/modules/customers')
-rw-r--r--app/modules/customers/forms.py36
-rw-r--r--app/modules/customers/routes.py38
2 files changed, 74 insertions, 0 deletions
diff --git a/app/modules/customers/forms.py b/app/modules/customers/forms.py
new file mode 100644
index 0000000..2c5bcaa
--- /dev/null
+++ b/app/modules/customers/forms.py
@@ -0,0 +1,36 @@
+# -*- 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 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")
diff --git a/app/modules/customers/routes.py b/app/modules/customers/routes.py
new file mode 100644
index 0000000..c8ae072
--- /dev/null
+++ b/app/modules/customers/routes.py
@@ -0,0 +1,38 @@
+# -*- mode: python; -*-
+
+
+from flask import (
+ Blueprint,
+ render_template,
+ send_file,
+ request,
+ redirect,
+ flash,
+ url_for,
+ jsonify,
+ abort,
+)
+from flask_login import login_required, current_user
+import inspect
+
+
+from ... import db
+from ...models import *
+from .forms import *
+
+customers = Blueprint("customers", __name__)
+
+
+@customers.route("/modules/customers")
+@login_required
+def view():
+ modules = Module.query.all()
+ cust = Customer.query.order_by(Customer.primary_key.desc())
+ module = "customers"
+ flash(f"Successfully accessed module {module}.", "info")
+ flash(f"Still fighting against styling in {module}.", "error")
+ return render_template(
+ f"modules/{module}.html",
+ modules=modules,
+ customers=cust,
+ )
Copyright 2019--2024 Marius PETER