<!-- Bevat het filter form waarmee je kan kiezen welke informatie je wilt zien -->
<?php

    $lab = $db->prepare("SELECT label, label_id FROM Labels");
    $lab->execute();
    $labels = $lab->fetchAll(PDO::FETCH_ASSOC);

    $priv = $db->prepare("SELECT privilege_id, privilege FROM User_Privileges");
    $priv->execute();
    $privileges = $priv->fetchAll(PDO::FETCH_ASSOC);

    echo '
        <div id="filters">
            <div class="filter_vak"><span>User name</span><input name="filter_user_name" id="filter_user_name" type="text"/></div>
            <div class="filter_vak"><span>E-mail</span><input name="filter_email" id="filter_email" type="text"/></div>

            <span class="dropdown-doelgroep">
                <div class="filter_vak labels_filter">Label V';

                echo '<div class="doelgroepen_filter">';

                    // Loopt door alle labels in de database en laat ze in een dropdown menu zien.
                    foreach ($labels as $key => $value) {
                        echo '<div class="doelgroep_edit_filter">
                                    <input class="label_id" type="hidden" name="label_filters[]" value="' . $value['label_id'] . '">' . $value['label'] . '
                                    <input class="label_selected" type="hidden" name="label_filters_selected[]" value="">
                              </div>';
                    }

                    echo '</div>

                </div>
            </span>

            <div class="filter_vak"><span>Privilege</span>
            <label>
                <select id="filter_status" name="filter_privilege">
                    <option></option>';

                    foreach ($privileges as $key => $value) {
                        echo '<option value="' . $value['privilege_id'] . '">' . $value['privilege'] . '</option>';
                    }
                echo '</select>
                </label>
            </div>
            <input button onclick="formSubmit(this)" type="submit" name="submit" id="submit_filters" value="filter"/>
        </div>
        <div id="filters_opties"><span>+</span></div>';

?>
