399 lines
17 KiB
HTML
399 lines
17 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></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>
|
|
</ul>
|
|
|
|
{module_include location='currencies_top'}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
<form action="{url path='/admin/configuration/currencies/update-rates'}" 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-default btn-primary action-btn" title="{intl l='Add a new currency'}" href="#add_currency_dialog" data-toggle="modal">
|
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
|
</a>
|
|
<button class="btn btn-default btn-info action-btn" title="{intl l='Update rates'}">{intl l='Update rates'} <span class="glyphicon glyphicon-globe"></span></button>
|
|
{/loop}
|
|
|
|
</caption>
|
|
<tr>
|
|
<th>
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='id'
|
|
reverse_order='id_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l='ID'}"
|
|
}
|
|
</th>
|
|
|
|
<th>
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='alpha'
|
|
reverse_order='alpha_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l='Name'}"
|
|
}
|
|
</th>
|
|
|
|
<th class="text-center">
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='code'
|
|
reverse_order='code_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l="ISO 4217 Code"}"
|
|
}
|
|
<a title="{intl l='More information about ISO 4217'}" href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank"><i class="glyphicon glyphicon-question-sign"></i></a>
|
|
</th>
|
|
|
|
<th class="text-center">
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='symbol'
|
|
reverse_order='symbol_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l="Symbol"}"
|
|
}
|
|
</th>
|
|
|
|
<th class="text-right">
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='rate'
|
|
reverse_order='rate_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l="Rate in €"}"
|
|
}
|
|
</th>
|
|
|
|
<th class="text-center">
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='manual'
|
|
reverse_order='manual_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l="Position"}"
|
|
}
|
|
</th>
|
|
|
|
<th class="text-center">
|
|
{admin_sortable_header
|
|
current_order=$order
|
|
order='is_default'
|
|
reverse_order='is_default_reverse'
|
|
path='/admin/configuration/currencies'
|
|
label="{intl l="Default"}"
|
|
}
|
|
</th>
|
|
|
|
{module_include location='currencies_table_header'}
|
|
|
|
<th> </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 class="text-center">{$ISOCODE}</td>
|
|
|
|
<td class="text-center">{$SYMBOL}</td>
|
|
|
|
<td class="text-right">{format_number number="$RATE" decimals="4"}</td>
|
|
|
|
<td class="text-center">
|
|
{admin_position_block
|
|
permission="admin.currencies.edit"
|
|
path="/admin/configuration/currencies"
|
|
url_parameter="currency_id"
|
|
in_place_edit_class="currencyPositionChange"
|
|
position="$POSITION"
|
|
id="$ID"
|
|
}
|
|
</td>
|
|
|
|
<td class="text-center">
|
|
<input class="change-default" type="radio" name="is_default" value="{$ID}" {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-default btn-xs currency-change" title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/change' currency_id="$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
|
{/loop}
|
|
|
|
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
|
|
<a class="btn btn-default btn-xs currency-delete" title="{intl l='Delete this currency'}" href="#delete_currency_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-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">×</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_message}</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"}
|
|
|
|
{* Switch edition to the current locale *}
|
|
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
|
|
|
{form_field form=$form field='locale'}
|
|
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
|
{/form_field}
|
|
|
|
<div class="input-group">
|
|
{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="input-group-addon"><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='code'}
|
|
<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='rate'}
|
|
<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="The rate from Euro (Price in Euro * rate = Price in this currency)"}</div>
|
|
{/form_field}
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<button type="submit" class="btn btn-default btn-primary">{intl l="Create this currency"}</button>
|
|
<button type="button" class="btn btn-default" 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">×</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-default btn-primary">{intl l="Yes"}</button>
|
|
<button type="button" class="btn btn-default" 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;
|
|
}
|
|
});
|
|
|
|
{* Change default status *}
|
|
|
|
$('.change-default').click(function(ev) {
|
|
var url = "{url path='/admin/configuration/currencies/set-default' currency_id='__ID__'}";
|
|
|
|
// Perform ID subtitutions
|
|
url = url.replace('__ID__', $(this).val());
|
|
|
|
// Reload the page
|
|
location.href = url;
|
|
});
|
|
|
|
});
|
|
</script>
|
|
{/block} |