<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	<h4 class="modal-title"><?php echo $menu->NAME;?></h4>
</div>
<div class="modal-body">
	<!--  -->
	<input type="hidden" name="MENU" value="<?php echo $menu->PKKEY;?>">
	<!--  -->
	
	<table class="table table-bordered">
		<thead>
			<tr>
				<th>User Group</th>
				<th style="width: 1%; white-space: nowrap;">
					<input type="checkbox" onChange="checkbox_master({checkbox: this, child_element: '#edit_ajax_container .edit_cb_group',});" style="width: 20px; height: 20px;">
				</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($all_group as $g):?>
				<tr>
					<td style="vertical-align: middle;"><?php echo $g->NAME;?></td>
					<td style="white-space: nowrap;">
						<?php 
							$checked="";
							foreach($access_array as $a){
								if($a->MENU == $menu->PKKEY && $a->USER_GROUP == $g->PKKEY){
									$checked="checked";
									break;
								}
							}
						?>
						<input type="checkbox" name="USER_GROUP[]" value="<?php echo $g->PKKEY;?>" class="edit_cb_group" style="width: 20px; height: 20px;" <?php echo $checked;?>>
					</td>
				</tr>
			<?php endforeach;?>
		</tbody>
	</table>
</div>
<div class="modal-footer">
	<a href="javascript:;" data-dismiss="modal" class="btn btn-default">Close</a>
	<button type="submit" id="edit_btn_submit" class="btn btn-primary btn_submit">
		<i class="fa fa-save"></i>
		Save
	</button>
</div>

<script>
	$(document).ready(function(){
//		$("#edit_ajax_container .switch").bootstrapSwitch({
//			onColor: "primary",
//			offColor: "danger",
//			onText: "YES",
//			offText: "NO",
//		});
	});
</script>