<div class="row"><br>
	<?php foreach($attachment_list->result_array() as $file){
				$div_class = 'icon';
				$icon_class = 'fa-file';
				$file_type = $file['fileType'];
				$file_ext = $file['fileExt'];
				$image_thumb = $file['serverFullPath'];
				$image_thumb_real = $file['serverFilePath'].$file['rawName'].'_thumb'.$file['fileExt'];
				if(file_exists($image_thumb_real))
				$image_thumb = $image_thumb_real;
				if (strpos($file_type, 'image') !== false) {
					$div_class = 'image';
				}
				if( ($file_ext==='.csv') || ($file_ext==='.xls') || ($file_ext==='.xlsx') )
				{
					$icon_class = 'fa-file-excel-o';
				}
				if( ($file_ext==='.pdf') )
				{
					$icon_class = 'fa-file-pdf-o';
				}
				if( ($file_ext==='.txt') )
				{
					$icon_class = 'fa-file-text-o';
				}
				if( ($file_ext==='.zip') ||  ($file_ext==='.7zip'))
				{
					$icon_class = 'fa-file-zip-o';
				}
				if( ($file_ext==='.rar') )
				{
					$icon_class = 'fa-archive';
				}
				if( ($file_ext==='.js') || ($file_ext==='.php') || ($file_ext==='.html') )
				{
					$icon_class = 'fa-file-code-o';
				}
				if( ($file_ext==='.3gp') || ($file_ext==='.avi') || ($file_ext==='.mp4') || ($file_ext==='.mpg4') )
				{
					$icon_class = 'fa-film';
				}
				if( ($file_ext==='.mp3') || ($file_ext==='.wav') || ($file_ext==='.wma') )
				{
					$icon_class = 'fa-music';
				}
				?>
	<div class="file-box">
		<div class="file">
			<a target="_blank" href="<?=base_url('main/upload/download_attachment/'.encode($file['idAttachment']))?>"
				download="<?=$file['origName']?>">
				<span class="corner"></span>

				<div class="<?=$div_class?>">
					<?php if($div_class=='icon'){?>
					<i class="fa <?=$icon_class?> color-cyan"></i>
					<?php }else{?>
					<img alt="image" class="img-responsive" src="<?=base_url($image_thumb_real)?>">
					<?php }?>
				</div>
				<div class="file-name">
					<?=$file['origName']?>
					<br>
					<small>Added: <?=date("Y-m-d H:i:s", strtotime($file['createTime']))?></small>
					<br>
					<small>Note: <?=$file['remark']?></small>
				</div>
			</a>
		</div>

	</div>
	<?php }?>
</div>
<script>
	$(document).ready(()=>{
		$('#attachment-count').text('<?=$attachment_list->num_rows();?>');
	})
</script>