From de799dc356e10877431d837e46310c6ddaf73f86 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Tue, 20 May 2025 00:35:15 +0800 Subject: [PATCH] E-Invoice - New state field when filling E-invoice info, validation of tin field and msic code field, etc...[AdminUI] --- .../UpdateCompanyDetailsLogic.php | 2 +- .../UpdateCompanyDetailsDTO.php | 7 +- app/Http/Resources/EInvoiceInfoResource.php | 2 +- .../forms/EInvoiceInfoFormComponent.vue | 4 +- ...ngeCustomerCompanyDetailsFormComponent.vue | 102 ++++++++++++++---- 5 files changed, 93 insertions(+), 24 deletions(-) diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php index 7cb9c3c8..6b08aad5 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php @@ -118,7 +118,7 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic //Update EInvoice Related Info if($company->e_invoice){ $district = $this->fetchesDistrict->execute(['id' => $dto->districtId]); - $addObj = new AddressObject($dto->streetOne, $dto->streetTwo, $district->country_id, $district->state_id, $district->id, $dto->postCode); + $addObj = new AddressObject($dto->streetOne, $dto->streetTwo, $district->country_id, $dto->stateId, $district->id, $dto->postCode); $this->canCreateAddress->passes($addObj); $address = $this->upsertsAddress->execute($company, $addObj, $dto->addressId); diff --git a/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php b/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php index 5a16f12c..e9a76434 100644 --- a/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php +++ b/app/Classes/Modules/Companies/DataTransferObjects/UpdateCompanyDetailsDTO.php @@ -12,10 +12,11 @@ class UpdateCompanyDetailsDTO implements DataTransferObject public string $reference; public int $type; - public int $tin; + public string $tin; public int $msicCode; public int $addressId; public int $districtId; + public int $stateId; public int $companyId; public string $streetOne; public string $streetTwo; @@ -29,10 +30,11 @@ class UpdateCompanyDetailsDTO implements DataTransferObject $this->reference = (string) ($data['reference'] ?? ''); $this->type = (int) ($data['type'] ?? 0); - $this->tin = (int) ($data['tin'] ?? 0); + $this->tin = (string) ($data['tin'] ?? 0); $this->msicCode = (int) ($data['msic_code'] ?? 0); $this->addressId = (int) ($data['address_id'] ?? 0); $this->districtId = (int) ($data['district_id'] ?? 0); + $this->stateId = (int) ($data['state_id'] ?? 0); $this->companyId = (int) ($data['company_id'] ?? 0); $this->streetOne = (string) ($data['street_one'] ?? ''); $this->streetTwo = (string) ($data['street_two'] ?? ''); @@ -52,6 +54,7 @@ class UpdateCompanyDetailsDTO implements DataTransferObject 'msic_code' => $this->msicCode, 'address_id' => $this->addressId, 'district_id' => $this->districtId, + 'state_id' => $this->stateId, 'company_id' => $this->companyId, 'street_one' => $this->streetOne, 'street_two' => $this->streetTwo, diff --git a/app/Http/Resources/EInvoiceInfoResource.php b/app/Http/Resources/EInvoiceInfoResource.php index 9bf8c8c1..565e86a7 100644 --- a/app/Http/Resources/EInvoiceInfoResource.php +++ b/app/Http/Resources/EInvoiceInfoResource.php @@ -24,7 +24,7 @@ class EInvoiceInfoResource extends JsonResource 'country' => $this->country, 'billing' => (int) $this->billing, 'msic_code' => (int) $this->msic_code, - 'tin' => (int) $this->tin, + 'tin' => (string) $this->tin, 'e_invoice' => (int) $this->e_invoice, ]; } diff --git a/resources/assets/vue/components/address/forms/EInvoiceInfoFormComponent.vue b/resources/assets/vue/components/address/forms/EInvoiceInfoFormComponent.vue index aad9ba94..0b8c20e5 100644 --- a/resources/assets/vue/components/address/forms/EInvoiceInfoFormComponent.vue +++ b/resources/assets/vue/components/address/forms/EInvoiceInfoFormComponent.vue @@ -59,7 +59,7 @@ -
+
@@ -168,7 +168,7 @@ 'id': function() { this.parameters.company_id = this.companyId; }, - // 'eInvoiceData': function() { + // 'eInvoiceData': function() { //cief todo: 90 // this.resetForm(); // this.parameters = { // company_id: this.companyId, diff --git a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue index 1dc9ed4a..ec0587a3 100644 --- a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue +++ b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue @@ -22,7 +22,7 @@
-
+
E-Invoice Info
@@ -47,7 +47,7 @@
- +
@@ -55,7 +55,7 @@
- +
@@ -74,6 +74,14 @@
+
+
+ + + + +
+
@@ -90,23 +98,79 @@