Files
exchange-2.0/resources/assets/vue/components/companies/forms/EditCustomerProfileInfoFormComponent.vue
T
2023-08-06 23:16:20 +08:00

94 lines
3.7 KiB
Vue

<template>
<div class="row">
<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 bold no-margin">Edit Customer Profile</h3>
</div>
</div>
<div class="row m-b-10">
<div class="col">
<validation-wrapper-component selectable :validator="$v.parameters.business_type">
<label>Business Type</label>
<selectable-component :endpoint="route('api.company.business_type.list')" section="businessTypeListSection" valueColumn="id" :labelColumn="['type']" v-model="parameters.business_type"></selectable-component>
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-10">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.email">
<label>Email</label>
<input type="text" class="form-control" v-model="parameters.email">
</validation-wrapper-component>
</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 } from "vuelidate/lib/validators";
export default {
props: {
data: {
type: Object,
default: null
},
},
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 : "";
}
},
data(){
return {
parameters: {
business_type: "",
email: "",
phone: "",
}
}
},
validations: {
parameters: {
business_type: {
required,
},
email: {
// required,
},
phone: {
required,
},
}
},
methods: {
submitForm(){
this.submit(route('api.company.profile.update', this.data.id), 'put', this.section, true, true);
},
},
mixins: [modalFormHandler]
}
</script>