{if $clientsstats.numdueinvoices>0}
<div class="notice notice-error">
	<div class="inside">
		<p>{$LANG.clientareahome_overdue} <strong>{$clientsstats.dueinvoicesbalance}</strong></p>
	</div>
</div>
{/if}

<p class="center">
{if $addfundsenabled}<a href="clientarea.php?action=addfunds" class="button1 color1">{$LANG.addfunds}</a>{/if}
{if $masspay && $clientsstats.numdueinvoices>0}<a href="clientarea.php?action=masspay&all=true" class="button1 color2">{$LANG.masspayall}</a>{/if}
</p>

<div class="col2">
	<div class="featureboxes1 accountboxes">
		<div class="featurebox">
		
			<div class="title">
				<h2>{$LANG.clientareahome_details}</h2>
			</div>
			
			<div class="main">
				<p>
			    <strong>{$clientsdetails.firstname} {$clientsdetails.lastname} {if $clientsdetails.companyname}({$clientsdetails.companyname}){/if}</strong><br />
			    {$clientsdetails.address1}{if $clientsdetails.address2}, {$clientsdetails.address2}{/if}<br />
			    {if $clientsdetails.city}{$clientsdetails.city}, {/if}{if $clientsdetails.state}{$clientsdetails.state}, {/if}{$clientsdetails.postcode}<br />
			    {$clientsdetails.countryname}<br />
			    <strong>{$clientsdetails.email}</strong></p>
			    <p class="alignright nomarginbottom"><a href="clientarea.php?action=details"><img src="images/details.gif" align="absmiddle" alt="" />{$LANG.clientareaupdateyourdetails}</a></p>
			</div>
		</div>
	</div>
</div><!-- .col2 -->

<div class="col2 nomarginright">
	<div class="featureboxes1 accountboxes">
		<div class="featurebox">
		
			<div class="title">
				<h2>{$LANG.clientareahome_stats}</h2>
			</div>
			
			<div class="main">
			
				<div class="side2">
					<ul>
						<li><a href="cart.php"><img src="images/order.gif" align="absmiddle" alt="" />{$LANG.menu_order}</a></li>
			            <li><a href="clientarea.php?action=products"><img src="images/products.gif" align="absmiddle" alt="" />{$LANG.clientareanavservices} ({$clientsstats.productsnumactive})</a></li>
			            <li><a href="clientarea.php?action=domains"><img src="images/domains.gif" align="absmiddle" alt="" />{$LANG.clientareanavdomains} ({$clientsstats.numactivedomains})</a></li>
			            <li><a href="clientarea.php?action=quotes"><img src="images/pdf.gif" align="absmiddle" alt="" />{$LANG.quotestitle} ({$clientsstats.numquotes})</a></li>
					</ul>
				</div><!--- .side2 -->
				
				<div class="side2 nomarginright">
					<ul>
			            <li><a href="clientarea.php?action=invoices"><img src="images/invoices.gif" align="absmiddle" alt="" />{$LANG.invoices} ({$clientsstats.numdueinvoices})</a></li>
			            <li><a href="supporttickets.php"><img src="images/supporttickets.gif" align="absmiddle" alt="" />{$LANG.toolbar_menu_tickets} ({$clientsstats.numtickets})</a></li>
			            {if $feature_affiliates eq "on"}
			            <li><a href="affiliates.php"><img src="images/affiliates.gif" align="absmiddle" alt="" />{$LANG.affiliatestitle} ({$clientsstats.numaffiliatesignups})</a></li>
			            {/if}
			            <li><a href="clientarea.php?action=emails"><img src="images/emails.gif" align="absmiddle" alt="" />{$LANG.clientareaemails}</a></li>
					</ul>
				</div><!--- .side2 -->	
				
				<div class="clear">&nbsp;</div>			
				
			</div>
			
		</div>
	</div>
</div><!-- .col2 -->

<div class="clear">&nbsp;</div>

{foreach from=$addons_html item=addon_html}
<div style="margin:15px 0 15px 0;">{$addon_html}</div>
{/foreach}


