Added an appointment cancellation button

This commit is contained in:
2021-11-03 00:37:47 +00:00
parent 5c536e0c0b
commit fce6e92d9d
25 changed files with 746 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ use App\Application;
use App\Appointment;
use App\Exceptions\InvalidAppointmentException;
use App\Exceptions\InvalidAppointmentStatusException;
use App\Http\Requests\CancelAppointmentRequest;
use App\Http\Requests\SaveNotesRequest;
use App\Services\AppointmentService;
use App\Services\MeetingNoteService;
@@ -61,7 +62,7 @@ class AppointmentController extends Controller
/**
* @throws AuthorizationException
*/
public function updateAppointment(Application $application, $status): RedirectResponse
public function updateAppointment(Application $application, string $status): RedirectResponse
{
$this->authorize('update', $application->appointment);
@@ -78,10 +79,32 @@ class AppointmentController extends Controller
->back()
->with('error', $ex->getMessage());
}
}
public function deleteAppointment(CancelAppointmentRequest $request, Application $application)
{
$this->authorize('update', $application->appointment);
try {
$this->appointmentService->deleteAppointment($application, $request->reason);
return redirect()
->back()
->with('success', __('Appointment cancelled.'));
}
catch (\Exception $ex) {
return redirect()
->back()
->with('error', $ex->getMessage());
}
}
public function saveNotes(SaveNotesRequest $request, Application $application)
{
try {