Skip to content

Commit

Permalink
Merge pull request #133 from Salesforce-org-Impact-Labs/lwc_Service_Reqs
Browse files Browse the repository at this point in the history
Lwc service reqs
  • Loading branch information
AIrwin33 authored Jul 10, 2020
2 parents dd7f79e + 2514fd4 commit 8a3b87d
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 70 deletions.
3 changes: 2 additions & 1 deletion force-app/main/default/classes/Test_getRecommendations.cls
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ public with sharing class Test_getRecommendations {
recs,
badServiceName
);
System.assertEquals(true, recs[badServiceIndex].Hidden);
System.assertEquals(true, recs[badServiceIndex].HiddenAll);
System.assertEquals(false, recs[badServiceIndex].Hidden);
}

@testSetup
Expand Down
4 changes: 3 additions & 1 deletion force-app/main/default/classes/getRecommendations.cls
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ public with sharing class getRecommendations {
rec.ServiceId
);
if (exclusions != null && exclusions.size() > 0) {
rec.Hidden = true;

for (Service_Exclusion__c exclusion : exclusions) {
if (exclusion.Contact__c == null) {
rec.HiddenAll = true;
}else{
rec.Hidden = true;
}
}
}
Expand Down
26 changes: 23 additions & 3 deletions force-app/main/default/flows/Send_Referral_Flow.flow-meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<locationY>172</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Screen_1_Referral_Confirmation</targetReference>
<targetReference>Get_Service</targetReference>
</connector>
<filters>
<field>Id</field>
Expand All @@ -150,6 +150,26 @@
<object>Contact</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups>
<recordLookups>
<name>Get_Service</name>
<label>Get Service</label>
<locationX>276</locationX>
<locationY>175</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Screen_1_Referral_Confirmation</targetReference>
</connector>
<filters>
<field>Id</field>
<operator>EqualTo</operator>
<value>
<elementReference>serviceId</elementReference>
</value>
</filters>
<getFirstRecordOnly>true</getFirstRecordOnly>
<object>Service__c</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups>
<screens>
<name>fault_screen</name>
<label>fault screen</label>
Expand Down Expand Up @@ -179,15 +199,15 @@
</connector>
<fields>
<name>Confirm</name>
<fieldText>&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Confirm Contact Information:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;{!Get_Contact.FirstName} {!Get_Contact.LastName}&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Phone: {!Get_Contact.MobilePhone}&lt;/p&gt;&lt;p&gt;Email: {!Get_Contact.Email}&lt;/p&gt;</fieldText>
<fieldText>&lt;p&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;Share This Service&lt;span class=&quot;ql-cursor&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Send To:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;{!Get_Contact.FirstName} {!Get_Contact.LastName}&lt;/p&gt;&lt;p&gt;Phone: {!Get_Contact.MobilePhone}&lt;/p&gt;&lt;p&gt;Email: {!Get_Contact.Email}&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
</fields>
<fields>
<name>Preferred_Method_of_Contact</name>
<choiceReferences>Email</choiceReferences>
<choiceReferences>SMS</choiceReferences>
<dataType>String</dataType>
<fieldText>Preferred Method of Contact</fieldText>
<fieldText>Send to Client Via:</fieldText>
<fieldType>MultiSelectCheckboxes</fieldType>
<isRequired>false</isRequired>
</fields>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div class="slds-form-element">
<label class="slds-form-element__label" for={apiName}>{label}</label>
<label class="slds-form-element__label " for={apiName}>{label}</label>
<div class="slds-form-element__control">
<div class={multiSelectListClass} id={apiName}>
<button class="slds-button slds-button--neutral slds-picklist__label relativePosition buttonWidth" onclick={openMultiSelectPicklist}>
<span class="slds-truncate" title="Select options...">{selectoptiontext}</span>
<span class="slds-truncate " title="Select options...">{selectoptiontext}</span>
<lightning-icon icon-name="utility:down" size="small" class="slds-icon dropdownButtonIconContainer"></lightning-icon>
</button>
<div class="slds-dropdown slds-dropdown--left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class MultiSelectPicklist extends LightningElement{
apiName = '';
@api selectoptiontext = 'View All';
picklistValues = ['Food', 'Education','Housing', 'Goods', 'Transit', 'Health','Money','Care', 'Work','Legal'];
multiSelectListClass = 'slds-picklist slds-dropdown-trigger slds-dropdown-trigger--click';
multiSelectListClass = 'slds-picklist slds-dropdown-trigger slds-dropdown-trigger--click slds-text-align_left';


openMultiSelectPicklist(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
width: 100%;
}

.slds-dropdown__item span {
color:black !important;
}

