from flask import Blueprint, render_template, request, redirect, url_for, flash from app.models import Repair, Technician from app.forms import RepairNoteForm technician_bp = Blueprint('technician', __name__) @technician_bp.route('/technician/dashboard') def dashboard(): repairs = Repair.query.filter_by(status='in_progress').all() return render_template('technician/dashboard.html', repairs=repairs) @technician_bp.route('/technician/repair/', methods=['GET', 'POST']) def repair_detail(repair_id): repair = Repair.query.get_or_404(repair_id) form = RepairNoteForm() if form.validate_on_submit(): repair.notes = form.notes.data repair.status = 'completed' # Add logic to save the repair status and notes flash('Repair notes updated successfully!', 'success') return redirect(url_for('technician.dashboard')) return render_template('technician/repair_detail.html', repair=repair, form=form)