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

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

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

{block name="main-content"}
<div class="coupon edit-coupon">
    <div id="wrapper" class="container">

        <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>{intl l='Editing coupon "%title"' title="$couponCode"}</li>
            </ul>
        </nav>

        {form name="thelia.admin.coupon.creation"}
            {include file='coupon/form.html' formAction={url path={$formAction}} form=$form noConditions=false title={intl l='Editing coupon "%title"' title=$couponCode}}
        {/form}
    </div> <!-- #wrapper -->
</div>
{/block}

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

    {javascripts file='assets/js/json2.js'}
        <script src="{$asset_url}"></script>
    {/javascripts}

    {javascripts file='assets/js/coupon.js'}
        <script src="{$asset_url}"></script>
    {/javascripts}

    <script>

        $(function($){

            // Url alowing to get coupon inputs
            $.couponManager.urlAjaxSaveConditions = '{$urlAjaxSaveConditions}';
            $.couponManager.urlAjaxDeleteConditions = '{$urlAjaxDeleteConditions}';
            $.couponManager.urlAjaxGetConditionSummaries = '{$urlAjaxGetConditionSummaries}';
            $.couponManager.urlAjaxAdminCouponDrawInputs = '{$urlAjaxAdminCouponDrawInputs}';
            $.couponManager.urlAjaxGetConditionInputFromServiceId = '{$urlAjaxGetConditionInputFromServiceId}';
            $.couponManager.urlAjaxGetConditionInputFromConditionInterface = '{$urlAjaxGetConditionInputFromConditionInterface}';
            $.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
            $.couponManager.intlPleaseSelectAnotherCondition = '{intl l='Please select another condition'}';
            $.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
            $.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';

            $('#condition-save-btn').hide();
        });
    </script>
{/block}

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