diff --git a/app/controllers/customer_appointments_controller.rb b/app/controllers/customer_appointments_controller.rb index 899a1a3..c513d91 100644 --- a/app/controllers/customer_appointments_controller.rb +++ b/app/controllers/customer_appointments_controller.rb @@ -25,6 +25,19 @@ class CustomerAppointmentsController < ApplicationController } end + def create_issues + @appointment = CustomerAppointment.find(params[:id]) + created_issues = @appointment.create_issues_from_labor_lines(project: @project, author: User.current) + + if created_issues.any? + flash[:notice] = l(:notice_successful_create) + redirect_to project_customer_appointments_path(@project) + else + flash[:error] = l(:error_no_labor_lines_found) + redirect_to customer_appointment_path(@appointment) + end + end + def index if params[:project_id] @project = Project.find(params[:project_id]) diff --git a/config/routes.rb b/config/routes.rb index 1a3dc6f..c56aa3d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,7 @@ RedmineApp::Application.routes.draw do resources :customer_appointments do collection do get :customer_options + get :create_issues end end