<div class="my-course-banner"></div>

<div class="uk-container uk-container-center">
  <div class="uk-padding-horizontal">
    <div class="my-course-banner-content">
      <h3 class="custom-title"><img src="https://doubleverify.com/wp-content/uploads/2022/06/DV_University_Logo.png" width="130" alt="Double Verify University"></h3>
      <p>DoubleVerify's purpose is to power media quality and performance for the world's largest brands and agencies. Global advertisers leverage DV's solutions to drive campaign efficiency, protect brand reputation and maximize return on their digital investment. The DVU course curriculum is designed to give you the tools you need to fully realize the benefits of DV's Advertiser Suite. Each course will let you take a self-guided tour of our service offerings, and demonstrate ways to leverage DV's actionable insights in order to achieve your digital campaign objectives.<br></p>
      <div> <p style="font-weight: 500;">Let’s build a better industry<sup style="font-size: 60%">&reg;</sup>.</p></div>
    </div>
  </div>
</div>

<div class="uk-container uk-container-center school-website-course-index-list  uk-margin-bottom current-person" data-person-id="{{current_person.id}}" data-person-name="{{current_person.name}}" data-person-email="{{current_person.email}}">
  <div class="uk-padding-horizontal">
    {% if current_school.apps.instructor_led_training.active? %} 
      {% if current_person.upcoming_registered_events.any? %}
        {% include "events" %}
      {% else %}
        {% include "events_empty" %}
      {% endif %}
    {% endif %}

    {% if my_content.learning_paths? %}
      {% include "my_paths" %}
    {% endif %}

    
    <div class="uk-grid uk-grid-flex uk-margin-left-remove">
      {% include "filters" with "" %}
      {% if current_school.filtering_enabled? and current_person.filterable_categories.count > 0 %}
        <div class="uk-width-medium-5-6 uk-padding">
      {% else %}
        <div class="uk-width-1-1 uk-padding">
      {% endif %}
        <ul class="uk-grid uk-grid-medium school-website-course-list uk-grid-match" data-uk-grid-match="{target:'.uk-panel'}">
          {% for course in my_content.courses %}
            {% if course.properties.language == current_person.properties.language %}
              {% include "course" %}
            {% endif %}
          {% endfor %}
        </ul>
      </div>
    </div>
  </div>
</div>

