{extends file="admin-layout.tpl"}

{block name="check-resource"}admin.coupon{/block}
{block name="check-access"}view{/block}

{block name="page-title"}{intl l='Coupon'}{/block}

{block name="main-content"}
<div class="coupons">

    <div id="wrapper" class="container">

        {loop type="coupon" name="read_coupon" id={$couponId} backend_context="true"}
        <nav>
            <ul class="breadcrumb">
                <li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
                <li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
                <li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
                <li>{$CODE}</li>
            </ul>
        </nav>

        <div class="row">
            <div class="col-md-12">
                <div class="general-block-decorator">
                    <div class="table-responsive">

                        {if !$IS_ENABLED}
                            <div class="alert alert-info">
                                <span class="glyphicon glyphicon-question-sign"></span>
                                {intl l='This coupon is disabled, you can enable at the bottom of this form.'}
                            </div>
                        {/if}

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <td>{intl l='Title'}</td>
                                <td>{$TITLE}</td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    {if $IS_ENABLED}
                                        <span class="label label-success">
                                            {intl l="Is enabled"}
                                        </span>
                                    {else}
                                        <span class="label label-warning">
                                            {intl l="Is disabled"}
                                        </span>
                                    {/if}
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    {$SUMMARY}
                                </td>
                            </tr>
                            <tr>
                                <td>{intl l='Amount'}</td>
                                <td>{$AMOUNT}</td>
                            </tr>
                            <tr>
                                <td>{intl l='Expiration date'}</td>
                                <td>{$EXPIRATION_DATE} ({$DAY_LEFT_BEFORE_EXPIRATION} {intl l="days left"})</td>
                            </tr>
                            <tr>
                                <td>{intl l='Usage left'}</td>
                                <td>
                                    {if $USAGE_LEFT == -1}
                                        <span class="label label-success">
                                            {intl l="Unlimited"}
                                        </span>
                                    {elseif $USAGE_LEFT}
                                        <span class="label label-success">
                                            {$USAGE_LEFT}
                                        </span>
                                    {else}
                                        <span class="label label-warning">
                                            0
                                        </span>
                                    {/if}
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    {if $IS_CUMULATIVE}
                                        <span class="label label-success">
                                            {intl l="May be cumulative"}
                                        </span>
                                    {else}
                                        <span class="label label-warning">
                                            {intl l="Can't be cumulative"}
                                        </span>
                                    {/if}
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    {if $IS_REMOVING_POSTAGE}
                                        <span class="label label-warning">
                                            {intl l="Will remove postage"}
                                        </span>
                                    {else}
                                        <span class="label label-success">
                                            {intl l="Won't remove postage"}
                                        </span>
                                    {/if}
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    {if $IS_AVAILABLE_ON_SPECIAL_OFFERS}
                                        <span class="label label-warning">
                                            {intl l="Will be available on special offers"}
                                        </span>
                                    {else}
                                        <span class="label label-success">
                                            {intl l="Won't be available on special offers"}
                                        </span>
                                    {/if}
                                </td>
                            </tr>
                            <tr>
                                <td>{intl l='Application field'}</td>
                                <td>
                                    <ul class="list-unstyled">
                                        {foreach from=$APPLICATION_CONDITIONS item=condition name=conditionsForeach}
                                            {if !$smarty.foreach.conditionsForeach.first}
                                                <li><span class="label label-info">{intl l='And'}</span></li>
                                            {/if}
                                            <li>{$condition nofilter}</li>
                                        {/foreach}
                                    </ul>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">{$SHORT_DESCRIPTION}</td>
                            </tr>
                            <tr>
                                <td colspan="2">{$DESCRIPTION}</td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <a href="{$urlEditCoupon}" class="btn btn-default btn-primary btn-medium pull-right">
                                        <span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
                                    </a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        {/loop}
    </div> <!-- #wrapper -->
</div>

{include file='includes/confirmation-modal.html' id="enable" message="{intl l='Do you really want to enable this element ?'}"}

{/block}

{block name="javascript-initialization"}
    {javascripts file='assets/js/main.js'}
        <script src="{$asset_url}"></script>
    {/javascripts}

{/block}

{block name="javascript-last-call"}
    {module_include location='coupon-read-js'}
{/block}
