<?php
/* @var bool $error */
$translator = $this->plugin('translate')->getTranslator();
?>
<h1><?=$this->translate('Account removal confirmation') ?></h1>

<?php if ($error):
    echo $this->alert()->danger(
        $this->translate('Removal of user account failed.'),
        ['dismissable' => false ]
    );
endif; ?>

<?php foreach ($this->lists as $list): /* @var $list \Auth\Dependency\ListInterface */?>
	<?php $count = $list->getCount($this->user);?>
	<div class="panel panel-default">
    	<div class="panel-heading"><?=$list->getTitle($translator)?> <span class="badge pull-right"><?=$count?></span></div>
    	<?php if ($count > 0):?>
    		<ul class="list-group">
                <?php foreach ($list->getItems($this->user, $this, $this->limit) as $item):?>
                	<?php $url = $item->getUrl();?>
                	<li class="list-group-item">
                		<?php if ($url):?><a href="<?=$url?>"><?php endif;?>
                		<?=$item->getTitle()?>
                		<?php if ($url):?></a><?php endif;?>
                	</li>
                <?php endforeach;?>
                <?php if ($count > $this->limit):?>
                	<li class="list-group-item disabled">
                		&hellip; <?=sprintf($this->translate('and %d other(s)'), $count - $this->limit)?>
                	</li>
                <?php endif;?>
    		</ul>
    	<?php endif;?>
	</div>
<?php endforeach;?>
<form method="post" action="">
	<button type="submit" class="btn btn-primary" name="confirm" value="1"><?=$this->translate('Remove my account')?></button>
	<a href="<?=$this->url('lang/my', ['action' => 'profile'])?>" class="btn btn-default"><?=$this->translate('Cancel account removal')?></a>
</form>