diff --git a/abstractapi/EnrichWidget.js b/abstractapi/EnrichWidget.js new file mode 100644 index 0000000000000000000000000000000000000000..d26615c0ffe6cd7fd31267c8563aeebf0b1200c5 --- /dev/null +++ b/abstractapi/EnrichWidget.js @@ -0,0 +1,124 @@ +var Accounts_Component_EnrichWidget = VTAP.Component.Core.extend({ + + created() { + VTAP.Component.Register('DETAIL_SUMMARY_WIDGET', {}, VTAP.Component.Load('AbstractAPIWidget', 'Accounts'), {module:'Accounts'}); + + VTAP.Component.Register('LIST_ADVANCED_SETTING', {name:'Abstract API', 'clickHandler':this.abstractAPIPopup}, '', {module:'Accounts'}); + }, + + + methods : { + + abstractAPIPopup() { + + VTAP.Utility.ShowPopup({ + component : VTAP.Component.Load('AbstractSettings', 'Accounts'), + componentData : {}, + modalOnModalMode : true + + }) + + } + } +}); + + +var Accounts_Component_AbstractSettings = VTAP.Component.Core.extend({ + + data() { + return { + apikey : '' + } + }, + + created() { + VTAP.AppData.Get('Accounts', {data_key:'abstract_apikey'}, (error, response) => { + + if(response) { + this.apikey = response[0].data_value; + } + }); + }, + + methods : { + + save() { + + if(this.apikey != '') { + VTAP.AppData.Save('Accounts', {data_key:'abstract_apikey', data_value:this.apikey}, (error, response) => { + if(response) VTAP.Utilty.ShowSuccessNotification('updated key'); + }) + } + + } + }, + + template : + ` +
+
API Key
+
+ +
+
+ +
` +}) + +var Accounts_Component_AbstractAPIWidget = VTAP.Component.Core.extend({ + props : ['record'], + + data() { + return { + enrichData : {} + } + }, + + methods : { + + getEnrichData() { + + if(this.record.email_domain == '') { + VTAP.Utility.ShowErrorNotification('Please add a valid email domain!!'); + return; + } + + VTAP.CustomApi.Get('get_abstractapi_company_enrich', {domain: this.record.email_domain}, (error, response) => { + if(response && response.content) { + this.enrichData = JSON.parse(response.content); + + } + }); + + } + + }, + + template : + `
+
+
+
+ Get enrich data from , click below button +
+
+ +
+
+
+
+ + Company Enrichment +
+ + + + + +
{{index}}{{data}}
+
+
+
` +}); \ No newline at end of file