Improve on the template, most things work???
This commit is contained in:
parent
c0f9876184
commit
46fa0d1ae5
19 changed files with 396 additions and 181 deletions
|
|
@ -1,11 +1,34 @@
|
|||
from flask import Blueprint, render_template
|
||||
from flask_login import login_required, current_user
|
||||
from app.models import Customer
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, flash
|
||||
from app.forms import AppointmentForm
|
||||
from app.models import Appointment, Repair, Customer
|
||||
|
||||
customer_bp = Blueprint('customer', __name__, url_prefix='/customers')
|
||||
customer_bp = Blueprint('customer', __name__)
|
||||
|
||||
@customer_bp.route('/portal')
|
||||
@login_required
|
||||
def portal():
|
||||
customer = Customer.query.filter_by(user_id=current_user.id).first_or_404()
|
||||
return render_template('customers/portal.html', customer=customer)
|
||||
@customer_bp.route('/dashboard')
|
||||
def dashboard():
|
||||
# Logic to retrieve customer data, repairs, and appointments
|
||||
customer_id = 1 # Placeholder for actual customer ID retrieval
|
||||
repairs = Repair.query.filter_by(customer_id=customer_id).all()
|
||||
appointments = Appointment.query.filter_by(customer_id=customer_id).all()
|
||||
customer = Customer.query.filter_by(customer_id=customer_id).all()
|
||||
return render_template('customer/dashboard.html', repairs=repairs, appointments=appointments, customer=customer)
|
||||
|
||||
@customer_bp.route('/schedule_appointment', methods=['GET', 'POST'])
|
||||
def schedule_appointment():
|
||||
form = AppointmentForm()
|
||||
if form.validate_on_submit():
|
||||
new_appointment = Appointment(
|
||||
customer_id=form.customer_id.data,
|
||||
date=form.date.data,
|
||||
time=form.time.data,
|
||||
notes=form.notes.data
|
||||
)
|
||||
# Logic to save the appointment to the database
|
||||
flash('Appointment scheduled successfully!', 'success')
|
||||
return redirect(url_for('customer.dashboard'))
|
||||
return render_template('customer/schedule_appointment.html', form=form)
|
||||
|
||||
@customer_bp.route('/track_progress/<int:repair_id>')
|
||||
def track_progress(repair_id):
|
||||
repair = Repair.query.get_or_404(repair_id)
|
||||
return render_template('customer/track_progress.html', repair=repair)
|
||||
Loading…
Add table
Add a link
Reference in a new issue