.headerdv {
display: flex;
}
Expand Down Expand Up @@ -33,6 +37,11 @@
line-height: 40px;
}

.hiddenMenu .slds-dropdown {
right:0;
left:auto;
}

.parentCard {
min-width: 300px;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,50 +75,44 @@
</div>
</div>
<div class="slds-float_right" slot="actions">
<lightning-button-group>
<lightning-button
label="Share"
onclick={handleSendReferral}
></lightning-button>
<lightning-button-icon
icon-name="utility:print"
variant="border-filled"
value={serviceid}
alternative-text="Print"
onclick={handlePrintReferral}
></lightning-button-icon>
<lightning-button-menu
if:false={servicerecommendation.Hidden}
alternative-text="Show More"
>
<lightning-menu-item
value="Hide for this Contact"
label="Hide for this Contact"
onclick={handleHideForThisContact}
></lightning-menu-item>
<lightning-menu-item
value="Hide for all Contacts"
label="Hide for all Contacts"
onclick={handleHideForAllContacts}
></lightning-menu-item>
</lightning-button-menu>
<!-- when to show hide/unhide? -->
<lightning-button-menu
if:true={servicerecommendation.Hidden}
alternative-text="Show More"
>
<lightning-menu-item
value="unhide for this Contact"
label="Unhide for this Contact"
onclick={handleUnhideForThisContact}
></lightning-menu-item>
<lightning-menu-item
value="unhide for all Contacts"
label="Unhide for all Contacts"
onclick={handleUnhideForAllContacts}
></lightning-menu-item>
</lightning-button-menu>
</lightning-button-group>
<div class="slds-button-group" role="group">
<button class="slds-button slds-button_neutral"
onclick={handleSendReferral}>Share</button>
<button class="slds-button slds-button_icon slds-button_icon-border-filled" value={serviceid} onclick={handlePrintReferral}>
<lightning-icon icon-name="utility:print" alternative-text="Print" size="x-small" >

</lightning-icon>
</button>
<div class="slds-dropdown-trigger slds-dropdown-trigger_click slds-button_last">
<lightning-button-icon icon-name="utility:down" class="slds-button slds-button_icon slds-button_icon-border-filled" onclick={handleOpenMenu}></lightning-button-icon>
<div class="slds-dropdown slds-dropdown_right slds-dropdown_actions">
<lightning-menu-item
if:false={servicerecommendation.Hidden}
value="Hide for this Contact"
label="Hide for this Contact"
onclick={handleHideForThisContact}
></lightning-menu-item>
<lightning-menu-item
if:true={servicerecommendation.Hidden}
value="unhide for this Contact"
label="Unhide for this Contact"
onclick={handleUnhideForThisContact}
></lightning-menu-item>
<lightning-menu-item
if:false={servicerecommendation.HiddenAll}
value="Hide for all Contacts"
label="Hide for all Contacts"
onclick={handleHideForAllContacts}
></lightning-menu-item>
<lightning-menu-item
if:true={servicerecommendation.HiddenAll}
value="unhide for all Contacts"
label="Unhide for all Contacts"
onclick={handleUnhideForAllContacts}
></lightning-menu-item>
</div>
</div>
</div>
</div>
</div>
<div class="slds-media__body">
Expand All @@ -127,7 +121,7 @@
<li>
<p>
Provided by:
<a href="#" onclick={handleAccountRedirect}>Org Name</a>
<a href="#" onclick={handleAccountRedirect}> {servicerecommendation.Service.Account__r.Name}</a>
</p>
</li>
<li><p>{servicerecommendation.ProgramDescription}</p></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-empty */
import { LightningElement, api } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

import hideContacts from '@salesforce/apex/serviceHide.hide';
import unhideContacts from '@salesforce/apex/serviceHide.unHide';
Expand All @@ -9,10 +10,10 @@ import print from '@salesforce/apex/ServicePrint.PrintPage';

import { icons } from './serviceTypeMap';

export default class ServiceRecommendation extends LightningElement {
export default class ServiceRecommendation extends NavigationMixin(LightningElement) {
@api servicerecommendation;


url;
@api contactid;
@api serviceid;

Expand All @@ -35,6 +36,9 @@ export default class ServiceRecommendation extends LightningElement {
if (rec.Indicators.length > 0) {
this.indicatorCount = rec.Indicators.length;
}



}

handleSendReferral() {
Expand Down Expand Up @@ -72,6 +76,15 @@ export default class ServiceRecommendation extends LightningElement {
hideContacts({ serviceId: this.serviceid, contactId: this.contactid })
.then(() => {
window.console.log('success');
let eventParams = 'reloadAfterHide';
const flowLaunchEvent = new CustomEvent('reloadafterhide', {
detail: {
eventParams
},
});
// Fire the custom event

this.dispatchEvent(flowLaunchEvent);
})
.catch((error) => {
window.console.log('error:' + error);
Expand All @@ -83,6 +96,15 @@ export default class ServiceRecommendation extends LightningElement {
hideContacts({ serviceId: this.serviceid, contactId: null })
.then(() => {
window.console.log('success');
let eventParams = 'reloadAfterHide';
const flowLaunchEvent = new CustomEvent('reloadafterhide', {
detail: {
eventParams
},
});
// Fire the custom event

this.dispatchEvent(flowLaunchEvent);
})
.catch((error) => {
window.console.log('error:' + error);
Expand All @@ -93,6 +115,15 @@ export default class ServiceRecommendation extends LightningElement {
unhideContacts({ serviceId: this.serviceid, contactId: this.contactid })
.then(() => {
window.console.log('success');
let eventParams = 'reloadAfterHide';
const flowLaunchEvent = new CustomEvent('reloadafterhide', {
detail: {
eventParams
},
});
// Fire the custom event

this.dispatchEvent(flowLaunchEvent);
})
.catch((error) => {
window.console.log('error:' + error);
Expand All @@ -103,15 +134,37 @@ export default class ServiceRecommendation extends LightningElement {
unhideContacts({ serviceId: this.serviceid, contactId: null })
.then(() => {
window.console.log('success');
let eventParams = 'reloadAfterHide';
const flowLaunchEvent = new CustomEvent('reloadafterhide', {
detail: {
eventParams
},
});
// Fire the custom event

this.dispatchEvent(flowLaunchEvent);
})
.catch((error) => {
window.console.log('error:' + error);
});
}

handleAccountRedirect() {
let url = '/' + this.servicerecommendation.AccountId;
window.open(url);
this[NavigationMixin.Navigate] ({
type: 'standard__recordPage',
attributes: {
recordId: this.servicerecommendation.AccountId,
objectApiName: 'Account',
actionName: 'view'
}
});
}

handleOpenMenu(event){
window.console.log('opening');
window.console.log(event.currentTarget);
let parent = event.currentTarget.parentElement;
parent.classList.toggle('slds-is-open');
}

handleShowAddComment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

</ul>
<ul class="slds-float_right slds-list_horizontal">
<li class="slds-p-right_x-small slds-p-top_xx-small">
<lightning-button-group>
<lightning-button-icon variant="border-filled" icon-name="utility:refresh" alternative-text="Refresh" onclick={handleRequestRecommendations}></lightning-button-icon>
</li>
<li class="slds-p-right_medium slds-p-top_xx-small">
<lightning-button-icon variant="border-filled" icon-name="utility:checkin" alternative-text="Refresh" onclick={handleExpand}></lightning-button-icon>
</li>
<lightning-button-icon variant="border-filled" icon-name="utility:expand_alt" alternative-text="Refresh" onclick={handleExpand}></lightning-button-icon>
</lightning-button-group>
</ul>
</div>
<div if:false={showRecommendations} class="slds-size_1-of-1 slds-grid slds-wrap slds-align_absolute-center">
Expand Down Expand Up @@ -382,12 +380,10 @@ <h3>No Recommendations Yet</h3>

</ul>
<ul class="slds-float_right slds-list_horizontal">
<li class="slds-p-right_x-small slds-p-top_xx-small">
<lightning-button-group>
<lightning-button-icon variant="border-filled" icon-name="utility:refresh" alternative-text="Refresh" onclick={handleRequestRecommendations}></lightning-button-icon>
</li>
<li class="slds-p-right_medium slds-p-top_xx-small">
<lightning-button-icon variant="border-filled" icon-name="utility:checkin" alternative-text="Refresh" onclick={handleExpand}></lightning-button-icon>
</li>
<lightning-button-icon variant="border-filled" icon-name="utility:contract_alt" alternative-text="Refresh" onclick={handleExpand}></lightning-button-icon>
</lightning-button-group>
</ul>
</div>
<div if:false={showRecommendations} class="slds-size_1-of-1 slds-grid slds-wrap slds-align_absolute-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class ServiceRecommendations extends LightningElement {
title: '',
description: ''
};
if(result[i].Hidden === true){
if(result[i].Hidden === true || result[i].HiddenAll === true){
hiddenResult.push(result[i]);
}else{
showResult.push(result[i]);
Expand Down
1 change: 0 additions & 1 deletion force-app/main/default/lwc/starRating/starRating.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
align-items: center;
flex: 0 0 auto;
justify-content: center;
margin-top: 0.5rem;
transition: all 0.3s ease;
flex-wrap: wrap;
}
Expand Down
Loading

0 comments on commit 8a3b87d

Please sign in to comment.