diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php index c435dab4..23cf9561 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php @@ -56,23 +56,15 @@ class UpdateCompanyLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - try { + $object = new CompanyObject($request->input('name'), $request->input('reference'), $request->input('type')); - $object = new CompanyObject($request->input('reference_no'), $request->input('name'), $request->input('type')); + $this->canUpdateCompany->passes($object); - $this->canUpdateCompany->passes($object); + $query = $this->fetchesCompany->execute(['id' => $request->route('id')]); - $query = $this->fetchesCompany->execute(['id' => $request->route('id')]); - - $query = $this->updatesCompany->execute($query, $object); - - return $this->resourceResponse(new CompanyResource($query)); - - - } catch (\Exception $exception){ - throw new ErrorException($exception->getMessage(), $exception->getCode()); - } + $query = $this->updatesCompany->execute($query, $object); + return $this->resourceResponse(new CompanyResource($query)); } } \ No newline at end of file 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/ControllersLogic/UpdateDocumentReferenceLogic.php b/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php new file mode 100644 index 00000000..1cea5eeb --- /dev/null +++ b/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php @@ -0,0 +1,68 @@ + 'Update Document', + 'message' => 'You have successfully updated the Document' + ]; + } + + /** @var CanUpdateDocumentReference*/ + private $canUpdateDocumentReference; + + /** @var UpdatesDocumentReference */ + private $updatesDocumentReference; + + /** @var FetchesDocument */ + private $fetchesDocument; + + + /** + * RejectDocumentLogic constructor. + * @param CanApproveDocument $canApproveDocument + * @param ApprovesDocument $approvesDocument + * @param FetchesDocument $fetchesDocument + */ + public function __construct(CanUpdateDocumentReference $canUpdateDocumentReference, UpdatesDocumentReference $updatesDocumentReference, FetchesDocument $fetchesDocument) + { + $this->canUpdateDocumentReference = $canUpdateDocumentReference; + $this->updatesDocumentReference = $updatesDocumentReference; + $this->fetchesDocument = $fetchesDocument; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $document = $this->fetchesDocument->execute(['id' => $request->route('id')]); + + $this->canUpdateDocumentReference->passes(); + + $document_query = $this->updatesDocumentReference->execute($document, $request->input('identification_number')); + + return $this->resourceResponse(new DocumentResource($document_query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Services/UpdatesDocument.php b/app/Classes/Modules/Documents/Services/UpdatesDocument.php new file mode 100644 index 00000000..b825753f --- /dev/null +++ b/app/Classes/Modules/Documents/Services/UpdatesDocument.php @@ -0,0 +1,19 @@ +handler($model); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php b/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php new file mode 100644 index 00000000..23a16e02 --- /dev/null +++ b/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php @@ -0,0 +1,20 @@ +reference = $reference; + return $this->handler($model); + } + +} \ 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/app/Http/Controllers/Documents/UpdateDocumentReferenceController.php b/app/Http/Controllers/Documents/UpdateDocumentReferenceController.php new file mode 100644 index 00000000..f14d1b8b --- /dev/null +++ b/app/Http/Controllers/Documents/UpdateDocumentReferenceController.php @@ -0,0 +1,20 @@ +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..ad4c3e42 100644 --- a/resources/assets/vue/components/bookings/elements/CurrencyOrderComponent.vue +++ b/resources/assets/vue/components/bookings/elements/CurrencyOrderComponent.vue @@ -26,7 +26,7 @@ -