Enable resubmit of treat health care sheet

This commit is contained in:
Djery-Tom 2021-11-29 11:22:32 +01:00
parent ea1621d5d8
commit 6e99bd4e51
3 changed files with 14 additions and 7 deletions

View File

@ -476,7 +476,7 @@ class HealthCareSheetController extends Controller
'care_condition' => 'required|in:CURRENT_AFFECTION,LONG_TERM_AFFECTION,EXONERATION', 'care_condition' => 'required|in:CURRENT_AFFECTION,LONG_TERM_AFFECTION,EXONERATION',
'accident_date' => 'nullable|date_format:Y-m-d|before:today', 'accident_date' => 'nullable|date_format:Y-m-d|before:today',
'pregnancy_start_at' => 'nullable|date_format:Y-m-d|before:today', 'pregnancy_start_at' => 'nullable|date_format:Y-m-d|before:today',
'pregnancy_end_at' => 'required_with:pregnancy_start_at|date_format:Y-m-d|after:pregnancy_start_at', 'pregnancy_end_at' => 'nullable|date_format:Y-m-d|after:pregnancy_start_at',
'performances' => 'required|array', 'performances' => 'required|array',
'performances.*.act_id' => 'required|integer|exists:nh_acts,id', 'performances.*.act_id' => 'required|integer|exists:nh_acts,id',
'performances.*.amount' => 'required|numeric', 'performances.*.amount' => 'required|numeric',
@ -715,7 +715,7 @@ class HealthCareSheetController extends Controller
* @OA\Property( * @OA\Property(
* property="action", * property="action",
* description = "Action à effectuer", * description = "Action à effectuer",
* enum={"ACCEPT","REJECT"}, * enum={"ACCEPT","REJECT","RESUBMIT"},
* example= "ACCEPT" * example= "ACCEPT"
* ), * ),
* ), * ),
@ -740,7 +740,7 @@ class HealthCareSheetController extends Controller
$this->validate($request, [ $this->validate($request, [
'health_care_sheet_id' => 'required|integer|exists:nh_health_care_sheets,id', 'health_care_sheet_id' => 'required|integer|exists:nh_health_care_sheets,id',
'user_id' => 'required|integer|exists:users,id', 'user_id' => 'required|integer|exists:users,id',
'action' => 'required|in:ACCEPT,REJECT' 'action' => 'required|in:ACCEPT,REJECT,RESUBMIT'
]); ]);
$action = $request->input('action'); $action = $request->input('action');
@ -751,7 +751,7 @@ class HealthCareSheetController extends Controller
return $this->errorResponse(trans('errors.unauthorized')); return $this->errorResponse(trans('errors.unauthorized'));
} }
if ($sheet->state != InsuranceSubscriptionState::UNDER_VALIDATION) { if ($action != 'RESUBMIT' && $sheet->state != InsuranceSubscriptionState::UNDER_VALIDATION) {
return $this->errorResponse(trans('errors.care_sheet_already_been_processed')); return $this->errorResponse(trans('errors.care_sheet_already_been_processed'));
} }
@ -762,11 +762,16 @@ class HealthCareSheetController extends Controller
$sheet->updated_at = $datetime; $sheet->updated_at = $datetime;
$sheet->save(); $sheet->save();
return $this->successResponse(trans('messages.care_sheet_accepted')); return $this->successResponse(trans('messages.care_sheet_accepted'));
} else { } else if ($action == 'REJECT') {
$sheet->state = InsuranceSubscriptionState::REJECTED; $sheet->state = InsuranceSubscriptionState::REJECTED;
$sheet->updated_at = $datetime; $sheet->updated_at = $datetime;
$sheet->save(); $sheet->save();
return $this->successResponse(trans('messages.care_sheet_rejected')); return $this->successResponse(trans('messages.care_sheet_rejected'));
} else {
$sheet->state = InsuranceSubscriptionState::UNDER_VALIDATION;
$sheet->updated_at = $sheet->created_at = $datetime;
$sheet->save();
return $this->successResponse(trans('messages.care_sheet_resubmitted'));
} }
} }

View File

@ -110,5 +110,6 @@ A new consultation or prescription has been made with your insurance company.
", ",
'consultation_or_prescription_carried_out_notification' => "A new consultation or prescription has just been made with your insurance company", 'consultation_or_prescription_carried_out_notification' => "A new consultation or prescription has just been made with your insurance company",
"care_sheet_accepted" => "The care sheet has been accepted", "care_sheet_accepted" => "The care sheet has been accepted",
"care_sheet_rejected" => "The care sheet has been rejected" "care_sheet_rejected" => "The care sheet has been rejected",
"care_sheet_resubmitted" => "The care sheet has been resubmitted"
]; ];

View File

@ -110,5 +110,6 @@ Une nouvelle consultation ou prescription vient d'etre effectuée auprès de vot
", ",
'consultation_or_prescription_carried_out_notification' => "Une nouvelle consultation ou prescription vient d'etre effectuée auprès de votre assurance", 'consultation_or_prescription_carried_out_notification' => "Une nouvelle consultation ou prescription vient d'etre effectuée auprès de votre assurance",
"care_sheet_accepted" => "La feuille de soins a été acceptée", "care_sheet_accepted" => "La feuille de soins a été acceptée",
"care_sheet_rejected" => "La feuille de soins a été rejetée" "care_sheet_rejected" => "La feuille de soins a été rejetée",
"care_sheet_resubmitted" => "La feuille de soins a été re-soumise"
]; ];