<?php
$this->load->view('block/script',$this->templates->getData());
$this->load->view('block/modal',$this->templates->getData());
$started = isProjectStarted();
$stopped = isProjectStopped();
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
	<!-- Content Header (Page header) -->
	<section class="content-header">
			<h1 style="font-family:roboto">
					<b><?php echo $this->lang->line('block'); ?></b>
			</h1>
			<ol class="breadcrumb">
					<li style="color:#0C0"><a href="#"><i class="fa fa-home"></i> <?php echo $this->lang->line('home'); ?></a></li>
					<li style="color:#0C0"><a href="#"><?php echo $this->lang->line('block'); ?></a></li>
					<li class="active" style="color:#0C0"><?php echo $this->lang->line('blockList'); ?></li>
			</ol>
	</section>

	<!-- Main content -->
	<section class="content">
	
		<div class="section-title p-5-x text-center">
			<h1 class="m-0-t font-weight-bold"><?php echo ($l = $this->lang->line('block')) ? ucwords(strtolower($l)) : 'Block'; ?></h1>
			<p class="m-0-b"><?php echo $this->lang->line('listof'); ?></p>
		</div>
		
		<div class="row p-5-x m-1-b text-center">
			<div class="flex-btn-group m-1-y col-md-4 col-md-offset-4">
				<a href="<?php echo base_url(); ?>dashboard" class="btn btn-danger"><i class="fa fa-backward"></i>&nbsp;<?php echo $this->lang->line('back'); ?></a>
				<a href="javascript:void(0);" onclick="printblock()" id="print_btn" target="_blank" class="btn btn-warning btn-sm" title="Print"><span class="glyphicon glyphicon glyphicon-print"></span> <?php echo $this->lang->line('print');?></a>
			</div>
		</div>

		<?php if($started || $stopped) { ?>
			<div class="helper helper-center"><?php echo ($started) ? $this->lang->line('helperStart') : $this->lang->line('helperStop'); ?></div>
		<?php } ?>
		
		
		<div class="table-responsive p-1-x m-1-y" style="overflow: hidden;">
			<table id="datatable_blocklist" class="table table-bordered table-striped datatables">
					<thead>
							<tr>
									<th class="text-center col-xs-1"><?php echo $this->lang->line('no'); ?></th>
									<th class="text-center col-xs-2"><?php echo $this->lang->line('voterID'); ?></th>
									<th class="text-left col-xs-3"><?php echo $this->lang->line('voterName'); ?></th>
									<th class="text-left col-xs-3"><?php echo $this->lang->line('companyName'); ?></th>
									<th class="text-center col-xs-2"><?php echo $this->lang->line('status'); ?></th>
									<?php if(!$stopped) { ?>
										<th class="text-center col-xs-1"></th>
									<?php } ?>
									<th class="hidden"></th>
							</tr>
					</thead>
					<tbody id="tblblock">
							<?php 
							if($blockList){
									$i = 1;
									foreach ($blockList as $row){
							?>
							<tr>
									<td class="text-center"><?php echo $i++; ?></td>
									<td class="text-center"><?php echo $row->noAhli; ?></td>
									<td class="text-left"><?php echo $row->name; ?></td>
									<td class="text-left"><?php echo $row->companyName; ?></td>
									<td class="text-center">																	
										<div class="switch toggle">
											<label>
												<input type="radio" name="validity_<?php echo $row->userID; ?>" value="1" <?php if($row->validity == 1) echo "checked";?> />
												<span>
													<span class="hidden-sm hidden-xs p-0"><?php echo $this->lang->line('invalid'); ?></span>
													<span class="hidden-md hidden-lg hidden-xl p-0"><i class="fa fa-times"></i></span>
												</span>
											</label>
											<label>
												<input type="radio" name="validity_<?php echo $row->userID; ?>" value="0" <?php if($row->validity == 0) echo "checked";?> />
												<span>
													<span class="hidden-sm hidden-xs p-0"><?php echo $this->lang->line('valid'); ?></span>
													<span class="hidden-md hidden-lg hidden-xl p-0 fa fa-check"></span>
												</span>
											</label>
										</div>
									</td>
									<?php if(!$stopped) { ?>
										<td class="text-right">
											<button type="button" onclick="updatestatus(<?php echo $row->userID; ?>, this)" class="btn btn-success btn-sm" title="Block"><i class="fa fa-check"></i><span class="hidden-sm hidden-xs">&nbsp;<?php echo $this->lang->line('save'); ?></a></button>
										</td>
									<?php } ?>
									<td class="hidden"><?php echo $row->validity; ?></td>
							</tr>
							<?php 
									}
							}
							?>


					</tbody>
			</table>
		</div>
		
	</section>
</div>
