diff --git a/app/Classes/Modules/Questionnaires/ControllersLogic/UpdateNextQuestionV1AdminWFLogic.php b/app/Classes/Modules/Questionnaires/ControllersLogic/UpdateNextQuestionV1AdminWFLogic.php index af701bbd..b6cdb372 100644 --- a/app/Classes/Modules/Questionnaires/ControllersLogic/UpdateNextQuestionV1AdminWFLogic.php +++ b/app/Classes/Modules/Questionnaires/ControllersLogic/UpdateNextQuestionV1AdminWFLogic.php @@ -91,8 +91,6 @@ class UpdateNextQuestionV1AdminWFLogic extends AbstractControllerLogic $this->canFetchQuestion->passes(); - Log::info('currentQuestion: '. json_encode($currentQuestion)); - if ($request->has('answerObj')) { $answer = $request->answerObj; $answerNextQuestionNumber = $answer['next_question_number']; diff --git a/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue b/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue index edb45304..b5ce6eac 100644 --- a/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue +++ b/resources/assets/vue/components/general/forms/AdminWorkFlowFormComponent.vue @@ -3,7 +3,7 @@

{{ formattedTime }}

-
+
@@ -333,7 +333,7 @@
-
+
@@ -348,6 +348,20 @@
+
+
+
+
+ {{error}} +
+
+
+
+ +
+
+
+
@@ -383,6 +397,7 @@ stepTime: 0, interval: 1000, isFetching: false, + noMoreWork: false, } }, validations() { @@ -513,8 +528,14 @@ } } }, - errorHandler(error){ - this.error = 'We are sorry, something went wrong. Please inform tech team.'; + errorHandler(error, statusCode, section){ + if(section === 'adminWorkFlowFormGetExternalApiResponse' && statusCode === 404){ + this.noMoreWork = true; + this.error = '[' + this.question.question_title + '] All records processed. Please reload page to continue' ; + } + else{ + this.error = 'We are sorry, something went wrong. Please inform tech team.'; + } this.isFetching = false; }, submitForm(direction) { diff --git a/resources/assets/vue/general/mixins/request.js b/resources/assets/vue/general/mixins/request.js index dc944b45..0b246f2a 100644 --- a/resources/assets/vue/general/mixins/request.js +++ b/resources/assets/vue/general/mixins/request.js @@ -37,7 +37,7 @@ export default { if (!success) { this.openModal(); errorNotification ? this.$store.dispatch('createNotification', { title: response.title, message: response.message, type: 'error' }) : null; - this.errorHandler(response, statusCode); return; + this.errorHandler(response, statusCode, section); return; } successNotification ? this.$store.dispatch('createNotification', { title: response.title, message: response.message, type: 'success' }) : null; diff --git a/routes/admin_work_flow.php b/routes/admin_work_flow.php index 5f8a0d06..c7f55f0f 100644 --- a/routes/admin_work_flow.php +++ b/routes/admin_work_flow.php @@ -55,6 +55,10 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp ->whereNotIn('id', $excludedBookingIds) ->first(); + if(!$booking){ + return jsonResponse(null, 'No booking found', 404); + } + markedProcessing($booking, '1688_admin_workflow_processing'); return $booking ? jsonResponse([ @@ -89,6 +93,10 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp ->whereHas('transactions', fn ($query) => $query->where('type', TransactionType::PURCHASE_ORDER)->where('status', '<', ApprovalStatus::APPROVED)) ->first(); + if(!$booking){ + return jsonResponse(null, 'No booking found', 404); + } + markedProcessing($booking, 'approve_po_admin_workflow_processing'); $result = new BookingResource($booking); @@ -123,6 +131,10 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp ->whereDoesntHave('transactions', fn ($query) => $query->where('type', TransactionType::PURCHASE_ORDER)) ->first(); + if(!$booking){ + return jsonResponse(null, 'No booking found', 404); + } + markedProcessing($booking, 'fill_po_admin_workflow_processing'); $result = new BookingResource($booking); @@ -139,7 +151,7 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp $booking = Booking::find($bookingId); if (!$booking) { - return jsonResponse(null, 'No approved booking found', 404); + return jsonResponse(null, 'No booking found', 404); } $attributes = $booking->modelAttributes()