From d1252b91c4cb67bb507f59013d42259914c03f98 Mon Sep 17 00:00:00 2001 From: airwin Date: Thu, 13 Aug 2020 14:25:31 -0500 Subject: [PATCH 1/2] update comment logic --- .../serviceRecommendation.html | 2 +- .../serviceRecommendation.js | 32 ++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) 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 @@ - + \ 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..a9d90ea0 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,34 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem newComment: this.newComment }) .then(() => { - window.console.log('success'); + this.showAddComment = false; + 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 }) From b351f9d84d951e8d27702373062daaba85b3935b Mon Sep 17 00:00:00 2001 From: airwin Date: Thu, 13 Aug 2020 14:29:57 -0500 Subject: [PATCH 2/2] update comment logic --- .../default/lwc/serviceRecommendation/serviceRecommendation.js | 1 + 1 file changed, 1 insertion(+) diff --git a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js index a9d90ea0..27908f36 100644 --- a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js +++ b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.js @@ -183,6 +183,7 @@ export default class ServiceRecommendation extends NavigationMixin(LightningElem }) .then(() => { this.showAddComment = false; + this.commentCount = this.commentCount + 1; this.handleReloadPage(); let evt = new ShowToastEvent({ title: 'Comment Added',