diff --git a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html index d27184b8..5dfd8162 100644 --- a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html +++ b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html @@ -185,4 +185,4 @@ </div> </footer> </article> -</template> +</template> \ No newline at end of file diff --git a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js index 1cfe5ecb..27908f36 100644 --- a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js +++ b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js @@ -1,6 +1,7 @@ /* eslint-disable no-empty */ import { LightningElement, api } from 'lwc'; import { NavigationMixin } from 'lightning/navigation'; +import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import hideContacts from '@salesforce/apex/serviceHide.hide'; import unhideContacts from '@salesforce/apex/serviceHide.unHide'; @@ -76,7 +77,7 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem .then(() => { window.console.log('success'); let eventParams = 'reloadAfterHide'; - const flowLaunchEvent = new CustomEvent('reloadafterhide', { + let flowLaunchEvent = new CustomEvent('reloadafterhide', { detail: { eventParams }, @@ -96,7 +97,7 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem .then(() => { window.console.log('success'); let eventParams = 'reloadAfterHide'; - const flowLaunchEvent = new CustomEvent('reloadafterhide', { + let flowLaunchEvent = new CustomEvent('reloadafterhide', { detail: { eventParams }, @@ -115,7 +116,7 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem .then(() => { window.console.log('success'); let eventParams = 'reloadAfterHide'; - const flowLaunchEvent = new CustomEvent('reloadafterhide', { + let flowLaunchEvent = new CustomEvent('reloadafterhide', { detail: { eventParams }, @@ -134,7 +135,7 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem .then(() => { window.console.log('success'); let eventParams = 'reloadAfterHide'; - const flowLaunchEvent = new CustomEvent('reloadafterhide', { + let flowLaunchEvent = new CustomEvent('reloadafterhide', { detail: { eventParams }, @@ -181,13 +182,35 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem newComment: this.newComment }) .then(() => { - window.console.log('success'); + this.showAddComment = false; + this.commentCount = this.commentCount + 1; + this.handleReloadPage(); + let evt = new ShowToastEvent({ + title: 'Comment Added', + message: '', + variant: 'success', + }); + this.dispatchEvent(evt); + window.console.log('after event?') }) .catch((error) => { window.console.log('error:' + error); }); } + handleReloadPage() { + let eventParams = 'reloadAfterHide'; + let flowLaunchEvent = new CustomEvent('reloadafterhide', { + detail: { + eventParams + }, + }); + // Fire the custom event + + this.dispatchEvent(flowLaunchEvent); + window.console.log('here'); + } + handlePrintReferral() { print({ serviceId: this.serviceid })