From 365c653b5c15e3049f922087b283fe2e676602a2 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 18:00:10 -0500 Subject: [PATCH 01/10] platform event --- ...Profile_Update_Notification__e.object-meta.xml | 8 ++++++++ .../fields/ClientProfileId__c.field-meta.xml | 7 +++++++ .../fields/ContactId__c.field-meta.xml | 7 +++++++ .../RefRecAdmin.permissionset-meta.xml | 15 +++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 force-app/main/default/objects/Client_Profile_Update_Notification__e/Client_Profile_Update_Notification__e.object-meta.xml create mode 100644 force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ClientProfileId__c.field-meta.xml create mode 100644 force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ContactId__c.field-meta.xml diff --git a/force-app/main/default/objects/Client_Profile_Update_Notification__e/Client_Profile_Update_Notification__e.object-meta.xml b/force-app/main/default/objects/Client_Profile_Update_Notification__e/Client_Profile_Update_Notification__e.object-meta.xml new file mode 100644 index 00000000..50edfda7 --- /dev/null +++ b/force-app/main/default/objects/Client_Profile_Update_Notification__e/Client_Profile_Update_Notification__e.object-meta.xml @@ -0,0 +1,8 @@ + + + Deployed + + Client Profile Update Notifications + added from sfdx plugin + StandardVolume + \ No newline at end of file diff --git a/force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ClientProfileId__c.field-meta.xml b/force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ClientProfileId__c.field-meta.xml new file mode 100644 index 00000000..221656ad --- /dev/null +++ b/force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ClientProfileId__c.field-meta.xml @@ -0,0 +1,7 @@ + + + + Text + ClientProfileId__c + 18 + \ No newline at end of file diff --git a/force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ContactId__c.field-meta.xml b/force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ContactId__c.field-meta.xml new file mode 100644 index 00000000..b80b8a1b --- /dev/null +++ b/force-app/main/default/objects/Client_Profile_Update_Notification__e/fields/ContactId__c.field-meta.xml @@ -0,0 +1,7 @@ + + + + Text + ContactId__c + 18 + \ No newline at end of file diff --git a/force-app/main/default/permissionsets/RefRecAdmin.permissionset-meta.xml b/force-app/main/default/permissionsets/RefRecAdmin.permissionset-meta.xml index ed4e70fa..2a4acb1f 100644 --- a/force-app/main/default/permissionsets/RefRecAdmin.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/RefRecAdmin.permissionset-meta.xml @@ -47,6 +47,11 @@ Open_Hours__c true + + true + true + Client_Profile_Update_Notification__e + true true @@ -217,6 +222,16 @@ true Service__c.Runaway__c + + true + true + Client_Profile_Update_Notification__e.ClientProfileId__c + + + true + true + Client_Profile_Update_Notification__e.ContactId__c + Service__c Visible From 228e998fdc88a201d5445d533d8f890edd58dfd9 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 18:00:20 -0500 Subject: [PATCH 02/10] subscribe from lwc --- .../serviceRecommendations.js | 294 ++++++++++-------- 1 file changed, 168 insertions(+), 126 deletions(-) diff --git a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js index bd73d97f..547f3e30 100644 --- a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js +++ b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js @@ -2,141 +2,183 @@ import { LightningElement, track, api } from 'lwc'; import { loadStyle } from 'lightning/platformResourceLoader'; import mapModal from '@salesforce/resourceUrl/mapModal'; +import { + subscribe, + unsubscribe, + onError, + setDebugFlag, + isEmpEnabled +} from 'lightning/empApi'; -import getRecs from '@salesforce/apex/getRecommendations.getRecommendations' +import getRecs from '@salesforce/apex/getRecommendations.getRecommendations'; -export default class ServiceRecommendations extends LightningElement { - @track returnRecommendations; - @track returnHiddenRecommendations; - @api recordId; - @api typefilters; - @track serviceId; - - @track showRecommendations = false; - @track showRelevancePopover = false; - @track showDropdown = false; - @track showAddComment = false; - @track showExpandedMap = false; - @track showHiddenRecsList = false; - - @track showHoursFilterChangePopover = false; - @track showLocationFilterChangePopover = false; - - get locationFilterOperatorOptions() { - return [ - { label: 'Within', value: 'Within' }, - { label: 'In Progress', value: 'inProgress' }, - { label: 'Finished', value: 'finished' }, - ]; - } +const eventChannel = '/event/Client_Profile_Update_Notification__e'; - mapMarkers = [ - { - location: { - Street: '415 Mission St', - City: 'San Francisco', - State: 'CA', - }, - - title: 'Salesforce Tower', - description: - 'lorem ipsum', - }, +export default class ServiceRecommendations extends LightningElement { + subscription = {}; + + @track returnRecommendations; + @track returnHiddenRecommendations; + @api recordId; + @api typefilters; + @track serviceId; + + @track showRecommendations = false; + @track showRelevancePopover = false; + @track showDropdown = false; + @track showAddComment = false; + @track showExpandedMap = false; + @track showHiddenRecsList = false; + + @track showHoursFilterChangePopover = false; + @track showLocationFilterChangePopover = false; + + get locationFilterOperatorOptions() { + return [ + { label: 'Within', value: 'Within' }, + { label: 'In Progress', value: 'inProgress' }, + { label: 'Finished', value: 'finished' } ]; - connectedCallback(){ - - Promise.all([ - loadStyle(this, mapModal) - ]) - } - - handleRequestRecommendations(){ - console.log('getting recommendations'); - console.log('recorid Id'+ this.recordId) - getRecs({contactId: '003J000001uUczOIAS'}) - .then((result) => { - window.console.log('success'); - if(this.showRecommendations === false){ - this.showRecommendations = !this.showRecommendations; - } - window.console.log('result' + JSON.stringify(result)); - this.returnRecommendations = result; - }) - .catch((error) => { - window.console.log('error:' + error); - }); - } - - handleExpand(){ - this.showExpandedMap = !this.showExpandedMap; - } - - handleFilterList(){ - window.console.log('show filter window'+ this.template.querySelector('.mapModalDiv').classList); - - this.template.querySelector('.mapModalDiv').classList.toggle('width67'); - this.template.querySelector('.mapModalDiv').classList.toggle('mapDivNarrow'); - this.template.querySelector('.recommendationsDiv').classList.toggle('recommendationsDivWide'); - //this.template.querySelector('.innerRecModalDiv').classList.toggle('modalWidth100'); - this.template.querySelector('.recommendationsDiv').classList.toggle('recommendationsDivNarrow'); - this.template.querySelector('.filterDiv').classList.toggle('slds-hide'); + } + + mapMarkers = [ + { + location: { + Street: '415 Mission St', + City: 'San Francisco', + State: 'CA' + }, + + title: 'Salesforce Tower', + description: 'lorem ipsum' } - - handleCloseFilters(){ - window.console.log('close filters'); - this.template.querySelector('.mapModalDiv').classList.toggle('width67'); - this.template.querySelector('.mapModalDiv').classList.toggle('mapDivNarrow'); - //this.template.querySelector('.innerRecModalDiv').classList.toggle('modalWidth100'); - this.template.querySelector('.recommendationsDiv').classList.toggle('recommendationsDivWide'); - this.template.querySelector('.recommendationsDiv').classList.toggle('recommendationsDivNarrow'); - this.template.querySelector('.filterDiv').classList.toggle('slds-hide'); - } - - handleSortList() { - - } - - handleShowHidden(){ - this.showHiddenRecsList = !this.showHiddenRecsList; - } - - changeFilter(event){ - window.console.log(event); - let tgt = event.currentTarget; - let filterAttribute = tgt.getAttribute('data-filter'); - window.console.log(filterAttribute); - if(filterAttribute === 'openhours'){ - this.showHoursFilterChangePopover = !this.showHoursFilterChangePopover; + ]; + connectedCallback() { + Promise.all([loadStyle(this, mapModal)]); + } + + handleRequestRecommendations() { + console.log('getting recommendations'); + console.log('recorid Id' + this.recordId); + getRecs({ contactId: '003J000001uUczOIAS' }) + .then((result) => { + window.console.log('success'); + if (this.showRecommendations === false) { + this.showRecommendations = !this.showRecommendations; } - if(filterAttribute === 'location'){ - this.showLocationFilterChangePopover = !this.showLocationFilterChangePopover; - } - - + window.console.log('result' + JSON.stringify(result)); + this.returnRecommendations = result; + }) + .catch((error) => { + window.console.log('error:' + error); + }); + } + + handleExpand() { + this.showExpandedMap = !this.showExpandedMap; + } + + handleFilterList() { + window.console.log( + 'show filter window' + + this.template.querySelector('.mapModalDiv').classList + ); + + this.template.querySelector('.mapModalDiv').classList.toggle('width67'); + this.template + .querySelector('.mapModalDiv') + .classList.toggle('mapDivNarrow'); + this.template + .querySelector('.recommendationsDiv') + .classList.toggle('recommendationsDivWide'); + //this.template.querySelector('.innerRecModalDiv').classList.toggle('modalWidth100'); + this.template + .querySelector('.recommendationsDiv') + .classList.toggle('recommendationsDivNarrow'); + this.template.querySelector('.filterDiv').classList.toggle('slds-hide'); + } + + handleCloseFilters() { + window.console.log('close filters'); + this.template.querySelector('.mapModalDiv').classList.toggle('width67'); + this.template + .querySelector('.mapModalDiv') + .classList.toggle('mapDivNarrow'); + //this.template.querySelector('.innerRecModalDiv').classList.toggle('modalWidth100'); + this.template + .querySelector('.recommendationsDiv') + .classList.toggle('recommendationsDivWide'); + this.template + .querySelector('.recommendationsDiv') + .classList.toggle('recommendationsDivNarrow'); + this.template.querySelector('.filterDiv').classList.toggle('slds-hide'); + } + + handleSortList() {} + + handleShowHidden() { + this.showHiddenRecsList = !this.showHiddenRecsList; + } + + changeFilter(event) { + window.console.log(event); + let tgt = event.currentTarget; + let filterAttribute = tgt.getAttribute('data-filter'); + window.console.log(filterAttribute); + if (filterAttribute === 'openhours') { + this.showHoursFilterChangePopover = !this.showHoursFilterChangePopover; } - - removeFilter(){ - + if (filterAttribute === 'location') { + this.showLocationFilterChangePopover = !this + .showLocationFilterChangePopover; } + } - removeFilters(){ + removeFilter() {} - } + removeFilters() {} - handleSortMenu(event){ - window.console.log('show sort menu'); - const menuItem = event.currentTarget; - const parent = menuItem.parentElement; - window.console.log('children' + parent.children); - for (let sibling of parent.children){ - sibling.checked = false; - } - menuItem.checked = !menuItem.checked; - //run sorting - } - - handleUpdateTypeFilters(event){ - window.console.log('type filters' + event.typefilters); + handleSortMenu(event) { + window.console.log('show sort menu'); + const menuItem = event.currentTarget; + const parent = menuItem.parentElement; + window.console.log('children' + parent.children); + for (let sibling of parent.children) { + sibling.checked = false; } - -} \ No newline at end of file + menuItem.checked = !menuItem.checked; + //run sorting + } + + handleUpdateTypeFilters(event) { + window.console.log('type filters' + event.typefilters); + } + + handleSubscribe() { + const messageCallback = (response) => { + console.log(response); + if (response.data.payload.ContactId === this.recordId) { + this.handleRequestRecommendations(); + } + }; + subscribe(eventChannel, -1, messageCallback).then((response) => { + // Response contains the subscription information on subscribe call + console.log( + 'Subscription request sent to: ', + JSON.stringify(response.channel) + ); + this.subscription = response; + }); + } + + renderedCallback() { + this.handleSubscribe(); + } + + disconnectedCallback() { + unsubscribe(this.subscription, (response) => { + console.log('unsubscribe() response: ', JSON.stringify(response)); + // Response is true for successful unsubscribe + }); + } +} From 4a5f0d2adede7a17b04fb7fd34209e5ba91b3a89 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 18:00:26 -0500 Subject: [PATCH 03/10] single quote in js --- .prettierrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierrc b/.prettierrc index 15683b69..94fdbd1c 100755 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { "trailingComma": "none", + "singleQuote": true, "overrides": [ { "files": "**/lwc/**/*.html", From 195a0d8ce650c1452d712c154529f7bfac9a5e1e Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 18:00:46 -0500 Subject: [PATCH 04/10] import cleanup --- .../lwc/serviceRecommendations/serviceRecommendations.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js index 547f3e30..a6c087e7 100644 --- a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js +++ b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js @@ -2,13 +2,7 @@ import { LightningElement, track, api } from 'lwc'; import { loadStyle } from 'lightning/platformResourceLoader'; import mapModal from '@salesforce/resourceUrl/mapModal'; -import { - subscribe, - unsubscribe, - onError, - setDebugFlag, - isEmpEnabled -} from 'lightning/empApi'; +import { subscribe, unsubscribe } from 'lightning/empApi'; import getRecs from '@salesforce/apex/getRecommendations.getRecommendations'; From fff932b5198bdfc611af8cea5c092408ecd887a8 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 18:14:55 -0500 Subject: [PATCH 05/10] datasets include new fields as empty --- datasets/sample.sql | 78 +++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/datasets/sample.sql b/datasets/sample.sql index 80b4ddc0..71bb59f2 100644 --- a/datasets/sample.sql +++ b/datasets/sample.sql @@ -4,9 +4,9 @@ CREATE TABLE "Account" ( "Name" VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Account" VALUES('001S000001CBEYZIA5','Test Provider 3'); -INSERT INTO "Account" VALUES('001S000001CBEYaIAP','Test Provider 1'); -INSERT INTO "Account" VALUES('001S000001CBEYbIAP','Test Provider 2'); +INSERT INTO "Account" VALUES('0011100001vqJwAAAU','Test Provider 3'); +INSERT INTO "Account" VALUES('0011100001vqJwBAAU','Test Provider 1'); +INSERT INTO "Account" VALUES('0011100001vqJwCAAU','Test Provider 2'); CREATE TABLE "Client_Profile__c" ( sf_id VARCHAR(255) NOT NULL, "Date_of_Birth__c" VARCHAR(255), @@ -15,11 +15,16 @@ CREATE TABLE "Client_Profile__c" ( "Postal_Code__c" VARCHAR(255), "Location__Latitude__s" VARCHAR(255), "Location__Longitude__s" VARCHAR(255), + "Homeless__c" VARCHAR(255), + "Runaway__c" VARCHAR(255), + "Home_Owner__c" VARCHAR(255), + "Home_Renter__c" VARCHAR(255), + "Near_Homeless__c" VARCHAR(255), contact__c VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Client_Profile__c" VALUES('a00S0000007dUHBIA2','2005-05-24','Micah','McLaughlin','94102','','','003S000001LarKCIAZ'); -INSERT INTO "Client_Profile__c" VALUES('a00S0000007dUHCIA2','1979-04-20','Shane','McLaughlin','94102','','','003S000001LarKDIAZ'); +INSERT INTO "Client_Profile__c" VALUES('a001100000FSejMAAT','2005-05-24','Micah','McLaughlin','94102','','','false','false','false','false','false','0031100001ffeU1AAI'); +INSERT INTO "Client_Profile__c" VALUES('a001100000FSejNAAT','1979-04-20','Shane','McLaughlin','94102','','','false','false','false','false','false','0031100001ffeU2AAI'); CREATE TABLE "Contact" ( sf_id VARCHAR(255) NOT NULL, "FirstName" VARCHAR(255), @@ -33,12 +38,12 @@ CREATE TABLE "Contact" ( reports_to_id VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Contact" VALUES('003S000001LarKCIAZ','Micah','McLaughlin','8324728021','micah@mailinator.com','2005-05-24','false','false','false',''); -INSERT INTO "Contact" VALUES('003S000001LarKDIAZ','Shane','McLaughlin','8324728021','shane.m@mailinator.com','1979-04-20','false','false','false',''); -INSERT INTO "Contact" VALUES('003S000001LarKEIAZ','Contact','WithoutProfile','8324728021','noprofile@mailinator.com','','false','false','false',''); -INSERT INTO "Contact" VALUES('003S000001LarOQIAZ','Test 1','Contact','','','','false','false','false',''); -INSERT INTO "Contact" VALUES('003S000001LarHKIAZ','Test 3','Contact','','','','false','false','false',''); -INSERT INTO "Contact" VALUES('003S000001LarPSIAZ','Test 2','Contact','','','','false','false','false',''); +INSERT INTO "Contact" VALUES('0031100001ffeU1AAI','Micah','McLaughlin','8324728021','micah@mailinator.com','2005-05-24','false','false','false',''); +INSERT INTO "Contact" VALUES('0031100001ffeU2AAI','Shane','McLaughlin','8324728021','shane.m@mailinator.com','1979-04-20','false','false','false',''); +INSERT INTO "Contact" VALUES('0031100001ffeU3AAI','Contact','WithoutProfile','8324728021','noprofile@mailinator.com','','false','false','false',''); +INSERT INTO "Contact" VALUES('0031100001ffeU4AAI','Test 1','Contact','','','','false','false','false',''); +INSERT INTO "Contact" VALUES('0031100001ffeV1AAI','Test 3','Contact','','','','false','false','false',''); +INSERT INTO "Contact" VALUES('0031100001ffeV2AAI','Test 2','Contact','','','','false','false','false',''); CREATE TABLE "FeedItem" ( sf_id VARCHAR(255) NOT NULL, "Body" VARCHAR(255), @@ -46,8 +51,8 @@ CREATE TABLE "FeedItem" ( parent_id VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "FeedItem" VALUES('0D5S000000RU4uIKAT','

This one is my favorite

','TextPost','a04S0000009JpNcIAK'); -INSERT INTO "FeedItem" VALUES('0D5S000000RU4uHKAT','

Here is another comment

','TextPost','a04S0000009JpNcIAK'); +INSERT INTO "FeedItem" VALUES('0D51100000jRqGoCAK','

This one is my favorite

','TextPost','a0511000009MhizAAC'); +INSERT INTO "FeedItem" VALUES('0D51100000jRqGpCAK','

Here is another comment

','TextPost','a0511000009MhizAAC'); CREATE TABLE "Open_Hours__c" ( sf_id VARCHAR(255) NOT NULL, "End_Time__c" VARCHAR(255), @@ -56,10 +61,10 @@ CREATE TABLE "Open_Hours__c" ( service__c VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Open_Hours__c" VALUES('a01S000000JktoMIAR','17:00:00.000Z','09:00:00.000Z','Thursday','a04S0000009JpNdIAK'); -INSERT INTO "Open_Hours__c" VALUES('a01S000000JktoNIAR','17:00:00.000Z','09:00:00.000Z','Tuesday','a04S0000009JpNdIAK'); -INSERT INTO "Open_Hours__c" VALUES('a01S000000JktoOIAR','17:00:00.000Z','09:00:00.000Z','Monday','a04S0000009JpNdIAK'); -INSERT INTO "Open_Hours__c" VALUES('a01S000000JktoPIAR','17:00:00.000Z','09:00:00.000Z','Wednesday','a04S0000009JpNdIAK'); +INSERT INTO "Open_Hours__c" VALUES('a011100000igZywAAE','17:00:00.000Z','09:00:00.000Z','Thursday','a0511000009Mhj0AAC'); +INSERT INTO "Open_Hours__c" VALUES('a011100000igZyxAAE','17:00:00.000Z','09:00:00.000Z','Tuesday','a0511000009Mhj0AAC'); +INSERT INTO "Open_Hours__c" VALUES('a011100000igZyyAAE','17:00:00.000Z','09:00:00.000Z','Monday','a0511000009Mhj0AAC'); +INSERT INTO "Open_Hours__c" VALUES('a011100000igZyzAAE','17:00:00.000Z','09:00:00.000Z','Wednesday','a0511000009Mhj0AAC'); CREATE TABLE "Referral__c" ( sf_id VARCHAR(255) NOT NULL, "Preferred_Channel__c" VARCHAR(255), @@ -68,21 +73,21 @@ CREATE TABLE "Referral__c" ( service__c VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvNIAV','Email','','003S000001LarKCIAZ','a04S0000009JpNcIAK'); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvOIAV','SMS','3.0','003S000001LarKDIAZ','a04S0000009JpNdIAK'); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvcIAF','SMS','1.0','003S000001LarPSIAZ','a04S0000009JpNbIAK'); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvhIAF','SMS','3.0','003S000001LarPSIAZ','a04S0000009JpNeIAK'); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvXIAV','SMS','3.0','003S000001LarHKIAZ','a04S0000009JpNdIAK'); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvYIAV','SMS','','003S000001LarOQIAZ','a04S0000009JpNcIAK'); -INSERT INTO "Referral__c" VALUES('a02S000000EjCvZIAV','SMS','','003S000001LarOQIAZ','a04S0000009JpNaIAK'); +INSERT INTO "Referral__c" VALUES('a0311000009dalLAAQ','SMS','3.0','0031100001ffeV1AAI','a0511000009Mhj0AAC'); +INSERT INTO "Referral__c" VALUES('a0311000009dalMAAQ','Email','','0031100001ffeU1AAI','a0511000009MhizAAC'); +INSERT INTO "Referral__c" VALUES('a0311000009dalNAAQ','SMS','3.0','0031100001ffeU2AAI','a0511000009Mhj0AAC'); +INSERT INTO "Referral__c" VALUES('a0311000009dalOAAQ','SMS','','0031100001ffeU4AAI','a0511000009MhixAAC'); +INSERT INTO "Referral__c" VALUES('a0311000009dalPAAQ','SMS','','0031100001ffeU4AAI','a0511000009MhizAAC'); +INSERT INTO "Referral__c" VALUES('a0311000009dalQAAQ','SMS','1.0','0031100001ffeV2AAI','a0511000009MhiyAAC'); +INSERT INTO "Referral__c" VALUES('a0311000009dalRAAQ','SMS','3.0','0031100001ffeV2AAI','a0511000009Mhj1AAC'); CREATE TABLE "Service_Exclusion__c" ( sf_id VARCHAR(255) NOT NULL, contact__c VARCHAR(255), service__c VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Service_Exclusion__c" VALUES('a03S0000007KiR5IAK','','a04S0000009JpNaIAK'); -INSERT INTO "Service_Exclusion__c" VALUES('a03S0000007KiR6IAK','','a04S0000009JpNeIAK'); +INSERT INTO "Service_Exclusion__c" VALUES('a041100000GnUYJAA3','','a0511000009MhixAAC'); +INSERT INTO "Service_Exclusion__c" VALUES('a041100000GnUYKAA3','','a0511000009Mhj1AAC'); CREATE TABLE "Service__c" ( sf_id VARCHAR(255) NOT NULL, "Name" VARCHAR(255), @@ -99,14 +104,19 @@ CREATE TABLE "Service__c" ( "Preferred__c" VARCHAR(255), "Location__Latitude__s" VARCHAR(255), "Location__Longitude__s" VARCHAR(255), + "Homeless__c" VARCHAR(255), + "Runaway__c" VARCHAR(255), + "Home_Owner__c" VARCHAR(255), + "Home_Renter__c" VARCHAR(255), + "Near_Homeless__c" VARCHAR(255), account__c VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Service__c" VALUES('a04S0000009JpNaIAK','hidden service (all contacts)','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Housing','www.google.com','94102','','false','37.7897','-122.397',''); -INSERT INTO "Service__c" VALUES('a04S0000009JpNbIAK','far service','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Housing','www.google.com','94102','','false','2.0','-2.0',''); -INSERT INTO "Service__c" VALUES('a04S0000009JpNcIAK','Test Service for Adults','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Food','www.google.com','94102','','false','37.7897','-122.397',''); -INSERT INTO "Service__c" VALUES('a04S0000009JpNdIAK','Test Service for Teens','17.0','13.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Education','www.google.com','94102','','false','37.7897','-122.397',''); -INSERT INTO "Service__c" VALUES('a04S0000009JpNeIAK','hidden service (only hidden from Shane)','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Health','www.google.com','94102','','false','37.7897','-122.397',''); +INSERT INTO "Service__c" VALUES('a0511000009MhixAAC','hidden service (all contacts)','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Housing','www.google.com','94102','','false','37.7897','-122.397','false','false','false','false','false',''); +INSERT INTO "Service__c" VALUES('a0511000009MhiyAAC','far service','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Housing','www.google.com','94102','','false','2.0','-2.0','false','false','false','false','false',''); +INSERT INTO "Service__c" VALUES('a0511000009MhizAAC','Test Service for Adults','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Food','www.google.com','94102','','false','37.7897','-122.397','false','false','false','false','false',''); +INSERT INTO "Service__c" VALUES('a0511000009Mhj0AAC','Test Service for Teens','17.0','13.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Education','www.google.com','94102','','false','37.7897','-122.397','false','false','false','false','false',''); +INSERT INTO "Service__c" VALUES('a0511000009Mhj1AAC','hidden service (only hidden from Shane)','','18.0','San Francisco','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut efficitur lacus in aliquet dignissim. Cras molestie risus vel magna gravida congue facilisis non nisl. Maecenas laoreet est libero, vitae cursus justo posuere in. Nunc vel elit sapien. Integer velit augue, volutpat ut mattis et, lacinia at orci.','555 555 5555','2400 Clay','Health','www.google.com','94102','','false','37.7897','-122.397','false','false','false','false','false',''); CREATE TABLE "Task" ( sf_id VARCHAR(255) NOT NULL, "Subject" VARCHAR(255), @@ -117,7 +127,7 @@ CREATE TABLE "Task" ( what_id VARCHAR(255), PRIMARY KEY (sf_id) ); -INSERT INTO "Task" VALUES('00TS000000cMiJ4MAK','Info to Client','','Completed','Normal','','a02S000000EjCvNIAV'); -INSERT INTO "Task" VALUES('00TS000000cMiJ5MAK','Reminder','','Not Started','Normal','','a02S000000EjCvNIAV'); -INSERT INTO "Task" VALUES('00TS000000cMiJ6MAK','Survey','','Not Started','Normal','','a02S000000EjCvNIAV'); +INSERT INTO "Task" VALUES('00T1100000OxrlOEAR','Info to Client','','Completed','Normal','','a0311000009dalMAAQ'); +INSERT INTO "Task" VALUES('00T1100000OxrlPEAR','Reminder','','Not Started','Normal','','a0311000009dalMAAQ'); +INSERT INTO "Task" VALUES('00T1100000OxrlQEAR','Survey','','Not Started','Normal','','a0311000009dalMAAQ'); COMMIT; From 1ac8fe038fd572c8c41d43cfd5106592359392b2 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 18:15:07 -0500 Subject: [PATCH 06/10] verifies sample data is buildable so dev flow doesn't break --- .github/workflows/verifies_test_data.yml | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/verifies_test_data.yml diff --git a/.github/workflows/verifies_test_data.yml b/.github/workflows/verifies_test_data.yml new file mode 100644 index 00000000..5022690b --- /dev/null +++ b/.github/workflows/verifies_test_data.yml @@ -0,0 +1,36 @@ +name: Verifies Sample Data + +on: + push: + branches: + - '**' + - '!master' + +env: + CUMULUSCI_KEYCHAIN_CLASS: cumulusci.core.keychain.EnvironmentProjectKeychain + CUMULUSCI_SERVICE_github: ${{ secrets.CUMULUSCI_SERVICE_github }} + +jobs: + unit_tests: + name: 'Verify sample data' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install sfdx + run: | + mkdir sfdx + wget -qO- https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz | tar xJ -C sfdx --strip-components 1 + ./sfdx/install + echo ${{ secrets.SFDX_AUTH_URL }} > sfdx_auth + sfdx force:auth:sfdxurl:store -f sfdx_auth -d + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.8' + - name: Install CumulusCI + run: | + python -m pip install -U pip + pip install cumulusci + - name: Deploy and load sample data + run: | + cci flow run dev_org --org dev --delete-org From f5a8e52bdb6b3b6dff5325055a692b33f4754f9a Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 19:30:54 -0500 Subject: [PATCH 07/10] don't cache ui --- orgs/dev.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/orgs/dev.json b/orgs/dev.json index 38ed7f6c..4ffb39f8 100644 --- a/orgs/dev.json +++ b/orgs/dev.json @@ -18,6 +18,9 @@ "forceRelogin": false } }, + "mobileSettings": { + "enableS1EncryptedStoragePref2": false + }, "languageSettings": { "enableTranslationWorkbench": true } From e2f62888a56af3669c3248346e3a8b7098c3dfbc Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 19:50:48 -0500 Subject: [PATCH 08/10] don't show today's hours if null --- .../serviceRecommendation.html | 289 +++++++++++++----- 1 file changed, 210 insertions(+), 79 deletions(-) diff --git a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html index 7a34f94a..a86d9190 100644 --- a/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html +++ b/force-app/main/default/lwc/serviceRecommendation/serviceRecommendation.html @@ -1,85 +1,216 @@ \ No newline at end of file +
+
+ +
+ +
+
+
+ + + From 9cd5f2ea7321f2930de371b2dcdeb4d02ce539e7 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 19:50:59 -0500 Subject: [PATCH 09/10] subscribe to platform event for refresh --- .../serviceRecommendations.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js index a6c087e7..4a8413ed 100644 --- a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js +++ b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js @@ -4,7 +4,7 @@ import { loadStyle } from 'lightning/platformResourceLoader'; import mapModal from '@salesforce/resourceUrl/mapModal'; import { subscribe, unsubscribe } from 'lightning/empApi'; -import getRecs from '@salesforce/apex/getRecommendations.getRecommendations'; +import getRecommendations from '@salesforce/apex/getRecommendations.getRecommendations'; const eventChannel = '/event/Client_Profile_Update_Notification__e'; @@ -54,7 +54,7 @@ export default class ServiceRecommendations extends LightningElement { handleRequestRecommendations() { console.log('getting recommendations'); console.log('recorid Id' + this.recordId); - getRecs({ contactId: '003J000001uUczOIAS' }) + getRecommendations({ contactId: this.recordId }) .then((result) => { window.console.log('success'); if (this.showRecommendations === false) { @@ -64,7 +64,8 @@ export default class ServiceRecommendations extends LightningElement { this.returnRecommendations = result; }) .catch((error) => { - window.console.log('error:' + error); + // window.console.log('error:' + error); + console.log(JSON.parse(JSON.stringify(error))); }); } @@ -149,10 +150,12 @@ export default class ServiceRecommendations extends LightningElement { } handleSubscribe() { - const messageCallback = (response) => { - console.log(response); - if (response.data.payload.ContactId === this.recordId) { - this.handleRequestRecommendations(); + const context = this; + const messageCallback = function (response) { + console.log(JSON.stringify(response)); + console.log(context.recordId); + if (response.data.payload.ContactId__c === context.recordId) { + context.handleRequestRecommendations(); } }; subscribe(eventChannel, -1, messageCallback).then((response) => { @@ -167,6 +170,7 @@ export default class ServiceRecommendations extends LightningElement { renderedCallback() { this.handleSubscribe(); + console.log('version 9'); } disconnectedCallback() { From 3a451c45548da46dd5b6a7b7c55283f7b10a5773 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 30 Jun 2020 19:52:13 -0500 Subject: [PATCH 10/10] less logging --- .../serviceRecommendations.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js index 4a8413ed..7402dccd 100644 --- a/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js +++ b/force-app/main/default/lwc/serviceRecommendations/serviceRecommendations.js @@ -53,7 +53,7 @@ export default class ServiceRecommendations extends LightningElement { handleRequestRecommendations() { console.log('getting recommendations'); - console.log('recorid Id' + this.recordId); + console.log('record Id' + this.recordId); getRecommendations({ contactId: this.recordId }) .then((result) => { window.console.log('success'); @@ -152,25 +152,24 @@ export default class ServiceRecommendations extends LightningElement { handleSubscribe() { const context = this; const messageCallback = function (response) { - console.log(JSON.stringify(response)); - console.log(context.recordId); + // console.log(JSON.stringify(response)); + // console.log(context.recordId); if (response.data.payload.ContactId__c === context.recordId) { context.handleRequestRecommendations(); } }; subscribe(eventChannel, -1, messageCallback).then((response) => { // Response contains the subscription information on subscribe call - console.log( - 'Subscription request sent to: ', - JSON.stringify(response.channel) - ); + // console.log( + // 'Subscription request sent to: ', + // JSON.stringify(response.channel) + // ); this.subscription = response; }); } renderedCallback() { this.handleSubscribe(); - console.log('version 9'); } disconnectedCallback() {