<!--begin::Profile Personal Information-->
<style>
	table th{
		text-align: center;
		vertical-align: middle !important;
	}
</style>
<div class="d-flex flex-row">
	<!--begin::Aside-->
	<div class="flex-row-auto offcanvas-mobile w-250px w-xxl-350px" id="kt_profile_aside">
		<!--begin::Profile Card-->
		<div class="card card-custom card-stretch">
			<!--begin::Header-->
			<div class="card-header py-3">
				<div class="card-title align-items-start flex-column">
					<h3 class="card-label font-weight-bolder text-dark">Users</h3>
					<span class="text-muted font-weight-bold font-size-sm mt-1">Select user to set roles</span>
				</div>
			</div>
			<!--end::Header-->
			<!--begin::Body-->
			<div class="card-body pt-4">
				<!--begin::Nav-->
				<div class="navi navi-bold navi-hover navi-active navi-link-rounded">
				<?php if($user_list){ 
					$i=0; foreach($user_list as $user){ $i++;
					$active_user_id = $user_dtl['user_id'] ?? '';
					$active = $user['user_id']==$active_user_id ? "active" : "";
				?>
					<div class="navi-item mb-2">
						<a href="<?=get_admin_path('authorize/user').'/'.$user['user_id']?>" class="navi-link py-4 <?=$active?>">							
							<span class="navi-text font-size-lg"><?=$i.'. '.$user['name']?></span>
						</a>
					</div>					
				<?php } } ?>
				</div>
				<!--end::Nav-->
			</div>
			<!--end::Body-->
		</div>
		<!--end::Profile Card-->
	</div>
	<!--end::Aside-->
	<!--begin::Content-->
	<div class="flex-row-fluid ml-lg-8">
		<!--begin::Card-->
		<div class="card card-custom card-stretch">			
			<!--begin::Header-->
			<div class="card-header py-3">
				<div class="card-title align-items-start flex-column">
					<h3 class="card-label font-weight-bolder text-dark">User Roles: <?=$user_dtl['name'] ?? ""?></h3>
					<span class="text-muted font-weight-bold font-size-sm mt-1">Set Roles</span>
				</div>
				<div class="card-toolbar">
					<button type="button" onclick="saveChanges();" class="btn btn-success mr-2">Save Changes</button>
				</div>
			</div>
			<!--begin::Form-->
			<?=form_open('',["class"=>"form","id"=>"user_role_form"])?>
				<!--end::Header-->			
				<!--begin::Body-->
				<div class="card-body">
					<div class="row">
						<table class="table table-bordered">
							<thead>
								<tr>
									<th scope="col" rowspan="2">#</th>
									<th scope="col" rowspan="2">Role</th>
									<th scope="col" colspan="3">Action</th>								
								</tr>
								<tr>
									<th scope="col" style="width:170px;">
										List<br>
										<div style="font-weight:normal">
											<a href="javascript:;" onclick="selectAll('list');">Select All</a> / 
											<a href="javascript:;" onclick="deselectAll('list');">Deselect All</a> 
										</div>
									</th>
									<th scope="col" style="width:170px;">Add<br>
										<div style="font-weight:normal">
											<a href="javascript:;" onclick="selectAll('add');">Select All</a> / 
											<a href="javascript:;" onclick="deselectAll('add');">Deselect All</a> 
										</div>
									</th>
									<th scope="col" style="width:170px;">Edit<br>
										<div style="font-weight:normal">
											<a href="javascript:;" onclick="selectAll('edit');">Select All</a> / 
											<a href="javascript:;" onclick="deselectAll('edit');">Deselect All</a> 
										</div>
									</th>
								</tr>
							</thead>
							<tbody>
						<?php if($role_list){ ?>
						<?=$roles_table_rows?>
						<?php }else{ ?>
							<tr>
								<td class="text-center" colspan="5">No Roles!</td>
							</tr>
						<?php } ?>
							</tbody>
						</table>
					</div>					
				</div>
				<!--end::Body-->
				<div class="card-footer">
					<div class="row">
						<div class="col-lg-12 text-center">
							<button type="button" onclick="saveChanges();" class="btn btn-success mr-2">Save Changes</button>
						</div>
					</div>
				</div>
			</form>
			<!--end::Form-->
		</div>
	</div>
	<!--end::Content-->
</div>
<!--end::Profile Personal Information-->