<script>
  var learner_id = $('.current-person').attr('data-person-id');
  var learner_name = encodeURI($('.current-person').attr('data-person-name'));
  var learner_email = encodeURIComponent($('.current-person').attr('data-person-email'));
  var current_language = $('.all-course_list').attr('data-current-language');

  console.log(current_language);

  $.ajax({
    url: "https://xenopsigrowthpartners.com/dv_api.php?callback=?&id="+learner_id+"&name="+learner_name+"&email="+learner_email,
    type: "GET",
    dataType: 'jsonp',
    processData: false,
    contentType: false,
    headers: {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
        "Access-Control-Allow-Headers": "origin, content-type, accept"
    },
    success: function(data) {
      console.log(data);
      var course_list = document.querySelectorAll('.single-course');
      course_list.forEach(function (e,i){
        var course_id = e.getAttribute('data-id');
        var course_progress = e.getAttribute('data-progress');
        var completed_badge = e.querySelectorAll('.completed-badge')[0];
        var completed_icon = e.querySelectorAll('.completed-icon')[0];
        if(jQuery.inArray(course_id, data) !== -1){
          if(completed_badge.classList.contains('completed-active') != true){
            completed_badge.classList.add('completed-active');
          }
          if(completed_icon.classList.contains('completed-active') != true){
            completed_icon.classList.add('completed-active');
          }
        }
      });


      //Programmatic solution single course
      var programmatic_course_ids = {
        'English' : '1ab6a178-6b95-486a-900c-9374c0773ae0',
        'Spanish' : '10c0d8ab-33cd-4120-aa84-88de0fa1097c',
        'Russian' : '8494a936-da9c-4c23-8ce4-dcb58dafbb52',
        'Japanese' : '84ce2d71-8a15-49de-b21d-7475a1ef0fd6',
        'German' : '538efded-8875-4e34-9592-a1e09e45bda7',
        'French' : 'd9c2de41-aa4f-4534-909b-2b0cbe4ceb15'
      };
      var programmatic_course_id = programmatic_course_ids[current_language];
      if(jQuery.inArray(programmatic_course_id, data) !== -1){
        var single_batch_ID = 263429;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+single_batch_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }

      //Tag Generator single course
      var tag_generator_course_ids = {
        'English' : 'f46d2369-dfcb-4108-8225-336c4759f877',
        'Spanish' : '22467135-ecc7-498f-b303-720487363bec',
        'Russian' : '512cd9c7-c884-422a-90ce-c499caaaf7bf',
        'Japanese' : '98f2eb27-bc93-4e86-be8d-a50b85cff70f',
        'German' : '85d8768b-a04b-452a-a553-a7627748bc7e',
        'French' : 'f351cdf6-932f-4ed0-93ca-08b350f86f18'
      };
      var tag_generator_course_id = tag_generator_course_ids[current_language];
      if(jQuery.inArray(tag_generator_course_id, data) !== -1){
        var single_batch_ID = 362664;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+single_batch_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }

      //Social Solutions single course
      var social_solution_course_ids = {
        'English' : 'd97ef57a-b004-4459-88f5-9ae5ebdf2c2d',
        'Spanish' : '8619c119-278b-4b9b-ab20-0de63daa91d8',
        'Russian' : 'd2f3225b-fc69-4958-a74e-158137b65146',
        'Japanese' : '9c01dbd9-e5c5-4f76-97eb-7a09382d9035',
        'German' : '312f7a71-81db-41e2-b8cb-89c7ef85a45e',
        'French' : 'dc8fc6e8-a8b9-4f63-92f4-0353782de173'
      };
      var social_solution_course_id = social_solution_course_ids[current_language];
      if(jQuery.inArray(social_solution_course_id, data) !== -1){
        var single_batch_ID = 292471;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+single_batch_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }

      //Authentic Attention single course
      var authentic_attention_course_ids = {
        'English' : '409a0308-924b-4d88-bdd8-aac3c226ffdf',
        'Spanish' : 'd8d32873-be1c-47a7-bf14-9f94f8705163',
        'Russian' : '409a0308-924b-4d88-bdd8-aac3c226ffdf',
        'Japanese' : '409a0308-924b-4d88-bdd8-aac3c226ffdf',
        'German' : '409a0308-924b-4d88-bdd8-aac3c226ffdf',
        'French' : '409a0308-924b-4d88-bdd8-aac3c226ffdf',
      };
      var authentic_attention_course_id = authentic_attention_course_ids[current_language];
      if(jQuery.inArray(authentic_attention_course_id, data) !== -1){
        var single_batch_ID = 381870;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+single_batch_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }

      //Pinnacle Publishers course
      var pinnacle_publishers_badge_ids = {
        'English' : '738021ce-297b-4397-84e6-a3b5ea68f168',
        'Spanish' : '738021ce-297b-4397-84e6-a3b5ea68f168',
        'Russian' : '738021ce-297b-4397-84e6-a3b5ea68f168',
        'Japanese' : '738021ce-297b-4397-84e6-a3b5ea68f168',
        'German' : '738021ce-297b-4397-84e6-a3b5ea68f168',
        'French' : '738021ce-297b-4397-84e6-a3b5ea68f168',
      };
      var pinnacle_publishers_badge_id = pinnacle_publishers_badge_ids[current_language];
      if(jQuery.inArray(pinnacle_publishers_badge_id, data) !== -1){
        var single_batch_ID = 564645;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+single_batch_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }

      var badge_completed = 0;
      var badge_completed_list = Array();
      var iq_cert_block = document.querySelectorAll('.cert-badge-block');
      iq_cert_block.forEach(function (e,i){
        var iq_cert_img = e.getAttribute('data-cert-img');
        var iq_cert_name = e.getAttribute('data-cert-name');
        var iq_cert_title = e.getAttribute('data-cert-title');
        var iq_cert_ID = e.getAttribute('data-cert-id');
        var iq_badge_logo = e.querySelectorAll('.iq-badge-logo')[0];
        var iq_badge_total = e.querySelectorAll('.iq-badge-total')[0].value;
        var iq_course_list = e.querySelectorAll('.cert-course-list');
        var total_iq_course_list = e.querySelectorAll('li');
        var course_status = e.querySelectorAll('.completed-icon')[0];
        var total_marks = 0; 

        total_iq_course_list.forEach(function (e,i){
          var course_id = e.getAttribute('data-id');
          if(jQuery.inArray(course_id, data) !== -1){
            e.setAttribute('data-progress', 100);
            e.setAttribute('class', 'completed');
          }

          total_marks += parseInt(e.getAttribute('data-progress'));
        });

        if(total_marks > 0){
          course_status.classList.remove('course-locked');
        }

        if(((iq_badge_total * 100) / total_marks) == 1){
          iq_badge_logo.classList.remove('filter-gray');
          course_status.classList.add('completed-active');
          badge_completed += 1;
          badge_completed_list.push(iq_cert_name);

          $.ajax({
            url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+iq_cert_ID+"&name="+learner_name+"&email="+learner_email,
            type: "GET",
            dataType: 'jsonp',
            processData: false,
            contentType: false,
            headers: {
                "Access-Control-Allow-Origin": "*",
                "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
                "Access-Control-Allow-Headers": "origin, content-type, accept"
            },
            success: function(data) {}
          });
        }
      });


      //Pinnacle Certificate Codes
      var li = "";
      li += '<li class="filter-gray"><img src="https://doubleverify.com/wp-content/uploads/2021/03/DV_ELM_Certificate_FINAL.png" alt="DV Pinnacle"><h6>DV Pinnacle</h6></li>';      
      li += '<li class="filter-gray"><img src="https://doubleverify.com/wp-content/uploads/2021/03/DV_ELM_Badges_Analytics.png" class="iq-badge-logo" alt="Quality Analytics Badge"></li>';
      li += '<li class="filter-gray"><img src="https://doubleverify.com/wp-content/uploads/2021/03/DV_ELM_Badges_Blueprint.png" class="iq-badge-logo" alt="Quality Analytics Badge"></li>';

      document.getElementById('certificate-list').innerHTML= li;
      var pinnacle_cert_badges = ["iq_blueprint", "iq_performance"]; //Badges for Pinnacle
      if(pinnacle_cert_badges.every(i => badge_completed_list.includes(i))){
        var certificate_list = certificate_modal.querySelectorAll('.certificate-list')[0].querySelectorAll('li');
        for(var i = 0; i < certificate_list.length; i++ ){
          certificate_modal.querySelectorAll('.certificate-list')[0].getElementsByTagName('li')[i].classList.remove('filter-gray');
        } 
        var all_certificate_list = certificate_modal.querySelectorAll('.all-certificate_list')[0];
        all_certificate_list.querySelectorAll('.completed-icon')[0].classList.remove('course-locked');
        all_certificate_list.querySelectorAll('.completed-icon')[0].classList.add('completed-active');

        var iq_cert_ID = 234077;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+iq_cert_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }

      
      /*//document.getElementById('certificate-list').innerHTML= li;
      if(badge_completed == 2){
        //certificate_modal.getElementsByTagName('li')[0].classList.remove('filter-gray');
        var iq_cert_ID = 234077;
        $.ajax({
          url: "https://xenopsigrowthpartners.com/dv_credential_api.php?callback=?&id="+iq_cert_ID+"&name="+learner_name+"&email="+learner_email,
          type: "GET",
          dataType: 'jsonp',
          processData: false,
          contentType: false,
          headers: {
              "Access-Control-Allow-Origin": "*",
              "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
              "Access-Control-Allow-Headers": "origin, content-type, accept"
          },
          success: function(data) {}
        });
      }
      //document.getElementById('certificate-list').innerHTML= li;
      */
    }
  });
</script>

<style>
.ui-code-hack {
      pointer-events: none;
      filter: grayscale(1);
      opacity: .8;
  }
  .custom-badge {
    font-size: 21px !important;
    font-weight: 700 !important;
  }
</style>
{% assign lang = current_person.properties.language %}
{% case lang %}
  {% when "Spanish" %}
     {% include "spanish_lang" %}
  {% when "Japanese" %}
     {% include "japanese_lang" %}
  {% when "Russian"%}
     {% include "russian_lang" %}
  {% when "German"%}
    {% include "german_lang" %}
  {% when "French"%}
    {% include "french_lang" %}
{% endcase %}