mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'dillon/90-e-invoice-e' into vapor/production
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,13 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.identification && this.company_details.identification.document_type">
|
||||
<label class="muted pull-left" :style="minWidth">Identification</label>
|
||||
<label class="pull-left" :style="minWidth">Identification</label>
|
||||
<div class="col-4 pull-left p-l-0 p-b-5">
|
||||
<label>{{ this.company_details.identification.document_type === 'IDENTITY_CARD' ? 'IC' : 'SSM Registration' }}</label>
|
||||
- <label>{{ this.company_details.identification.reference }}</label>
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary" data-type="changeCustomerCompanyDetails" >
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
<div class="row no-margin pull-right">
|
||||
<div v-for="file in this.company_details.identification.files" v-bind:key="file.id" class="col-auto no-padding m-r-5">
|
||||
<document-file-viewer-component :file="file">
|
||||
@@ -57,6 +61,44 @@
|
||||
<i class="fa fa-pencil m-r-10"></i>Edit Profile Info
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 p-0 p-t-5" v-if="this.company_details.e_invoice">
|
||||
<label class="muted m-b-0" :style="minWidth175">E-Invoice Info </label>
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary" data-type="changeCustomerCompanyDetails" >
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 b-t b-grey p-t-5 p-b-5 m-t-5 m-b-5 p-l-0 p-r-1" v-if="this.company_details.e_invoice">
|
||||
<label :style="minWidth175">TIN</label>
|
||||
<label>{{this.company_details.tin ? this.company_details.tin : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice">
|
||||
<label :style="minWidth175">MSIC Code</label>
|
||||
<label>{{this.company_details.msic_code ? this.company_details.msic_code : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice && this.company_details.address_einvoice">
|
||||
<label :style="minWidth175">Billing Address Line 1</label>
|
||||
<label>{{this.company_details.address_einvoice.street_one ? this.company_details.address_einvoice.street_one : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice && this.company_details.address_einvoice">
|
||||
<label :style="minWidth175">Billing Address Line 2</label>
|
||||
<label>{{this.company_details.address_einvoice.street_two ? this.company_details.address_einvoice.street_two : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice && this.company_details.address_einvoice">
|
||||
<label :style="minWidth175">District</label>
|
||||
<label>{{this.company_details.address_einvoice.district ? this.company_details.address_einvoice.district.name : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice && this.company_details.address_einvoice">
|
||||
<label :style="minWidth175">Post Code</label>
|
||||
<label>{{this.company_details.address_einvoice.post_code ? this.company_details.address_einvoice.post_code : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice && this.company_details.address_einvoice">
|
||||
<label :style="minWidth175">State</label>
|
||||
<label>{{this.company_details.address_einvoice.state ? this.company_details.address_einvoice.state.name : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0" v-if="this.company_details.e_invoice && this.company_details.address_einvoice">
|
||||
<label :style="minWidth175">Country</label>
|
||||
<label>{{this.company_details.address_einvoice.country ? this.company_details.address_einvoice.country.name : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0 p-t-5">
|
||||
<label class="muted m-b-0" :style="minWidth">Recipients Bank Accounts </label>
|
||||
</div>
|
||||
@@ -99,6 +141,9 @@
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeCompanyType">
|
||||
<edit-customer-company-type-form-component :data="this.company_details" :section="section"></edit-customer-company-type-form-component>
|
||||
</modal-component>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeCustomerCompanyDetails">
|
||||
<change-customer-company-details-form-component :section="'customerProfileSection'" :data="this.company_details"></change-customer-company-details-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -136,8 +181,8 @@
|
||||
minWidth:{
|
||||
minWidth:'120px',
|
||||
},
|
||||
minWidth150:{
|
||||
minWidth:'150px',
|
||||
minWidth175:{
|
||||
minWidth:'175px',
|
||||
},
|
||||
address_id:0,
|
||||
address:{},
|
||||
@@ -234,4 +279,4 @@
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
+16
-1
@@ -22,6 +22,16 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-15" v-if="data.identification">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.params.identification_reference">
|
||||
<label class="text-primary">{{ data.type === 2 ? 'Identification Card' : 'SSM Registration' }}</label>
|
||||
<input class="form-control" v-model="params.identification_reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-5" v-if="data.e_invoice !== 0 && data.e_invoice !== null">
|
||||
<div class="col">
|
||||
E-Invoice Info
|
||||
@@ -77,7 +87,7 @@
|
||||
<div class="row m-b-15">
|
||||
<div class="col-6 p-r-5">
|
||||
<validation-wrapper-component selectable :validator="$v.params.state_id">
|
||||
<label>State</label>
|
||||
<label class="text-primary">State</label>
|
||||
<selectable-component :endpoint="route('api.address.state.list')" section="stateListSection" valueColumn="id" :labelColumn="['state']" v-model="params.state_id"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user