<!--// $Id$ //-->

<style>

    .voipaccount-data {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .voipaccount-data > div {
        flex-grow: 1;
    }

    #voipaccount-right-panel {
        margin-right: 2em;
    }

</style>

<table class="lmsbox">
    <colgroup>
        <col style="width: 1%;">
        <col style="width: 99%;">
    </colgroup>
    <thead>
        {block name="voipaccountinfobox-login"}
        <tr>
            <td>
                <img src="img/voip.gif" alt="">
            </td>
            <td class="bold">
                {$voipaccountinfo.login} ({$voipaccountinfo.id|string_format:"%04d"})
            </td>
        </tr>
        {/block}
    </thead>
    <tbody>
    <tr>
        <td colspan="2" class="container">
            <table width="100%" celpadding="0">
                <tr>
                    <td class="voipaccount-data">
                        <div id="voipaccount-left-panel">
                            <TABLE>
                                <COLGROUP>
                                    <COL style="width: 1%;">
                                    <COL style="width: 1%;">
                                    <COL style="width: 99%;">
                                </COLGROUP>
                                {block name="voipaccountinfobox-password"}
                                <tr>
                                    <td>
                                        <img src="img/passwd.gif" alt="{trans("Password:")}">
                                    </td>
                                    <td class="bold nobr">
                                        {trans("Password:")}
                                    </td>
                                    <td class="nobr">
                                        {if ConfigHelper::checkPrivilege('hide_voip_passwords')}{'*'|str_repeat:8}{else}{$voipaccountinfo.passwd}{/if}
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-phone"}
                                <tr>
                                    <td>
                                        <img src="img/phone.gif" alt="{trans("Phone number")}">
                                    </td>
                                    <td class="bold nobr">
                                        {if $voipaccountinfo['numbers']|size > 1}
                                            {trans("Phone numbers")}
                                        {else}
                                            {trans("Phone number")}
                                        {/if}
                                    </td>
                                    <td>
                                        {if empty($voipaccountinfo['numbers'])}
                                            {trans("— none —")}
                                        {else}
                                            {foreach $voipaccountinfo['numbers'] as $number}
                                                {strip}
                                                    {if !$number@first},&nbsp{/if}
                                                    {if $number.number_index == 1 && $number@total > 1}
                                                        <strong>
                                                            {$number.phone}
                                                        </strong>
                                                    {else}
                                                        {$number.phone}
                                                    {/if}
                                                    {if isset($number.info) && strlen($number.info)}
                                                        &nbsp;({$number.info|escape})
                                                    {/if}
                                                {/strip}
                                            {/foreach}
                                        {/if}
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-customer"}
                                <tr>
                                    <td>
                                        <img src="img/customer.gif" alt="{trans("Customer:")}">
                                    </td>
                                    <td class="bold nobr">
                                        {trans("Customer:")}
                                    </td>
                                    <td class="nobr">
                                        <a href="?m=customerinfo&id={$voipaccountinfo.ownerid}">{$voipaccountinfo.owner}</a>
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-location"}
                                {if $voipaccountinfo.location}
                                <tr>
                                    <td>
                                        <img src="img/home.gif" alt="{trans('Location:')}">
                                    </td>
                                     <td class="bold nobr">
                                        {trans("Location:")}
                                    </td>
                                    <td class="nobr">
                                        {$voipaccountinfo.location}{if $voipaccountinfo.borough_name} ({$voipaccountinfo.state_name} / {$voipaccountinfo.district_name} / {$_BOROUGHTYPES[$voipaccountinfo.borough_type]} {$voipaccountinfo.borough_name}){/if}
                                    </td>
                                </tr>
                                {/if}
                                {/block}
                                {block name="voipaccountinfobox-serviceprovider"}
                                    {if !empty($serviceproviders) && !empty($voipaccountinfo.serviceproviderid)}
                                        <tr>
                                            <td>
                                                {icon name="service"}
                                            </td>
                                            <td class="nobr">
                                                <strong>{trans("Service provider")}</strong>
                                            </td>
                                            <td>
                                                {$serviceproviders[$voipaccountinfo.serviceproviderid].name|escape}
                                            </td>
                                        </tr>
                                    {/if}
                                {/block}
                                {block name="voipaccountinfobox-status"}
                                <tr>
                                    <td>
                                        <a href="?m=voipaccountset&id={$voipaccountinfo.id}"><img src="img/{if ! $voipaccountinfo.access}no{/if}access.gif" alt=""></a>
                                    </td>
                                    <td class="bold nobr">
                                        {trans("Status:")}
                                    </td>
                                    <td class="bold" colspan="1">
                                        {if $voipaccountinfo.access}{trans("connected<!singular>")}{else}{trans("disconnected<!singular>")}{/if}
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-cost_limit"}
                                <tr>
                                    <td>
                                        <img src="img/money.gif" alt="">
                                    </td>
                                    <td class="bold nobr">
                                        {trans("Cost limit:")}
                                    </td>
                                    <td class="nobr">
                                        {if $voipaccountinfo.cost_limit}
                                            {$voipaccountinfo.cost_limit|money_format}
                                        {else}
                                            {ConfigHelper::getConfig('voip.default_cost_limit')|money_format} ({trans("default")})
                                        {/if}
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-balance"}
                                <tr>
                                    <td>
                                        <img src="img/money.gif" alt="">
                                    </td>
                                    <td class="bold nobr">
                                        {trans("Balance:<!voip>")}
                                    </td>
                                    <td class="nobr">
                                        {$voipaccountinfo.balance|money_format}
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-flags"}
                                <tr>
                                    <td>
                                        <img src="img/settings.gif" alt="">
                                    </td>
                                    <td class="bold">
                                        {trans("Settings:")}
                                    </td>
                                    <td>
                                        <table>
                                            <tr>
                                                <td>{trans("recording for operator")}</td>
                                                <td>
                                                    {if $voipaccountinfo.flags & $smarty.const.VOIP_ACCOUNT_FLAG_ADMIN_RECORDING}
                                                        {trans("yes")}
                                                    {else}
                                                        {trans("no")}
                                                    {/if}<br>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>{trans("recording for customer")}</td>
                                                <td>
                                                    {if $voipaccountinfo.flags & $smarty.const.VOIP_ACCOUNT_FLAG_CUSTOMER_RECORDING}
                                                        {trans("yes")}
                                                    {else}
                                                        {trans("no")}
                                                    {/if}
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>{trans("<!voip-account>trunk")}</td>
                                                <td>
                                                    {if $voipaccountinfo.flags & $smarty.const.VOIP_ACCOUNT_FLAG_TRUNK}
                                                        {trans("yes")}
                                                    {else}
                                                        {trans("no")}
                                                    {/if}
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-events"}
                                <tr>
                                    <td>
                                        <img src="img/info.gif" alt="">
                                    </td>
                                    <td class="bold">
                                        {trans("Created:")}
                                        {if $voipaccountinfo.moddate}<br>{trans("Modified:")}{/if}
                                    </td>
                                    <td>
                                        {$voipaccountinfo.createdby|escape}, {$voipaccountinfo.creationdateh}<br>
                                        {if $voipaccountinfo.moddate}{$voipaccountinfo.modifiedby|escape}, {$voipaccountinfo.moddateh}{/if}
                                    </td>
                                </tr>
                                {/block}
                                {block name="voipaccountinfobox-extra"}{/block}
                            </TABLE>
                        </div>
                        <div id="voipaccount-right-panel">
                            <TABLE>
                                <colgroup>
                                    <col style="width: 1%">
                                    <col style="width: 99%">
                                </colgroup>
                                {if $voipaccountinfo.description}
                                <TR>
                                    <TD>
                                        <IMG SRC="img/info1.gif" ALT="">
                                    </TD>
                                    <TD>
                                        <TABLE WIDTH="100%" CELLPADDING="5">
                                            <TR>
                                                <TD CLASS="fall superlight">
                                                    {$voipaccountinfo.description|replace:"\n":"<BR>"}
                                                </TD>
                                            </TR>
                                        </TABLE>
                                    </TD>
                                </TR>
                                {/if}
                            </TABLE>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
        <tr>
            <td class="lms-ui-box-buttons" colspan="2">
                {block name="voipaccountinfobox-buttons"}
                    {button href="?m=voipaccountbillinglist&fvoipaccid={$voipaccountinfo.id}" label="Billings" icon="billing" tip="show billings"}
                    {button href="?m=voipaccountedit&id={$voipaccountinfo.id}" accesskey="E" label="Edit" icon="edit"}
                    {button id="delete-voipaccount" data_href="?m=voipaccountdel&id={$voipaccountinfo.id}"
                        data_name=$voipaccountinfo.login label="Delete" icon="delete"}
                {/block}
            </td>
        </tr>
    </tbody>
</table>
<script>

    $('#delete-voipaccount').click(function() {
        var name = $(this).attr('data-name');
        confirmDialog($t("Are you sure, you want to remove voip account '$a' from database?", name), this).done(function() {
            location.href = $(this).attr('data-href');
        });
        return false;
    });

</script>
