?>
				<script>
					var timePopup = setTimeout(function(){
						window.parent.boss.removeClass('modal_dialog', 'active');
					}, 100);
					window.parent.boss.popup("Esse(s) membro(s) já estão participando desta equipe.");
				</script>
				<?php 
                die;
            }
            foreach ($pk_members as $index => $pk_member) {
                $fields = array('id_team' => $pk, 'id_member' => $pk_member);
                $query = array('id_team' => $pk, 'id_member' => $pk_member, 'status' => 1);
                $count = $model->count($query);
                if ($count == 0) {
                    $model = new TeamMemberSet($fields);
                    $team_member_set = $model->save();
                } else {
                    ?>
					<script>
						var timePopup = setTimeout(function(){
							window.parent.boss.removeClass('modal_dialog', 'active');
						}, 100);
						window.parent.boss.popup("Esse(s) membro(s) já estão participando desta equipe.");
					</script>
					<?php 
                    die;
                }
                if ($team_member_set) {
                    $model = new Team();
                    $sql = array('id_team' => $pk, 'id_admin' => $logado['id_member'], 'status' => 1);
require_once 'init.php';
use Agil\View\View;
use Agil\Session\Session;
$logado = Session::get('logado');
$request = View::route($_GET);
$pk = $request['pk'];
$sql = array("id_team" => $pk, "status" => 1);
$fields = array("id_team", "id_admin", "name", "website", "slug");
$model = new Team();
$model->fields = $fields;
$teams = $model->get($sql);
$team = $teams[0];
$sql = array("id_team" => $team['id_team'], "status" => 1);
$fields = array('id_member');
$model = new TeamMemberSet();
$model->fields = $fields;
$rsTeamMembers = $model->get($sql);
?>
<div class="modal-content">
	<div class="modal-header">
		<button class="close" onclick="boss.removeClass('modal_dialog', 'active')">x</button>
		<h3 class="modal-title font-open-sans"><?php 
echo $team['name'];
?>
</h3>
	</div>
	<div class="modal-body">
		<div class="container">
			<label>Membros</label>
			<ul id="select_member" class="list-group">