{% include "header" %}
{% include "course_version_outdated_alert", courses: courses.enrolled %}
{% comment %} {% include "sub_navigation" %} {% endcomment %}
<main class="np-main np-courses np-subpage-container np-max-width">
  <div class="np-resource-title">
    {% comment %} {% t shared.course_vocabulary.plural, key: current_school.course_vocabulary %} {% endcomment %}
    Learning Center
  </div>
  <div class="np-resource-subtitle">
    {% comment %} {% t .headline, key: current_school.course_vocabulary %} {% endcomment %}
     Hey {{current_person.first_name}}, welcome to the Dasher learning center. Educate yourself on the best practices used by the highest-rated Dashers.
     {% assign groups = current_person.groups | map: 'name'%}
     {% if groups contains 'NZ Mandatory Training' %}
       {% include 'group_selection' %}
     {% endif %}
  </div>
  {% include "courses_index", class: "col-xs-12 col-sm-6 col-lg-4 np-stretch-content" %}
</main>
{% include "footer" %}

{% if groups contains 'NZ Mandatory Training' %}
  <script>
    $('div[course-vehicle]').hide()
    $(document).ready(function() {
      console.log('{{ current_person.properties.learner_vehicle }}')
      if ($('.group-selection-select')[0].value == 'Car') {
        $('[course-vehicle]').each(function() {
          console.log($(this).attr('course-vehicle')[0])
          if ($(this).attr('course-vehicle')[0] == '1') {
            $(this).show()
            console.log(123)
          }
        })
      }
      else if ($('.group-selection-select')[0].value == 'Bike') {
        $('[course-vehicle]').each(function() {
          if ($(this).attr('course-vehicle')[1] == '1') {
            $(this).show()
            console.log(321)
          }
        })
      }
      else if ($('.group-selection-select')[0].value == 'Scooter/Motorbike') {
        $('[course-vehicle]').each(function() {
          if ($(this).attr('course-vehicle')[2] == '1') {
            $(this).show()
            console.log(321)
          }
        })
      }
    });
  </script>
{% endif %}