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 @@ -
+
+
+
+
+ + +
+
+
+
+
+
+
Are you Sure?
+
Are you sure you want to delete this docuement?
+
+
+
+
+
Cancel
+
+
+
Delete
+
+
+
+
+
+
+
+
+
+
@@ -79,8 +112,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/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue index 0adfbf8b..64fc74e2 100644 --- a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue +++ b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue @@ -42,16 +42,28 @@ -
+
Company Name
-
+
-
{{item.owner.name}}
+
{{item.owner.name}}
+
+
+
+
+ +
+
+
+
+ +
+
@@ -63,9 +75,21 @@
{{ item.owner.type === 0 ? 'IC' : 'SSM Registration' }} Number
-
+
-
{{item.reference}}
+
{{item.reference}}
+
+
+
+
+ +
+
+
+
+ +
+
@@ -168,7 +192,9 @@ export default { data() { return { - expanded: false + expanded: false, + isEditIdentificationNumber: false, + isEditCompanyName: false, } }, methods: { diff --git a/resources/assets/vue/components/companies/elements/UpdateCompanyNameFormComponent.vue b/resources/assets/vue/components/companies/elements/UpdateCompanyNameFormComponent.vue new file mode 100644 index 00000000..0cafa5db --- /dev/null +++ b/resources/assets/vue/components/companies/elements/UpdateCompanyNameFormComponent.vue @@ -0,0 +1,38 @@ + + diff --git a/resources/assets/vue/components/companies/elements/UpdateIdentificationNumberFormComponent.vue b/resources/assets/vue/components/companies/elements/UpdateIdentificationNumberFormComponent.vue new file mode 100644 index 00000000..7fe3a240 --- /dev/null +++ b/resources/assets/vue/components/companies/elements/UpdateIdentificationNumberFormComponent.vue @@ -0,0 +1,49 @@ + + diff --git a/routes/document.php b/routes/document.php index 12419c9e..c186032f 100644 --- a/routes/document.php +++ b/routes/document.php @@ -4,6 +4,9 @@ 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'); + + Route::put('/{id}/reference/update', 'UpdateDocumentReferenceController@update')->name('reference.update'); }); \ No newline at end of file