<!-- Dashboard users start -->

<div id="dashboard-users">
	<div class="row">
		<div class="col s12">

			<!-- Users-->
			<div class="widget-holder hoverable fadeIn" id="dashboard-users-overview">
				<div class="widget-heading">
					<h2 class="widget-heading-thick"><?php echo Lang::get('usersList.title'); ?></h2>
					<a href="<?php echo URL::route('getNewUser'); ?>" class="btn-floating waves-effect waves-light btn-primary new-blog-post" id="add-user-button"><i class="material-icons">add</i></a>

					<div class="row filter-row">
						<div class="col s12">

							<div class="input-field right">
								<i class="material-icons prefix">search</i>
								<input id="icon_prefix" type="text" onkeyup="filterTable()">
								<label for="icon_prefix"><?php echo ucfirst(Lang::get('core.search')); ?></label>
							</div>
						</div>
					</div>
				</div>
				<div class="widget-content">
					<div class="table-wrapper">
						<table class="bordered responsive-table">
							<thead>
							<tr>

								<th class="text-center"><?php echo Lang::get('usersList.header_id'); ?></th>
								<th><?php echo Lang::get('usersList.header_email'); ?></th>
								<th><?php echo Lang::get('usersList.header_name'); ?></th>
								<th><?php echo Lang::get('usersList.header_language'); ?></th>
								<th><?php echo Lang::get('usersList.header_role'); ?></th>
								<th class="text-center"><?php echo Lang::get('usersList.header_edit_user'); ?></th>
							</tr>
							</thead>

							<tbody  id="searchable">

							<?php foreach($users as $user): ?>
								<?php if($user->role_id != 6): ?>
									<tr>
										<td><?php echo $user->id; ?></td>
										<td class="truncate"><?php echo $user->email; ?></td>
										<td><?php echo $user->first_name . ' ' . $user->last_name; ?></td>
										<td>
											<?php if($user->language_local_name == '' || $user->language_local_name == null): ?>
												<?php echo $user->language; ?>

											<?php else: ?>
												<?php echo $user->language . ' (' . $user->language_local_name . ')'; ?>

											<?php endif; ?>
										</td>
										<td><?php echo ucfirst($user->role_name) . ' (' . $user->role_id . ')'; ?></td>


										<td class="action-td">
											<div class="col s12">
												<?php if($user->role_id>$current_role || $user->role_id == 1): ?>
													<a href="<?php echo URL::route('getEditUser', array('id' => $user->id)); ?>"  class="icon-btn icon-btn-edit" title="<?php echo Lang::get('usersList.button_edit_user', array('name' => $user->first_name . ' ' . $user->last_name)); ?>"><i class="material-icons">mode_edit</i></a>
													<a href="<?php echo URL::route('getSignInAs', array('id' => $user->id)); ?>" class="icon-btn icon-btn-list" title="<?php echo Lang::get('usersList.button_login_as', array('name' => $user->first_name . ' ' . $user->last_name)); ?>"><i class="material-icons">input</i></a>
													<a href="<?php echo URL::route('deleteUser', array('id' => $user->id)); ?>" class="icon-btn icon-btn-delete" title="<?php echo Lang::get('city.link_delete_city', array('name' => $user->first_name . ' ' . $user->last_name)); ?>"><i class="material-icons">delete</i></a>
												<?php endif; ?>
											</div>

										</td>
									</tr>
								<?php endif; ?>
							<?php endforeach; ?>


							</tbody>
						</table>
					</div>
				</div>
			</div>
			<!--Users end-->

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

<!-- Dashboard users end -->