mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Set default, delete, update & view identity documents
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Addresses\ControllersLogic;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\UpdatesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesDistrict;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanUpdateAddress;
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Http\Resources\AddressResource;
|
||||
@@ -35,17 +36,22 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
/** @var FetchesAddress */
|
||||
private $fetchesAddress;
|
||||
|
||||
/** @var FetchesDistrict */
|
||||
private $fetchesDistrict;
|
||||
|
||||
/**
|
||||
* UpdateAddressLogic constructor.
|
||||
* @param CanUpdateAddress $canUpdateAddress
|
||||
* @param UpdatesAddress $updatesAddress
|
||||
* @param FetchesAddress $fetchesAddress
|
||||
* @param FetchesDistrict $fetchesDistrict
|
||||
*/
|
||||
public function __construct(CanUpdateAddress $canUpdateAddress, UpdatesAddress $updatesAddress, FetchesAddress $fetchesAddress)
|
||||
public function __construct(CanUpdateAddress $canUpdateAddress, UpdatesAddress $updatesAddress, FetchesAddress $fetchesAddress, FetchesDistrict $fetchesDistrict)
|
||||
{
|
||||
$this->canUpdateAddress = $canUpdateAddress;
|
||||
$this->updatesAddress = $updatesAddress;
|
||||
$this->fetchesAddress = $fetchesAddress;
|
||||
$this->fetchesDistrict = $fetchesDistrict;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +64,9 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
{
|
||||
try {
|
||||
|
||||
//$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
//$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
$object = new AddressObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing'));
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
//$object = new AddressObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing'));
|
||||
|
||||
$this->canUpdateAddress->passes($object);
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ class UpdatesAddress extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(Address $model, AddressObject $object) {
|
||||
|
||||
$model->company_id = $object->getCompanyId();
|
||||
//$model->company_id = $object->getCompanyId();
|
||||
$model->street_one = $object->getStreetOne();
|
||||
$model->street_two = $object->getStreetTwo();
|
||||
$model->city = $object->getCity();
|
||||
$model->state = $object->getState();
|
||||
$model->post_code = $object->getPostCode();
|
||||
$model->country = $object->getCountry();
|
||||
$model->default = $object->getDefault();
|
||||
$model->billing = $object->getBilling();
|
||||
$model->district_id = $object->getDistrictId();
|
||||
$model->state_id = $object->getStateId();
|
||||
$model->postcode = $object->getPostCode();
|
||||
$model->country_id = $object->getCountryId();
|
||||
//$model->default = $object->getDefault();
|
||||
//$model->billing = $object->getBilling();
|
||||
|
||||
return $this->handler($model);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
this.submit(route('api.address.default',this.address.id), 'put', this.section, true, true);
|
||||
},
|
||||
updateAddress(id){
|
||||
this.$root.$emit('updateAddressForm', this.address);
|
||||
this.$root.$emit('updateAddressForm', this.address, true);
|
||||
},
|
||||
deleteAddress(id){
|
||||
this.$root.$emit('deleteAddressConfirm', id);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<div class="row">
|
||||
<div class="col text-right">
|
||||
<button type="button" class="btn btn-sm btn-success b-rad-none" @click="submitForm()">{{(this.type==3)?"Update":"Create"}} Billing Address</button>
|
||||
<button v-show="this.type==3" type="button" class="btn btn-sm bg-master-lighter b-rad-none m-l-5" @click="closeForm()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,6 +57,7 @@
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
//Npte: type 1 = create, type 2 = update set default, type 3 = update address
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
@@ -70,6 +72,7 @@
|
||||
this.parameters.company_id = this.id;
|
||||
},
|
||||
'addressData': function() {
|
||||
this.resetForm();
|
||||
this.parameters = {
|
||||
company_id: this.id,
|
||||
street_one: this.addressData.street_one,
|
||||
@@ -107,9 +110,13 @@
|
||||
this.submit((this.route('api.address.create')), 'post', 'bookingDetailSection', true, true)
|
||||
}
|
||||
},
|
||||
closeForm(){
|
||||
this.$root.$emit('updateAddressForm', {}, false);
|
||||
},
|
||||
successHandler(response){
|
||||
if(this.type==3){
|
||||
console.log('updated??');
|
||||
this.closeForm();
|
||||
this.$store.dispatch('reloadList', {'name': "addresslist"});
|
||||
}else {
|
||||
this.type !== 2 ? this.$emit('updateDefaultAddress', response.payload.data) : this.$emit('createdAddress', response.payload.data);
|
||||
this.resetForm();
|
||||
|
||||
@@ -17,17 +17,13 @@
|
||||
<label class="muted" :style="minWidth"> </label>
|
||||
<label><i class="fa fa-phone text-primary fs-10"></i> {{this.company_details.contact ? this.company_details.contact.phone : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0">
|
||||
<label class="muted" :style="minWidth">Total Booking</label>
|
||||
<label>{{this.company_details.bookings ? this.company_details.bookings.length : ""}}</label>
|
||||
<div class="col-12 p-0" v-if="this.company_details.identification && this.company_details.identification.document_type">
|
||||
<label class="muted" :style="minWidth">Identification</label>
|
||||
<label>{{ this.company_details.identification.document_type === 'IDENTITY_CARD' ? 'IC' : 'SSM Registration' }}</label>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col-12 p-0" v-if="this.company_details.identification && this.company_details.identification.files">
|
||||
<label class="muted" :style="minWidth"> </label>
|
||||
<div class="col">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="fs-8 all-caps muted">{{ this.company_details.identification.document_type === 'IDENTITY_CARD' ? 'IC' : 'SSM Registration' }} Document</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin">
|
||||
<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">
|
||||
@@ -41,6 +37,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 p-0">
|
||||
<label class="muted" :style="minWidth">Total Booking</label>
|
||||
<label>{{this.company_details.bookings ? this.company_details.bookings.length : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0">
|
||||
<canvas id="booking-chart"></canvas>
|
||||
</div>
|
||||
@@ -70,12 +70,10 @@
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
company: function(newVal, oldVal) {
|
||||
console.log(newVal);
|
||||
},
|
||||
company_details: function(newVal, oldVal) {
|
||||
this.company_details=newVal;
|
||||
console.log(newVal);
|
||||
|
||||
console.log('hellp');
|
||||
if(newVal !== null) {
|
||||
|
||||
let approved = 0, completed = 0, rejected = 0, expired = 0, pending = 0;
|
||||
|
||||
+13
-7
@@ -78,7 +78,7 @@
|
||||
<div class="row justify-content-end">
|
||||
<div class="col-6">
|
||||
<div class="row fs-12 text-center">
|
||||
<div class="col p-t-15 p-b-15 bg-master-lighter tabButton" tab-name="profile">
|
||||
<div class="col p-t-15 p-b-15 bg-master-lighter tabButton" tab-name="profile" @click="refreshCompanyDetails()">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
@@ -181,7 +181,7 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<company-details-component :company_details="company" section="customerProfileSection"></company-details-component>
|
||||
<company-details-component :company_details="company_details" section="customerProfileSection"></company-details-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -215,6 +215,7 @@
|
||||
return {
|
||||
section: 'customerProfileSection',
|
||||
company: null,
|
||||
company_details: {},
|
||||
bookingFilters: {
|
||||
reference: '',
|
||||
type: 0,
|
||||
@@ -247,11 +248,13 @@
|
||||
this.address_id=id;
|
||||
$("#deleteAddressModal").closest('.modal').modal('show');
|
||||
});
|
||||
this.$root.$on('updateAddressForm', (address) => {
|
||||
console.log(">>>> "+address);
|
||||
console.log(">>>> "+address.street_one);
|
||||
this.address=address;
|
||||
this.displayAddressForm = true;
|
||||
this.$root.$on('updateAddressForm', (address, show) => {
|
||||
if(show) {
|
||||
this.address = address;
|
||||
this.displayAddressForm = true;
|
||||
}else{
|
||||
this.displayAddressForm = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
@@ -265,6 +268,9 @@
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section});
|
||||
},
|
||||
methods: {
|
||||
refreshCompanyDetails(){
|
||||
this.company_details = this.company ;
|
||||
},
|
||||
fetchCompany(){
|
||||
this.submit(route('api.company.show', this.id), 'get', this.section, false, false)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user