<!-- Content Header (Page header) -->
<section class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-6">
				<h1 class="m-0">User</h1>
			</div>

			<div class="col-sm-6">
				<ol class="breadcrumb float-sm-right">
					<li class="breadcrumb-item"><a href="dashboard">Dashboard</a></li>
					<li class="breadcrumb-item active">User</li>
				</ol>
			</div>
		</div>
	</div>
</section>

<!-- Main content -->
<section class="content">
	<div class="container-fluid">
		<div class="row mb-4">
			<div class="col-md-12">
				<?php $this->load->view( 'flash_message' );?>
			</div>

			<div class="col-lg-3 col-md-6">
				<a href="user/save" class="btn btn-block bg-gradient-primary"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;<strong>Add New User</strong></a>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<div class="card">
					<div class="card-header">
						<h3 class="card-title">User List</h3>
					</div>

					<div class="card-body">
						<table id="data-table" class="table table-bordered table-hover">
							<thead>
								<tr>
									<th>Name</th>
									<th>Email</th>
									<th>Company</th>
									<th>Created</th>
									<th>Status</th>
									<th>User Type</th>
									<th class="col-md-2 text-center">Action</th>
								</tr>
							</thead>
							<tbody>
								<?php foreach ( $users as $user ): ?>
									<tr>
										<td><?php echo $user['name']; ?></td>
										<td><?php echo $user['email']; ?></td>
										<td><?php echo $user['c_name']; ?></td>
										<td><?php echo $user['created']; ?></td>
										<td><?php echo $user['status']; ?></td>
										<td><?php echo $user['type']; ?></td>
										<td class="col-md-2 text-center">
											<?php if ( $this->session->user_type != 'User' ): ?>
												<a class="btn-sm btn-success" href="user/privileges/<?php echo $user['id']; ?>"><i class="fa fa-lock"></i> Permission</a>
											<?php endif;?>
											<a class="btn-sm btn-warning" href="user/save/<?php echo $user['id']; ?>"><i class="fa fa-edit"></i> Edit</a>
											<a class="btn-sm btn-danger del" href="user/delete/<?php echo $user['id']; ?>"><i class="fa fa-trash"></i> Delete</a>
										</td>
									</tr>
								<?php endforeach;?>
							</tbody>
							<tfoot>
								<tr>
									<th>Name</th>
									<th>Email</th>
									<th>Company</th>
									<th>Created</th>
									<th>Status</th>
									<th>User Type</th>
									<th class="col-md-2 text-center">Action</th>
								</tr>
							</tfoot>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
