var Events_Component_Invitess = VTAP.Component.Core.extend({
mounted() {
VTAP.Event.Register("CREATE_MODAL_SHOWN", (data) => { this.observeEventsFormActivityType(data); });
VTAP.Event.Register("EDIT_MODAL_SHOWN", (data) => { this.observeEventsFormActivityType(data); });
},
methods : {
observeEventsFormActivityType(data) {
if (data.module == "Events") {
setTimeout(() => {
var element = jQuery('select[name="activitytype"]');
if (element.length) {
this.handleEventsFormActivityType(element.get(0).value);
element.on('change', () => { this.handleEventsFormActivityType(element.get(0).value); }); /* changes */
} else {
if(data && data.record) {
VTAP.Api.Get('records', {
'module': 'Events',
'id': data.record
}, (error, response) => {
this.handleEventsFormActivityType(response.activitytype);
});
}
}
}, 500);
}
},
handleEventsFormActivityType(activityType) {
if (activityType == "Call" || activityType == "Meeting") {
VTAP.Event.Trigger("EVENT_SHOW_INVITEES");
} else {
VTAP.Event.Trigger("EVENT_HIDE_INVITEES");
}
}
}
});