{% extends "commerce/_layouts/store-settings" %} {% set selectedItem = 'subscription-plans' %} {% do view.registerAssetBundle('craft\\web\\assets\\admintable\\AdminTableAsset') -%} {% do view.registerTranslations('commerce', [ 'Active subscriptions', 'Are you sure you want to archive the “{name}” subscription plan? It WILL NOT cancel the existing subscriptions.', 'Couldn’t reorder plans.', 'Enabled?', 'Gateway', 'Handle', 'Information linked?', 'Name', 'No subscription plans exist yet.', 'No', 'Plans reordered.', 'Yes', ]) %} {% block actionButton %} {{ 'New subscription plan'|t('commerce') }} {% endblock %} {% block content %}
{% endblock %} {% set tableData = [] %} {% for plan in plans %} {% set tableData = tableData|merge([{ id: plan.id, title: plan.name|t('site'), url: url('commerce/store-settings/subscription-plans/plan/'~plan.id), status: plan.enabled ? true : false, handle: plan.handle|e, gateway: plan.gateway.name|t('site')|e, subscriptions: plan.subscriptionCount, information: plan.planInformationId ? 'Yes'|t('commerce')|e : 'No'|t('commerce')|e, }]) %} {% endfor %} {% js %} var columns = [ { name: '__slot:title', title: Craft.t('commerce', 'Name') }, { name: '__slot:handle', title: Craft.t('commerce', 'Handle') }, { name: 'gateway', title: Craft.t('commerce', 'Gateway') }, { name: 'subscriptions', title: Craft.t('commerce', 'Active subscriptions') }, { name: 'information', title: Craft.t('commerce', 'Information linked?'), callback: function(value) { return ''+value+''; } } ]; new Craft.VueAdminTable({ columns: columns, container: '#plans-vue-admin-table', deleteAction: 'commerce/plans/archive-plan', deleteConfirmationMessage: Craft.t('commerce', 'Are you sure you want to archive the “{name}” subscription plan? It WILL NOT cancel the existing subscriptions.'), reorderAction: 'commerce/plans/reorder', reorderSuccessMessage: Craft.t('commerce', 'Plans reordered.'), reorderFailMessage: Craft.t('commerce', 'Couldn’t reorder plans.'), tableData: {{ tableData|json_encode|raw }} }); {% endjs %}