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
/
PropertyCarousel.cmp
54 lines (51 loc) · 1.93 KB
/
PropertyCarousel.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
<aura:component
implements="force:hasRecordId,flexipage:availableForAllPageTypes"
controller="PropertyController"
access="global"
>
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<aura:attribute name="files" type="Object[]" />
<force:recordData
recordId="{!v.recordId}"
targetFields="{!v.property}"
fields="['Id', 'Name', 'Address__c', 'Description__c']"
/>
<aura:handler name="init" value="{!this}" action="{!c.onInit}" />
<aura:handler
event="ltng:selectSObject"
action="{!c.recordChangeHandler}"
/>
<lightning:card title="{!v.property.Name}" iconName="custom:custom38">
<aura:if isTrue="{!v.files.length > 0}">
<lightning:carousel disableAutoRefresh="true">
<aura:iteration items="{!v.files}" var="file" indexVar="index">
<lightning:carouselImage
src="{! '/sfc/servlet.shepherd/version/download/' + file.Id}"
/>
</aura:iteration>
</lightning:carousel>
<aura:set attribute="else">
<div class="card-content">
<lightning:icon
iconName="utility:photo"
size="medium"
class="slds-align_absolute-center"
/>
<p class="slds-text-color_weak">
There are currently no pictures for this property.
</p>
</div>
</aura:set>
</aura:if>
<div class="card-content">
<lightning:fileUpload
label="Add picture"
multiple="true"
accept=".jpg, .png, .gif"
recordId="{!v.recordId}"
onuploadfinished="{!c.onUploadFinished}"
/>
</div>
</lightning:card>
</aura:component>