Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkSurveyOfContacts() {
  2.     if (thisObj.interactionData.category === 'umbrella') {
  3.         if (isClientContactSurveyEditable()) {
  4.             resolveSurveyEditableCase();
  5.             thisObj.isSendSurveyLastStateEnabled = true;
  6.         } else {
  7.             setSurveyToNotEditableCase();
  8.             thisObj.isSendSurveyLastStateEnabled = false
  9.         }
  10.     }
  11. }
  12.  
  13. function isClientContactSurveyEditable() {
  14.     if (isOutcomeEqualToSpecificStatus(OUTCOME_COMPLETED)) {
  15.         if (isInteractionTypeEqualToSpecificType(TYPE_ANALYST_CONSULTATION)) {
  16.             if (isProduct_EVP_MVP_GITA_IRS_IEP()) {
  17.                 return true;
  18.             }
  19.          } else if (isInteractionTypeEqualToSpecificType(TYPE_BENCHMARK)
  20.                     && isInteractionPurposeEqualToSpecificPurpose(PURPOSE_DEAL_REVIEW)
  21.                     && isProductSAS()) {
  22.             return true;
  23.          }
  24.     }
  25.     return false;
  26. }
  27.  
  28. function resolveSurveyEditableCase() {
  29.     if(thisObj.isSendSurveyLastStateEnabled){
  30.         return;
  31.     }
  32.  
  33.     angular.forEach(thisObj.interactionData.clientContacts, function (item, i) {
  34.         if (item.email && item.email.length > 0) {
  35.             item.survey = true;
  36.             item.disabledSurvey = false;
  37.         } else {
  38.             thisObj.contactEmailChanged(item);
  39.         }
  40.     });
  41.     thisObj.interactionData.doNotSendSurvey = false;
  42. }
  43.  
  44. function setSurveyToNotEditableCase() {
  45.     angular.forEach(thisObj.interactionData.clientContacts, function (item, i) {
  46.         item.survey = false;
  47.         item.disabledSurvey = true;
  48.     });
  49.     thisObj.interactionData.doNotSendSurvey = true;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement