{extends "../frame.tpl"}

{block js}
    {$smarty.block.parent}
    {literal}
    {/literal}
{/block}

{block content}
{if $body.acn=='order'  && isset($body.id)  &&  is_numeric($body.id)}

    $foundAll = 0;

    {if {find_module name="paymuzo"}}
        {if $body.paymuzo|@count > 0}
            <fieldset><legend>E-platba přes PayMuzo</legend>
                <table width="100%"  border="0" cellspacing="2" cellpadding="0">
                    {foreach from=$body.paymuzo item=item key=key name=paymuzo}
                        $ID = sqlResult($SQL, $i, "id");
                        $date = sqlResult($SQL, $i, "datef");
                        $PRCode = sqlResult($SQL, $i, "pr_code");
                        $SRCode = sqlResult($SQL, $i, "sr_code");
                        $amount = price_format(sqlResult($SQL, $i, "amount_order"));

                        {if $smarty.foreach.paymuzo.index > 0}
                            <hr />
                        {/if}
                            <tr>
                                <td width="25%"><strong>{$item.datef}</strong></td>
                                <td width="30%"><strong>Stav:{* todo <?=$classPayMuzo->getAction({$item.order_state});?> *}</strong></td>
                                <td><strong>Částka: {* todo  price_format() *}{$item.amount_order} {$item.currency}</strong></td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    {* todo <?
                                        echo $classPayMuzo->getPRCode({$item.pr_code});
                                        if($PRCode > 0)
                                        {
                                        if($SRCode > 0)
                                        {
                                        echo ": ";
                                        echo $classPayMuzo->getSRCode({$item.sr_code});
                                        }
                                        echo " <small>(PRCode: ".$PRCode.", SRCode: ".$SRCode.")</small>";
                                        }
                                        ?>
                                    *}
                                </td>
                            </tr>
                    {/foreach}
                </table>
            </fieldset>
		{/if}
	{/if}

	{if {find_module name="multiservis"}}
        {if $body.multiservis|@count > 0}
            <fieldset><legend>E-platba přes Multiservis</legend>
                <table width="100%"  border="0" cellspacing="2" cellpadding="0">
                    {foreach from=$body.multiservis item=item key=key name=multiservis}
                        {if $smarty.foreach.multiservis.index > 0}
                            <tr>
                                <td colspan="3"><hr /></td>
                            </tr>
                        {/if}
                        <tr>
                            <td width="25%"><strong>{$item.datef}</strong></td>
                            <td width="30%"><strong>Stav:
                                    {if $item.order_state =="APPROVED"}
                                        autorizována
                                    {elseif $item.order_state =="REQUESTED"}
                                        nedokončena
                                    {/if}</strong></td>
                            <td><strong>Částka:{* todo  price_format() *}{$item.amount_order} {$item.currency}</strong></td>
                        </tr>
                            {if $item.datea}
                                <tr>
                                    <td align="left"><strong>Autorizována:&nbsp;</strong></td>
                                    <td colspan="2">{$item.datea}</td>
                                </tr>
                                <tr>
                                    <td align="left"><strong>Číslo smlouvy:&nbsp;</strong></td>
                                    <td colspan="2">{$item.id_agreement}</td>
                                </tr>
                            {/if}
                    {/foreach}
                </table>
            </fieldset>
        {/if}
	{/if}


	{if {find_module name="homecredit"}}
        {if $body.homecredit|@count > 0}
            <fieldset><legend>E-platba přes Home Credit a.s.</legend>
                <table width="100%"  border="0" cellspacing="2" cellpadding="0">
                    {foreach from=$body.homecredit item=item key=key name=homecredit}
                        {if $smarty.foreach.homecredit.index > 0}
                            <tr>
                                <td colspan="3"><hr /></td>
                            </tr>
                        {/if}
                        <tr>
                            <td width="25%"><strong><?=$date;?></strong></td>
                            <td width="30%"><strong>Stav:
                                    {if $item.order_state =="APPROVED"}
                                    okamžité schválení
                                    {elseif $item.order_state =="DECLINED"}
                                    okamžité zamítnutí
                                    {elseif $item.order_state =="PROCESSING"}
                                    odložená autorizace (posouzení)
                                    {elseif $item.order_state =="REQUESTED"}
                                    nedokončena
                                    {/if}</strong></td>
                            <td><strong>Částka:{* todo  price_format() *}{$item.amount_order} {$item.currency}</strong></td>
                        </tr>
                        {if !empty($item.datea)}
                            <tr>
                                <td align="left"><strong>Autorizována:&nbsp;</strong></td>
                                <td colspan="2">{$item.datea}</td>
                            </tr>
                        {/if}

                    {/foreach}
                </table>
            </fieldset>
		{/if}
	{/if}


	// pokud nebyla nalezena ani jedna platba
    {if $body.paymuzo|@count == 0 && $body.multiservis|@count == 0 && $body.homecredit|@count == 0}
        <h1 class="h4 main-panel-title">Požadavky na E-platbu</h1>
        <table width="100%"  border="0" cellspacing="2" cellpadding="0">
            <tr>
                <td align="center"><strong>K této objednávce nebyla zaznamenána žádná platba</strong></td>
            </tr>
        </table>
    {/if}
{/if}


{/block}