This repository has been archived by the owner on Mar 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 501
/
PropertySummary.cmp
110 lines (105 loc) · 4.43 KB
/
PropertySummary.cmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<aura:component
implements="force:hasRecordId,flexipage:availableForAllPageTypes"
access="global"
>
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<force:recordData
aura:id="service"
recordId="{!v.recordId}"
targetFields="{!v.property}"
fields="['Id',
'Thumbnail__c',
'Address__c',
'City__c',
'State__c',
'Zip__c',
'Price__c',
'Beds__c',
'Baths__c',
'Broker__r.Id',
'Broker__r.Name',
'Broker__r.Title__c',
'Broker__r.Mobile_Phone__c',
'Broker__r.Email__c',
'Broker__r.Picture__c']"
/>
<aura:handler
event="ltng:selectSObject"
action="{!c.recordChangeHandler}"
/>
<lightning:card title="Property Summary" iconName="custom:custom85">
<aura:set attribute="actions">
<lightning:buttonIcon
iconName="utility:edit"
variant="bare"
alternativeText="Edit Record"
onclick="{!c.editRecord}"
/>
</aura:set>
<aura:if isTrue="{!v.recordId==undefined}">
<div aura:id="selectSection" class="select slds-text-color_weak">
Select a property to see details here
</div>
</aura:if>
<aura:if isTrue="{!v.recordId!=undefined}">
<lightning:layout verticalAlign="center">
<lightning:layoutItem padding="horizontal-small">
<aura:if isTrue="{!v.property.Thumbnail__c}">
<!-- to make sure we don't show a broken image before the record is loaded -->
<img
src="{!v.property.Thumbnail__c}"
class="property-pic"
/>
</aura:if>
</lightning:layoutItem>
<lightning:layoutItem>
<div>
<lightning:formattedAddress
street="{!v.property.Address__c}"
city="{!v.property.City__c}"
province="{!v.property.State__c}"
postalCode="{!v.property.Zip__c}"
/>
<p>
Beds: {!v.property.Beds__c} Baths:
{!v.property.Baths__c}
</p>
<p>
<lightning:formattedNumber
value="{!v.property.Price__c}"
style="currency"
currencyCode="USD"
minimumFractionDigits="0"
maximumFractionDigits="0"
/>
</p>
</div>
</lightning:layoutItem>
</lightning:layout>
<lightning:layout verticalAlign="center">
<lightning:layoutItem padding="around-small">
<aura:if isTrue="{!v.property.Broker__r.Picture__c}">
<!-- to make sure we don't show a broken image before the record is loaded -->
<img
src="{!v.property.Broker__r.Picture__c}"
class="broker-pic"
/>
</aura:if>
</lightning:layoutItem>
<lightning:layoutItem>
<div class="broker">
<p>
<a onclick="{!c.navigateToBrokerRecord}"
>{!v.property.Broker__r.Name}</a
>
</p>
<p>{!v.property.Broker__r.Title__c}</p>
<p>{!v.property.Broker__r.Mobile_Phone__c}</p>
<p>{!v.property.Broker__r.Email__c}</p>
</div>
</lightning:layoutItem>
</lightning:layout>
</aura:if>
</lightning:card>
</aura:component>