mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-25 15:34:02 +00:00
update customer profile
This commit is contained in:
@@ -52,7 +52,7 @@ class UpdateCompanyProfileLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$object = new CompanyProfileObject($request->input('email'), $request->input('phone'), $request->input('business_type'));
|
||||
$object = new CompanyProfileObject($request->input('email'), $request->input('phone'), $request->input('type'));
|
||||
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class CompanyProfileObject implements DataTransferObject
|
||||
private $phone;
|
||||
|
||||
/** @var int|null */
|
||||
private $businessType;
|
||||
private $companyType;
|
||||
|
||||
/**
|
||||
* CompanyObject constructor.
|
||||
@@ -22,11 +22,11 @@ class CompanyProfileObject implements DataTransferObject
|
||||
* @param string $phone
|
||||
* @param int|null $businessType
|
||||
*/
|
||||
public function __construct(?string $email, string $phone, ?int $businessType = BusinessType::IMPORTER)
|
||||
public function __construct(?string $email, string $phone, int $companyType)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->phone = $phone;
|
||||
$this->businessType = $businessType;
|
||||
$this->companyType = $companyType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,8 +48,8 @@ class CompanyProfileObject implements DataTransferObject
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBusinessType(): int
|
||||
public function getCompanyType(): int
|
||||
{
|
||||
return $this->businessType;
|
||||
return $this->companyType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class UpdatesCompanyProfile extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(Company $model, CompanyProfileObject $object)
|
||||
{
|
||||
$model->business_type = $object->getBusinessType();
|
||||
$model->type = $object->getCompanyType();
|
||||
|
||||
$contact = $model->contacts()->first();
|
||||
if ($contact) {
|
||||
|
||||
@@ -10,8 +10,13 @@
|
||||
<label>{{this.company_details.business_type ? getBusinessTypeDesc(this.company_details.business_type) : ""}}</label>
|
||||
</div>
|
||||
<div class="col-12 p-0">
|
||||
<label :style="minWidth">Company Type</label>
|
||||
<label>{{this.company_details.type ? getCompanyTypeDesc(this.company_details.type) : ""}}</label>
|
||||
<label :style="minWidth">Company Type</label>
|
||||
<label>
|
||||
{{getCompanyTypeDesc(this.company_details.type)}}
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary" data-type="changeCompanyType" >
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-12 p-0">
|
||||
<label :style="minWidth">Email</label>
|
||||
@@ -23,7 +28,12 @@
|
||||
</div>
|
||||
<div class="col-12 p-0">
|
||||
<label :style="minWidth"> </label>
|
||||
<label><i class="fa fa-phone text-primary fs-10"></i> {{this.company_details.contact ? this.company_details.contact.phone : ""}}</label>
|
||||
<label>
|
||||
<i class="fa fa-phone text-primary fs-10"></i> {{this.company_details.contact ? this.company_details.contact.phone : ""}}
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary" data-type="changeCustomerContactNumber" >
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
</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>
|
||||
@@ -42,7 +52,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 p-0 p-b-5">
|
||||
<div class="col-12 p-0 p-b-5 d-none">
|
||||
<div class="btn btn-xs btn-default bg-master-lighter btn-rounded p-r-20 p-l-15 requestModal" data-type="editProfileInfo">
|
||||
<i class="fa fa-pencil m-r-10"></i>Edit Profile Info
|
||||
</div>
|
||||
@@ -73,7 +83,12 @@
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editProfileInfo">
|
||||
<edit-customer-profile-info-form-component :data="this.company_details" :section="section" v-if="this.company_details.id"></edit-customer-profile-info-form-component>
|
||||
</modal-component>
|
||||
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeCustomerContactNumber">
|
||||
<edit-customer-contact-number-form-component :data="this.company_details" :section="section"></edit-customer-contact-number-form-component>
|
||||
</modal-component>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -204,14 +219,7 @@
|
||||
}
|
||||
},
|
||||
getCompanyTypeDesc(company_type_id) {
|
||||
switch (company_type_id) {
|
||||
case 0:
|
||||
return 'Personal Business';
|
||||
case 1:
|
||||
return 'Company Business';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return (company_type_id == 1) ? 'Company Business' : 'Personal Business';
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<h3 class="all-caps m-b-5 no-margin text-center">Edit Company Type</h3>
|
||||
<div class="fs-11 text-center">Please double confirm before ediiting the Company Type</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.type">
|
||||
<label>Company Type</label>
|
||||
<selectable-component :endpoint="route('api.company.company_type.list')" section="listCompanyTypeSection" valueColumn="id" :labelColumn="['type']" v-model="parameters.type"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Update</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from "../../../general/mixins/modalFormHandler";
|
||||
import { required, email } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.parameters = {};
|
||||
this.parameters.type = [0,1].includes(this.data.type) ? this.data.type: 0;
|
||||
this.parameters.email = this.data.contact ? this.data.contact.email : "";
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : "";
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
type: {
|
||||
required,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(route('api.company.profile.update', this.data.id), 'put', this.section, true, true);
|
||||
},
|
||||
successHandler(){
|
||||
window.location.reload();
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
</script>
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<h3 class="all-caps m-b-5 no-margin text-center">Edit Contact Number</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.phone">
|
||||
<label>Phone</label>
|
||||
<input type="text" class="form-control" v-model="parameters.phone">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Update</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from "../../../general/mixins/modalFormHandler";
|
||||
import { required, email } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.parameters = {};
|
||||
this.parameters.type = [0,1].includes(this.data.type) ? this.data.type: 0;
|
||||
this.parameters.email = this.data.contact ? this.data.contact.email : "";
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : "";
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
phone: {
|
||||
required,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(route('api.company.profile.update', this.data.id), 'put', this.section, true, true);
|
||||
},
|
||||
successHandler(){
|
||||
window.location.reload();
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
</script>
|
||||
+9
-21
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -10,9 +10,9 @@
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.business_type">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.type">
|
||||
<label>Company Type</label>
|
||||
<selectable-component :endpoint="route('api.company.business_type.list')" section="businessTypeListSection" valueColumn="id" :labelColumn="['type']" v-model="parameters.business_type"></selectable-component>
|
||||
<selectable-component :endpoint="route('api.company.company_type.list')" section="listCompanyTypeSection" valueColumn="id" :labelColumn="['type']" v-model="parameters.type"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,24 +56,19 @@
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if(this.data){
|
||||
this.parameters.business_type = this.data.business_type;
|
||||
this.parameters.email = this.data.contact ? this.data.contact.email : "";
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : "";
|
||||
}
|
||||
this.parameters = {};
|
||||
this.parameters.type = [0,1].includes(this.data.type) ? this.data.type: 0;
|
||||
this.parameters.email = this.data.contact ? this.data.contact.email : "";
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : "";
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
business_type: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
}
|
||||
parameters: {},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
business_type: {
|
||||
type: {
|
||||
required,
|
||||
},
|
||||
email: {
|
||||
@@ -84,13 +79,6 @@
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'data': function() {
|
||||
this.parameters.business_type = this.data.business_type;
|
||||
this.parameters.email = this.data.contact ? this.data.contact.email : "";
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : "";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(route('api.company.profile.update', this.data.id), 'put', this.section, true, true);
|
||||
|
||||
Reference in New Issue
Block a user