{% extends "commerce/_layouts/tax" %} {% do view.registerAssetBundle('craft\\web\\assets\\admintable\\AdminTableAsset') -%} {% do view.registerTranslations('commerce', [ 'Used by Tax Rates', 'Default?', ]) %} {% block actionButton %} {{ craft.commerce.taxes.taxCategoryActionHtml()|raw }} {% if craft.commerce.taxes.createTaxCategories() %} {{ 'New tax category'|t('commerce') }} {% endif %} {% endblock %} {% block content %}
{% endblock %} {% set tableData = [] %} {% for taxCategory in taxCategories %} {% set taxRates = [] %} {% for taxRate in taxCategory.taxRates %} {% set taxRates = taxRates|merge([{ label: taxRate.name|t('site')|e, url: taxRate.cpEditUrl, }]) %} {% endfor %} {% set tableData = tableData|merge([{ id: taxCategory.id, title: taxCategory.name|t('site'), url: taxCategory.cpEditUrl, handle: taxCategory.handle, description: taxCategory.description|t('site')|e, taxRates: taxRates, default: taxCategory.default ? true : false, _showDelete: not taxCategory.taxRates|length }]) %} {% endfor %} {% js %} var columns = [ { name: '__slot:title', title: Craft.t('app', 'Name') }, { name: '__slot:handle', title: Craft.t('app', 'Handle') }, { name: 'description', title: Craft.t('app', 'Description') }, { name: 'taxRates', title: Craft.t('commerce', 'Used By Tax Rates'), callback: function(value) { var output = ''; if (value && value.length) { for (var i = 0; i < value.length; i++) { output += ''+value[i].label+'