<?php
/**
 * This is a core PHP file. For customization, create a file in the folder /custom/.
 * Files with the same filename in this folder will automatically be loaded instead of the current file
 */
?>
<div class="sidebar-column p-t-1">

	<?php
	$search = Cache::get('filter-list-group-cst');
	?>
	<form class="m-b-2 form-list-search" role="search" action="<?php echo __SITE_URL . '/' . __('cst', 'url'); ?>">
		<input type="text" class="form-control" placeholder="<?php echo __('search'); ?>" value="<?php if($search){ echo normalize($search); } ?>" id="list-search">
	</form>

	<?php
	if(!empty($cst_list))
	{
		?>
		<div id="list-items">

			<h3 class="m-b-1 m-t-2">
				<a class="hidden-lg-up" data-toggle="collapse" href="#list-group-cst" aria-controls="list-group-cst">
					<?php echo __('cst services'); ?>
				</a>
				<span class="hidden-md-down"><?php echo __('cst services'); ?></span>
				<span class="tag tag-default tag-pill pull-xs-right result-count"><?php echo ($cst_list) ? count($cst_list) : 0; ?></span>
			</h3>

			<div class="list-group full-width collapse collapse-md-up row scrollable-list" id="list-group-cst">
				<?php

				if(is_array($cst_list))
				{
					foreach($cst_list as $_item)
					{
						$active = (isset($service->id) && $_item['Identifier'] == $service->id) ? 'active' : '';
						?>
						<a href="<?php echo __SITE_URL . '/' . __('cst', 'url') . '/' . __('view', 'url') . '/' . $_item['Identifier']; ?>" class="list-group-item list-group-item-action <?php echo $active; ?>" data-search-term="<?php echo strtolower(normalize($_item['Name'])); ?>">
							<?php
							if(isset($_item['Termination']) && $_item['Termination'])
							{
								?>
								<s><?php echo normalize($_item['Name']); ?></s>
								<div class="clearfix">
									<small class="text-muted"><?php echo sprintf(__('service list termination at'), rewrite_date_db2site($_item['Termination']['Date'])); ?></small>
								</div>
								<?php
							}
							else
							{
								echo normalize($_item['Name']);
							}
							?>
						</a>
						<?php
					}
				}
				?>
				<a id="list-search-noresult" class="list-group-item hide"><?php echo __('no search results found'); ?></a>
			</div>
		</div>
		<?php
	}
	?>


</div>