Files
sterivein/templates/admin/default/currencies.html
2013-09-03 11:26:03 +02:00

401 lines
18 KiB
HTML

{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Currencies'}{/block}
{block name="check-permissions"}admin.configuration.currencies.view{/block}
{block name="after-admin-css"}
{stylesheets file='assets/bootstrap-editable/css/bootstrap-editable.css' filters='cssembed'}
<link rel="stylesheet" href="{$asset_url}">
{/stylesheets}
{/block}
{block name="main-content"}
<div class="currencies">
<div id="wrapper" class="container">
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a> <span class="divider">/</span></li>
<li><a href="{url path='/admin/configuration/currencies'}">{intl l="Currencies"}</a></li>
</ul>
{module_include location='currencies_top'}
<div class="row-fluid">
<div class="span12">
<form action="{url path='/admin/configuration/currencies/change-values'}" method="post">
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l='Currencies'}
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.currencies.create"}
<a class="btn btn-primary action-btn" title="{intl l='Add a new currency'}" href="#add_currency_dialog" data-toggle="modal">
<i class="icon-plus-sign icon-white"></i>
</a>
{/loop}
</caption>
<tr>
<th>
{if $order == 'id'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'id_reverse'}
{elseif $order == 'id_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'id'}
{else}
{$order_change = 'id'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="ID"}
</a>
</th>
<th>
{if $order == 'alpha'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'alpha_reverse'}
{elseif $order == 'alpha_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'alpha'}
{else}
{$order_change = 'alpha'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="Name"}
</a>
</th>
<th>
{if $order == 'code'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'code_reverse'}
{elseif $order == 'code_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'code'}
{else}
{$order_change = 'code'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">{intl l="ISO 4217 Code"}</a>
<a title="{intl l='More information about ISO 4217'}" href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank"><i class="icon icon-question-sign"></i></a>
</th>
<th>
{if $order == 'symbol'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'symbol_reverse'}
{elseif $order == 'symbol_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'symbol'}
{else}
{$order_change = 'symbol'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="Symbol"}
</a>
</th>
<th>
{if $order == 'rate'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'rate_reverse'}
{elseif $order == 'rate_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'rate'}
{else}
{$order_change = 'rate'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="Rate in &euro;"}
</a>
</th>
<th>
{if $order == 'manual'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'manual_reverse'}
{elseif $order == 'manual_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'manual'}
{else}
{$order_change = 'manual'}
{/if}
<a href="{url path='/admin/configuration/currencies' order="$order_change"}">{intl l="Position"}</a>
</th>
<th>{intl l="Default"}</th>
{module_include location='currencies_table_header'}
<th>&nbsp;</th>
</tr>
{loop name="currencies" type="currency" backend_context="1" lang=$lang_id order=$order}
<tr>
<td>{$ID}</td>
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/change' currency_id="$ID"}">{$NAME}</a>
{/loop}
{elseloop rel="can_change"}
{$NAME}
{/elseloop}
</td>
<td>{$ISOCODE}</td>
<td>{$SYMBOL}</td>
<td>{$RATE|string_format:"%.4f"}</td>
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
<a href="{url path='/admin/configuration/currencies/positionUp' currency_id=$ID}"><i class="icon-arrow-up"></i></a>
<span class="currencyPositionChange" data-id="{$ID}">{$POSITION}</span>
<a href="{url path='/admin/configuration/currencies/positionDown' currency_id=$ID}"><i class="icon-arrow-down"></i></a>
{/loop}
{elseloop rel="can_change"}
{$POSITION}
{/elseloop}
</td>
<td><input type="radio" name="default[{$ID}]" value="1" {if $IS_DEFAULT}checked="checked"{/if}/></td>
{module_include location='currencies_table_row'}
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
<a class="btn btn-mini currency-change" title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/change' currency_id="$ID"}"><i class="icon-edit"></i></a>
{/loop}
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
<a class="btn btn-mini currency-delete" title="{intl l='Delete this currency'}" href="#delete_currency_dialog" data-id="{$ID}" data-toggle="modal"><i class="icon-trash"></i></a>
{/loop}
</div>
</td>
</tr>
{/loop}
{elseloop rel="currencies"}
<tr>
<td colspan="8">
<div class="alert alert-info">
{intl l="No currency has been created yet. Click the + button to create one."}
</div>
</td>
</tr>
{/elseloop}
</table>
</div>
</form>
</div>
</div>
{module_include location='currencies_bottom'}
</div>
</div>
{* Adding a new currency *}
<div class="modal hide fade" id="add_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Create a new currency"}</h3>
</div>
{form name="thelia.admin.currency.creation"}
<form method="POST" action="{url path='/admin/configuration/currencies/create'}" {form_enctype form=$form}>
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/change' currency_id='_ID_'}" />
{/form_field}
{* We do not allow users to create secured currencies from here *}
<div class="modal-body">
{if #form_error}<div class="alert alert-block alert-error" id="add_currency_dialog_error">#form_error_currency</div>{/if}
<div class="control-group">
<label class="control-label">
{intl l='Name *'}
</label>
<div class="controls">
{loop type="lang" name="default-lang" default_only="1"}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
<div class="input-append">
{form_field form=$form field='name'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
</span>
{/form_field}
<span class="add-on"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
</div>
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
{/loop}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='ISO 4217 code *'}
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
</span>
<div class="help-block">
<a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a>
</div>
{/form_field}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Symbol *'}
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
</span>
{/form_field}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Rate *'}
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
</span>
<div class="help-block">{intl l="Currency rate, in Euro"}</div>
{/form_field}
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{intl l="Create this currency"}</button>
<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
</div>
</form>
{/form}
</div>
{* Delete confirmation dialog *}
<div class="modal hide fade" id="delete_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Delete a currency"}</h3>
</div>
<div class="modal-body">
<p>{intl l="Do you really want to delete this currency ?"}</p>
</div>
<form method="post" action="{url path='/admin/configuration/currencies/delete'}">
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{intl l="Yes"}</button>
<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">{intl l="No"}</button>
</div>
</form>
</div>
{/block}
{block name="after-javascript-include"}
{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{/block}
{block name="javascript-initialization"}
<script>
$(function() {
// Set proper currency ID in delete from
$('a.currency-delete').click(function(ev) {
$('#currency_delete_id').val($(this).data('id'));
});
{* display the form creation dialog if it contains errors *}
{form name="thelia.admin.currency.creation"}
{if #form_error}
$('#add_currency_dialog').modal();
{/if}
{/form}
{* Always reset create dialog on close *}
$('#add_currency_dialog').on('hidden',function() {
// Hide error currency
$('#add_currency_dialog_error').remove();
// Clear error status
$("#add_currency_dialog .error").removeClass('error');
// Empty field values
$("#add_currency_dialog input[type=text]").val('');
});
{* Inline editing of object position using bootstrap-editable *}
$('.currencyPositionChange').editable({
type : 'text',
title : '{intl l="Enter new currency position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url path='/admin/configuration/currencies/changePosition' currency_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id'))
.replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
});
</script>
{/block}