diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php index 6b08aad5..dea2b21c 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php @@ -9,6 +9,8 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyDebtor; use App\Classes\Modules\Addresses\Services\UpsertsAddress; use App\Classes\Modules\Addresses\Services\FetchesDistrict; use App\Classes\Modules\Addresses\Services\UpdatesAddressMetadata; +use App\Classes\Modules\Documents\Services\FetchesDocument; +use App\Classes\Modules\Documents\Services\UpdatesDocumentReference; use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress; use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject; use App\Classes\Modules\Companies\Services\UpdatesCompanyEInvoiceInfo; @@ -57,6 +59,12 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic /** @var UpdatesAddressMetadata */ private $updatesAddressMetadata; + /** @var FetchesDocument */ + private $fetchesDocument; + + /** @var UpdatesDocumentReference */ + private $updatesDocumentReference; + /** * UpdateCompanyDetailsLogic constructor. @@ -70,6 +78,9 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic * @param UpsertsAddress $upsertsAddress * @param UpdatesCompanyEInvoiceInfo $updatesCompanyEInvoiceInfo; * @param UpdatesAddressMetadata $updatesAddressMetadata + * @param FetchesDocument $fetchesDocument + * @param UpdatesDocumentReference $updatesDocumentReference + * */ public function __construct( CanUpdateCompany $canUpdateCompany, @@ -80,7 +91,9 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic FetchesDistrict $fetchesDistrict, UpsertsAddress $upsertsAddress, UpdatesCompanyEInvoiceInfo $updatesCompanyEInvoiceInfo, - UpdatesAddressMetadata $updatesAddressMetadata + UpdatesAddressMetadata $updatesAddressMetadata, + FetchesDocument $fetchesDocument, + UpdatesDocumentReference $updatesDocumentReference ) { $this->canUpdateCompany = $canUpdateCompany; @@ -93,6 +106,8 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic $this->upsertsAddress = $upsertsAddress; $this->updatesCompanyEInvoiceInfo = $updatesCompanyEInvoiceInfo; $this->updatesAddressMetadata = $updatesAddressMetadata; + $this->fetchesDocument = $fetchesDocument; + $this->updatesDocumentReference = $updatesDocumentReference; } /** @@ -126,6 +141,12 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic $this->updatesCompanyEInvoiceInfo->execute($company, $dto->tin, $dto->msicCode); } + //Update Identification Card / SSM Registration + if($dto->identificationId){ + $document = $this->fetchesDocument->execute(['id' => $dto->identificationId]); + $this->updatesDocumentReference->execute($document, $dto->identificationReference); + } + return $this->resourceResponse(new CompanyResource($company)); } } diff --git a/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php b/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php index d77019ef..35cfb61d 100644 --- a/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php +++ b/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php @@ -22,6 +22,9 @@ class UpdateCompanyDetailsDTO implements DataTransferObject public string $streetTwo; public string $postCode; + public string $identificationReference; + public int $identificationId; + public function __construct(array $data) { $this->id = (int) ($data['id'] ?? 0); @@ -30,7 +33,7 @@ class UpdateCompanyDetailsDTO implements DataTransferObject $this->reference = (string) ($data['reference'] ?? ''); $this->type = (int) ($data['type'] ?? 0); - $this->tin = (string) ($data['tin'] ?? 0); + $this->tin = (string) ($data['tin'] ?? ''); $this->msicCode = (string) ($data['msic_code'] ?? ''); $this->addressId = (int) ($data['address_id'] ?? 0); $this->districtId = (int) ($data['district_id'] ?? 0); @@ -38,7 +41,10 @@ class UpdateCompanyDetailsDTO implements DataTransferObject $this->companyId = (int) ($data['company_id'] ?? 0); $this->streetOne = (string) ($data['street_one'] ?? ''); $this->streetTwo = (string) ($data['street_two'] ?? ''); - $this->postCode = (string) ($data['post_code'] ?? 0); + $this->postCode = (string) ($data['post_code'] ?? ''); + + $this->identificationReference = (string) ($data['identification_reference'] ?? ''); + $this->identificationId = (int) ($data['identification_id'] ?? 0); } public function toArray(): array @@ -59,6 +65,9 @@ class UpdateCompanyDetailsDTO implements DataTransferObject 'street_one' => $this->streetOne, 'street_two' => $this->streetTwo, 'post_code' => $this->postCode, + + 'identification_reference' => $this->identificationReference, + 'identification_id' => $this->identificationId, ]; } } diff --git a/resources/assets/vue/components/companies/elements/CompanyDetailsComponent.vue b/resources/assets/vue/components/companies/elements/CompanyDetailsComponent.vue index f241c8af..1f625f68 100644 --- a/resources/assets/vue/components/companies/elements/CompanyDetailsComponent.vue +++ b/resources/assets/vue/components/companies/elements/CompanyDetailsComponent.vue @@ -36,9 +36,13 @@
- +
+ - +
+ +
@@ -57,6 +61,44 @@ Edit Profile Info
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
@@ -99,6 +141,9 @@ + + +
@@ -136,8 +181,8 @@ minWidth:{ minWidth:'120px', }, - minWidth150:{ - minWidth:'150px', + minWidth175:{ + minWidth:'175px', }, address_id:0, address:{}, @@ -234,4 +279,4 @@ }, mixins: [componentHandler] } - \ No newline at end of file + diff --git a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue index 326274d3..64c868c8 100644 --- a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue +++ b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue @@ -22,6 +22,16 @@
+ +
+
+ + + + +
+
+
E-Invoice Info @@ -77,7 +87,7 @@
- +
@@ -134,6 +144,9 @@ district_id: this.data.address_einvoice ? this.data.address_einvoice.district.id : null, state_id: this.data.address_einvoice ? this.data.address_einvoice.state.id : null, post_code: this.data.address_einvoice ? this.data.address_einvoice.post_code : null, + + identification_id: this.data.identification ? this.data.identification.id : null, + identification_reference: this.data.identification ? this.data.identification.reference : null, } } }, @@ -176,11 +189,13 @@ district_id: isEInvoiceEnabled ? { required } : {}, state_id: isEInvoiceEnabled ? { required } : {}, post_code: isEInvoiceEnabled ? { notZero, fiveDigits } : {}, + identification_reference: this.data.identification ? { required } : {}, } } }, methods: { successHandler(response) { + this.$store.dispatch('reloadList', {'name': "customerProfileSection"}); this.closeModal(); }, submitForm() {