From c7ef49b6bc49d46cd4772a62f4c89409f34a46e7 Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Fri, 11 Apr 2025 08:52:40 -0500 Subject: [PATCH 1/7] Added registrant lwc for instance --- .gitignore | 1 + force-app/main/default/lwc/tsconfig.json | 4 + force-app/main/default/lwc/ustMap/ustMap.css | 3 + force-app/main/default/lwc/ustMap/ustMap.html | 16 +++ force-app/main/default/lwc/ustMap/ustMap.js | 113 ++++++++++++++++++ .../default/lwc/ustMap/ustMap.js-meta.xml | 12 ++ 6 files changed, 149 insertions(+) create mode 100644 force-app/main/default/lwc/tsconfig.json create mode 100644 force-app/main/default/lwc/ustMap/ustMap.css create mode 100644 force-app/main/default/lwc/ustMap/ustMap.html create mode 100644 force-app/main/default/lwc/ustMap/ustMap.js create mode 100644 force-app/main/default/lwc/ustMap/ustMap.js-meta.xml diff --git a/.gitignore b/.gitignore index b37abced..cefedc27 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ robot/SummitEventsApp/results/ .DS_Store # Illuminated Cloud (IntelliJ IDEA) +.IlluminatedCloud IlluminatedCloud out .idea diff --git a/force-app/main/default/lwc/tsconfig.json b/force-app/main/default/lwc/tsconfig.json new file mode 100644 index 00000000..c430026c --- /dev/null +++ b/force-app/main/default/lwc/tsconfig.json @@ -0,0 +1,4 @@ +// DO NOT EDIT: This file is managed by Illuminated Cloud. Any external changes will be discarded. +{ + "extends": "../../../../.illuminatedCloud/lwc/tsconfig.json" +} \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.css b/force-app/main/default/lwc/ustMap/ustMap.css new file mode 100644 index 00000000..88a0dbb0 --- /dev/null +++ b/force-app/main/default/lwc/ustMap/ustMap.css @@ -0,0 +1,3 @@ +/** + * Created by Thad-PC-2019 on 4/9/2025. + */ \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.html b/force-app/main/default/lwc/ustMap/ustMap.html new file mode 100644 index 00000000..24dfdc62 --- /dev/null +++ b/force-app/main/default/lwc/ustMap/ustMap.html @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.js b/force-app/main/default/lwc/ustMap/ustMap.js new file mode 100644 index 00000000..717dad68 --- /dev/null +++ b/force-app/main/default/lwc/ustMap/ustMap.js @@ -0,0 +1,113 @@ +/** + * Created by Thad-PC-2019 on 4/9/2025. + */ + +import {LightningElement, wire, api, track} from 'lwc'; +import {gql, graphql} from "lightning/uiGraphQLApi"; + +export default class UstMap extends LightningElement { + + @api recordId; + + @track mapMarkers; + + // Define the center of the map + center = { + location: { + Latitude: 44.949642, // San Francisco Latitude + Longitude: -93.093124 // San Francisco Longitude + } + }; + + // Console log the recordId received + connectedCallback() { + //console.log('Record Id:', this.recordId); + } + + //Use LWC graphQl to query all summit_event_registrations using registrant_city__c registrant_state__c registrant_country__c, registrant_postal_code__c to build out mapParkers + @wire(graphql, { + query: gql` + query getRegistrations($recordId: ID) { + uiapi { + query { + summit__Summit_Events_Registration__c( + where: { + and: [ + { summit__Event_Instance__c: { eq: $recordId } } + { summit__Registrant_City__c: { ne: null } } + { summit__Registrant_State__c: { ne: null } } + { summit__Registrant_Zip__c: { ne: null } } + ] + } + ) { + edges { + node { + Id + summit__Registrant_Street_1__c { + value + } + summit__Preferred_First_Name_Formatted__c { + value + } + summit__Registrant_Street_2__c { + value + } + summit__Registrant_City__c { + value + } + summit__Registrant_State__c { + value + } + summit__Registrant_Country__c { + value + } + summit__Registrant_Zip__c { + value + } + } + } + } + } + } + }`, + variables: "$variables", + }) + summitEventRegistration({errors, data}) { + if (data) { + this.mapMarkers = data.uiapi.query.summit__Summit_Events_Registration__c.edges.map((edge) => ({ + location: { + City: edge.node.summit__Registrant_City__c.value || '', + Country: edge.node.summit__Registrant_Country__c.value || '', + PostalCode: edge.node.summit__Registrant_Zip__c.value || '', + State: edge.node.summit__Registrant_State__c.value || '', + Street: + (edge.node.summit__Registrant_Street_1__c?.value || '') + + (edge.node.summit__Registrant_Street_2__c?.value ? ' ' + edge.node.summit__Registrant_Street_2__c.value : '') + }, + title: edge.node.summit__Preferred_First_Name_Formatted__c.value || 'Registrant', + url: '/lightning/r/Account/' + edge.node.Id + '/view', + description: 'Registration', + value: edge.node.Id, + icon: 'standard:location' + })); + } else if (errors) { + console.error('Errors:', errors); + } + } + + get variables() { + return { + recordId: this.recordId, + // dateFilter: this.dateFilter, + } + } + + handleMapClick(event) { + + const marker = event.detail; + const markerId = marker.value; + const url = `/lightning/r/Account/${markerId}/view`; + window.open(url, '_blank'); + } + +} \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.js-meta.xml b/force-app/main/default/lwc/ustMap/ustMap.js-meta.xml new file mode 100644 index 00000000..b20166eb --- /dev/null +++ b/force-app/main/default/lwc/ustMap/ustMap.js-meta.xml @@ -0,0 +1,12 @@ + + + 61.0 + Ust Map + true + Ust Map + + lightning__AppPage + lightning__RecordPage + lightning__HomePage + + \ No newline at end of file From f48637be14a55d7c84ee317fef5a8879c3e39635 Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Fri, 25 Apr 2025 08:28:37 -0500 Subject: [PATCH 2/7] gitignore update --- .forceignore | 5 +++++ .gitignore | 10 +++++++++- force-app/main/default/lwc/ustMap/ustMap.js | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .forceignore diff --git a/.forceignore b/.forceignore new file mode 100644 index 00000000..eeed72a8 --- /dev/null +++ b/.forceignore @@ -0,0 +1,5 @@ +/.illuminatedCloud/ +**/*.ts +**/tsconfig*.json +**/*.tsbuildinfo +**/eslint.config.mjs \ No newline at end of file diff --git a/.gitignore b/.gitignore index cefedc27..05e371f8 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,12 @@ out *.iml # CumulusCI -/test_results.* \ No newline at end of file +/test_results.* + +# Added by Illuminated Cloud +.localdev/ +target/ +node_modules/ +/.illuminatedCloud/ +**/tsconfig*.json +**/*.tsbuildinfo \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.js b/force-app/main/default/lwc/ustMap/ustMap.js index 717dad68..41e65623 100644 --- a/force-app/main/default/lwc/ustMap/ustMap.js +++ b/force-app/main/default/lwc/ustMap/ustMap.js @@ -8,7 +8,7 @@ import {gql, graphql} from "lightning/uiGraphQLApi"; export default class UstMap extends LightningElement { @api recordId; - + @api objectApiName; @track mapMarkers; // Define the center of the map @@ -27,7 +27,7 @@ export default class UstMap extends LightningElement { //Use LWC graphQl to query all summit_event_registrations using registrant_city__c registrant_state__c registrant_country__c, registrant_postal_code__c to build out mapParkers @wire(graphql, { query: gql` - query getRegistrations($recordId: ID) { + query getRegistrations($recordId: ID, $objectApiName: String, $namespace: String, $query: String) { uiapi { query { summit__Summit_Events_Registration__c( @@ -96,8 +96,18 @@ export default class UstMap extends LightningElement { } get variables() { + //get the object api name from the record id + let namespace = ''; + if(this.objectApiName.toLowerCase().startsWith('summit__')) { + namespace = 'summit__'; + } + + let query = 'summit__Summit_Events_Registration__c(\n where: {\n and: [\n { summit__Event_Instance__c: { eq: $recordId } }\n { summit__Registrant_City__c: { ne: null } }\n { summit__Registrant_State__c: { ne: null } }\n { summit__Registrant_Zip__c: { ne: null } }\n ]\n }\n ) {\n edges {\n node {\n Id\n summit__Registrant_Street_1__c {\n value\n }\n summit__Preferred_First_Name_Formatted__c {\n value\n }\n summit__Registrant_Street_2__c {\n value\n }\n summit__Registrant_City__c {\n value\n }\n summit__Registrant_State__c {\n value\n }\n summit__Registrant_Country__c {\n value\n }\n summit__Registrant_Zip__c {\n value\n }\n }\n }\n }' return { recordId: this.recordId, + objectApiName: this.objectApiName, + namespace: namespace, + query: query, // dateFilter: this.dateFilter, } } From 9208832fde2dad07637980f2d0fbbc8aa04f79ab Mon Sep 17 00:00:00 2001 From: Alex Kadis Date: Thu, 31 Jul 2025 12:12:23 -0400 Subject: [PATCH 3/7] Summit Events Registrant Map - Apex version --- .../classes/SummitEventsMapController.cls | 24 +++++++++++++ .../SummitEventsMapController.cls-meta.xml | 5 +++ .../summitEventsRegistrantMap.html | 11 ++++++ .../summitEventsRegistrantMap.js | 36 +++++++++++++++++++ .../summitEventsRegistrantMap.js-meta.xml | 12 +++++++ 5 files changed, 88 insertions(+) create mode 100644 force-app/main/default/classes/SummitEventsMapController.cls create mode 100644 force-app/main/default/classes/SummitEventsMapController.cls-meta.xml create mode 100644 force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html create mode 100644 force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js create mode 100644 force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js-meta.xml diff --git a/force-app/main/default/classes/SummitEventsMapController.cls b/force-app/main/default/classes/SummitEventsMapController.cls new file mode 100644 index 00000000..f3345ac7 --- /dev/null +++ b/force-app/main/default/classes/SummitEventsMapController.cls @@ -0,0 +1,24 @@ +public with sharing class SummitEventsMapController { + + @AuraEnabled(cacheable=true) + public static List getSummitEventsRegistrants(Id eventId) { + List registrations; + try { + if (Schema.SObjectType.Summit_Events_Registration__c.isAccessible()) { + registrations = [SELECT Id, + Preferred_First_Name_Formatted__c, + Contact__r.MailingStreet, Contact__r.MailingCity, Contact__r.MailingState, Contact__r.MailingPostalCode, Contact__r.MailingLongitude, Contact__r.MailingLatitude + FROM Summit_Events_Registration__c + WHERE Event_Instance__c =: eventId + AND Registrant_City__c != null + AND Registrant_State__c != null + AND Registrant_Zip__c != null + WITH SECURITY_ENFORCED + ]; + } + } catch (Exception e) { + throw new AuraHandledException(e.getMessage()); + } + return registrations; + } +} \ No newline at end of file diff --git a/force-app/main/default/classes/SummitEventsMapController.cls-meta.xml b/force-app/main/default/classes/SummitEventsMapController.cls-meta.xml new file mode 100644 index 00000000..1e7de940 --- /dev/null +++ b/force-app/main/default/classes/SummitEventsMapController.cls-meta.xml @@ -0,0 +1,5 @@ + + + 64.0 + Active + diff --git a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html new file mode 100644 index 00000000..d0e8e653 --- /dev/null +++ b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js new file mode 100644 index 00000000..01883a80 --- /dev/null +++ b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js @@ -0,0 +1,36 @@ +import { LightningElement, wire, api } from 'lwc'; +import getSummitEventsRegistrants from '@salesforce/apex/SummitEventsMapController.getSummitEventsRegistrants'; + +export default class SummitEventsRegistrantMap extends LightningElement { + @api recordId; + @api objectApiName; + mapMarkers; + + // Define the center of the map + center = { + location: { + // Latitude: 44.949642, // San Francisco Latitude + // Longitude: -93.093124 // San Francisco Longitude + } + }; + + @wire(getSummitEventsRegistrants, {eventId: '$recordId'}) + summitEventsRegistrants ({error, data}) { + if (error) { + console.error(error); + } else if (data) { + console.log((JSON.stringify(data))); + this.mapMarkers = data.map((registrant) => ({ + location: { + Latitude: registrant?.Contact__r?.MailingLatitude, + Longitude: registrant?.Contact__r?.MailingLongitude + }, + title: registrant.Preferred_First_Name_Formatted__c || 'Registrant', + url: '/lightning/r/Account/' + registrant.Id + '/view', + description: 'Registration', + value: registrant.Id, + icon: 'standard:location' + })); + } + } +} \ No newline at end of file diff --git a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js-meta.xml b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js-meta.xml new file mode 100644 index 00000000..1819cfbe --- /dev/null +++ b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js-meta.xml @@ -0,0 +1,12 @@ + + + 64.0 + Summit Events Registrant Map + true + Summit Events Registrant Map + + lightning__AppPage + lightning__RecordPage + lightning__HomePage + + \ No newline at end of file From abe5e60b81a869e36f2a4d08284c22b6ea7922de Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Thu, 31 Jul 2025 13:06:06 -0500 Subject: [PATCH 4/7] created registration snofakery recipe --- .../snowfakery/sea_test_registrations.yml | 33 +++++ force-app/main/default/lwc/ustMap/ustMap.css | 3 - force-app/main/default/lwc/ustMap/ustMap.html | 16 --- force-app/main/default/lwc/ustMap/ustMap.js | 123 ------------------ .../default/lwc/ustMap/ustMap.js-meta.xml | 12 -- 5 files changed, 33 insertions(+), 154 deletions(-) create mode 100644 datasets/snowfakery/sea_test_registrations.yml delete mode 100644 force-app/main/default/lwc/ustMap/ustMap.css delete mode 100644 force-app/main/default/lwc/ustMap/ustMap.html delete mode 100644 force-app/main/default/lwc/ustMap/ustMap.js delete mode 100644 force-app/main/default/lwc/ustMap/ustMap.js-meta.xml diff --git a/datasets/snowfakery/sea_test_registrations.yml b/datasets/snowfakery/sea_test_registrations.yml new file mode 100644 index 00000000..c51bd93e --- /dev/null +++ b/datasets/snowfakery/sea_test_registrations.yml @@ -0,0 +1,33 @@ +- snowfakery_version: 3 +- plugin: snowfakery.standard_plugins.Salesforce.SOQLDataset +- object: Contact + count: 100 + fields: + FirstName: ${{fake.first_name}} + LastName: ${{fake.last_name}} + Email: ${{fake.email}} + Phone: ${{fake.phone_number}} + MailingStreet: ${{fake.street_address}} + MailingCity: ${{fake.city}} + MailingState: ${{fake.state}} + MailingPostalCode: ${{fake.postcode}} + MailingCountry: ${{fake.country}} + friends: + - object: summit_events_Registration__c + fields: + __instance: + SOQLDataset.iterate: + fields: Id, Instance_Title__c, Event__c + from: summit_events_instance__c + where: Event__r.Name = 'Sample - Open House for Prospective Graduate Students' + Contact__c: ${{Contact}} + Event__c: ${{__instance.Event__c}} + Event_Instance__c: ${{__instance.Id}} + registrant_first_name__c: ${{Contact.FirstName}} + registrant_last_name__c: ${{Contact.LastName}} + registrant_email__c: ${{Contact.Email}} + registrant_phone__c: ${{Contact.Phone}} + registrant_street_1__c: ${{Contact.MailingStreet}} + registrant_city__c: ${{Contact.MailingCity}} + registrant_postal_code__c: ${{Contact.MailingPostalCode}} + status__c: 'Registered' \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.css b/force-app/main/default/lwc/ustMap/ustMap.css deleted file mode 100644 index 88a0dbb0..00000000 --- a/force-app/main/default/lwc/ustMap/ustMap.css +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by Thad-PC-2019 on 4/9/2025. - */ \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.html b/force-app/main/default/lwc/ustMap/ustMap.html deleted file mode 100644 index 24dfdc62..00000000 --- a/force-app/main/default/lwc/ustMap/ustMap.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.js b/force-app/main/default/lwc/ustMap/ustMap.js deleted file mode 100644 index 41e65623..00000000 --- a/force-app/main/default/lwc/ustMap/ustMap.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Created by Thad-PC-2019 on 4/9/2025. - */ - -import {LightningElement, wire, api, track} from 'lwc'; -import {gql, graphql} from "lightning/uiGraphQLApi"; - -export default class UstMap extends LightningElement { - - @api recordId; - @api objectApiName; - @track mapMarkers; - - // Define the center of the map - center = { - location: { - Latitude: 44.949642, // San Francisco Latitude - Longitude: -93.093124 // San Francisco Longitude - } - }; - - // Console log the recordId received - connectedCallback() { - //console.log('Record Id:', this.recordId); - } - - //Use LWC graphQl to query all summit_event_registrations using registrant_city__c registrant_state__c registrant_country__c, registrant_postal_code__c to build out mapParkers - @wire(graphql, { - query: gql` - query getRegistrations($recordId: ID, $objectApiName: String, $namespace: String, $query: String) { - uiapi { - query { - summit__Summit_Events_Registration__c( - where: { - and: [ - { summit__Event_Instance__c: { eq: $recordId } } - { summit__Registrant_City__c: { ne: null } } - { summit__Registrant_State__c: { ne: null } } - { summit__Registrant_Zip__c: { ne: null } } - ] - } - ) { - edges { - node { - Id - summit__Registrant_Street_1__c { - value - } - summit__Preferred_First_Name_Formatted__c { - value - } - summit__Registrant_Street_2__c { - value - } - summit__Registrant_City__c { - value - } - summit__Registrant_State__c { - value - } - summit__Registrant_Country__c { - value - } - summit__Registrant_Zip__c { - value - } - } - } - } - } - } - }`, - variables: "$variables", - }) - summitEventRegistration({errors, data}) { - if (data) { - this.mapMarkers = data.uiapi.query.summit__Summit_Events_Registration__c.edges.map((edge) => ({ - location: { - City: edge.node.summit__Registrant_City__c.value || '', - Country: edge.node.summit__Registrant_Country__c.value || '', - PostalCode: edge.node.summit__Registrant_Zip__c.value || '', - State: edge.node.summit__Registrant_State__c.value || '', - Street: - (edge.node.summit__Registrant_Street_1__c?.value || '') + - (edge.node.summit__Registrant_Street_2__c?.value ? ' ' + edge.node.summit__Registrant_Street_2__c.value : '') - }, - title: edge.node.summit__Preferred_First_Name_Formatted__c.value || 'Registrant', - url: '/lightning/r/Account/' + edge.node.Id + '/view', - description: 'Registration', - value: edge.node.Id, - icon: 'standard:location' - })); - } else if (errors) { - console.error('Errors:', errors); - } - } - - get variables() { - //get the object api name from the record id - let namespace = ''; - if(this.objectApiName.toLowerCase().startsWith('summit__')) { - namespace = 'summit__'; - } - - let query = 'summit__Summit_Events_Registration__c(\n where: {\n and: [\n { summit__Event_Instance__c: { eq: $recordId } }\n { summit__Registrant_City__c: { ne: null } }\n { summit__Registrant_State__c: { ne: null } }\n { summit__Registrant_Zip__c: { ne: null } }\n ]\n }\n ) {\n edges {\n node {\n Id\n summit__Registrant_Street_1__c {\n value\n }\n summit__Preferred_First_Name_Formatted__c {\n value\n }\n summit__Registrant_Street_2__c {\n value\n }\n summit__Registrant_City__c {\n value\n }\n summit__Registrant_State__c {\n value\n }\n summit__Registrant_Country__c {\n value\n }\n summit__Registrant_Zip__c {\n value\n }\n }\n }\n }' - return { - recordId: this.recordId, - objectApiName: this.objectApiName, - namespace: namespace, - query: query, - // dateFilter: this.dateFilter, - } - } - - handleMapClick(event) { - - const marker = event.detail; - const markerId = marker.value; - const url = `/lightning/r/Account/${markerId}/view`; - window.open(url, '_blank'); - } - -} \ No newline at end of file diff --git a/force-app/main/default/lwc/ustMap/ustMap.js-meta.xml b/force-app/main/default/lwc/ustMap/ustMap.js-meta.xml deleted file mode 100644 index b20166eb..00000000 --- a/force-app/main/default/lwc/ustMap/ustMap.js-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - 61.0 - Ust Map - true - Ust Map - - lightning__AppPage - lightning__RecordPage - lightning__HomePage - - \ No newline at end of file From 285a0a7e18413389a2cb9ff784406053b7d0a769 Mon Sep 17 00:00:00 2001 From: Alex Kadis Date: Thu, 31 Jul 2025 16:37:32 -0400 Subject: [PATCH 5/7] Working version of Summit Events Registrant Map Can be added to either the Summit Event FlexiPage or Summit Event Instance FlexiPage after activating data integration rule for the mapping data service. Details: https://help.salesforce.com/s/articleView?id=sales.ddc_data_integration_rule_activating.htm&type=5 --- .../snowfakery/sea_test_registrations.yml | 4 +- .../classes/SummitEventsMapController.cls | 13 ++-- .../summitEventsRegistrantMap.html | 27 +++++--- .../summitEventsRegistrantMap.js | 63 ++++++++++++++----- .../SummitEventsMapController_TEST.cls | 18 ++++++ ...ummitEventsMapController_TEST.cls-meta.xml | 5 ++ 6 files changed, 101 insertions(+), 29 deletions(-) create mode 100644 force-app/test/default/classes/SummitEventsMapController_TEST.cls create mode 100644 force-app/test/default/classes/SummitEventsMapController_TEST.cls-meta.xml diff --git a/datasets/snowfakery/sea_test_registrations.yml b/datasets/snowfakery/sea_test_registrations.yml index c51bd93e..5c378bbf 100644 --- a/datasets/snowfakery/sea_test_registrations.yml +++ b/datasets/snowfakery/sea_test_registrations.yml @@ -9,8 +9,8 @@ Phone: ${{fake.phone_number}} MailingStreet: ${{fake.street_address}} MailingCity: ${{fake.city}} - MailingState: ${{fake.state}} - MailingPostalCode: ${{fake.postcode}} + MailingState: ${{fake.stateAbbr}} + MailingPostalCode: ${{fake.zipcodeInState}} MailingCountry: ${{fake.country}} friends: - object: summit_events_Registration__c diff --git a/force-app/main/default/classes/SummitEventsMapController.cls b/force-app/main/default/classes/SummitEventsMapController.cls index f3345ac7..c7888447 100644 --- a/force-app/main/default/classes/SummitEventsMapController.cls +++ b/force-app/main/default/classes/SummitEventsMapController.cls @@ -7,12 +7,15 @@ public with sharing class SummitEventsMapController { if (Schema.SObjectType.Summit_Events_Registration__c.isAccessible()) { registrations = [SELECT Id, Preferred_First_Name_Formatted__c, - Contact__r.MailingStreet, Contact__r.MailingCity, Contact__r.MailingState, Contact__r.MailingPostalCode, Contact__r.MailingLongitude, Contact__r.MailingLatitude + Contact__r.MailingStreet, + Contact__r.MailingCity, + Contact__r.MailingState, + Contact__r.MailingPostalCode, + Contact__r.MailingCountry, + Contact__r.MailingLongitude, + Contact__r.MailingLatitude FROM Summit_Events_Registration__c - WHERE Event_Instance__c =: eventId - AND Registrant_City__c != null - AND Registrant_State__c != null - AND Registrant_Zip__c != null + WHERE (Event_Instance__c =: eventId OR Event__c =: eventId) WITH SECURITY_ENFORCED ]; } diff --git a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html index d0e8e653..3df895bf 100644 --- a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html +++ b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.html @@ -1,11 +1,24 @@ \ No newline at end of file diff --git a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js index 01883a80..69af47fb 100644 --- a/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js +++ b/force-app/main/default/lwc/summitEventsRegistrantMap/summitEventsRegistrantMap.js @@ -1,36 +1,69 @@ import { LightningElement, wire, api } from 'lwc'; import getSummitEventsRegistrants from '@salesforce/apex/SummitEventsMapController.getSummitEventsRegistrants'; +import { getRelatedListRecords } from 'lightning/uiRelatedListApi'; export default class SummitEventsRegistrantMap extends LightningElement { @api recordId; @api objectApiName; mapMarkers; + selectedEventInstance = ''; + selectedMarkerValue; + eventInstancesOptions = [ + { label: 'All Event Instances', value: '' } + ]; - // Define the center of the map - center = { - location: { - // Latitude: 44.949642, // San Francisco Latitude - // Longitude: -93.093124 // San Francisco Longitude - } - }; + get selectedEventOrEventInstanceId() { + return (this.selectedEventInstance === null || this.selectedEventInstance === '') ? this.recordId : this.selectedEventInstance; + } + + get isEvent() { + return this.objectApiName === 'Summit_Events__c'; + } - @wire(getSummitEventsRegistrants, {eventId: '$recordId'}) + @wire(getRelatedListRecords, { + parentRecordId: '$recordId', + relatedListId: 'Event_Instances__r', + fields: ['Summit_Events_Instance__c.Id','Summit_Events_Instance__c.Event__c', 'Summit_Events_Instance__c.Name'], + orderBy: 'Summit_Events_Instance__c.Name' + }) + listInfo({ error, data }) { + if (data) { + data.records.forEach((childRecord) => { + this.eventInstancesOptions.push({ + label: childRecord?.fields?.Name?.value, + value: childRecord?.fields?.Id?.value + }) + }); + this.eventInstancesOptions = JSON.parse(JSON.stringify(this.eventInstancesOptions)); + } else if (error) { + if (this.isEvent) { + console.error(JSON.stringify(error)); + } + } + } + + @wire(getSummitEventsRegistrants, {eventId: '$selectedEventOrEventInstanceId'}) summitEventsRegistrants ({error, data}) { if (error) { - console.error(error); + console.error(JSON.stringify(error)); } else if (data) { - console.log((JSON.stringify(data))); this.mapMarkers = data.map((registrant) => ({ location: { Latitude: registrant?.Contact__r?.MailingLatitude, - Longitude: registrant?.Contact__r?.MailingLongitude + Longitude: registrant?.Contact__r?.MailingLongitude, }, - title: registrant.Preferred_First_Name_Formatted__c || 'Registrant', - url: '/lightning/r/Account/' + registrant.Id + '/view', - description: 'Registration', - value: registrant.Id, + title: registrant?.Preferred_First_Name_Formatted__c || 'Registrant', + description: registrant?.Contact__r?.MailingCity + ', ' + (registrant?.Contact__r?.MailingState === undefined ? registrant?.Contact__r?.MailingCountry : registrant?.Contact__r?.MailingState), + value: registrant?.Id, icon: 'standard:location' })); } } + handleSelectEventInstanceChange(event) { + this.selectedEventInstance = event.target.value; + } + + handleMarkerSelect(event) { + this.selectedMarkerValue = event.target.selectedMarkerValue; + } } \ No newline at end of file diff --git a/force-app/test/default/classes/SummitEventsMapController_TEST.cls b/force-app/test/default/classes/SummitEventsMapController_TEST.cls new file mode 100644 index 00000000..52572763 --- /dev/null +++ b/force-app/test/default/classes/SummitEventsMapController_TEST.cls @@ -0,0 +1,18 @@ +@isTest +public with sharing class SummitEventsMapController_TEST { + @isTest + public static void getSummitEventsRegistrants_givenRegistrant_shouldReturnRegistrant() { + SummitEventsTestSharedDataFactory.createContact('TestFirst1', 'TestLast1', 'test1@example.net', '55418', '(555) 555-5555', '1971-03-22'); + List seaTestInstances = SummitEventsTestSharedDataFactory.createTestEvent(); + Summit_Events_Registration__c seaTestRegistration = SummitEventsTestSharedDataFactory.createEventRegistration(seaTestInstances[1], 'TestFirst', 'TestLast', 'test@example.net', '55418', '1971-03-22', '2012', null); + seaTestRegistration.Registrant_City__c = 'Example'; + seaTestRegistration.Registrant_State__c = 'KS'; + update seaTestRegistration; + + Test.startTest(); + List registrants = SummitEventsMapController.getSummitEventsRegistrants(seaTestInstances[1].Id); + Test.stopTest(); + + Assert.areEqual(1, registrants.size(), 'There should be one registrant returned'); + } +} \ No newline at end of file diff --git a/force-app/test/default/classes/SummitEventsMapController_TEST.cls-meta.xml b/force-app/test/default/classes/SummitEventsMapController_TEST.cls-meta.xml new file mode 100644 index 00000000..1e7de940 --- /dev/null +++ b/force-app/test/default/classes/SummitEventsMapController_TEST.cls-meta.xml @@ -0,0 +1,5 @@ + + + 64.0 + Active + From d6fda40be727e846cefcce3c0518a7714719edb4 Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:12:50 -0500 Subject: [PATCH 6/7] removed tsconfig --- force-app/main/default/lwc/tsconfig.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 force-app/main/default/lwc/tsconfig.json diff --git a/force-app/main/default/lwc/tsconfig.json b/force-app/main/default/lwc/tsconfig.json deleted file mode 100644 index c430026c..00000000 --- a/force-app/main/default/lwc/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -// DO NOT EDIT: This file is managed by Illuminated Cloud. Any external changes will be discarded. -{ - "extends": "../../../../.illuminatedCloud/lwc/tsconfig.json" -} \ No newline at end of file From 8946d48e129d47ae99d31890bbc0b5a99b5e7676 Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Mon, 8 Sep 2025 08:16:12 -0500 Subject: [PATCH 7/7] snowfakery recipe for registrant --- datasets/snowfakery/sea_test_registrations.yml | 4 ++-- force-app/main/default/lwc/tsconfig.json | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/datasets/snowfakery/sea_test_registrations.yml b/datasets/snowfakery/sea_test_registrations.yml index c51bd93e..a23d7861 100644 --- a/datasets/snowfakery/sea_test_registrations.yml +++ b/datasets/snowfakery/sea_test_registrations.yml @@ -9,8 +9,8 @@ Phone: ${{fake.phone_number}} MailingStreet: ${{fake.street_address}} MailingCity: ${{fake.city}} - MailingState: ${{fake.state}} - MailingPostalCode: ${{fake.postcode}} + MailingState: ${{fake.stateAbbr}} + MailingPostalCode: ${{fake.postCodeInState}} MailingCountry: ${{fake.country}} friends: - object: summit_events_Registration__c diff --git a/force-app/main/default/lwc/tsconfig.json b/force-app/main/default/lwc/tsconfig.json index c430026c..0c284693 100644 --- a/force-app/main/default/lwc/tsconfig.json +++ b/force-app/main/default/lwc/tsconfig.json @@ -1,4 +1,7 @@ // DO NOT EDIT: This file is managed by Illuminated Cloud. Any external changes will be discarded. { - "extends": "../../../../.illuminatedCloud/lwc/tsconfig.json" + "extends": [ + // If a file named 'tsconfig.overrides.json' exists in the same directory, it will be added to this 'extends' list. + "../../../../.illuminatedCloud/lwc/tsconfig.json" + ] } \ No newline at end of file