IT Assets: add Maintenance page with modal form

New database table: maintenance_records
- Fields: asset, start_date, end_date, status (open/in_progress/closed),
  initial_diagnosis, action_taken, action_result

New routes (/maintenance/):
- List with status + asset filters and pagination
- POST /new — create record (editor+); auto-sets asset status to 'maintenance'
- GET /<id>/edit — opens list page with modal pre-filled
- POST /<id>/update — save edits; auto-clears 'maintenance' status on close
- POST /<id>/delete — remove record

UI:
- Bootstrap modal form shared for add and edit
- Clicking any table row opens the modal pre-filled with that row's data
- Asset field locked in edit mode (cannot change asset)
- Delete button per row (with confirmation)
- Sidebar: 'Maintenance' link added under Hardware section
This commit is contained in:
ske087
2026-07-08 22:56:21 +03:00
parent 95ea6a3a35
commit 55a088eff4
7 changed files with 581 additions and 3 deletions
+3 -1
View File
@@ -26,7 +26,7 @@ def create_app(config_name='default'):
login_manager.init_app(app)
# Import models so Flask-Migrate detects them
from app.models import admin_user, user, asset, assignment, paperwork, audit_log, document_template # noqa: F401
from app.models import admin_user, user, asset, assignment, paperwork, audit_log, document_template, maintenance # noqa: F401
# Register blueprints
from app.routes.auth import bp as auth_bp
@@ -39,6 +39,7 @@ def create_app(config_name='default'):
from app.routes.settings import bp as settings_bp
from app.routes.doc_templates import bp as doc_templates_bp
from app.routes.internal import bp as internal_bp
from app.routes.maintenance import bp as maintenance_bp
app.register_blueprint(auth_bp)
app.register_blueprint(dashboard_bp)
@@ -50,6 +51,7 @@ def create_app(config_name='default'):
app.register_blueprint(settings_bp)
app.register_blueprint(doc_templates_bp)
app.register_blueprint(internal_bp)
app.register_blueprint(maintenance_bp)
# Inject common template variables
from datetime import datetime, date