  <div class="profile-match-plugin">
    
<div class="profile-matching-view function_profile_matching">
  <div class="matching-one">
    <div class="row">
      <div class="col-md-12 mx-auto">

        <div class="pm-shell">
          <div class="pm-hero">
            <div>
              <span class="pm-kicker">Role Matching</span>
              <p class="pm-subtitle">Zoek, filter en vergelijk rol-functies in een overzicht dat snel scanbaar blijft.</p>
            </div>
          </div>

        <div class="pm-table-card">
        <table id="functions_profile" class="table-responsive" style="width:100%" aria-colspan="5" aria-rowspan="5">
            <tfoot style="display: table-header-group;">
            <tr class="pm-filter-row">
              <th rowspan="1" colspan="1"><input id="search_profile" class="pm-control" type="text" placeholder="Search Title"
                  value=""></th>
              <th rowspan="1" colspan="1">
                <select id="workcompline_filter" class="pm-control">
                  <option value="">All career lines</option>
                </select>
              </th>
              <th rowspan="1" colspan="1" id="level_filter_cell">
                <select id="level_filter" class="pm-control">
                  <option value="">All levels</option>
                </select>
              </th>
            <th class="pm-actions-cell">
                <div class="pm-actions">
                <input type="hidden" value="https://2unboss.helloworklife.com/en/profile-matching/?match=1&#038;profileid="
                  id="hidden_match_url">
                <a href="javascript:void(0);" class="common_color_btn pm-action-btn trigger_custom_match">Match</a>

                <input type="hidden"
                  value="https://2unboss.helloworklife.com/en/profile-matching/?skill_match=1&#038;profileid="
                  id="hidden_match_url_skillmatch">&nbsp;
                <a href="javascript:void(0);" class="common_color_btn pm-action-btn trigger_custom_skill_match">Skill Overview</a>

                <input type="hidden" value="https://2unboss.helloworklife.com/en/profile-matching/?report=1&#038;profileid="
                  id="hidden_match_url_report">&nbsp;
                <a href="javascript:void(0);" class="common_color_btn pm-action-btn trigger_custom_report">Report</a>

                <button id="select_all_profiles" class="pm-action-btn pm-action-btn-secondary">Select All</button>
                </div>
              </th>
            </tr>
          </tfoot>
          <thead>
            <tr>
              <th style="width:26%">Title</th>
              <th style="width:22%">Career line</th>
              <th style="width:22%">Experience level</th>
              <th style="width:30%"></th>
            </tr>
          </thead>
        
          <tbody id="pm-profile-tbody">
            
              <tr>
                <td colspan="4" class="text-center">Geen profiel gevonden</td>
              </tr>

                      </tbody>
        </table>

        </div>
        </div>

      </div>
    </div>
  </div>
</div>

<script>
  jQuery(function ($) {
    if (!$.fn.DataTable || !$('#functions_profile').length) {
      return;
    }

    var table = $('#functions_profile').DataTable({
      language: {
        info: "Bekijk _START_ van _END_ van de _TOTAL_ profiels",
        infoEmpty: "Bekijk 0 van 0 van de 0 profiels",
        paginate: {
          previous: "Vorige",
          next: "Volgende"
        }
      },
      bLengthChange: false,
      bFilter: true,
      dom: 'rtp',
      paging: true,
      info: false,
      fixedColumns: true,
      order: [],
      columnDefs: [
        { width: "26%", targets: 0 },
        { width: "22%", targets: 1 },
        { width: "22%", targets: 2 },
        { width: "30%", targets: 3 }
      ],
      aoColumnDefs: [{
        bSortable: false,
        aTargets: [-1]
      }]
    });

    $('#search_profile').on('keyup change clear', function () {
      table.column(0).search(this.value).draw();
    });

    function normalizeFilterText(cellHtml, columnIndex) {
      var $temp = $('<div>').html(cellHtml);
      if (columnIndex === 1) {
        return $temp.find('.pm-pill').first().text().trim() || $temp.text().trim();
      }
      if (columnIndex === 2) {
        return $temp.find('.pm-level').first().text().trim() || $temp.text().trim();
      }
      return $temp.text().trim();
    }

    function buildSelectOptions(selector, columnIndex) {
      var $select = $(selector);
      var optionMap = {};

      table.column(columnIndex).data().each(function (d) {
        var text = normalizeFilterText(d, columnIndex);
        if (text !== '') {
          optionMap[text] = true;
        }
      });

      Object.keys(optionMap).sort().forEach(function (text) {
        var safeText = $('<div>').text(text).html();
        $select.append('<option value="' + safeText + '">' + safeText + '</option>');
      });

      $select.on('change', function () {
        var selected = $(this).val();
        table.column(columnIndex).search(selected || '').draw();
      });
    }

    buildSelectOptions('#workcompline_filter', 1);
    buildSelectOptions('#level_filter', 2);

    $(document).on('click', '.trigger_custom_match', function (e) {
      e.preventDefault();
      var selected = [];
      $("input:checkbox[name=profile_match]:checked").each(function () {
        selected.push($(this).val());
      });

      if (!selected.length) {
        alert('Choose at least one profile');
        return false;
      }

      window.location.href = $("#hidden_match_url").val() + selected.join(',');
    });

    $(document).on('click', '.trigger_custom_skill_match', function (e) {
      e.preventDefault();
      var selected = [];
      $("input:checkbox[name=profile_match]:checked").each(function () {
        selected.push($(this).val());
      });

      if (!selected.length) {
        alert('Choose at least one profile');
        return false;
      }

      window.location.href = $("#hidden_match_url_skillmatch").val() + selected.join(',');
    });

    $(document).on('click', '#select_all_profiles', function (e) {
      e.preventDefault();
      $("input:checkbox[name=profile_match]").prop('checked', true);
    });

    $(document).on('click', '.trigger_custom_report', function (e) {
      e.preventDefault();
      var selected = [];
      $("input:checkbox[name=profile_match]:checked").each(function () {
        selected.push($(this).val());
      });

      if (!selected.length) {
        alert('Choose at least one profile');
        return false;
      }

      window.location.href = $("#hidden_match_url_report").val() + selected.join(',');
    });

  });
</script>
  <div class="profile-match-plugin">
    {"id":27514,"date":"2021-08-17T08:33:45","date_gmt":"2021-08-17T06:33:45","guid":{"rendered":"https:\/\/development.2unbossintranet.nl\/?page_id=27514"},"modified":"2021-08-17T08:33:45","modified_gmt":"2021-08-17T06:33:45","slug":"function-house","status":"publish","type":"page","link":"https:\/\/2unboss.helloworklife.com\/en\/function-house\/","title":{"rendered":"Function House"},"content":{"rendered":"<div>\n<div><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":53,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"pmpro_default_level":"","footnotes":""},"class_list":["post-27514","page","type-page","status-publish","hentry","pmpro-has-access"],"acf":[],"_links":{"self":[{"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/pages\/27514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/comments?post=27514"}],"version-history":[{"count":0,"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/pages\/27514\/revisions"}],"wp:attachment":[{"href":"https:\/\/2unboss.helloworklife.com\/en\/wp-json\/wp\/v2\/media?parent=27514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}