From df9f245c57f4d03c7bcb8fd02caa1a36c0cc3058 Mon Sep 17 00:00:00 2001
From: Nguyen HP Laptop
Date: Sat, 25 Apr 2026 11:21:27 -0400
Subject: [PATCH] 04/25 modified the UI, projects -> contracts, button names
---
app/routes/customers.py | 8 ++++----
app/routes/projects.py | 14 +++++++-------
app/templates/auth/notification_matrix.html | 2 +-
app/templates/base.html | 2 +-
app/templates/customers/import.html | 10 +++++-----
app/templates/customers/index.html | 2 +-
app/templates/customers/manage.html | 14 +++++++-------
app/templates/dashboard.html | 2 +-
app/templates/facilities/form.html | 2 +-
app/templates/inspections/list.html | 4 ++--
app/templates/projects/assignment_form.html | 6 +++---
app/templates/projects/form.html | 2 +-
app/templates/projects/list.html | 10 +++++-----
app/templates/projects/view.html | 10 +++++-----
app/utils/forms.py | 4 ++--
15 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/app/routes/customers.py b/app/routes/customers.py
index 291fe7c..7081079 100644
--- a/app/routes/customers.py
+++ b/app/routes/customers.py
@@ -347,7 +347,7 @@ def manage(customer_id):
aform = CustomerAssignmentForm()
projects = Project.query.filter_by(active=True).order_by(Project.name).all()
aform.user_id.choices = [(customer.id, customer.username)]
- aform.facility_id.choices = [(0, '— All facilities in project —')]
+ aform.facility_id.choices = [(0, '— All facilities in contract —')]
return render_template(
'customers/manage.html',
@@ -374,7 +374,7 @@ def add_assignment(customer_id):
facility_id = request.form.get('facility_id', type=int) or None
if not project_id:
- flash('Please select a project.', 'warning')
+ flash('Please select a contract.', 'warning')
return redirect(url_for('customers.manage', customer_id=customer_id))
project = Project.query.get_or_404(project_id)
@@ -691,7 +691,7 @@ def bulk_import():
if pname:
project = proj_by_name.get(pname.lower())
if project is None:
- row_errors.append(f'project "{pname}" not found or inactive')
+ row_errors.append(f'contract "{pname}" not found or inactive')
else:
proj_id = project.id
if fname:
@@ -703,7 +703,7 @@ def bulk_import():
).first()
if facility is None:
row_errors.append(
- f'facility "{fname}" not found in project "{pname}"'
+ f'facility "{fname}" not found in contract "{pname}"'
)
else:
fac_id = facility.id
diff --git a/app/routes/projects.py b/app/routes/projects.py
index f66ec61..2255a30 100644
--- a/app/routes/projects.py
+++ b/app/routes/projects.py
@@ -60,10 +60,10 @@ def create():
current_user.username, project.id, project.name)
log_action(ACTION_CREATE, 'Project', project.id, project.name,
f'pm_id={pm_id}; active={project.active}')
- flash(f'Project "{project.name}" created successfully.', 'success')
+ flash(f'Contract "{project.name}" created successfully.', 'success')
return redirect(url_for('projects.view', project_id=project.id))
- return render_template('projects/form.html', form=form, title='Create Project')
+ return render_template('projects/form.html', form=form, title='Create Contract')
# ── View ──────────────────────────────────────────────────────────────────────
@@ -111,10 +111,10 @@ def edit(project_id):
current_user.username, project.id, project.name)
log_action(ACTION_UPDATE, 'Project', project.id, project.name,
f'pm_id={project.project_manager_id}; active={project.active}')
- flash(f'Project "{project.name}" updated successfully.', 'success')
+ flash(f'Contract "{project.name}" updated successfully.', 'success')
return redirect(url_for('projects.view', project_id=project.id))
- return render_template('projects/form.html', form=form, project=project, title='Edit Project')
+ return render_template('projects/form.html', form=form, project=project, title='Edit Contract')
# ── Delete ────────────────────────────────────────────────────────────────────
@@ -137,7 +137,7 @@ def delete(project_id):
logger.info('PROJECTS | delete | user=%s project_id=%s name=%s',
current_user.username, project_id_snap, project_name)
log_action(ACTION_DELETE, 'Project', project_id_snap, project_name)
- flash(f'Project "{project_name}" deleted successfully.', 'success')
+ flash(f'Contract "{project_name}" deleted successfully.', 'success')
return redirect(url_for('projects.index'))
@@ -156,7 +156,7 @@ def add_assignment(project_id):
# Facilities belonging to this project
project_facilities = project.facilities.order_by(Facility.name).all()
- form.facility_id.choices = [(0, '— All facilities in project —')] + \
+ form.facility_id.choices = [(0, '— All facilities in contract —')] + \
[(f.id, f.name) for f in project_facilities]
if form.validate_on_submit():
@@ -188,7 +188,7 @@ def add_assignment(project_id):
log_action(ACTION_CREATE, 'CustomerAssignment', assignment.id,
f'{user.username} → {project.name}',
f'scope={scope_label}')
- flash(f'Customer "{user.username}" assigned to project "{project.name}".', 'success')
+ flash(f'Customer "{user.username}" assigned to contract "{project.name}".', 'success')
return redirect(url_for('projects.view', project_id=project_id))
return render_template(
diff --git a/app/templates/auth/notification_matrix.html b/app/templates/auth/notification_matrix.html
index d78d2ec..3c59725 100644
--- a/app/templates/auth/notification_matrix.html
+++ b/app/templates/auth/notification_matrix.html
@@ -204,7 +204,7 @@
Customer: Customer-portal users are notified only for facilities
- they are assigned to via their project/facility assignments.
+ they are assigned to via their contract/facility assignments.
Custom Recipients: Additional email addresses (e.g. external managers)
diff --git a/app/templates/base.html b/app/templates/base.html
index c5d6886..916dc52 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -103,7 +103,7 @@
{% if current_user.role in ['admin', 'director', 'project_manager'] %}
- Projects
+ Contracts
{% endif %}
diff --git a/app/templates/customers/import.html b/app/templates/customers/import.html
index 5042933..5cc8bfb 100644
--- a/app/templates/customers/import.html
+++ b/app/templates/customers/import.html
@@ -33,15 +33,15 @@
Optional columns
- project_name — exact project name
- facility_name — exact facility name within project (leave blank for all)
+ project_name — exact contract name
+ facility_name — exact facility name within contract (leave blank for all)
Tips
- Repeat a username on multiple rows to assign them to multiple projects
- Leave facility_name blank to grant access to all facilities in the project
+ Repeat a username on multiple rows to assign them to multiple contracts
+ Leave facility_name blank to grant access to all facilities in the contract
Existing usernames/emails will be flagged as errors before anything is saved
@@ -96,7 +96,7 @@
Row
Username
Email
- Project
+ Contract
Facility Scope
Status
diff --git a/app/templates/customers/index.html b/app/templates/customers/index.html
index c4a0d66..c357228 100644
--- a/app/templates/customers/index.html
+++ b/app/templates/customers/index.html
@@ -28,7 +28,7 @@
Full Name
Email
Status
- Assigned Projects
+ Assigned Contracts
Accessible Facilities
Created
diff --git a/app/templates/customers/manage.html b/app/templates/customers/manage.html
index bd96d7a..713b1dd 100644
--- a/app/templates/customers/manage.html
+++ b/app/templates/customers/manage.html
@@ -123,14 +123,14 @@
{# ── Current assignments table ── #}
{% if assignments %}
- Project
+ Contract
Facility Scope
Assigned
@@ -186,10 +186,10 @@
-
Project
+
Contract
- — Select project —
+ — Select contract —
{% for p in projects %}
{{ p.name }}
{% endfor %}
@@ -198,10 +198,10 @@
Facility Scope
- — All facilities in project —
+ — All facilities in contract —
- Leave blank to grant access to all facilities in the project.
+ Leave blank to grant access to all facilities in the contract.
@@ -228,7 +228,7 @@
projSelect.addEventListener('change', function () {
const projectId = this.value;
- facSelect.innerHTML = '— All facilities in project — ';
+ facSelect.innerHTML = '— All facilities in contract — ';
if (!projectId) return;
diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html
index 19f9770..6f657e0 100644
--- a/app/templates/dashboard.html
+++ b/app/templates/dashboard.html
@@ -134,7 +134,7 @@
Facility
Address
- Project
+ Contract
diff --git a/app/templates/facilities/form.html b/app/templates/facilities/form.html
index 08eee4d..9d91b00 100644
--- a/app/templates/facilities/form.html
+++ b/app/templates/facilities/form.html
@@ -37,7 +37,7 @@
{{ form.project_id.label(class="form-label") }}
{{ form.project_id(class="form-select") }}
-
Link this facility to a project for customer portal access.
+
Link this facility to a contract for customer portal access.
diff --git a/app/templates/inspections/list.html b/app/templates/inspections/list.html
index 6724308..0d71d5f 100644
--- a/app/templates/inspections/list.html
+++ b/app/templates/inspections/list.html
@@ -5,7 +5,7 @@
Inspections
{% if current_user.role != 'customer' %}
- Start Inspection
+ New Inspection
{% endif %}
@@ -69,7 +69,7 @@
- {{ ins.status|replace('_',' ')|title }}
+ {{ 'Submitted' if ins.status == 'completed' else ins.status|replace('_',' ')|title }}
{% if ins.follow_up_required and not ins.follow_ups.count() %}
diff --git a/app/templates/projects/assignment_form.html b/app/templates/projects/assignment_form.html
index 5ae8e4a..1956d2e 100644
--- a/app/templates/projects/assignment_form.html
+++ b/app/templates/projects/assignment_form.html
@@ -9,7 +9,7 @@
{{ title }}
- Project: {{ project.name }}
+ Contract: {{ project.name }}
diff --git a/app/templates/projects/form.html b/app/templates/projects/form.html
index 1850981..acdcc29 100644
--- a/app/templates/projects/form.html
+++ b/app/templates/projects/form.html
@@ -42,7 +42,7 @@
- {# ── Project Info ── #}
+ {# ── Contract Info ── #}
@@ -42,7 +42,7 @@
{{ 'Active' if project.active else 'Inactive' }}
- Project Manager
+ Contract Manager
{{ project.project_manager.username if project.project_manager else '—' }}
@@ -95,7 +95,7 @@
{% else %}
-
No facilities linked to this project yet.
+
No facilities linked to this contract yet.
{% endif %}
diff --git a/app/utils/forms.py b/app/utils/forms.py
index cbfc8cb..b204018 100644
--- a/app/utils/forms.py
+++ b/app/utils/forms.py
@@ -96,7 +96,7 @@ class FacilityForm(FlaskForm):
address = TextAreaField('Address', validators=[Optional()])
contact_person = StringField('Contact Person', validators=[Optional(), Length(max=100)])
contact_phone = StringField('Contact Phone', validators=[Optional(), Length(max=20)])
- project_id = SelectField('Project', coerce=int, validators=[Optional()])
+ project_id = SelectField('Contract', coerce=int, validators=[Optional()])
active = BooleanField('Active', default=True)
@@ -183,7 +183,7 @@ class IssueUpdateForm(FlaskForm):
# ── Projects ─────────────────────────────────────────────────────────────────
class ProjectForm(FlaskForm):
- name = StringField('Project Name', validators=[DataRequired(), Length(max=255)])
+ name = StringField('Contract Name', validators=[DataRequired(), Length(max=255)])
description = TextAreaField('Description', validators=[Optional()])
project_manager_id = SelectField('Project Manager', coerce=int, validators=[Optional()])
active = BooleanField('Active', default=True)