<?php
checkLogin('adm');
checkEnteService($_GET['flt_serv_cod']);
include("functions.inc.php");
include("menu.inc.php");

$p = new Page('Anagrafiche');
$p->addMenu('logged');
$p->printHeader();
?>
<div class="row">
	<div class="col-xs-9 col-sm-10">
		<h3 class="p-title">Anagrafiche <small> <?php echo get_serv_name($_GET['flt_serv_cod']);?></small></h3>
    </div>
	<div class="col-xs-3 col-sm-2"><?php print_optMenu('adm_home');?></div>
</div>
<?php
//anagrafiche di questo servizio
if($list = get_anagr()){

	$tableList = new TableList();
	$tableList->addHeader(
		array('Nome','col-xs-4'),
		array('Indirizzo','hidden-xs col-sm-5'),
		array('Comune','col-xs-3')
	);

	foreach($list['list'] as $v){
		
		$qs_year = intval($_GET['flt_year']) > 0 ? '&flt_year='.intval($_GET['flt_year']) : '';
		$tableList->setRowUrl('../adm_add/?id='.$v['anagr_id'].$qs_year);
		
		$tableList->addCol($v['anagr_cognome'].' '.$v['anagr_nome']);
		$tableList->addCol($v['anagr_ind']);
		$tableList->addCol(utf8_encode($v['comune']));
	}
	
	$tableList->output($list['pagination']);

}else if(isset($_GET['filter'])){
	printMsg("Nessun risultato","warning",false);	
}else{
	printMsg("Nessuna anagrafica inserita","info",false);	
}

$p->printFooter();
?>