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

{block name="page-title"}{intl l='Edit a currency'}{/block}

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

{block name="main-content"}
    <div class="currencies edit-currency">

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

            {loop name="currency_edit" type="currency" id="$currency_id" backend_context="1" lang="$edit_language_id"}

                <ul class="breadcrumb">
        			<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
                    <li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
                    <li><a href="{url path='/admin/configuration/currencies'}">{intl l="Currencies"}</a></li>
                    <li>{intl l='Editing currency "%name"' name="{$NAME}"}</li>
                </ul>

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

        					<div class="col-md-12 title title-without-tabs">
        					   {intl l="Edit currency $NAME"}
        					</div>

                            <div class="form-container">
                                <div class="col-md-12">

        						    {form name="thelia.admin.currency.modification"}
        						    	<form method="POST" action="{url path='/admin/configuration/currencies/save'}" {form_enctype form=$form} class="clearfix">

        	                                {* Be sure to get the currency ID, even if the form could not be validated *}
        	                                <input type="hidden" name="currency_id" value="{$currency_id}" />

                                        	{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/currencies'}"}

        						        	{form_hidden_fields form=$form}

        						        	{form_field form=$form field='success_url'}
        						        		<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies'}" />
        						        	{/form_field}

        			                        {form_field form=$form field='locale'}
        			                        	<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
        			                        {/form_field}

        					            	{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}

        	                                <div class="col-md-6">

        										{form_field form=$form field='name'}
        								            <div class="form-group {if $error}has-error{/if}">
        								                <label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
        												<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Currency name'}" class="form-control">
                                                        <span class="help-block">&nbsp;</span>
        								            </div>
        							            {/form_field}

        										{form_field form=$form field='code'}
        		                                    <div class="form-group {if $error}has-error{/if}">
        		                                        <label for="{$label_attr.for}" class="control-label">
                                                            {intl l="{$label}"} :
        		                                       	</label>
                                                        <input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Currency ISO 4217 Code'}" placeholder="{intl l='Code'}" class="form-control">
                                                        <span class="help-block">
                                                            <a title="{intl l='More information about ISO 4217'}" href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">List of ISO 4217 code</a>
                                                        </span>
        		                                    </div>
        		                               	{/form_field}

        	                                </div>

                                            <div class="col-md-6">

                                                {form_field form=$form field='symbol'}
            	                                    <div class="form-group {if $error}has-error{/if}">
            	                                        <label for="{$label_attr.for}" class="control-label">
            	                                           {intl l="{$label}"} :
            	                                        </label>
                                                        <input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}" class="form-control">
                                                        <span class="help-block">{intl l='The symbol, such as $, £, &euro;...'}</span>
            	                                    </div>
                                                {/form_field}

                                                {form_field form=$form field='rate'}
            	                                    <div class="form-group {if $error}has-error{/if}">
            	                                        <label for="{$label_attr.for}" class="control-label">
            	                                           {intl l="{$label}"} :
             	                                        </label>
                                                        <input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Rate from Euro'}" placeholder="{intl l='Rate'}" class="form-control">
                                                        <span class="help-block">The rate from Euro: Price in Euro x rate = Price in this currency</span>
            	                                    </div>
                                                {/form_field}

                                            </div>

                                        </form>
        							{/form}

        						</div>
        					</div>

        				</div>
        			</div>

        		</div>

    		{/loop}

            {elseloop rel="currency_edit"}
                <div class="row">
                    <div class="col-md-12">
                        <div class="alert alert-error">
                            {intl l="Sorry, currency ID=$currency_id was not found."}
                        </div>
                    </div>
                </div>
            {/elseloop}

        </div>
    </div>
{/block}