示例#1
0
def index():
    try:
        customers = CustomerAppService().get_customers_view()
    except CustomerExceptions as e:
        return handle_message_error(e)
    except VehicleExceptions as e:
        return handle_message_error(e)
    return render_template('customers/index.html', view=customers)
示例#2
0
def new_schedule_with_doc_id(doc_id):
    try:
        schedule_view = ScheduleAppService().schedule_definition_view(doc_id)
        if schedule_view:
            return render_template('schedules/new_schedule_step2.html',
                                   view=schedule_view)
    except CustomerExceptions as e:
        return handle_message_error(e)
    except ScheduleExceptions as e:
        return handle_message_error(e)
示例#3
0
def new_schedule():
    if request.method == "POST":
        doc_id = request.form['doc_id']

        try:
            schedule_view = ScheduleAppService().schedule_definition_view(
                doc_id)
            if schedule_view:
                return render_template('schedules/new_schedule_step2.html',
                                       view=schedule_view)
        except CustomerExceptions as e:
            return handle_message_error(e)
        except ScheduleExceptions as e:
            return handle_message_error(e)

    return render_template('schedules/new_schedule_step1.html')
示例#4
0
def confirm_schedule():
    vehicle_id = request.form.get('vehicles')
    categories = request.form.getlist('categories')
    time_scheduled = request.form.get('available_times')

    try:
        ScheduleAppService().schedule_confirmation(vehicle_id, time_scheduled,
                                                   categories)
    except ScheduleExceptions as e:
        return handle_message_error(e)

    return redirect(url_for('.index'))
示例#5
0
def new_customer():
    if request.method == 'POST':
        doc_id = request.form['doc_id']
        name = request.form['name']
        email = request.form['email']

        try:
            CustomerAppService().new_customer(doc_id, name, email)
            return redirect(url_for('.index'))
        except CustomerExceptions as e:
            return handle_message_error(e)

    return render_template('customers/new_customer.html')
示例#6
0
def new_vehicle(owner_id):
    if request.method == 'POST':
        plate = request.form['plate']
        model_id = request.form.get('models')
        model_year = request.form['model_year']

        try:
            CustomerAppService().new_vehicle(plate, owner_id, model_id,
                                             model_year)
            return redirect(url_for('.index', customer_id=owner_id))
        except VehicleExceptions as e:
            return handle_message_error(e)

    return render_template('vehicles/new_vehicle.html',
                           view=CustomerAppService().get_vehicle_for_crud_view(
                               customer_id=owner_id))
示例#7
0
def index():
    try:
        schedules = ScheduleAppService().get_schedules_view()
    except ScheduleExceptions as e:
        return handle_message_error(e)
    return render_template('schedules/index.html', view=schedules)
示例#8
0
def index(customer_id):
    try:
        vehicles_view = CustomerAppService().get_vehicles_view(customer_id)
    except VehicleExceptions as e:
        return handle_message_error(e)
    return render_template('vehicles/index.html', view=vehicles_view)