{if in_array('invoices',$contactpermissions)}

		<div class="bigheader">
			<h2>{$clientsstats.numdueinvoices} {$LANG.invoicesdue}</h2>
		</div><!-- .bigheader -->

<form method="post" action="clientarea.php?action=masspay">

<div class="table-responsive table-grey">
<table>
  <tr>
    {if $masspay}<th width="15"></th>{/if}
    <th>{$LANG.invoicenumber}</th>
    <th>{$LANG.invoicesdatecreated}</th>
    <th>{$LANG.invoicesdatedue}</th>
    <th>{$LANG.invoicestotal}</th>
    <th>{$LANG.invoicesbalance}</th>
    <th>{$LANG.invoicesstatus}</th>
    <th>&nbsp;</th>
  </tr>
  {foreach key=num item=invoice from=$invoices}
  <tr>
    {if $masspay}<td><input type="checkbox" name="invoiceids[]" value="{$invoice.id}" /></td>{/if}
    <td><a href="viewinvoice.php?id={$invoice.id}" target="_blank"><strong>{$invoice.invoicenum}</strong></a></td>
    <td>{$invoice.datecreated}</td>
    <td>{$invoice.datedue}</td>
    <td>{$invoice.total}</td>
    <td>{$invoice.balance}</td>
    <td><strong>{$invoice.status}</strong></td>
    <td align="center"><a href="viewinvoice.php?id={$invoice.id}" target="_blank" class="button1 color1">{$LANG.invoicesview}</a></td>
  </tr>
  {foreachelse}
  <tr>
    <td colspan="{if $masspay}8{else}7{/if}" align="center">{$LANG.norecordsfound}</td>
  </tr>
  {/foreach}
  {if $invoices}
  <tr style="font-weight:bold;">
    <td colspan="{if $masspay}4{else}3{/if}">{if $masspay}<input type="submit" value="{$LANG.masspayselected}" class="button1 color2" />{/if}</td>
    <td style="text-align:right;">{$LANG.invoicestotaldue}</td>
    <td>{$totalbalance}</td>
    <td colspan="2">{if $masspay}<a href="clientarea.php?action=masspay&all=true" class="button1 color2">{$LANG.masspayall}</a>{/if}</td>
  </tr>
  {/if}
</table>
</div>

</form>
{/if}


{if in_array('tickets',$contactpermissions)}

		<div class="bigheader">
			<h2>{$clientsstats.numactivetickets} {$LANG.supportticketsopentickets}</h2>
		</div><!-- .bigheader -->

<p class="floatright"><a href="submitticket.php" class="button1 color1">{$LANG.supportticketssubmitticket}</a></p>

<div class="table-responsive table-grey">
<table>
  <tr>
    <th>{$LANG.supportticketsdate}</th>
    <th>{$LANG.supportticketssubject}</th>
    <th>{$LANG.supportticketsstatus}</th>
    <th>{$LANG.supportticketsticketurgency}</th>
  </tr>
  {foreach key=num item=ticket from=$tickets}
  <tr>
    <td>{$ticket.date}</td>
    <td><a href="viewticket.php?tid={$ticket.tid}&amp;c={$ticket.c}">{$ticket.subject}</a>{if $ticket.unread} - <strong class="red">Unread</strong>{/if}</td>
    <td width="120">{$ticket.status}</td>
    <td width="80">{$ticket.urgency}</td>
  </tr>
  {foreachelse}
  <tr>
    <td colspan="4" align="center">{$LANG.norecordsfound}</td>
  </tr>
  {/foreach}
</table>
</div>
{/if}




{if $files}

		<div class="bigheader">
			<h2>{$LANG.clientareafiles}</h2>
		</div><!-- .bigheader -->

<div class="table-responsive table-grey">
<table>
  <tr>
    <th>{$LANG.clientareafilesdate}</th>
    <th>{$LANG.clientareafilesfilename}</th>
  </tr>
  {foreach key=num item=file from=$files}
  <tr>
    <td>{$file.date}</td>
    <td><a href="dl.php?type=f&id={$file.id}">{$file.title}</a></td>
  </tr>
  {/foreach}
</table>
</div>
{/if}