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/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/CanUpdateDocumentReference.php b/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php new file mode 100644 index 00000000..e6a29785 --- /dev/null +++ b/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php @@ -0,0 +1,39 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue index 0adfbf8b..50659403 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 d7b23ec2..c186032f 100644 --- a/routes/document.php +++ b/routes/document.php @@ -7,4 +7,6 @@ Route::group(['prefix' => 'document', 'as' => 'document.', 'namespace' => 'Docum 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