<hr>

<h5>
Assign Reviewer
</h5>

<form
method="POST"
action="/easychair/admin/submission/assign-reviewer"
>

<input
type="hidden"
name="submission_id"
value="<?= $submission['id'] ?>"
>

<select
name="reviewer_ids[]"
multiple
class="form-control"
>

<?php

$db =
    \App\Core\Database::getInstance();

$stmt =
    $db->query("
        SELECT
            id,
            email
        FROM users
        WHERE role_id = 4
        ORDER BY email
    ");

$reviewers =
    $stmt->fetchAll(
        PDO::FETCH_ASSOC
    );

foreach ($reviewers as $r):

?>

<option
value="<?= $r['id'] ?>"
>

<?= htmlspecialchars($r['email']) ?>

</option>

<?php endforeach; ?>

</select>

<br>

<button
class="btn btn-primary"
>

Assign Reviewer

</button>

</form>

<link
href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css"
rel="stylesheet">

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>

<script>

document.addEventListener(
'DOMContentLoaded',
function(){

if(
window.jQuery
&&
$.fn.select2
){

jQuery(
'select[name="reviewer_id"]'
)
.select2({

width:'100%',

placeholder:
'Search reviewer',

allowClear:true

});

}

});

</script>

<style>

.select2-container{
width:100%!important;
}

.select2-selection{
min-height:44px!important;
border-radius:14px!important;
}

</style>

