From fdfcf714e5002c21eea2f9c5d046f642fe95da72 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 20 Jun 2025 11:08:37 +0800 Subject: [PATCH] E-Invoice - Fix minor problems discovered from Shipping Portal --- .../UpdateCompanyEInvoiceInfoLogic.php | 3 - .../UpdatesCompanyEInvoiceRequest.php | 2 +- ...ngeCustomerCompanyDetailsFormComponent.vue | 78 ++++++++++--------- 3 files changed, 41 insertions(+), 42 deletions(-) diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyEInvoiceInfoLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyEInvoiceInfoLogic.php index eb38294b..ee91153a 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyEInvoiceInfoLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyEInvoiceInfoLogic.php @@ -109,9 +109,6 @@ class UpdateCompanyEInvoiceInfoLogic extends AbstractControllerLogic //Update tin, msic code $this->updatesCompanyEInvoiceInfo->execute($company, $dto->tin, $dto->msicCode); - $query->tin = $dto->tin; - $query->msic_code = $dto->msicCode; - return $this->response([]); } } diff --git a/app/Classes/Modules/Companies/Services/UpdatesCompanyEInvoiceRequest.php b/app/Classes/Modules/Companies/Services/UpdatesCompanyEInvoiceRequest.php index 7a678bda..bdef7fc8 100644 --- a/app/Classes/Modules/Companies/Services/UpdatesCompanyEInvoiceRequest.php +++ b/app/Classes/Modules/Companies/Services/UpdatesCompanyEInvoiceRequest.php @@ -17,7 +17,7 @@ class UpdatesCompanyEInvoiceRequest extends AbstractUpdateRecord */ public function execute(Company $model, bool $eInvoice) { - if (is_null($model->e_invoice) && is_null($model->e_invoice_requested_at)) { + if (is_null($model->e_invoice_requested_at)) { if($eInvoice){ $model->e_invoice_requested_at = now(); } diff --git a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue index ec0587a3..b27083e8 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
@@ -135,40 +135,43 @@ // }, validations() { const companyType = this.data.type + const isEInvoiceEnabled = this.data.e_invoice !== 0 && this.data.e_invoice !== null; return { parameters: { name: { required, }, debtor: {}, - tin: { - ...(companyType === 0 - ? { - required, - alphaNum, - minLength: minLength(11), - maxLength: maxLength(13) - } - : {}), - ...(companyType === 1 - ? { - required, - alphaNum, - minLength: minLength(10), - maxLength: maxLength(12) - } - : {}) - }, - msic_code: { + tin: isEInvoiceEnabled + ? { + ...(companyType === 0 + ? { + required, + alphaNum, + minLength: minLength(11), + maxLength: maxLength(13) + } + : {}), + ...(companyType === 1 + ? { + required, + alphaNum, + minLength: minLength(10), + maxLength: maxLength(12) + } + : {}) + } + : {}, + msic_code: isEInvoiceEnabled ? { notZero, fiveDigits - }, + }: {}, address_id: {}, - street_one: { required }, + street_one: isEInvoiceEnabled ? { required } : {}, street_two: {}, - district_id: { required }, - state_id: { required }, - post_code: { required, notZero}, + district_id: isEInvoiceEnabled ? { required } : {}, + state_id: isEInvoiceEnabled ? { required } : {}, + post_code: isEInvoiceEnabled ? { required, notZero } : {}, } } @@ -185,22 +188,21 @@ } } }, - watch: { - 'data': function(newData) { //cief todo: 90 - if (newData && newData.address_einvoice) { - this.parameters.address_id = newData.address_einvoice.id; - this.parameters.street_one = newData.address_einvoice.street_one; - this.parameters.street_two = newData.address_einvoice.street_two; - this.parameters.district_id = newData.address_einvoice.district.id; - this.parameters.state_id = newData.address_einvoice.state.id; - this.parameters.post_code = newData.address_einvoice.post_code; - } - } - }, + // watch: { + // 'data': function(newData) { //cief todo: 90 + // if (newData && newData.address_einvoice) { + // this.parameters.address_id = newData.address_einvoice.id; + // this.parameters.street_one = newData.address_einvoice.street_one; + // this.parameters.street_two = newData.address_einvoice.street_two; + // this.parameters.district_id = newData.address_einvoice.district.id; + // this.parameters.state_id = newData.address_einvoice.state.id; + // this.parameters.post_code = newData.address_einvoice.post_code; + // } + // } + // }, methods: { successHandler(response) { // window.location.replace(this.route('customers', response.payload.data.reference)); - this.$emit('e-invoice-info', this.parameters); this.closeModal(); }, submitForm() {