- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
# GET /med_programs/1/edit
def edit
@med_program = MedProgram.includes(:appeal, :template).find(params[:id])
next_step_path = next_step_appeal_path(@med_program.appeal_id)
# TODO: flash.keep ?
case true
when @med_program.appeal.kit_not_found?
redirect_to @med_program.appeal
when @med_program.appeal.new?
# Just render edit view
when @med_program.appeal.verify_person?
redirect_to edit_person_path(@med_program.appeal.person_id, :back_url => next_step_path)
return # для наглядности
when @med_program.appeal.create_user?
if @med_program.appeal.person.user_id
path = edit_user_path(@med_program.appeal.person.user_id, :back_url => next_step_path)
else
path = new_user_path(:person_id => @med_program.appeal.person_id, :back_url => next_step_path)
end
redirect_to path
return # для наглядности
when @med_program.appeal.add_doctor?
redirect_to add_doctor_med_program_path(@med_program.id)
return # для наглядности
when @med_program.appeal.create_user_doctor?
if @med_program.doctor.person.user_id
path = edit_user_path(@med_program.doctor.person.user_id, :back_url => next_step_path)
else
path = new_user_path(:person_id => @med_program.doctor.person_id, :back_url => next_step_path)
end
redirect_to path
return # для наглядности
when @med_program.appeal.add_contractor?
redirect_to add_contractor_med_program_path(@med_program.id)
return # для наглядности
when @med_program.appeal.input_settings?
redirect_to set_settings_med_program_path(@med_program.id)
return # для наглядности
when @med_program.appeal.pick_specialists?
redirect_to select_specialists_med_program_path(@med_program.id)
return # для наглядности
when @med_program.appeal.pick_operators?
redirect_to select_operators_med_program_path(@med_program.id)
return # для наглядности
when @med_program.appeal.read_informed_consent?
redirect_to informed_consent_med_program_path(@med_program.id)
return # для наглядности
when @med_program.appeal.sign_contract?
redirect_to sign_contract_med_program_path(@med_program.id)
return # для наглядности
else
redirect_to @med_program
end
end
kipar 02.02.2015 16:47 # 0
kegdan 02.02.2015 16:55 # 0
foxweb 04.02.2015 13:35 # 0