The ui components feature enables us to modify or add custom buttons or icons. Which on click will perform actions.
VTAP.Api.Delete('records', {id:VTAP.Detail.Id(), module:VTAP.Detail.Module()}, (err, res) => { });
window.location.href = "https://xxxxx.od2.vtiger.com/view/Page1?module=Potentials";
//Popup is the name of the popup component defined in Contacts module
VTAP.Utility.ShowPopup({component:VTAP.Component.Load('Popup','Contacts')});
var MYMODULE_Component_Popup = VTAP.Component.Core.extend({
data() {
//store popup data to make use of them to display and to send it to server
return {
name:"",
email:""
}
},
methods: {
onok(event) {
//prevent popup to close
event.preventDefault();
//add post action on click on ok button
VTAP.Api.Post("records", {module:'Contacts',"lastname":this.name,"email":this.email}, (error,response) => {
if(response) {
VTAP.Utility.ShowSuccessNotification("Saved successfully");
this.hidePopup();
} else {
VTAP.Utility.ShowErrorNotification(error);
}
});
},
hidePopup() {
//bv::hide::modal is the event, modal-1 is the modal popup id which needs to be closed.
this.$root.$emit('bv::hide::modal', 'modal-1')
}
},
//:no-close-on-backdrop="true" is to ensure the popup is not closed when clicked outside the modal
template: `<b-modal id="modal-1" title="Save Contact" @ok=onok :ok-title="Save" :no-close-on-backdrop="true">
<p class="my-4">
<div class="container" >
<input v-model="name" class="form-control w-50 m-2" placeholder="Enter the name">
<input v-model="email" class="form-control w-50 m-2" placeholder="Enter the email address">
</div>
</p>
</b-modal>`
});