<!--// $Id$ //-->
{css}
{js}

{tab_container id="customervoipaccountsbox" label="VoIP Accounts"}
	{tab_header content_id="voipaccountspanel"}
		{tab_header_cell icon="lms-ui-icon-phone"}
			<strong>{t a=$customervoipaccounts|size}VoIP Accounts ($a){/t}</strong>
		{/tab_header_cell}
		{tab_header_cell}
			{if $customerinfo.status != $smarty.const.CSTATUS_INTERESTED && !$customerinfo.deleted}
				<a href="?m=voipaccountadd&ownerid={$customerinfo.id}">
					{trans("New VoIP Account")}
					{icon name="next" class="fa-fw"}
				</a>
			{/if}
		{/tab_header_cell}
	{/tab_header}
	{tab_contents id="voipaccountspanel"}
		{tab_table}
		{block name="customervoipaccountsbox-list-columns"}
			{assign var='number_of_table_columns' value='7'}
		{/block}
			<div class="lms-ui-tab-table-row header">
			{block name="customervoipaccountsbox-list-header"}
				<div class="lms-ui-tab-table-wrapper col-6">
					<div class="lms-ui-tab-table-wrapper col-2">
						<div class="lms-ui-tab-table-column login">
							<strong>{trans("<!voipaccount>Login")}</strong>
						</div>
						<div class="lms-ui-tab-table-column id">
							{trans("ID")}
						</div>
					</div>
					<div class="lms-ui-tab-table-wrapper col-2">
						<div class="lms-ui-tab-table-column serviceprovider">
							{trans("Service provider")}
						</div>
						<div class="lms-ui-tab-table-column extid">
							{trans("External ID")}
						</div>
					</div>
					<div class="lms-ui-tab-table-wrapper col-2">
						<div class="lms-ui-tab-table-column password">
							{trans("Password")}
						</div>
						<div class="lms-ui-tab-table-column number">
							{trans("Phone number")}
						</div>
					</div>
				</div>
				<div class="lms-ui-tab-table-column buttons">
					&nbsp;
				</div>
			{/block}
			</div>
			{foreach $customervoipaccounts as $voipaccount}
				{block name="customervoipaccountsbox-list-row"}
				<div class="lms-ui-tab-table-row" data-target-url="?m=voipaccountinfo&id={$voipaccount.id}">
					<div class="lms-ui-tab-table-wrapper col-6">
						<div class="lms-ui-tab-table-wrapper col-2">
							<div class="lms-ui-tab-table-column login">
								{$voipaccount.login}
							</div>
							<div class="lms-ui-tab-table-column id">
								({$voipaccount.id|string_format:"%04d"})
							</div>
						</div>
						<div class="lms-ui-tab-table-wrapper col-2">
							<div class="lms-ui-tab-table-column serviceprovider">
								{if !empty($voipaccount.serviceproviderid)}
									{$voipaccount.serviceprovidername}
								{else}
									-
								{/if}
							</div>
							<div class="lms-ui-tab-table-column extid">
								{if !empty($voipaccount.serviceproviderid) && !empty($voipaccount.extid)}
									#{$voipaccount.extid}
								{else}
									-
								{/if}
							</div>
						</div>
						<div class="lms-ui-tab-table-wrapper col-2">
							<div class="lms-ui-tab-table-column password">
								{if !ConfigHelper::checkConfig('privileges.hide_voip_passwords')}{$voipaccount.passwd}{else}{'*'|str_repeat:8}{/if}
							</div>
							<div class="lms-ui-tab-table-column number">
								{foreach $voipaccount.phones as $phone}
									{$phone.phone}{if !$phone@last}, {/if}
								{/foreach}
							</div>
						</div>
					</div>

					<div class="lms-ui-tab-table-column buttons">
						{button type="link" icon="delete" class="delete-voipaccount" href="?m=voipaccountdel&id={$voipaccount.id}" tip="Delete"}
						{button type="link" icon="edit" href="?m=voipaccountedit&id={$voipaccount.id}"
							tip="Edit"}
						{button type="link" icon="info" href="?m=voipaccountinfo&id={$voipaccount.id}"
							tip="Info"}
					</div>
				</div>
				{/block}
			{foreachelse}
				{block name="customervoipaccountsbox-list-empty-row"}
				<div class="lms-ui-tab-empty-table">
					{trans("That customer does not own any VoIP account.")}
				</div>
				{/block}
			{/foreach}
		{/tab_table}
	{/tab_contents}
{/tab_container}
