Advertisement
DataCCIW

Update Grades and Ages in Family Info Card

Sep 8th, 2020 (edited)
1,563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Update Grades and Ages in Family Info Card, this relies on additional info provided by cust_CCIW_get_family_data sproc
  2. var currentGUID = "";
  3. var currentRel;
  4. var currentAge, currentGrade;
  5.  
  6. // Find all spans that contain the family info
  7. $("span[id$='FamilyInfo'] a").each(function(index) {
  8.  
  9.     // Grab the Guid
  10.     //console.log(index + ": " + $(this).attr('rel').split(',')[1]);
  11.     currentGUID = $(this).attr('rel').split(',')[1]
  12.  
  13.     //Fetch the age for the specified GUID from the cust_CCIW_get_family_data results
  14.     //console.log('ID Selector:' + "#GUID"+currentGUID)
  15.     //console.log('Current Hidden Input Based on Guid Selector:' + $("#GUID"+currentGUID))
  16.  
  17.     //console.log('Age Value:' + $("#GUID"+currentGUID).attr("age_value"))
  18.     currentAge = $("#GUID" + currentGUID).attr("age_value")
  19.     currentGrade = $("#GUID" + currentGUID).attr("grade")
  20.  
  21.     //currentRel = $("#GUID"+currentGUID);
  22.  
  23.     // Find the label that contains the household position, 3 parents up, next element, first child
  24.     //console.log($(this).parent().parent().parent().next().children()[1].innerText)
  25.  
  26.     $(this).html($(this).html() + ' (' + currentAge + ')<br>');
  27.     if (currentGrade != 13) {
  28.         $(this).html($(this).html() + '<i class="fa nophoto mr-q fa-lg"></i>Grade: ' + currentGrade);
  29.     }
  30. });
  31. //update the family member row for the profile you are currently visiting. The html structure slight differs.
  32. var currentPerson = $("span[id$='FamilyInfo'] > span > span")
  33. currentGUID = currentPerson.attr('rel').split(',')[1]
  34. currentAge = $("#GUID" + currentGUID).attr("age_value")
  35. currentGrade = $("#GUID" + currentGUID).attr("grade")
  36. currentPerson.html(currentPerson.html() + ' (' + currentAge + ')<br>');
  37.  
  38. if (currentGrade != 13) {
  39.     currentPerson.html(currentPerson.html() + '<i class="fa nophoto mr-q fa-lg"></i>Grade: ' + currentGrade);
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement