Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. <apex:page standardController="Contact" extensions="ContactCTRL_XT">
  2. <script src="https://use.fontawesome.com/305c6a828e.js"></script>
  3. <style tyle="text/css">
  4. .hide {display:none;}
  5. .show {display:none;border:1px solid #ccc;background-color:green;color:white;font-weight:bold;border-radius: 6px;margin-top:0px;margin-bottom:0px;padding:6px;}
  6. .verify {display:inline-block;border:1px solid #ccc;border-radius: 6px;margin-top:0px;margin-bottom:0px;padding:10px;margin-left:-120px;}
  7. .verify:hover .show {display:inline-block;}
  8. span.needToVerify {display:inline-block;font-weight:bold;font-size:1.5em;color:red;margin-top:5px}
  9. span.verifiedText {display:inline-block;font-weight:bold;font-size:1.5em;color:green;margin-top:5px}
  10. .isVerified {border:1px solid #ccc;border-radius: 6px;margin-top:0px;margin-bottom:0px;padding:10px;display:inline-block;margin-left:0px;}
  11. </style>
  12.  
  13. <apex:form >
  14. <div style="width:100%;text-align:center">
  15. <apex:outputPanel id="refreshMe">
  16. <apex:outputPanel rendered="{!!isVerified}" id="needToVerify">
  17. <div class="verify">
  18. <apex:commandLink action="{!verifyContact}" rerender="refreshMe">
  19. <div class="show">
  20. Verify
  21. </div>
  22. </apex:commandLink>
  23.  
  24. <span class="fa-stack fa-lg" style="color:red;vertical-align:middle;margin-top:-7px">
  25. <i class="fa fa-circle-thin fa-stack-2x"></i>
  26. <i class="fa fa-exclamation fa-stack-1x"></i>
  27. </span>
  28. <span class="needToVerify">Contact Needs Verification</span>
  29. </div>
  30. </apex:outputPanel>
  31.  
  32. <apex:outputPanel rendered="{!IsVerified}" id="Verified">
  33. <div class="isVerified">
  34. <span class="fa-stack fa-lg" style="color:green;vertical-align:middle;margin-top:-7px">
  35. <i class="fa fa-circle-thin fa-stack-2x"></i>
  36. <i class="fa fa-check fa-stack-1x"></i>
  37. </span>
  38. <span class="verifiedText">Contact Verified</span>
  39. </div>
  40. </apex:outputPanel>
  41.  
  42. <apex:outputPanel rendered="{!(contact.account.Password__c != NULL) && (contact.account.Zuora__Active__c == 'Yes')}">
  43. <c:PasswordRequiredBanner Password="{!contact.account.Password__c}" />
  44. </apex:outputPanel>
  45. </apex:outputPanel>
  46. </div>
  47. </apex:form>
  48. </apex:page>
  49.  
  50. public with sharing class ContactCTRL_XT {
  51. Contact cont {get;set;}
  52.  
  53. public ContactCTRL_XT(ApexPages.StandardController stdController) {
  54. stdController.addFields(new String[]{
  55. 'FirstName',
  56. 'LastName',
  57. 'Contact_Verified__c',
  58. 'Last_Verification_Date__c'
  59. });
  60.  
  61. this.cont = (Contact)stdController.getRecord();
  62. }
  63.  
  64. public Boolean getIsVerified(){
  65. Date contactDate = cont.Last_Verification_Date__c;
  66. Date todaysDate = Date.today();
  67. if(contactDate == null){
  68. return false;
  69. }
  70. else{
  71. Date contactDatePlus14 = cont.Last_Verification_Date__c + 14;
  72.  
  73. if(contactDatePlus14 >= todaysDate){
  74. return true;
  75. }
  76. else{
  77. return false;
  78. }
  79.  
  80. }
  81. }
  82.  
  83. public PageReference verifyContact(){
  84. Contact tempContact = new Contact(Id = cont.Id,
  85. Last_Verification_Date__c = Date.today(),
  86. Contact_Verified__c = true
  87. );
  88.  
  89. update tempContact;
  90.  
  91. return null;
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement