Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Created February 21, 2019 18:57
Show Gist options
  • Save choudharymanish8585/8c664281c576683aaf375ea59f500c44 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/8c664281c576683aaf375ea59f500c44 to your computer and use it in GitHub Desktop.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
<aura:attribute type="Id" name="Id" access="public" />
<aura:attribute type="Car__c" name="car" access="public" />
<aura:attribute name="recordError" type="String" access="private" />
<!-- this attribute will hold the value of selected tab -->
<aura:attribute type="Id" name="tabId" access="public" />
<aura:attribute type="boolean" name="showComponent" default="false" />
<aura:handler event="c:CarSelectedApplicationEvent" action="{!c.onCarSelected}" />
<aura:handler event="c:HideCarDetailsApplicationEvent" action="{!c.hideComponent}" />
<aura:handler event="c:CarExpAdded" name="carExpAdded" action="{!c.onCarExpAdded}" />
<!-- here we are using lightning data service
to fetch record data
* recordUpdated="{!c.onRecordUpdated}" is optional
and use it only if you need to fire an even on update
* mode can be either EDIT or VIEW-->
<force:recordData aura:id="service"
recordId="{!v.Id}"
mode="EDIT"
targetFields="{!v.car}"
targetError="{!v.recordError}"
recordUpdated="{!c.onRecordUpdated}"
fields="Id, Name, Mileage__c, Per_Day_Rent__c, Build_Year__c, Contact__r.Name,
Contact__r.Email, Contact__r.HomePhone, Car_Type__r.Name, Picture__c" />
<aura:if isTrue="{!v.showComponent}">
<lightning:layout multipleRows="true">
<lightning:layoutItem size="12"
smallDeviceSize="12"
mediumDeviceSize="12"
largeDeviceSize="12" >
<aura:if isTrue="{! !empty(v.car)}">
<lightning:tabset aura:id="tabs" selectedTabId="{!v.tabId}">
<lightning:tab label="Details" id="cardetailtab">
<c:CarDetail car="{!v.car}" />
</lightning:tab>
<lightning:tab label="Experiences" id="carexpstab">
<c:CarExperiences aura:Id="carExp" car="{!v.car}" />
</lightning:tab>
<lightning:tab label="Add Experience" id="addexptab">
<c:AddCarExperience car="{!v.car}" />
</lightning:tab>
</lightning:tabset>
</aura:if>
</lightning:layoutItem>
</lightning:layout>
</aura:if>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment