Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.16 KB | None | 0 0
  1. <aura:component controller="serverSideController" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId">
  2. <!-- use notifications to display error msg on top of modal -->
  3. <lightning:notificationsLibrary aura:id="notifLib"/>
  4.  
  5. <aura:attribute name="newLead" type="Lead" default="{sobjectType: 'Lead', Company: 'Salesforce'}"/>
  6. <aura:attribute name="recordId" type="String"/>
  7.  
  8. <!-- attributes we use with our custom validations -->
  9. <aura:attribute name="hasEmailErrors" type="Boolean" default="true" />
  10. <aura:attribute name="hasPhoneErrors" type="Boolean" default="true" />
  11. <aura:attribute name="hasPicklistErrors" type="Boolean" default="true" />
  12.  
  13. <!-- name and address are both compound fields in Lightning storing multiple inputs -->
  14. <aura:attribute name="nameFields" type="List" default="['Salutation','firstName', 'lastName']"/>
  15. <aura:attribute name="addressFields" type="List" default="['Street','City','State','postalCode','Country']"/>
  16. <aura:attribute name="postalCode" type="String" />
  17. <!-- variable we use for the fetchPicklistValues in the helper -->
  18. <aura:attribute name="objectName" type="Lead" default="{sobjectType: 'Lead'}"/>
  19.  
  20. <!-- an example of manually defining select options for a picklist -->
  21. <aura:attribute name="salutationOptions" type="List" default="[{'label': 'Mr.', 'value': 'Mr.'},
  22. {'label': 'Ms.', 'value': 'Ms.'},
  23. {'label': 'Mrs.', 'value': 'Mrs.'},
  24. {'label': 'Dr.', 'value': 'Dr.'},
  25. {'label': 'Prof.', 'value': 'Prof.'}]"/>
  26. <!-- for this picklist example we will fetch values from the server -->
  27. <aura:attribute name="industryPicklistSelection" type="String"/>
  28. <aura:attribute name="date" type="Date"/>
  29. <aura:handler name="init" value="{!this}" action="{!c.onInit}"/>
  30.  
  31. <div style="height: 640px;">
  32. <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
  33. <div class="slds-modal__container" style="height: 540px; width: 440px">
  34. <header class="slds-modal__header">
  35. <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
  36. <span class="slds-assistive-text">Close</span>
  37. </button>
  38. <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">New Lead</h2>
  39. </header>
  40. <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
  41. <!-- add modal content here -->
  42. <form>
  43. <div class="slds-form slds-form_stacked"> <!-- start address field markup -->
  44. <div class="slds-form-element slds-p-top_medium">
  45. <div class="slds-form-element__control">
  46. <lightning:inputName
  47. label="First Name and Salutation"
  48. name="name"
  49. aura:id="formInput"
  50. required="true"
  51. fieldsToDisplay="{!v.nameFields}"
  52. options="{!v.salutationOptions}"
  53. salutation="{!v.newLead.Salutation}"
  54. firstName="{!v.newLead.FirstName}"
  55. lastName="{!v.newLead.LastName}" />
  56. </div>
  57. </div>
  58. </div> <!-- close address field markup -->
  59. <div class="slds-form-element"> <!-- start date component markup -->
  60. <div class="slds-form-element__control">
  61. <lightning:input
  62. type="date"
  63. name="date"
  64. aura:id="formInput"
  65. label="Date of Birth"
  66. required="true"
  67. value="{!v.newLead.Date_Of_Birth__c}" />
  68. </div>
  69. </div> <!-- end date component markup -->
  70. <div class="slds-form-element"> <!-- start the address markup -->
  71. <div class="slds-form-element__control">
  72. <div>
  73. <lightning:inputAddress
  74. aura:id="formInput"
  75. addressLabel="Address"
  76. streetLabel="Street"
  77. cityLabel="City"
  78. countryLabel="Country"
  79. provinceLabel="State"
  80. postalCodeLabel="Postal Code"
  81. street="{!v.newLead.Street}"
  82. city="{!v.newLead.City}"
  83. province="{!v.newLead.State}"
  84. postalCode ="{!v.postalCode}"
  85. country="{!v.newLead.Country}"
  86. required="true" />
  87. </div>
  88. </div>
  89. </div> <!-- end the address markup -->
  90. <div class="slds-form-element"> <!-- start work phone markup -->
  91. <div class="slds-form-element__control slds-p-around_xx-small">
  92. <ui:inputPhone
  93. aura:id="phoneId"
  94. label="Work Phone"
  95. change='{!c.validatePhoneNumber}'/>
  96. </div>
  97. </div> <!-- end work phone markup -->
  98. <div class="slds-form-element"> <!-- start mobile phone markup -->
  99. <div class="slds-form-element__control slds-p-around_xx-small">
  100. <ui:inputPhone
  101. aura:id="mobilePhoneId"
  102. label="Mobile Phone"
  103. change='{!c.validatePhoneNumber}'/>
  104. </div>
  105. </div><!-- end mobile phone markup -->
  106. <div class="slds-form-element"> <!-- start email markup -->
  107. <div class="slds-form-element__control">
  108. <ui:inputText aura:id="emailId" label="Email" value="{!v.newLead.Email}" change="{!c.validateEmail}" class="slds-input"/>
  109. </div>
  110. </div><!-- end email markup -->
  111. <div class="slds-form slds-form_stacked"> <!-- start company field markup -->
  112. <div class="slds-form-element slds-p-top_medium">
  113. <div class="slds-form-element__control">
  114. <lightning:input
  115. label="Company"
  116. name="company"
  117. aura:id="formInput"
  118. value="{!v.newLead.Company}"/>
  119. </div>
  120. </div>
  121. </div> <!-- close company field markup -->
  122. <!-- start industry picklist markup -->
  123. <div class="slds-form-element">
  124. <div class="slds-form-element__control">
  125. <ui:inputSelect label="Industry" aura:id="industryAuraID" class="slds-select"
  126. change="{!c.onSelectIndustry}" required="true"/>
  127. </div>
  128. </div> <!-- end industry picklist markup -->
  129. </form>
  130. <!-- end main modal content -->
  131. </div>
  132. <footer class="slds-modal__footer">
  133. <button class="slds-button slds-button_neutral" onclick="{!c.onCancel}">Cancel</button>
  134. <button class="slds-button slds-button_brand" onclick="{!c.onSave}">Save</button>
  135. </footer>
  136. </div>
  137. </section>
  138. <div class="slds-backdrop slds-backdrop_open"></div>
  139. </div>
  140. </aura:component>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement