04/25 modified the UI, projects -> contracts, button names
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user