summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/spree/admin/shared/_subscription_tab.html.erb2
-rw-r--r--app/views/spree/admin/users/_subscription_tab.html.erb5
-rw-r--r--app/views/spree/admin/users/subscriptions/index.html.erb44
3 files changed, 50 insertions, 1 deletions
diff --git a/app/views/spree/admin/shared/_subscription_tab.html.erb b/app/views/spree/admin/shared/_subscription_tab.html.erb
index de8c973..516f482 100644
--- a/app/views/spree/admin/shared/_subscription_tab.html.erb
+++ b/app/views/spree/admin/shared/_subscription_tab.html.erb
@@ -1,3 +1,3 @@
<% if can? :admin, SolidusSubscriptions::Subscription %>
- <%= tab :subscriptions, icon: 'repeat' %>
+ <%= tab :subscriptions, icon: 'repeat', match_path: '/subscriptions' %>
<% end %>
diff --git a/app/views/spree/admin/users/_subscription_tab.html.erb b/app/views/spree/admin/users/_subscription_tab.html.erb
new file mode 100644
index 0000000..cfb9205
--- /dev/null
+++ b/app/views/spree/admin/users/_subscription_tab.html.erb
@@ -0,0 +1,5 @@
+<% if can? :admin, @user.subscriptions %>
+ <li<%== ' class="active"' if current == :subscriptions %>>
+ <%= link_to t("spree.admin.user.subscriptions"), spree.admin_user_subscriptions_path(@user) %>
+ </li>
+<% end %>
diff --git a/app/views/spree/admin/users/subscriptions/index.html.erb b/app/views/spree/admin/users/subscriptions/index.html.erb
new file mode 100644
index 0000000..064499a
--- /dev/null
+++ b/app/views/spree/admin/users/subscriptions/index.html.erb
@@ -0,0 +1,44 @@
+<% admin_breadcrumb(link_to plural_resource_name(Spree::LegacyUser), spree.admin_users_path) %>
+<% admin_breadcrumb(link_to @user.email, edit_admin_user_url(@user)) %>
+<% admin_breadcrumb(plural_resource_name(SolidusSubscriptions::Subscription)) %>
+
+<%= render 'spree/admin/users/sidebar' %>
+<%= render 'spree/admin/users/tabs', current: :subscriptions %>
+
+<fieldset>
+ <legend><%= plural_resource_name(SolidusSubscriptions::Subscription) %></legend>
+
+ <% if @subscriptions.any? %>
+ <table id="subscriptions-table" class="index">
+ <thead>
+ <tr>
+ <th><%= SolidusSubscriptions::Subscription.human_attribute_name(:created_at) %></th>
+ <th><%= SolidusSubscriptions::Subscription.human_attribute_name(:actionable_date) %></th>
+ <th><%= SolidusSubscriptions::Subscription.human_attribute_name(:interval) %></th>
+ <th><%= SolidusSubscriptions::Subscription.human_attribute_name(:state) %></th>
+ <th><%= SolidusSubscriptions::Subscription.human_attribute_name(:processing_state) %></th>
+ <th class="actions"></th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <% @subscriptions.each do |subscription| %>
+ <tr>
+ <td><%= l(subscription.created_at.to_date) %></td>
+ <td><%= subscription.actionable_date ? l(subscription.actionable_date.to_date) : '-' %></td>
+ <td><%= subscription.interval.inspect %></td>
+ <td><%= render 'spree/admin/subscriptions/state_pill', subscription: subscription %></td>
+ <td><%= render 'spree/admin/subscriptions/processing_state_pill', subscription: subscription %></td>
+ <td class="actions">
+ <%= link_to_edit(subscription, no_text: true, url: edit_admin_subscription_path(subscription)) %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ <% else %>
+ <div class="no-objects-found">
+ <%= render 'spree/admin/shared/no_objects_found', resource: SolidusSubscriptions::Subscription %>
+ </div>
+ <% end %>
+</fieldset>