{% extends "commerce/_layouts/store-settings" %} {% do view.registerAssetBundle('craft\\web\\assets\\admintable\\AdminTableAsset') -%} {% do view.registerTranslations('commerce', [ 'Base', 'Code', 'Conversion Rate', 'Currency', 'No additional payment currencies exist yet.', 'Warning, deleting this currency will stop all payments and refunds in this currency, are you sure you want to delete “{name}”?', ]) %} {% block actionButton %} {{ 'New currency'|t('commerce') }} {% endblock %} {% block content %}
{% endblock %} {% set tableData = [] %} {% for currency in currencies %} {% set tableData = tableData|merge([{ id: currency.id, title: currency.primary ? "{name} (Primary)"|t('commerce', { name: currency.name })|e : currency.name|t('site'), url: currency.cpEditUrl, handle: currency.iso, rate: currency.primary ? 'base' : currency.rate|number, _showDelete: (not currency.primary), }]) %} {% endfor %} {% js %} var columns = [ { name: '__slot:title', title: Craft.t('commerce', 'Currency') }, { name: '__slot:handle', title: Craft.t('commerce', 'Code') }, { name: 'rate', title: Craft.t('commerce', 'Conversion Rate'), callback: function(value) { if (value == 'base') { return ''+Craft.escapeHtml(Craft.t('commerce', 'Base'))+'' } return value; } }, ]; new Craft.VueAdminTable({ columns: columns, container: '#currencies-vue-admin-table', emptyMessage: Craft.t('commerce', 'No additional payment currencies exist yet.'), deleteAction: 'commerce/payment-currencies/delete', deleteConfirmationMessage: Craft.t('commerce', 'Warning, deleting this currency will stop all payments and refunds in this currency, are you sure you want to delete “{name}”?'), tableData: {{ tableData|json_encode|raw }}, }); {% endjs %}