Files
exchange-2.0/resources/assets/vue/components/companies/forms/EditCustomerContactNumberFormComponent.vue
T
2023-08-11 15:12:34 +08:00

70 lines
2.5 KiB
Vue

<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>