diff --git a/app/Classes/Modules/Documents/ControllersLogic/DeleteDocumentLogic.php b/app/Classes/Modules/Documents/ControllersLogic/DeleteDocumentLogic.php new file mode 100644 index 00000000..06419d87 --- /dev/null +++ b/app/Classes/Modules/Documents/ControllersLogic/DeleteDocumentLogic.php @@ -0,0 +1,70 @@ + 'Deleted Document', + 'message' => 'You have successfully deleted a document' + ]; + } + + /** @var FetchesDocument */ + private $fetchesDocument; + + /** @var DeletesDocument */ + private $deletesDocument; + + /** @var CanDeleteDocument */ + private $canDeleteDocument; + + /** + * DeleteDocumentLogic constructor. + * @param FetchesDocument $fetchesDocument + * @param DeletesDocument $deletesDocument + * @param CanDeleteDocument $canDeleteDocument + */ + public function __construct(FetchesDocument $fetchesDocument, DeletesDocument $deletesDocument, CanDeleteDocument $canDeleteDocument) + { + $this->fetchesDocument = $fetchesDocument; + $this->deletesDocument = $deletesDocument; + $this->canDeleteDocument = $canDeleteDocument; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + $document = $this->fetchesDocument->execute(['id' => $request->route('id')]); + + $this->canDeleteDocument->passes(); + + $this->deletesDocument->execute($document); + + return $this->response([]); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Standards/Rules/CanDeleteDocument.php b/app/Classes/Modules/Documents/Standards/Rules/CanDeleteDocument.php new file mode 100644 index 00000000..e5bc4891 --- /dev/null +++ b/app/Classes/Modules/Documents/Standards/Rules/CanDeleteDocument.php @@ -0,0 +1,39 @@ +execute($request); } diff --git a/app/Http/Controllers/Documents/DeleteDocumentController.php b/app/Http/Controllers/Documents/DeleteDocumentController.php new file mode 100644 index 00000000..092f1d78 --- /dev/null +++ b/app/Http/Controllers/Documents/DeleteDocumentController.php @@ -0,0 +1,14 @@ +execute($request); + } +} \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/elements/CurrencyOrderComponent.vue b/resources/assets/vue/components/bookings/elements/CurrencyOrderComponent.vue index 5329e0e6..5132e194 100644 --- a/resources/assets/vue/components/bookings/elements/CurrencyOrderComponent.vue +++ b/resources/assets/vue/components/bookings/elements/CurrencyOrderComponent.vue @@ -26,7 +26,7 @@ -
+
+ +
+
+
+ + +
+
+
+
+
+
+
Are you Sure?
+
Are you sure you want to delete this docuement?
+
+
+
+
+
Cancel
+
+
+
Delete
+
+
+
+
+
+
+
+
+
+
@@ -79,8 +113,12 @@ methods: { approveDocument(status){ this.isLoading = true; - this.submit(this.route('api.company.identification.approval', this.item.owner.id, this.item.id, status), 'put', 'identificationVerificationSection', true, true); + this.submit(this.route('api.document.status.approve', this.item.id, status), 'put', 'identificationVerificationSection', true, true); }, + deleteDocument() { + this.isLoading = true; + this.submit(this.route('api.document.delete', this.item.id), 'delete', 'identificationVerificationSection', true, true); + } }, mixins: [componentHandler, staticFormHandler] } diff --git a/routes/document.php b/routes/document.php index 12419c9e..d7b23ec2 100644 --- a/routes/document.php +++ b/routes/document.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Route; Route::group(['prefix' => 'document', 'as' => 'document.', 'namespace' => 'Documents'], function () { Route::get('/list', 'ListDocumentsController@list')->name('list'); + Route::delete('/{id}/delete', 'DeleteDocumentController@delete')->name('delete'); Route::put('/{id}/approve', 'ApproveDocumentController@approve')->name('status.approve'); Route::put('/{id}/reject', 'RejectDocumentController@reject')->name('status.reject'); }); \ No newline at end of file