{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_modules.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$header.razdel_name}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div class="help_text" style="display:block;">
    <div class="close_help">
        <img src="{$site_root}{$template_root}/images/close_help.png" alt="">
    </div>
    <div class="help_body">
        <span class="help_title">{$lang.help}:</span>{$lang.voip.statistics_help}
    </div>
</div>
<div class="cr">&nbsp;</div>
<ul class="tabs">
    <li>
        <a href="admin_voip_settings.php">{$lang.admin_menu.voip_settings}</a>
    </li>
    <li>
        <a class="current">{$lang.admin_menu.voip_statistics}</a>
    </li>
</ul>
		<div class="user_operation_line">

		</div>
		<div class="cr"></div>

    <b>{$lang.voip.total_recieved}:&nbsp; <font color=red>{$payment_stat.services.voip_call}</font>&nbsp;{$form.costunits}</b><br /><br />
	<table  cellpadding="0" cellspacing="0" width="100%">
	<tr class="table_header">
		<td>{$lang.voip.login}</td>
		<td>{$lang.voip.total_time}</td>
		<td>{$lang.voip.total_cost}</td>
		<td>{$lang.voip.last_date}</td>
		<!--td>{$lang.voip.login} From user</td>
		<td>{$lang.voip.login} To user</td>
		<td>{$lang.voip.total_time}</td>
		<td>{$lang.voip.total_cost}</td>
		<td>Start time</td>
		<td>End time</td>
		<td>Status</td-->
	</tr>
	{foreach name=stat from=$stat item=item name=ttt}
	{assign var="iteration" value=$smarty.foreach.stat.iteration}
	<tr {if $smarty.foreach.ttt.index is div by 2}class="odd"{else}class="even"{/if}>
		<td><a id="au_{$iteration}" href="#" onClick="javascript: expandUser({$item.id_user},{$iteration}); return false;"><img id="ecu_{$iteration}" src="{$site_root}{$template_root}/images/expand.gif" border="0" alt="">&nbsp;<b>{$item.login}</b></a></td>
		<td>{$item.duration}</td>
		<td>
			{foreach name=cost from=$item.cost item=item1}
			{$item1.curr_value} {$item1.curr_name}
			{if !$smarty.foreach.cost.last}/{/if}
			{/foreach}
		</td>
		<td>{$item.last_date}</td>
		<!--td>{$item.from}</td>
		<td>{if $item.to eq ''} - {else}{$item.to}{/if}</td>
		<td>{$item.duration}</td>
		<td>{$item.cost}</td>
		<td>{$item.start_time}</td>
		<td>{$item.end_time}</td>
		<td>{$item.status}</td-->
	</tr>
	<tr id="tru_{$iteration}" style="display:none;"><td colspan="4" id="destu_{$iteration}" style="padding:10px;">5454</td></tr>
	{foreachelse}
	<tr class="odd">
	  <td align="center" colspan=7>...</td>	
	</tr>
	{/foreach}
	<tr class="table_header">
	 <td colspan=7>&nbsp;</td>	
	</tr>
	</table>
<script type="text/javascript">
file_name = '{$file_name}';
path_to_image = '{$site_root}{$template_root}/images/';
browser = navigator.appName;
{literal}
function expandUser(id_user,iter){
	au_obj = document.getElementById("au_"+iter);
	imgu_obj = document.getElementById("ecu_"+iter);
	tru_obj = document.getElementById("tru_"+iter);
	destu_odj = document.getElementById("destu_"+iter);
	imgu_obj.src = path_to_image+'collapse.gif';
	
	if (browser=="Microsoft Internet Explorer"){
		tru_obj.style.display = 'inline';
	}else{
		tru_obj.style.display = 'table-row';
	}
	
	au_obj.onclick = function(){collapseUser(iter); return false};
	str = "sel=user_stat&id_user="+id_user+"&iter="+iter;
	
	ajaxRequest(file_name, str, destu_odj, '<img src="'+path_to_image+'loading.gif" border="0"/>', true);
}

function collapseUser(iter){
	au_obj = document.getElementById("au_"+iter);
	imgu_obj = document.getElementById("ecu_"+iter);
	tru_obj = document.getElementById("tru_"+iter);
	
	au_obj.onclick = function(){expandUserWithoutAjax(iter); return false};

	imgu_obj.src = path_to_image+'expand.gif';
	tru_obj.style.display = 'none';
}

function expandUserWithoutAjax(iter){
	tru_obj = document.getElementById("tru_"+iter);
	
	imgu_obj.src = path_to_image+'collapse.gif';
	
	if (browser=="Microsoft Internet Explorer"){
		tru_obj.style.display = 'inline';
	}else{
		tru_obj.style.display = 'table-row';
	}
	
	au_obj.onclick = function(){collapseUser(iter); return false};
}

{/literal}
</script>
{include file="$admingentemplates/admin_bottom.tpl"}